Merge pull request #12657 from frederic34/patch-19

doxygen
This commit is contained in:
Laurent Destailleur 2019-12-09 10:47:16 +01:00 committed by GitHub
commit 0a3b2987d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 16 deletions

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -63,7 +63,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
if ($action == 'validate' && $user->rights->deplacement->creer) if ($action == 'validate' && $user->rights->deplacement->creer)
{ {
$object->fetch($id); $object->fetch($id);
if ($object->statut == 0) if ($object->statut == Deplacement::STATUS_DRAFT)
{ {
$result = $object->setStatut(1); $result = $object->setStatut(1);
if ($result > 0) if ($result > 0)
@ -81,9 +81,9 @@ if ($action == 'validate' && $user->rights->deplacement->creer)
elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer)
{ {
$object->fetch($id); $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) if ($result > 0)
{ {
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
@ -116,14 +116,14 @@ elseif ($action == 'add' && $user->rights->deplacement->creer)
{ {
$error = 0; $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->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount
$object->type = GETPOST('type', 'alpha'); $object->type = GETPOST('type', 'alpha');
$object->socid = GETPOST('socid', 'int'); $object->socid = (int) GETPOST('socid', 'int');
$object->fk_user = GETPOST('fk_user', 'int'); $object->fk_user = (int) GETPOST('fk_user', 'int');
$object->note_private = GETPOST('note_private', 'alpha'); $object->note_private = GETPOST('note_private', 'alpha');
$object->note_public = GETPOST('note_public', 'alpha'); $object->note_public = GETPOST('note_public', 'alpha');
$object->statut = 0; $object->statut = Deplacement::STATUS_DRAFT;
if (!$object->date) if (!$object->date)
{ {
@ -178,8 +178,8 @@ elseif ($action == 'update' && $user->rights->deplacement->creer)
$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->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount
$object->type = GETPOST('type', 'alpha'); $object->type = GETPOST('type', 'alpha');
$object->socid = GETPOST('socid', 'int'); $object->socid = (int) GETPOST('socid', 'int');
$object->fk_user = GETPOST('fk_user', 'int'); $object->fk_user = (int) GETPOST('fk_user', 'int');
$object->note_private = GETPOST('note_private', 'alpha'); $object->note_private = GETPOST('note_private', 'alpha');
$object->note_public = GETPOST('note_public', 'alpha'); $object->note_public = GETPOST('note_public', 'alpha');
@ -523,7 +523,7 @@ elseif ($id)
print '<div class="tabsAction">'; 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) if ($user->rights->deplacement->creer)
{ {
@ -535,7 +535,7 @@ elseif ($id)
} }
} }
if ($object->statut == 0) // if draft if ($object->statut == Deplacement::STATUS_DRAFT) // if draft
{ {
if ($user->rights->deplacement->creer) if ($user->rights->deplacement->creer)
{ {
@ -547,7 +547,7 @@ elseif ($id)
} }
} }
if ($object->statut == 1) // if validated if ($object->statut == Deplacement::STATUS_VALIDATED) // if validated
{ {
if ($user->rights->deplacement->creer) if ($user->rights->deplacement->creer)
{ {

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * 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 * 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 * 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 $fk_user;
public $km; /**
* @var string km value formatted
*/
public $km;
/**
* @var int Thirdparty id
*/
public $socid; public $socid;
public $statut; // 0=draft, 1=validated
/**
* @var int Status 0=draft, 1=validated, 2=Refunded
*/
public $statut;
public $extraparams=array(); public $extraparams=array();
public $statuts=array(); public $statuts=array();
public $statuts_short=array(); public $statuts_short=array();
/**
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Refunded status
*/
const STATUS_REFUNDED = 2;
/** /**
* Constructor * Constructor
* *