From 2bfc5fe235b441d940df03f3b091329be730ccc3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 15 Dec 2018 19:56:08 +0100 Subject: [PATCH] Work on cash fence --- htdocs/compta/cashcontrol/cashcontrol_card.php | 14 ++++++++------ .../compta/cashcontrol/class/cashcontrol.class.php | 4 ++-- htdocs/core/menus/standard/eldy.lib.php | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 9d52e83afd8..ce45bdc44ed 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -38,6 +38,7 @@ $id=GETPOST('id'); if (!$user->rights->banque->configurer) accessforbidden(); +$id=GETPOST('id','int'); $categid = GETPOST('categid'); $label = GETPOST("label"); @@ -55,15 +56,17 @@ if (! $sortfield) $sortfield='b.label'; if (! $sortorder) $sortorder='ASC'; + /* - * Add category + * Actions */ + if ($action=="start") { $cashcontrol= new CashControl($db); $cashcontrol->opening=GETPOST('opening'); - if (GETPOST('posmodule')==0) $cashcontrol->posmodule="cashdesk"; - else if (GETPOST('posmodule')==1) $cashcontrol->posmodule="takepos"; + if (GETPOST('posmodule')=='cashdesk') $cashcontrol->posmodule="cashdesk"; + else if (GETPOST('posmodule')=='takepos') $cashcontrol->posmodule="takepos"; $cashcontrol->posnumber=GETPOST('posnumber'); $id=$cashcontrol->create($user); $action="view"; @@ -77,7 +80,6 @@ if ($action=="close") $action="view"; } - if ($action=="create") { llxHeader(); @@ -92,7 +94,7 @@ if ($action=="create") print ''; print ''; print ''; - print ''; + print ''; print "\n"; print ''; print ''; @@ -103,7 +105,7 @@ if ($action=="create") print '
'.$langs->trans("Ref").''.$langs->trans("InitialBankBalance").''.$langs->trans("Module").''.$langs->trans("CashDesk").' ID,'.$langs->trans("Ref").''.$langs->trans("InitialBankBalance").''.$langs->trans("Module").''.$langs->trans("CashDesk").' ID
 
'; } -if ($action=="view") +if (empty($action) || $action=="view") { $cashcontrol= new CashControl($db); $cashcontrol->fetch($id); diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index a741a0e5bbd..3d3e97bab6f 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -68,10 +68,10 @@ class CashControl extends CommonObject 'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnul'=>1, 'position'=>60), 'posmodule' =>array('type'=>'varchar(30)', 'label'=>'Module', 'enabled'=>1, 'visible'=>1, 'notnul'=>1, 'position'=>65), 'posnumber' =>array('type'=>'varchar(30)', 'label'=>'CashDesk', 'enabled'=>1, 'visible'=>1, 'notnul'=>1, 'position'=>70), - 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>80), 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>505), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>510), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated')), ); public $id; @@ -123,7 +123,7 @@ class CashControl extends CommonObject //$sql .= "'(PROV)', "; $sql .= $conf->entity; $sql .= ", ".$this->opening; - $sql .= ",1"; + $sql .= ", 0"; // Draft by default $sql .= ", '".$this->db->idate(dol_now())."'"; $sql .= ", '".$this->posmodule."'"; $sql .= ", '".$this->posnumber."'"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 872edac9ed8..520d21e400a 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1249,8 +1249,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->takepos->enabled) || ! empty($conf->cashdesk->enabled)) { $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list",$langs->trans("CashControl"),0,1, '', $mainmenu, 'cashcontrol'); + $newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create",$langs->trans("NewCashFence"),1,1); $newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list",$langs->trans("List"),1,1); - $newmenu->add("/compta/cashcontrol/cashcontrol_card.php?action=create",$langs->trans("New"),1,1); } }