Skip to content
Permalink
Browse files

Merge pull request #12657 from frederic34/patch-19

doxygen
  • Loading branch information
eldy committed Dec 9, 2019
2 parents 4b8ebe9 + c05ba62 commit 0a3b2987d1358033726aa94383f03a28cf021133
Showing with 43 additions and 16 deletions.
  1. +14 −14 htdocs/compta/deplacement/card.php
  2. +29 −2 htdocs/compta/deplacement/class/deplacement.class.php
@@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -63,7 +63,7 @@
if ($action == 'validate' && $user->rights->deplacement->creer)
{
$object->fetch($id);
if ($object->statut == 0)
if ($object->statut == Deplacement::STATUS_DRAFT)
{
$result = $object->setStatut(1);
if ($result > 0)
@@ -81,9 +81,9 @@
elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer)
{
$object->fetch($id);
if ($object->statut == 1)
if ($object->statut == Deplacement::STATUS_VALIDATED)
{
$result = $object->setStatut(2);
$result = $object->setStatut(Deplacement::STATUS_REFUNDED);
if ($result > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
@@ -116,14 +116,14 @@
{
$error = 0;

$object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount
$object->type = GETPOST('type', 'alpha');
$object->socid = GETPOST('socid', 'int');
$object->fk_user = GETPOST('fk_user', 'int');
$object->type = GETPOST('type', 'alpha');
$object->socid = (int) GETPOST('socid', 'int');
$object->fk_user = (int) GETPOST('fk_user', 'int');
$object->note_private = GETPOST('note_private', 'alpha');
$object->note_public = GETPOST('note_public', 'alpha');
$object->statut = 0;
$object->statut = Deplacement::STATUS_DRAFT;

if (!$object->date)
{
@@ -178,8 +178,8 @@
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount
$object->type = GETPOST('type', 'alpha');
$object->socid = GETPOST('socid', 'int');
$object->fk_user = GETPOST('fk_user', 'int');
$object->socid = (int) GETPOST('socid', 'int');
$object->fk_user = (int) GETPOST('fk_user', 'int');
$object->note_private = GETPOST('note_private', 'alpha');
$object->note_public = GETPOST('note_public', 'alpha');

@@ -523,7 +523,7 @@

print '<div class="tabsAction">';

if ($object->statut < 2) // if not refunded
if ($object->statut < Deplacement::STATUS_REFUNDED) // if not refunded
{
if ($user->rights->deplacement->creer)
{
@@ -535,7 +535,7 @@
}
}

if ($object->statut == 0) // if draft
if ($object->statut == Deplacement::STATUS_DRAFT) // if draft
{
if ($user->rights->deplacement->creer)
{
@@ -547,7 +547,7 @@
}
}

if ($object->statut == 1) // if validated
if ($object->statut == Deplacement::STATUS_VALIDATED) // if validated
{
if ($user->rights->deplacement->creer)
{
@@ -3,6 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -81,14 +82,40 @@ class Deplacement extends CommonObject
*/
public $fk_user;

public $km;
/**
* @var string km value formatted
*/
public $km;

/**
* @var int Thirdparty id
*/
public $socid;
public $statut; // 0=draft, 1=validated

/**
* @var int Status 0=draft, 1=validated, 2=Refunded
*/
public $statut;
public $extraparams=array();

public $statuts=array();
public $statuts_short=array();

/**
* Draft status
*/
const STATUS_DRAFT = 0;

/**
* Validated status
*/
const STATUS_VALIDATED = 1;

/**
* Refunded status
*/
const STATUS_REFUNDED = 2;

/**
* Constructor
*

0 comments on commit 0a3b298

Please sign in to comment.
You can’t perform that action at this time.