From 988ba172ae0369e05a75d421a160ab534e3d0683 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Dec 2018 14:59:51 +0100 Subject: [PATCH 1/2] Clean code of POS modules --- htdocs/cashdesk/admin/cashdesk.php | 42 ++++--- .../compta/cashcontrol/cashcontrol_card.php | 11 +- .../cashcontrol/class/cashcontrol.class.php | 9 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/core/modules/modCashDesk.class.php | 2 +- htdocs/core/modules/modTakePos.class.php | 2 +- htdocs/langs/en_US/admin.lang | 6 +- htdocs/takepos/admin/setup.php | 105 +++++++++--------- 8 files changed, 100 insertions(+), 79 deletions(-) diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 62867d855cb..399a59b4687 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -86,7 +86,7 @@ $formproduct=new FormProduct($db); llxHeader('',$langs->trans("CashDeskSetup")); $linkback=''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("CashDeskSetup"),$linkback,'title_setup'); +print load_fiche_titre($langs->trans("CashDeskSetup").' (SimplePOS)',$linkback,'title_setup'); print '
'; @@ -95,9 +95,28 @@ print '
'; print ''; print ''; +if (! empty($conf->service->enabled)) +{ + print ''; + print ''; + print ''; + print "\n"; + + print '\n"; + + print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; + print $langs->trans("CashdeskShowServices"); + print ''; + print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1); + print "
'; + + print '
'; +} + + print ''; print ''; -print ''; +print ''; print "\n"; print ''; @@ -106,19 +125,19 @@ print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.cli print ''; if (! empty($conf->banque->enabled)) { - + print ''; print ''; - + print ''; print ''; - + print ''; print ''; // Force warehouse (this is not a default value) print ''; // Force warehouse (this is not a default value) print ''; } -if (! empty($conf->service->enabled)) -{ - print '\n"; -} - // Use Dolibarr Receipt Printer if (! empty($conf->receiptprinter->enabled)) { diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index ce45bdc44ed..307b024aea6 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -94,13 +94,16 @@ if ($action=="create") print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").''.$langs->trans("Terminal").' 0'.$langs->trans("Value").'
'.$langs->trans("CashDeskThirdPartyForSell").'
'.$langs->trans("CashDeskBankAccountForSell").''; $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH,'CASHDESK_ID_BANKACCOUNT_CASH',0,"courant=2",1); print '
'.$langs->trans("CashDeskBankAccountForCheque").''; $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE,'CASHDESK_ID_BANKACCOUNT_CHEQUE',0,"courant=1",1); print '
'.$langs->trans("CashDeskBankAccountForCB").''; $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB,'CASHDESK_ID_BANKACCOUNT_CB',0,"courant=1",1); @@ -127,7 +146,7 @@ if (! empty($conf->banque->enabled)) if (! empty($conf->stock->enabled)) { - + print '
'.$langs->trans("CashDeskDoNotDecreaseStock").''; if (empty($conf->productbatch->enabled)) { @@ -144,7 +163,7 @@ if (! empty($conf->stock->enabled)) $disabled=$conf->global->CASHDESK_NO_DECREASE_STOCK; - + print '
'.$langs->trans("CashDeskIdWareHouse").''; if (! $disabled) @@ -159,15 +178,6 @@ if (! empty($conf->stock->enabled)) print '
'; - print $langs->trans("CashdeskShowServices"); - print ''; - print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1); - print "
'; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; print ''; - print ''; print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print '
'.$langs->trans("Ref").''.$langs->trans("InitialBankBalance").''.$langs->trans("Module").''.$langs->trans("CashDesk").' ID'.$langs->trans("Module").''.$langs->trans("CashDesk").' ID'.$langs->trans("InitialBankBalance").'
 '.$form->selectarray('posmodule', $arrayofposavailable, 1).'
'; } diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index d05a99ac709..5750a0877c9 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -55,14 +55,14 @@ class CashControl extends CommonObject public $picto = 'bank'; public $fields=array( - 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), + 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>10), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>15), 'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>18), 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>20), 'opening' =>array('type'=>'double(24,8)', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25), 'cash' =>array('type'=>'double(24,8)', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30), - //'card' =>array('type'=>'double(24,8)', 'label'=>'Card', 'enabled'=>1, 'visible'=>1, 'position'=>35), - 'cheque' =>array('type'=>'double(24,8)', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>35), + 'cheque' =>array('type'=>'double(24,8)', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>33), + 'card' =>array('type'=>'double(24,8)', 'label'=>'Card', 'enabled'=>1, 'visible'=>1, 'position'=>36), 'day_close' =>array('type'=>'integer', 'label'=>'Day close', 'enabled'=>1, 'visible'=>1, 'position'=>50), 'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55), 'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnul'=>1, 'position'=>60), @@ -140,6 +140,9 @@ class CashControl extends CommonObject if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."pos_cash_fence"); + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'pos_cash_fence SET ref = rowid where rowid = '.$this->id; + $this->db->query($sql); } // Commit or rollback diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 520d21e400a..7c736465761 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1248,7 +1248,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Cash Control 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_list.php?action=list",$langs->trans("POS"),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); } diff --git a/htdocs/core/modules/modCashDesk.class.php b/htdocs/core/modules/modCashDesk.class.php index d9bfe6b0b5f..472abe53a42 100644 --- a/htdocs/core/modules/modCashDesk.class.php +++ b/htdocs/core/modules/modCashDesk.class.php @@ -46,7 +46,7 @@ class modCashDesk extends DolibarrModules $this->rights_class = 'cashdesk'; $this->family = "portal"; - $this->module_position = '10'; + $this->module_position = '55'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "CashDesk module"; diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 1a0a681e206..df541c97e90 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -53,7 +53,7 @@ class modTakePos extends DolibarrModules // It is used to group modules by family in module setup page $this->family = "portal"; // Module position in the family on 2 digits ('01', '10', '20', ...) - $this->module_position = '90'; + $this->module_position = '60'; // Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 01900aba754..8c62a74024c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -623,9 +623,9 @@ Module40000Desc=Use alternative currencies in prices and documents Module50000Name=PayBox Module50000Desc=Offer customers a PayBox online payment page (credit/debit cards). This can be used to allow your customers to make free payments or for a payment on a particular Dolibarr object (invoice, order, ...) Module50100Name=Point of sales -Module50100Desc=Point of sales module (POS). +Module50100Desc=Point of sales module SimplePOS (simple POS). Module50150Name=Point of sales -Module50150Desc=Point of sales module (Touch screen POS). +Module50150Desc=Point of sales module TakePOS (touch screen POS). Module50200Name=Paypal Module50200Desc=Offer customers a PayPal online payment page (PayPal account or credit/debit cards). This can be used to allow your customers to make free payments or for a payment on a particular Dolibarr object (invoice, order, ...) Module50400Name=Accounting (advanced) @@ -1619,7 +1619,7 @@ CashDeskBankAccountForCB= Default account to use to receive payments by credit c CashDeskDoNotDecreaseStock=Disable stock decrease when a sale is done from Point of Sale (if "no", stock decrease is done for each sale done from POS, irrespective of the option set in module Stock). CashDeskIdWareHouse=Force and restrict warehouse to use for stock decrease StockDecreaseForPointOfSaleDisabled=Stock decrease from Point of Sale disabled -StockDecreaseForPointOfSaleDisabledbyBatch=Stock decrease in POS is not compatible with lot management +StockDecreaseForPointOfSaleDisabledbyBatch=Stock decrease in POS is not compatible with module Serial/Lot management (currently active) so stock decrease is disabled. CashDeskYouDidNotDisableStockDecease=You did not disable stock decrease when making a sale from Point of Sale. Hence a warehouse is required. ##### Bookmark ##### BookmarkSetup=Bookmark module setup diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 58601201fbe..e2f944d6641 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -86,7 +86,7 @@ $formproduct=new FormProduct($db); llxHeader('',$langs->trans("CashDeskSetup")); $linkback=''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("CashDeskSetup"),$linkback,'title_setup'); +print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)',$linkback,'title_setup'); print '
'; @@ -95,9 +95,59 @@ print '
'; print ''; print ''; +if (! empty($conf->service->enabled)) +{ + print ''; + + print ''; + print ''; + print "\n"; + + print '\n"; + + // Use Takepos printing + print '\n"; + + if ($conf->global->TAKEPOSCONNECTOR){ + print ''; + } + + // Bar Restaurant mode + print '\n"; + + if ($conf->global->TAKEPOS_BAR_RESTAURANT and $conf->global->TAKEPOSCONNECTOR){ + print ''; + } + + print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; + print $langs->trans("CashdeskShowServices"); + print ''; + print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1); + print "
'; + print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("TakeposConnectorNecesary").')'; + print ''; + print $form->selectyesno("TAKEPOSCONNECTOR",$conf->global->TAKEPOSCONNECTOR,1); + print "
'; + print $langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; + print ''; + print ''; + print '
'; + print 'Bar Restaurant'; + print ''; + print $form->selectyesno("TAKEPOS_BAR_RESTAURANT",$conf->global->TAKEPOS_BAR_RESTAURANT,1); + print "
'; + print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; + print ''; + print $form->selectyesno("TAKEPOS_ORDER_PRINTERS",$conf->global->TAKEPOS_ORDER_PRINTERS,1); + print '
'; + + print '
'; +} + + print ''; print ''; -print ''; +print ''; print "\n"; print ''; @@ -159,45 +209,6 @@ if (! empty($conf->stock->enabled)) print ''; } -if (! empty($conf->service->enabled)) -{ - print '\n"; -} - -// Use Takepos printing -print '\n"; - -if ($conf->global->TAKEPOSCONNECTOR){ - print ''; -} - -// Bar Restaurant mode -print '\n"; - -if ($conf->global->TAKEPOS_BAR_RESTAURANT and $conf->global->TAKEPOSCONNECTOR){ - print ''; -} - print '
'.$langs->trans("Parameters").''.$langs->trans("Value").''.$langs->trans("Terminal").' 0'.$langs->trans("Value").'
'.$langs->trans("CashDeskThirdPartyForSell").'
'; - print $langs->trans("CashdeskShowServices"); - print ''; - print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1); - print "
'; -print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("TakeposConnectorNecesary").')'; -print ''; -print $form->selectyesno("TAKEPOSCONNECTOR",$conf->global->TAKEPOSCONNECTOR,1); -print "
'; - print $langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; - print ''; - print ''; - print '
'; -print 'Bar Restaurant'; -print ''; -print $form->selectyesno("TAKEPOS_BAR_RESTAURANT",$conf->global->TAKEPOS_BAR_RESTAURANT,1); -print "
'; - print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; - print ''; - print $form->selectyesno("TAKEPOS_ORDER_PRINTERS",$conf->global->TAKEPOS_ORDER_PRINTERS,1); - print '
'; print '
'; @@ -206,9 +217,10 @@ print '
\n"; +print '

'; // Marketplace -print "
\n"; +print "
\n"; print "\n"; print ''; print ''; @@ -221,18 +233,11 @@ print ''; print ''; print ''; -print "\n"; -$url='https://www.dolistore.com/en/modules/949-Cash-Control-7.html'; -print ''; -print ''; -print ''; -print ''; - print "
TakePOS Marketplace'.$langs->trans("URL").'TakePOS for mobile devices'.$url.'
TakePOS CashControl'.$url.'
\n"; print '
'; // Support -print "
\n"; +print "
\n"; print "\n"; print ''; print ''; From e366d7d57cb7d02a65bc158a5e8c774a92e6c967 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Dec 2018 15:30:31 +0100 Subject: [PATCH 2/2] Work on cash fence --- .../compta/cashcontrol/cashcontrol_card.php | 129 +++++++++++++----- .../compta/cashcontrol/cashcontrol_list.php | 4 +- .../cashcontrol/class/cashcontrol.class.php | 12 +- htdocs/core/modules/modTakePos.class.php | 26 +--- 4 files changed, 111 insertions(+), 60 deletions(-) diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 307b024aea6..9e288d4b9a6 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -30,14 +30,9 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php'; -$langs->loadLangs(array("cashcontrol","install","cashdesk","admin")); +$langs->loadLangs(array("cashcontrol","install","cashdesk","admin","banks")); $action=GETPOST('action','aZ09'); -$id=GETPOST('id'); - -if (!$user->rights->banque->configurer) - accessforbidden(); - $id=GETPOST('id','int'); $categid = GETPOST('categid'); $label = GETPOST("label"); @@ -55,6 +50,11 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield='b.label'; if (! $sortorder) $sortorder='ASC'; +if (! $user->rights->cashdesk->use && ! $user->rights->takepos->use) +{ + accessforbidden(); +} + /* @@ -63,13 +63,29 @@ if (! $sortorder) $sortorder='ASC'; if ($action=="start") { - $cashcontrol= new CashControl($db); - $cashcontrol->opening=GETPOST('opening'); - 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"; + $error=0; + if (! GETPOST('posmodule','alpha') || GETPOST('posmodule','alpha') == '-1') + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Module")), null, 'errors'); + $action='create'; + $error++; + } + if (GETPOST('opening','alpha') == '') + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("InitialBankBalance")), null, 'errors'); + $action='create'; + $error++; + } + if (! $error) + { + $cashcontrol= new CashControl($db); + $cashcontrol->opening=GETPOST('opening'); + 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"; + } } if ($action=="close") @@ -96,12 +112,58 @@ if ($action=="create") print ''; print ''; print ''; + print ''; + print ''; + print ''; print ''; print ''; print "\n"; + + $now=dol_now(); + $syear = dol_print_date($now, "%Y"); + $smonth = dol_print_date($now, "%m"); + $sday = dol_print_date($now, "%d"); + print ''; - print ''; + print ''; print ''; + // Year + print ''; + // Month + print ''; + // Day + print ''; print ''; print ''; print ''; @@ -119,49 +181,50 @@ if (empty($action) || $action=="view") print '
'; print '
TakePOS Support'.$langs->trans("URL").'
'.$langs->trans("Module").''.$langs->trans("CashDesk").' ID'.$langs->trans("Year").''.$langs->trans("Month").''.$langs->trans("Day").''.$langs->trans("InitialBankBalance").'
'.$form->selectarray('posmodule', $arrayofposavailable, 1).''.$form->selectarray('posmodule', $arrayofposavailable, 1, (count($arrayofposavailable)>1?1:0)).''; + $retstring=''; + + for ($year = $syear - 10; $year < $syear + 10 ; $year++) + { + $retstring.=''; + } + $retstring.="\n"; + print $retstring; + print ''; + $retstring=''; + for ($month = 1 ; $month <= 12 ; $month++) + { + $retstring.='"; + } + $retstring.=""; + print $retstring; + print ''; + $retstring=''; + if ($emptydate || $set_time == -1) + { + $retstring.=''; + } + for ($day = 1 ; $day <= 31; $day++) + { + $retstring.=''; + } + $retstring.=""; + print $retstring; + print '
'; - print ''; - print ''; + print '"; + + print '"; print ''; print ''; print '
'; - print $langs->trans("Code"); - print ''; + print '
'; + print $langs->trans("Ref"); + print ''; print $id; print '
'; - print $langs->trans("DateCreationShort"); - print ''; - print dol_print_date($cashcontrol->date_creation, 'dayhour'); - print '
'.$langs->trans("Module").''; + print $cashcontrol->posmodule; + print "
'.$langs->trans("InitialBankBalance").''; + print price($cashcontrol->opening); + print "
'; print $langs->trans("DateEnd"); - print ''; - print dol_print_date(strtotime($cashcontrol->year_close."-".$cashcontrol->month_close."-".$cashcontrol->day_close), 'day'); + print ''; + print $cashcontrol->year_close."-".$cashcontrol->month_close."-".$cashcontrol->day_close; print '
'; print $langs->trans("Status"); - print ''; + print ''; if ($cashcontrol->status==1) print $langs->trans("Opened"); if ($cashcontrol->status==2) print $langs->trans("Closed"); print '
'; print '
'; + print '
'; print '
'; print ''; - print '"; + print ''; - print '"; - print '"; - print "
'.$langs->trans("InitialBankBalance").''; - print price($cashcontrol->opening); - print "
'; + print $langs->trans("DateCreationShort"); + print ''; + print dol_print_date($cashcontrol->date_creation, 'dayhour'); + print '
'.$langs->trans("CashDesk").' ID'; + print '
'.$langs->trans("CashDesk").' ID'; print $cashcontrol->posnumber; print "
'.$langs->trans("Module").''; - print $cashcontrol->posmodule; - print "
\n"; print '
'; print '
'; diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index ba0f985f510..219a8d987af 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -166,8 +166,8 @@ if (empty($reshook)) // Mass actions $objectclass='CashControl'; $objectlabel='CashControl'; - $permtoread = ($user->rights->cashdesk->read || $user->rights->takepos->read); - $permtodelete = ($user->rights->cashdesk->delete || $user->rights->takepos->delete); + $permtoread = ($user->rights->cashdesk->use || $user->rights->takepos->use); + $permtodelete = ($user->rights->cashdesk->use || $user->rights->takepos->use); //$uploaddir = ''; //include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index 5750a0877c9..0b10d49c4bf 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -58,16 +58,16 @@ class CashControl extends CommonObject 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>10), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>15), 'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>18), - 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>20), + 'posmodule' =>array('type'=>'varchar(30)', 'label'=>'Module', 'enabled'=>1, 'visible'=>1, 'notnul'=>1, 'position'=>19), + 'posnumber' =>array('type'=>'varchar(30)', 'label'=>'CashDesk', 'enabled'=>1, 'visible'=>1, 'notnul'=>1, 'position'=>20), + 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>0, 'position'=>24), 'opening' =>array('type'=>'double(24,8)', 'label'=>'Opening', 'enabled'=>1, 'visible'=>1, 'position'=>25), 'cash' =>array('type'=>'double(24,8)', 'label'=>'Cash', 'enabled'=>1, 'visible'=>1, 'position'=>30), 'cheque' =>array('type'=>'double(24,8)', 'label'=>'Cheque', 'enabled'=>1, 'visible'=>1, 'position'=>33), - 'card' =>array('type'=>'double(24,8)', 'label'=>'Card', 'enabled'=>1, 'visible'=>1, 'position'=>36), - 'day_close' =>array('type'=>'integer', 'label'=>'Day close', 'enabled'=>1, 'visible'=>1, 'position'=>50), + 'card' =>array('type'=>'double(24,8)', 'label'=>'CreditCard', 'enabled'=>1, 'visible'=>1, 'position'=>36), + 'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnul'=>1, 'position'=>50), 'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55), - '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), + 'day_close' =>array('type'=>'integer', 'label'=>'Day close', 'enabled'=>1, 'visible'=>1, 'position'=>60), '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), diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index df541c97e90..c47a66c3de2 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -104,7 +104,7 @@ class modTakePos extends DolibarrModules $this->langfiles = array("cashdesk"); $this->phpmin = array(5,4); // Minimum version of PHP required by module $this->need_dolibarr_version = array(4,0); // Minimum version of Dolibarr required by module - $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + $this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text') $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) //$this->automatic_activation = array('FR'=>'TakePosWasAutomaticallyActivatedBecauseOfYourCountryChoice'); //$this->always_enabled = true; // If true, can't be disabled @@ -195,27 +195,15 @@ class modTakePos extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module - /*$r=0; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Read myobject of TakePos'; // Permission label - $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->takepos->level1->level2) - $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->takepos->level1->level2) + $r=0; $r++; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Create/Update myobject of TakePos'; // Permission label - $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->takepos->level1->level2) - $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->takepos->level1->level2) + $this->rights[$r][0] = 50151; + $this->rights[$r][1] = 'Use point of sale'; + $this->rights[$r][2] = 'a'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'use'; - $r++; - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - $this->rights[$r][1] = 'Delete myobject of TakePos'; // Permission label - $this->rights[$r][3] = 1; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->takepos->level1->level2) - $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->takepos->level1->level2) - */ // Main menu entries $this->menu = array(); // List of menus to add