From 64e91fa25b1ccfdb8ba510293fcf0582be0dec01 Mon Sep 17 00:00:00 2001 From: Cristian Torres Date: Wed, 27 Mar 2019 17:09:59 -0600 Subject: [PATCH 001/151] [CHANGE] Making State available in .odt templates... ...making use of the same strategy when loading Country info from single attribute. Previously attempted on PR #10463 which has been closed This also relates to #7428 --- htdocs/admin/company.php | 12 +++++++++++- htdocs/societe/class/societe.class.php | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 949038b4413..1a5f963a46a 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -74,11 +74,21 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha')) activateModulesRequiredByCountry($mysoc->country_code); } + $tmparray=getState(GETPOST('state_id','int'),'all',$db,$langs,0); + if (! empty($tmparray['id'])) + { + $mysoc->state_id =$tmparray['id']; + $mysoc->state_code =$tmparray['code']; + $mysoc->state_label=$tmparray['label']; + + $s=$mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label; + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s,'chaine',0,'',$conf->entity); + } + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS",'nohtml'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN",'nohtml'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP",'alpha'),'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code",'alpha'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency",'aZ09'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 38d07e8e4db..ba268b0b269 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3310,6 +3310,31 @@ class Societe extends CommonObject $this->country=$country_label; if (is_object($langs)) $this->country=($langs->trans('Country'.$country_code)!='Country'.$country_code)?$langs->trans('Country'.$country_code):$country_label; + //TODO This could be replicated for region but function `getRegion` didn't exist, so I didn't added it. + // We define state_id, state_code and state + $state_id=$state_code=$state_label=''; + if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) + { + $tmp=explode(':',$conf->global->MAIN_INFO_SOCIETE_STATE); + $state_id=$tmp[0]; + if (! empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_STATE is "id:code:label" + { + $state_code=$tmp[1]; + $state_label=$tmp[2]; + } + else // For backward compatibility + { + dol_syslog("Your state setup use an old syntax. Reedit it using setup area.", LOG_ERR); + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + $state_code=getState($state_id,2,$this->db); // This need a SQL request, but it's the old feature that should not be used anymore + $state_label=getState($state_id,0,$this->db); // This need a SQL request, but it's the old feature that should not be used anymore + } + } + $this->state_id=$state_id; + $this->state_code=$state_code; + $this->state=$state_label; + if (is_object($langs)) $this->state=($langs->trans('State'.$state_code)!='State'.$state_code)?$langs->trans('State'.$state_code):$state_label; + $this->phone=empty($conf->global->MAIN_INFO_SOCIETE_TEL)?'':$conf->global->MAIN_INFO_SOCIETE_TEL; $this->fax=empty($conf->global->MAIN_INFO_SOCIETE_FAX)?'':$conf->global->MAIN_INFO_SOCIETE_FAX; $this->url=empty($conf->global->MAIN_INFO_SOCIETE_WEB)?'':$conf->global->MAIN_INFO_SOCIETE_WEB; From cc5727bc7b8c5b80d5603a44c6b160fcf2d4cc24 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 15 Apr 2019 09:15:42 +0200 Subject: [PATCH 002/151] Move to Warning an alert on hook when method return a string than a int --- htdocs/core/class/hookmanager.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index f23aa1da5a3..8752f01b95d 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -275,7 +275,7 @@ class HookManager // TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string if (! is_array($resaction) && ! is_numeric($resaction)) { - dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR); + dol_syslog('Warning: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_WARNING); if (empty($actionclassinstance->resprints)) { $this->resPrint.=$resaction; $resaction=0; } } } From 660a1cea1d8ddca131114ec2c7c975ec2bb66db2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 17 Apr 2019 07:26:39 +0200 Subject: [PATCH 003/151] NEW Accounting - Add rights on export, delete operations in ledger --- htdocs/accountancy/bookkeeping/list.php | 61 +++++++++++++-------- htdocs/core/modules/modAccounting.class.php | 39 ++++++++++--- htdocs/langs/en_US/admin.lang | 9 +++ 3 files changed, 79 insertions(+), 30 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 207ea3464d8..53603e08b39 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2019 Alexandre Spangaro * Copyright (C) 2016-2017 Laurent Destailleur * Copyright (C) 2018 Frédéric France * @@ -100,7 +100,7 @@ $formaccounting = new FormAccounting($db); $formother = new FormOther($db); $form = new Form($db); -if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && ! GETPOST('noreset', 'int')) +if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && ! GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export) { if (empty($search_date_start) && empty($search_date_end) && ! GETPOSTISSET('restore_lastsearch_values')) { @@ -283,7 +283,7 @@ if (! empty($search_lettering_code)) { } -if ($action == 'delbookkeeping') { +if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { $import_key = GETPOST('importkey', 'alpha'); @@ -296,7 +296,7 @@ if ($action == 'delbookkeeping') { exit(); } } -if ($action == 'delbookkeepingyearconfirm') { +if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) { $delyear = GETPOST('delyear', 'int'); if ($delyear==-1) { @@ -327,7 +327,7 @@ if ($action == 'delbookkeepingyearconfirm') { exit; } } -if ($action == 'delmouvconfirm') { +if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) { $mvt_num = GETPOST('mvt_num', 'int'); @@ -347,7 +347,7 @@ if ($action == 'delmouvconfirm') { } // Export into a file with format defined into setup (FEC, CSV, ...) -if ($action == 'export_file') { +if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); @@ -442,18 +442,30 @@ print ''; print ''; print ''; -$listofformat=AccountancyExport::getType(); -$button = ''; -if (count($filter)) $button.= $langs->trans("ExportFilteredList"); -else $button.= $langs->trans("ExportList"); -//$button.=' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')'; -$button.= ''; - +if ($user->rights->accounting->mouvements->export) { + $listofformat=AccountancyExport::getType(); + $button = ''; + if (count($filter)) $button.= $langs->trans("ExportFilteredList"); + else $button.= $langs->trans("ExportList"); + $button.= ''; +} else { + $button = ''; + if (count($filter)) $button.= $langs->trans("ExportFilteredList"); + else $button.= $langs->trans("ExportList"); + $button.= ''; +} $groupby = ' ' . $langs->trans("GroupByAccountAccounting") . ''; -$newcardbutton = ''.$langs->trans("NewAccountingMvt").''; -$newcardbutton.= ''; -$newcardbutton.= ''; + +if ($user->rights->accounting->mouvements->creer) { + $newcardbutton = ''.$langs->trans("NewAccountingMvt").''; + $newcardbutton.= ''; + $newcardbutton.= ''; +} else { + $newcardbutton = '' . $langs->trans("NewAccountingMvt") . ''; + $newcardbutton.= ''; + $newcardbutton.= ''; +} print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, $groupby.$newcardbutton, '', $limit); @@ -731,8 +743,12 @@ if ($num > 0) // Action column print ''; - print '' . img_edit() . ' '; - print '' . img_delete() . ''; + if ($user->rights->accounting->mouvements->creer) { + print '' . img_edit() . ''; + } + if ($user->rights->accounting->mouvements->supprimer) { + print ' ' . img_delete() . ''; + } print ''; if (! $i) $totalarray['nbfield']++; @@ -766,10 +782,11 @@ print ""; print ''; // TODO Replace this with mass delete action -print '
' . "\n"; -print '' . $langs->trans("DeleteMvt") . ''; -print '
'; - +if ($user->rights->accounting->mouvements->supprimer_tous) { + print '
' . "\n"; + print '' . $langs->trans("DeleteMvt") . ''; + print '
'; +} print ''; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 8250549b9e1..c91c59169ba 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -170,14 +170,6 @@ class modAccounting extends DolibarrModules $this->rights = array(); // Permission array used by this module $r = 0; - $this->rights[$r][0] = 50440; - $this->rights[$r][1] = 'Manage chart of accounts, setup of accountancy'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'chartofaccount'; - $this->rights[$r][5] = ''; - $r++; - $this->rights[$r][0] = 50401; $this->rights[$r][1] = 'Bind products and invoices with accounting accounts'; $this->rights[$r][2] = 'r'; @@ -212,6 +204,30 @@ class modAccounting extends DolibarrModules $this->rights[$r][5] = 'creer'; $r++; + $this->rights[$r][0] = 50414; + $this->rights[$r][1] = 'Delete operations in Ledger'; + $this->rights[$r][2] = 'd'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvements'; + $this->rights[$r][5] = 'supprimer'; + $r++; + + $this->rights[$r][0] = 50415; + $this->rights[$r][1] = 'Delete all operations by year and journal in Ledger'; + $this->rights[$r][2] = 'd'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvements'; + $this->rights[$r][5] = 'supprimer_tous'; + $r++; + + $this->rights[$r][0] = 50418; + $this->rights[$r][1] = 'Export operations of the Ledger'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvements'; + $this->rights[$r][5] = 'export'; + $r++; + $this->rights[$r][0] = 50420; $this->rights[$r][1] = 'Report and export reports (turnover, balance, journals, ledger)'; $this->rights[$r][2] = 'r'; @@ -228,6 +244,13 @@ class modAccounting extends DolibarrModules $this->rights[$r][5] = ''; $r++; + $this->rights[$r][0] = 50440; + $this->rights[$r][1] = 'Manage chart of accounts, setup of accountancy'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'chartofaccount'; + $this->rights[$r][5] = ''; + $r++; // Menus //------- diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 23f10739424..6c54cb643fe 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -882,6 +882,15 @@ Permission2802=Use FTP client in write mode (delete or upload files) Permission50101=Use Point of Sale Permission50201=Read transactions Permission50202=Import transactions +Permission50401=Bind products and invoices with accounting accounts +Permission50411=Read operations in ledger +Permission50412=Write/Edit operations in ledger +Permission50414=Delete operations in ledger +Permission50415=Delete all operations by year and journal in ledger +Permission50418=Export operations of the ledger +Permission50420=Report and export reports (turnover, balance, journals, ledger) +Permission50430=Define and close a fiscal year +Permission50440=Manage chart of accounts, setup of accountancy Permission54001=Print Permission55001=Read polls Permission55002=Create/modify polls From 3091288ed79c6287ab31edd0ad78293e0c8cd7fa Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 17 Apr 2019 07:27:38 +0200 Subject: [PATCH 004/151] Revert "Move to Warning an alert on hook when method return a string than a int" This reverts commit cc5727bc7b8c5b80d5603a44c6b160fcf2d4cc24. --- htdocs/core/class/hookmanager.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 8752f01b95d..f23aa1da5a3 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -275,7 +275,7 @@ class HookManager // TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string if (! is_array($resaction) && ! is_numeric($resaction)) { - dol_syslog('Warning: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_WARNING); + dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR); if (empty($actionclassinstance->resprints)) { $this->resPrint.=$resaction; $resaction=0; } } } From 01ea4c28cff6efe403c310ad5718fb03f70965c7 Mon Sep 17 00:00:00 2001 From: Joa Date: Fri, 3 May 2019 11:02:37 +0200 Subject: [PATCH 005/151] adding hooks loading for form customization to card.php of adherents module --- htdocs/adherents/card.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 5d57208eb0e..850537356ee 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1059,6 +1059,13 @@ else // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + //Hooks here + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + //print $hookmanager->resPrint; //it double prints? + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + } print ''; print "\n"; @@ -1357,9 +1364,15 @@ else // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - + //Hooks here + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + //print $hookmanager->resPrint; //it double prints? + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + } + print ''; - dol_fiche_end(); print '
'; From 87e83a79670cd5e2503f88c676b6e4b1137fa11a Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Fri, 3 May 2019 16:14:44 +0200 Subject: [PATCH 006/151] New add extrafield separator collapse with theses specific values - empty for a simple separator - 1 to extend by default all extrafields after the separator position - 2 to collapse by default all extrafields after the separator position --- htdocs/core/class/commonobject.class.php | 17 ++++++++- htdocs/core/class/extrafields.class.php | 36 ++++++++++++++++++- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 +- .../core/tpl/admin_extrafields_edit.tpl.php | 4 +-- htdocs/core/tpl/extrafields_view.tpl.php | 18 ++++++++-- 5 files changed, 70 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fae9ab49cc8..7a4b2e58e0a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6404,6 +6404,7 @@ abstract class CommonObject $out .= ' '; $out .= "\n"; + $extrafields_collapse_num = ''; $e = 0; foreach($extrafields->attributes[$this->table_element]['label'] as $key=>$label) { @@ -6463,6 +6464,20 @@ abstract class CommonObject if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { + $extrafields_collapse_num = ''; + $extrafield_param = $extrafields->attributes[$this->table_element]['param'][$key]; + if (!empty($extrafield_param) && is_array($extrafield_param)) { + $extrafield_param_list = array_keys($extrafield_param['options']); + + if (count($extrafield_param_list)>0) { + $extrafield_collapse_display_value = intval($extrafield_param_list[0]); + + if ($extrafield_collapse_display_value==1 || $extrafield_collapse_display_value==2) { + $extrafields_collapse_num = $extrafields->attributes[$this->table_element]['pos'][$key]; + } + } + } + $out .= $extrafields->showSeparator($key, $this); } else @@ -6482,7 +6497,7 @@ abstract class CommonObject $html_id = !empty($this->id) ? 'extrarow-'.$this->element.'_'.$key.'_'.$this->id : ''; - $out .= ''; + $out .= ''; if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index caea57280b9..86019cc807b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1951,9 +1951,43 @@ class ExtraFields { global $langs; - $out = ''; + $out = ''; $out.= $langs->trans($this->attributes[$object->table_element]['label'][$key]); $out.= ''; + + $extrafield_param = $this->attributes[$object->table_element]['param'][$key]; + if (!empty($extrafield_param) && is_array($extrafield_param)) { + $extrafield_param_list = array_keys($extrafield_param['options']); + + if (count($extrafield_param_list) > 0) { + $extrafield_collapse_display_value = intval($extrafield_param_list[0]); + if ($extrafield_collapse_display_value == 1 || $extrafield_collapse_display_value == 2) { + $collapse_display = ($extrafield_collapse_display_value == 2 ? false : true); + $extrafields_collapse_num = $this->attributes[$object->table_element]['pos'][$key]; + + $out .= ''; + } + } + } + return $out; } diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 45c620db456..04720004492 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -107,7 +107,7 @@ $langs->load("modulebuilder"); else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();jQuery("#helppassword").hide();} else if (type == 'separate') { langfile.val('').prop('disabled',true);size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); - jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide(); + jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide(); } else { // type = string size.val('').prop('disabled', true); diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 1ba83bc393f..7ed41af9281 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -103,7 +103,7 @@ $langs->load("modulebuilder"); else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide();} else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();jQuery("#helppassword").hide();} else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();jQuery("#helppassword").hide();} - else if (type == 'separate') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide();} + else if (type == 'separate') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide();} else { // type = string size.val('').prop('disabled', true); unique.removeAttr('disabled'); @@ -173,7 +173,7 @@ if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_ar } } } -elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password')) +elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password') || ($type == 'separate')) { $paramlist=array_keys($param['options']); $param_chain = $paramlist[0]; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index db0d6a4897d..00a617a3e6c 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -48,8 +48,8 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e //var_dump($extrafields->attributes[$object->table_element]); if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]['label'])) - { + $extrafields_collapse_num = ''; foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { // Discard if extrafield is a hidden field on form @@ -86,11 +86,25 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] } if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') { + $extrafields_collapse_num = ''; + $extrafield_param = $extrafields->attributes[$object->table_element]['param'][$key]; + if (!empty($extrafield_param) && is_array($extrafield_param)) { + $extrafield_param_list = array_keys($extrafield_param['options']); + + if (count($extrafield_param_list)>0) { + $extrafield_collapse_display_value = intval($extrafield_param_list[0]); + + if ($extrafield_collapse_display_value==1 || $extrafield_collapse_display_value==2) { + $extrafields_collapse_num = $extrafields->attributes[$object->table_element]['pos'][$key]; + } + } + } + print $extrafields->showSeparator($key, $object); } else { - print ''; + print ''; print ''; print ''; print ''; From a7a8eb3648b2d0a634d76583c24249ee19924900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20L=C3=A9onard?= Date: Sat, 4 May 2019 06:33:23 +0200 Subject: [PATCH 007/151] Add customer code in customer orders documents --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 9d73384cf3a..0aada45f7f0 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1320,6 +1320,14 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date, "%d %b %Y", false, $outputlangs, true), '', 'R'); + if ($object->thirdparty->code_client) + { + $posy+=4; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + } + // Get contact if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) { From 9c69c8acc7db9fc27f1dcce206c2e9b2a3691814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn?= Date: Sat, 4 May 2019 12:08:28 +0200 Subject: [PATCH 008/151] trying to pass travis check --- htdocs/adherents/card.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 850537356ee..17ccdb0c546 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1060,17 +1060,16 @@ else // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; //Hooks here - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - //print $hookmanager->resPrint; //it double prints? - if (empty($reshook)) - { + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + //print $hookmanager->resPrint; //it double prints? + if (empty($reshook)) + { print $object->showOptionals($extrafields, 'edit'); - } - - print ''; + } + + print ''; print "
\n"; - - dol_fiche_end(); + dol_fiche_end(); print '
'; print ''; @@ -1365,12 +1364,12 @@ else // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; //Hooks here - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - //print $hookmanager->resPrint; //it double prints? - if (empty($reshook)) - { + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + //print $hookmanager->resPrint; //it double prints? + if (empty($reshook)) + { print $object->showOptionals($extrafields, 'edit'); - } + } print ''; dol_fiche_end(); From 11ece5603816221f531c35dbede74d84e61b58a0 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 5 May 2019 19:08:27 +0200 Subject: [PATCH 009/151] NEW add API shipment mode --- htdocs/api/class/api_setup.class.php | 62 ++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 783ec6540e3..e3bb7f4a799 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2017 Regis Houssin * Copyright (C) 2017 Neil Orley * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Thibault FOUCART * * * This program is free software; you can redistribute it and/or modify @@ -706,6 +707,67 @@ class Setup extends DolibarrApi return $list; } + + /** + * Get the list of shipping methods. + * + * @param int $limit Number of items per page + * @param int $page Page number {@min 0} + * @param int $active Shipping methodsm is active or not {@min 0} {@max 1} + * @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')" + * + * @url GET dictionary/shipping_methods + * + * @return array List of shipping methods + * + * @throws 400 RestException + * @throws 200 OK + */ + public function getShippingModes($limit = 100, $page = 0, $active = 1, $sqlfilters = '') + { + $list = array(); + + $sql = "SELECT rowid as id, code, libelle as label, description, tracking, module"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t"; + $sql.= " WHERE t.entity IN (".getEntity('c_shipment_mode').")"; + $sql.= " AND t.active = ".$active; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + //$sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(400, $this->db->lasterror()); + } + + return $list; + } /** * Get the list of tickets categories. From 15cff25bbc68738e6c11a7d12081fa7842c2f9b0 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 5 May 2019 19:10:39 +0200 Subject: [PATCH 010/151] Update llx_c_shipment_mode.sql --- htdocs/install/mysql/tables/llx_c_shipment_mode.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_c_shipment_mode.sql b/htdocs/install/mysql/tables/llx_c_shipment_mode.sql index 7945c9f9fb0..efacec420c9 100644 --- a/htdocs/install/mysql/tables/llx_c_shipment_mode.sql +++ b/htdocs/install/mysql/tables/llx_c_shipment_mode.sql @@ -19,6 +19,7 @@ create table llx_c_shipment_mode ( rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp, code varchar(30) NOT NULL, libelle varchar(50) NOT NULL, From 499798b2e01b725b35027dd94dcc2dadf2bb2340 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 5 May 2019 19:11:18 +0200 Subject: [PATCH 011/151] Update llx_c_shipment_mode.key.sql --- htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql b/htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql index 15058c0630e..3a90d15330f 100644 --- a/htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql +++ b/htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql @@ -16,5 +16,5 @@ -- -- =================================================================== -ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code); +ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (entity, code); From e65c8399e60b0310648bd8368dc48fd0c6428706 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 5 May 2019 19:14:09 +0200 Subject: [PATCH 012/151] Update 9.0.0-10.0.0.sql --- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index e5b925b0d83..2e143209d9a 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -108,6 +108,8 @@ ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_id varchar(12 ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_site varchar(128) NULL; -- Fix if table exists +ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer; + ALTER TABLE llx_c_units DROP INDEX uk_c_units_code; ALTER TABLE llx_c_units ADD COLUMN scale integer; ALTER TABLE llx_c_units ADD COLUMN unit_type varchar(10); From a0ba8d98a1fee2b2d414c4a6ed137e792cfaa755 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 5 May 2019 20:54:31 +0200 Subject: [PATCH 013/151] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index e3bb7f4a799..78b794a996c 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2017 Regis Houssin * Copyright (C) 2017 Neil Orley * Copyright (C) 2018 Frédéric France - * Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018 Thibault FOUCART * * * This program is free software; you can redistribute it and/or modify @@ -767,7 +767,7 @@ class Setup extends DolibarrApi } return $list; - } + } /** * Get the list of tickets categories. From 2aafef4017b0927b947ba0fd5a26559e8bc6e12c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 6 May 2019 10:27:13 +0200 Subject: [PATCH 014/151] NEW add multicurrency rate at currency list API --- htdocs/api/class/api_setup.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 783ec6540e3..8d5d6d581f9 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -448,6 +448,7 @@ class Setup extends DolibarrApi /** * Get the list of currencies. * + * @param int $multicurrency Multicurrency rates (0: no multicurrency, 1: last rate) {@min 0} {@max 1} * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Number of items per page @@ -460,13 +461,22 @@ class Setup extends DolibarrApi * * @throws RestException */ - public function getListOfCurrencies($sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + public function getListOfCurrencies($multicurrency = 0, $sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { $list = array(); - //TODO link with multicurrency module $sql = "SELECT t.code_iso, t.label, t.unicode"; + if (!empty($multicurrency)) $sql.= " , cr.date_sync, cr.rate "; $sql.= " FROM ".MAIN_DB_PREFIX."c_currencies as t"; + if (!empty($multicurrency)) { + $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency as m ON m.code=t.code_iso"; + $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency_rate as cr ON (m.rowid = cr.fk_multicurrency)"; + } $sql.= " WHERE t.active = ".$active; + if (!empty($multicurrency)) { + $sql.= " AND m.entity IN (".getEntity('multicurrency').")"; + $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; + } + // Add sql filters if ($sqlfilters) { From 650fbb2bbf7c8af2a193cb3736e7bff1a9d61d73 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 6 May 2019 10:55:11 +0200 Subject: [PATCH 015/151] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 8d5d6d581f9..386c04cdd9f 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -475,7 +475,7 @@ class Setup extends DolibarrApi if (!empty($multicurrency)) { $sql.= " AND m.entity IN (".getEntity('multicurrency').")"; $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; - } + } // Add sql filters if ($sqlfilters) From 80ed080800954f31b35eae42b43bff6ea09dacc6 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 6 May 2019 11:31:41 +0200 Subject: [PATCH 016/151] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 386c04cdd9f..227921889e6 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -448,7 +448,7 @@ class Setup extends DolibarrApi /** * Get the list of currencies. * - * @param int $multicurrency Multicurrency rates (0: no multicurrency, 1: last rate) {@min 0} {@max 1} + * @param int $multicurrency Multicurrency rates (0: no multicurrency, 1: last rate, 2: all rates) {@min 0} {@max 2} * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Number of items per page @@ -474,7 +474,7 @@ class Setup extends DolibarrApi $sql.= " WHERE t.active = ".$active; if (!empty($multicurrency)) { $sql.= " AND m.entity IN (".getEntity('multicurrency').")"; - $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; + if (!empty($multicurrency) && $multicurrecny != 2) $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; } // Add sql filters From 96cc4f7774a9aef072c79644ec401d172373b902 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 6 May 2019 12:37:55 +0200 Subject: [PATCH 017/151] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 227921889e6..e72f178cd68 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -474,7 +474,7 @@ class Setup extends DolibarrApi $sql.= " WHERE t.active = ".$active; if (!empty($multicurrency)) { $sql.= " AND m.entity IN (".getEntity('multicurrency').")"; - if (!empty($multicurrency) && $multicurrecny != 2) $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; + if (!empty($multicurrency) && $multicurrency != 2) $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; } // Add sql filters From 77d3f221631a1a92e7c27c82126c33f505eea90c Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Mon, 6 May 2019 11:21:39 +0200 Subject: [PATCH 018/151] NEW : Amount invoiced column in propal list --- htdocs/comm/propal/list.php | 30 ++++++++++++++++++++++++++++++ htdocs/langs/fr_FR/main.lang | 1 + 2 files changed, 31 insertions(+) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 24c53d26526..7355ea83269 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -160,6 +160,7 @@ $arrayfields=array( 'p.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'p.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'p.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), + 'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0), 'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10), 'sale_representative'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>1), 'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), @@ -637,6 +638,12 @@ if ($resql) print ''; print ''; } + if (! empty($arrayfields['p.total_invoiced']['checked'])) + { + // Amount invoiced + print ''; + print ''; + } if (! empty($arrayfields['u.login']['checked'])) { // Author @@ -701,6 +708,7 @@ if ($resql) if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); // Extra fields @@ -911,6 +919,27 @@ if ($resql) if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; } + // Amount invoiced + if(! empty($arrayfields['p.total_invoiced']['checked'])) { + $totalInvoiced = 0; + $p = new Propal($db); + $TInvoiceData = $p->InvoiceArrayList($obj->rowid); + + if(! empty($TInvoiceData)) { + foreach($TInvoiceData as $invoiceData) { + $invoice = new Facture($db); + $invoice->fetch($invoiceData->facid); + + if(! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) continue; + $totalInvoiced += $invoice->total_ttc; + } + } + + print ''.price($totalInvoiced)."\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalinvoicedfield']=$totalarray['nbfield']; + $totalarray['totalinvoiced'] += $totalInvoiced; + } $userstatic->id=$obj->fk_user_author; $userstatic->login=$obj->login; @@ -1037,6 +1066,7 @@ if ($resql) elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalinvoicedfield'] == $i) print ''.price($totalarray['totalinvoiced']).''; elseif ($totalarray['totalizable']) { $printed = false; foreach ($totalarray['totalizable'] as $totalizable) { diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 552c3334bbe..22e6914dcd9 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -347,6 +347,7 @@ PriceUTTC=P.U TTC Amount=Montant AmountInvoice=Montant facture AmountInvoiced=Montant facturé +AmountInvoicedTTC=Montant TTC facturé AmountPayment=Montant paiement AmountHTShort=Montant HT AmountTTCShort=Montant TTC From 53b1dec317f9b8bee27e39437916f899021cbd37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 May 2019 01:56:52 +0200 Subject: [PATCH 019/151] Update 9.0.0-10.0.0.sql --- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 2e143209d9a..66839713bb7 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -107,9 +107,11 @@ ALTER TABLE llx_prelevement_facture_demande ADD COLUMN sourcetype varchar(32); ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_id varchar(128) NULL; ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_site varchar(128) NULL; --- Fix if table exists -ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer; +ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1; +ALTER TABLE llx_c_shipment_mode DROP INDEX uk_c_shipment_mode; +ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (entity, code); +-- Fix if table exists ALTER TABLE llx_c_units DROP INDEX uk_c_units_code; ALTER TABLE llx_c_units ADD COLUMN scale integer; ALTER TABLE llx_c_units ADD COLUMN unit_type varchar(10); From 249893a4ab1774b55fb8bf4e066aebb962ba450a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 May 2019 01:57:23 +0200 Subject: [PATCH 020/151] Update 9.0.0-10.0.0.sql --- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 66839713bb7..43e12c6c05f 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -109,7 +109,7 @@ ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_site varchar( ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1; ALTER TABLE llx_c_shipment_mode DROP INDEX uk_c_shipment_mode; -ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (entity, code); +ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code, entity); -- Fix if table exists ALTER TABLE llx_c_units DROP INDEX uk_c_units_code; From 95bb8a1f755f323fef09be8a8f6129a3951ef612 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 May 2019 01:57:39 +0200 Subject: [PATCH 021/151] Update llx_c_shipment_mode.key.sql --- htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql b/htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql index 3a90d15330f..a75dfaf2740 100644 --- a/htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql +++ b/htdocs/install/mysql/tables/llx_c_shipment_mode.key.sql @@ -16,5 +16,5 @@ -- -- =================================================================== -ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (entity, code); +ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code, entity); From c4fdec9481c3469dcae8f0622abc127ab09eda58 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 May 2019 02:05:03 +0200 Subject: [PATCH 022/151] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index e72f178cd68..57aac1b3bb0 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -448,7 +448,7 @@ class Setup extends DolibarrApi /** * Get the list of currencies. * - * @param int $multicurrency Multicurrency rates (0: no multicurrency, 1: last rate, 2: all rates) {@min 0} {@max 2} + * @param int $multicurrency Multicurrency rates (0: no multicurrency, 1: last rate, 2: all rates) {@min 0} {@max 2} * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Number of items per page From 3dbfc08a1353c66d81c368f850cd5149b0250420 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 10 May 2019 12:24:02 +0200 Subject: [PATCH 023/151] NEW add "printBucktrackInfo" hook, an external module can add info --- ChangeLog | 1 + htdocs/main.inc.php | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index 355d9baa561..4e36f831197 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ FIX: Disallow line start date if after end date. For Developers: NEW: Module "DebugBar" is available as a stable module. +NEW: add "printBucktrackInfo" hook, an external module can add info WARNING: diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index f195d5f945e..2f3455f7631 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2030,6 +2030,16 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ $bugbaseurl.= urlencode("- **PHP**: " . php_sapi_name() . ' ' . phpversion() . "\n"); $bugbaseurl.= urlencode("- **Database**: " . $db::LABEL . ' ' . $db->getVersion() . "\n"); $bugbaseurl.= urlencode("- **URL**: " . $_SERVER["REQUEST_URI"] . "\n"); + + // Execute hook printBugtrackInfo + $parameters=array('searchform'=>$searchform); + $reshook=$hookmanager->executeHooks('printBugtrackInfo', $parameters); // Note that $action and $object may have been modified by some hooks + if (empty($reshook)) + { + $bugbaseurl.=$hookmanager->resPrint; + } + else $bugbaseurl=$hookmanager->resPrint; + $bugbaseurl.= urlencode("\n"); $bugbaseurl.= urlencode("## Report\n"); print '
'; From a91b462a898cb871fe7e91c886194853b42c7128 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 10 May 2019 12:28:27 +0200 Subject: [PATCH 024/151] FIX wrong parameter --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2f3455f7631..7dc8df05499 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2032,7 +2032,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ $bugbaseurl.= urlencode("- **URL**: " . $_SERVER["REQUEST_URI"] . "\n"); // Execute hook printBugtrackInfo - $parameters=array('searchform'=>$searchform); + $parameters=array('bugbaseurl'=>$bugbaseurl); $reshook=$hookmanager->executeHooks('printBugtrackInfo', $parameters); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { From bdd4f3e2973ec48a3d4d51286959383fdecb1e48 Mon Sep 17 00:00:00 2001 From: ATM John BOTELLA Date: Sat, 18 May 2019 18:59:55 +0200 Subject: [PATCH 025/151] add css for html5 ::invalid pseudo element --- htdocs/theme/eldy/global.inc.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index c1167524bf5..3ab314a5321 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -95,6 +95,10 @@ input.button.massactionconfirmed { margin: 4px; } +input:invalid, select:invalid { + border-color: #ea1212; +} + /* Focus definitions must be after standard definition */ textarea:focus { /* v6 box-shadow: 0 0 4px #8091BF; */ From 6be48e69521262c461b91d61095362239acec38e Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Mon, 20 May 2019 08:59:44 +0200 Subject: [PATCH 026/151] NEW : Amount HT invoiced column in propal list --- htdocs/comm/propal/list.php | 32 +++++++++++++++++++++++++++++++- htdocs/langs/fr_FR/main.lang | 1 + 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7355ea83269..cd98800f606 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -160,6 +160,7 @@ $arrayfields=array( 'p.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'p.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'p.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), + 'p.total_ht_invoiced'=>array('label'=>$langs->trans("AmountInvoicedHT"), 'checked'=>0), 'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0), 'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10), 'sale_representative'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>1), @@ -638,6 +639,12 @@ if ($resql) print ''; print ''; } + if (! empty($arrayfields['p.total_ht_invoiced']['checked'])) + { + // Amount invoiced + print ''; + print ''; + } if (! empty($arrayfields['p.total_invoiced']['checked'])) { // Amount invoiced @@ -708,7 +715,8 @@ if ($resql) if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); - if (! empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); // Extra fields @@ -920,6 +928,27 @@ if ($resql) $totalarray['totalttc'] += $obj->total_ttc; } // Amount invoiced + if(! empty($arrayfields['p.total_ht_invoiced']['checked'])) { + $totalInvoiced = 0; + $p = new Propal($db); + $TInvoiceData = $p->InvoiceArrayList($obj->rowid); + + if(! empty($TInvoiceData)) { + foreach($TInvoiceData as $invoiceData) { + $invoice = new Facture($db); + $invoice->fetch($invoiceData->facid); + + if(! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) continue; + $totalInvoiced += $invoice->total_ht; + } + } + + print ''.price($totalInvoiced)."\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalhtinvoicedfield']=$totalarray['nbfield']; + $totalarray['totalhtinvoiced'] += $totalInvoiced; + } + // Amount invoiced if(! empty($arrayfields['p.total_invoiced']['checked'])) { $totalInvoiced = 0; $p = new Propal($db); @@ -1066,6 +1095,7 @@ if ($resql) elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalhtinvoicedfield'] == $i) print ''.price($totalarray['totalhtinvoiced']).''; elseif ($totalarray['totalinvoicedfield'] == $i) print ''.price($totalarray['totalinvoiced']).''; elseif ($totalarray['totalizable']) { $printed = false; diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 22e6914dcd9..3cbcf89574e 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -347,6 +347,7 @@ PriceUTTC=P.U TTC Amount=Montant AmountInvoice=Montant facture AmountInvoiced=Montant facturé +AmountInvoicedHT=Montant HT facturé AmountInvoicedTTC=Montant TTC facturé AmountPayment=Montant paiement AmountHTShort=Montant HT From 45fabede280fcf2ede6519b6be6c751a182740bf Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 26 May 2019 16:44:17 +0200 Subject: [PATCH 027/151] Basic phone layout for Restaurants in TakePOS --- htdocs/langs/en_US/cashdesk.lang | 3 +- htdocs/takepos/admin/setup.php | 10 +++ htdocs/takepos/invoice.php | 127 +++++++++++++++++++++++++++++-- htdocs/takepos/takepos.php | 7 ++ 4 files changed, 138 insertions(+), 9 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 8ba3bda053f..83c217b06f7 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -67,4 +67,5 @@ ValidateAndClose=Validate and close Terminal=Terminal NumberOfTerminals=Number of Terminals TerminalSelect=Select terminal you want to use: -POSTicket=POS Ticket \ No newline at end of file +POSTicket=POS Ticket +BasicPhoneLayout=Use basic layout for phones \ No newline at end of file diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index f331587723b..3fb9d869cd0 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -73,6 +73,7 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -199,6 +200,15 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOSCONNECTOR){ print ''; } +if ($conf->global->TAKEPOS_BAR_RESTAURANT) +{ + print ''; + print $langs->trans("BasicPhoneLayout"); + print ''; + print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); + print ''; +} + print ''; print $langs->trans('TicketVatGrouped'); print ''; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 510b949b92b..aac6f7ecaf8 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -44,6 +44,31 @@ $action = GETPOST('action', 'alpha'); $idproduct = GETPOST('idproduct', 'int'); $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant +if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT==1 && $conf->browser->layout == 'phone') +{ + // DIRECT LINK TO THIS PAGE FROM MOBILE AND NO TERMINAL SELECTED + if ($_SESSION["takeposterminal"]=="") + { + if ($conf->global->TAKEPOS_NUM_TERMINALS=="1") $_SESSION["takeposterminal"]=1; + else + { + header("Location: takepos.php"); + exit; + } + } + $mobilepage = GETPOST('mobilepage', 'alpha'); + $title='TakePOS - Dolibarr '.DOL_VERSION; + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; + $head=' + + + '; + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); + print ' + + '; +} + /** * Abort invoice creationg with a given error message * @@ -497,13 +522,88 @@ print $langs->trans('TotalTTC'); print ' : '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).''; print '
'.$sectionwithinvoicelink; print ''; -print '' . $langs->trans('ReductionShort') . ''; -print '' . $langs->trans('Qty') . ''; -print '' . $langs->trans('TotalHTShort') . ''; +if ($_SESSION["basiclayout"]!=1) +{ + print '' . $langs->trans('ReductionShort') . ''; + print '' . $langs->trans('Qty') . ''; + print '' . $langs->trans('TotalHTShort') . ''; +} print "\n"; +if ($_SESSION["basiclayout"]==1) +{ + if ($mobilepage=="cats") + { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $categorie = new Categorie($db); + $categories = $categorie->get_full_arbo('product'); + $htmlforlines = ''; + foreach ($categories as $row){ + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= $row['label']; + $htmlforlines.= ''; + $htmlforlines.= ''."\n"; + } + $htmlforlines.= ''; + $htmlforlines.= '
'; + $htmlforlines.= ''.$langs->trans("Floors").''; + $htmlforlines.= '
'; + print $htmlforlines; + } + + if ($mobilepage=="products") + { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $object = new Categorie($db); + $catid = GETPOST('catid', 'int'); + $result=$object->fetch($catid); + $prods = $object->getObjectsInCateg("product"); + $htmlforlines = ''; + foreach ($prods as $row) { + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= $row->label; + $htmlforlines.= ''; + $htmlforlines.= ''."\n"; + } + $htmlforlines.= ''; + $htmlforlines.= '
'; + $htmlforlines.= ''.$langs->trans("Categories").''; + $htmlforlines.= ''.$langs->trans("Floors").''; + $htmlforlines.= '
'; + print $htmlforlines; + } + + if ($mobilepage=="places") + { + $sql="SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables"; + $resql = $db->query($sql); + $rows = array(); + $htmlforlines = ''; + while($row = $db->fetch_array($resql)){ + $rows[] = $row; + $htmlforlines.= ''; + $htmlforlines.= ''; + $htmlforlines.= $row['label']; + $htmlforlines.= ''; + $htmlforlines.= ''."\n"; + } + $htmlforlines.= ''; + $htmlforlines.= '
'; + $htmlforlines.= ''.$langs->trans("Categories").''; + $htmlforlines.= ''.$langs->trans("Floors").''; + $htmlforlines.= '
'; + print $htmlforlines; + } +} + if ($placeid > 0) { + if ($_SESSION["basiclayout"]==1 && $mobilepage!="invoice") return; if (is_array($invoice->lines) && count($invoice->lines)) { $tmplines = array_reverse($invoice->lines); @@ -538,11 +638,14 @@ if ($placeid > 0) } } if (!empty($line->array_options['options_order_notes'])) $htmlforlines.= "
(".$line->array_options['options_order_notes'].")"; - $htmlforlines.= ''; - $htmlforlines.= '' . vatrate($line->remise_percent, true) . ''; - $htmlforlines.= '' . $line->qty . ''; - $htmlforlines.= '' . price($line->total_ttc) . ''; - $htmlforlines.= ''."\n"; + if ($_SESSION["basiclayout"]!=1) + { + $htmlforlines.= ''; + $htmlforlines.= '' . vatrate($line->remise_percent, true) . ''; + $htmlforlines.= '' . $line->qty . ''; + $htmlforlines.= '' . price($line->total_ttc) . ''; + } + $htmlforlines.= ''."\n"; print $htmlforlines; } @@ -558,6 +661,14 @@ else { // No invoice generated yet print ''; +if ($_SESSION["basiclayout"]==1 && $mobilepage=="invoice") +{ + print ''; +} + if ($invoice->socid != $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}) { $soc = new Societe($db); diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index c0a37881cf9..7e55bbc5936 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -57,6 +57,13 @@ if ($conf->browser->layout == 'phone') { $maxcategbydefaultforthisdevice=8; $maxproductbydefaultforthisdevice=16; + //REDIRECT TO BASIC LAYOUT IF TERMINAL SELECTED AND BASIC MOBILE LAYOUT ENABLED + if ($_SESSION["takeposterminal"]!="" && $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT==1) + { + $_SESSION["basiclayout"]=1; + header("Location: invoice.php?mobilepage=invoice"); + exit; + } } $MAXCATEG = (empty($conf->global->TAKEPOS_NB_MAXCATEG)?$maxcategbydefaultforthisdevice:$conf->global->TAKEPOS_NB_MAXCATEG); $MAXPRODUCT = (empty($conf->global->TAKEPOS_NB_MAXPRODUCT)?$maxproductbydefaultforthisdevice:$conf->global->TAKEPOS_NB_MAXPRODUCT); From 439eafb6377780f9347aa4fabd185949621c73a6 Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Mon, 3 Jun 2019 15:44:17 +0200 Subject: [PATCH 028/151] NEW add extrafields in warehouses - create table - admin extrafields - object fecth, insert, update and delete extrafields - card and list --- htdocs/admin/stock.php | 5 + htdocs/core/lib/stock.lib.php | 34 +++++ .../install/mysql/migration/10.0.0-11.0.0.sql | 15 +++ .../tables/llx_entrepot_extrafields.key.sql | 20 +++ .../mysql/tables/llx_entrepot_extrafields.sql | 26 ++++ htdocs/install/pgsql/functions/functions.sql | 1 + htdocs/product/admin/stock_extrafields.php | 116 +++++++++++++++++ htdocs/product/stock/card.php | 118 +++++++++++++----- htdocs/product/stock/class/entrepot.class.php | 66 ++++++++-- htdocs/product/stock/list.php | 73 +++++++++-- 10 files changed, 424 insertions(+), 50 deletions(-) create mode 100644 htdocs/install/mysql/migration/10.0.0-11.0.0.sql create mode 100644 htdocs/install/mysql/tables/llx_entrepot_extrafields.key.sql create mode 100644 htdocs/install/mysql/tables/llx_entrepot_extrafields.sql create mode 100644 htdocs/product/admin/stock_extrafields.php diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 2e934211970..7c22d1a4a58 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -27,6 +27,7 @@ */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "stocks")); @@ -77,6 +78,10 @@ llxHeader('', $langs->trans("StockSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("StockSetup"), $linkback, 'title_setup'); +$head = stock_admin_prepare_head(); + +dol_fiche_head($head, 'general', $langs->trans("StockSetup"), -1, 'stock'); + $form=new Form($db); diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php index 7b3ef796432..fc7701877bc 100644 --- a/htdocs/core/lib/stock.lib.php +++ b/htdocs/core/lib/stock.lib.php @@ -78,3 +78,37 @@ function stock_prepare_head($object) return $head; } + +/** + * Return array head with list of tabs to view object informations. + * + * @return array head array with tabs + */ +function stock_admin_prepare_head() +{ + global $langs, $conf, $user; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/admin/stock.php'; + $head[$h][1] = $langs->trans("Miscellaneous"); + $head[$h][2] = 'general'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab + complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin'); + + $head[$h][0] = DOL_URL_ROOT.'/product/admin/stock_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFields"); + $head[$h][2] = 'attributes'; + $h++; + + complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin', 'remove'); + + return $head; +} + diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql new file mode 100644 index 00000000000..9f758b6bc40 --- /dev/null +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -0,0 +1,15 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 11.0.0 or higher. + + +create table llx_entrepot_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_entrepot_extrafields ADD INDEX idx_entrepot_extrafields (fk_object); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_entrepot_extrafields.key.sql b/htdocs/install/mysql/tables/llx_entrepot_extrafields.key.sql new file mode 100644 index 00000000000..72973186918 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_entrepot_extrafields.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2011 Laurent Destailleur +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_entrepot_extrafields ADD INDEX idx_entrepot_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_entrepot_extrafields.sql b/htdocs/install/mysql/tables/llx_entrepot_extrafields.sql new file mode 100644 index 00000000000..c7a209eba8b --- /dev/null +++ b/htdocs/install/mysql/tables/llx_entrepot_extrafields.sql @@ -0,0 +1,26 @@ +-- ======================================================================== +-- Copyright (C) 2011 Laurent Destailleur +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ======================================================================== + +create table llx_entrepot_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 66b1fbaf370..fc4e4116c84 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -106,6 +106,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_email CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollectoraction FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_emailcollector_emailcollectorfilter FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_entrepot_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_events FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_expedition FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_expensereport FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/product/admin/stock_extrafields.php b/htdocs/product/admin/stock_extrafields.php new file mode 100644 index 00000000000..8b2a016415e --- /dev/null +++ b/htdocs/product/admin/stock_extrafields.php @@ -0,0 +1,116 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/product/admin/stock_extrafields.php + * \ingroup stock + * \brief Page to setup extra fields of third party + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array('companies', 'admin', 'stock')); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label=ExtraFields::$type2label; +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val); + +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); +$elementtype='entrepot'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject=$langs->transnoentitiesnoconv("Warehouses"); + +llxHeader('', $langs->trans("StockSetup")); + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("StockSetup"), $linkback, 'title_setup'); + + +$head = stock_admin_prepare_head(); + +dol_fiche_head($head, 'attributes', $langs->trans("Warehouses"), -1, 'stock'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print ''; + print "
"; +} + + +/* ************************************************************************** */ +/* */ +/* Creation of an optional field */ +/* */ +/* ************************************************************************** */ + +if ($action == 'create') +{ + print "
"; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* ************************************************************************** */ +/* */ +/* Edition of an optional field */ +/* */ +/* ************************************************************************** */ +if ($action == 'edit' && ! empty($attrname)) +{ + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index ae2150e8464..89d7258e3cc 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; // Load translation files required by the page $langs->loadLangs(array('products', 'stocks', 'companies', 'categories')); @@ -55,16 +56,32 @@ $backtopage=GETPOST('backtopage', 'alpha'); //$result=restrictedArea($user,'stock', $id, 'entrepot&stock'); $result=restrictedArea($user, 'stock'); +$object = new Entrepot($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('entrepot'); + +// Load object +if ($id > 0 || ! empty($ref)) { + $ret = $object->fetch($id, $ref); +// if ($ret > 0) +// $ret = $object->fetch_thirdparty(); + if ($ret <= 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $action = ''; + } +} + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('warehousecard','globalcard')); -$object = new Entrepot($db); - - /* * Actions */ +$error = 0; + $usercanread = (($user->rights->stock->lire)); $usercancreate = (($user->rights->stock->creer)); $usercandelete = (($user->rights->stock->supprimer)); @@ -85,27 +102,30 @@ if ($action == 'add' && $user->rights->stock->creer) if (! empty($object->libelle)) { - $id = $object->create($user); - if ($id > 0) - { - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) { + $error++; + $action = 'create'; + } - if (! empty($backtopage)) - { - header("Location: ".$backtopage); - exit; - } - else - { - header("Location: card.php?id=".$id); - exit; - } - } - else - { - $action = 'create'; - setEventMessages($object->error, $object->errors, 'errors'); - } + if (! $error) { + $id = $object->create($user); + if ($id > 0) { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + + if (!empty($backtopage)) { + header("Location: " . $backtopage); + exit; + } else { + header("Location: card.php?id=" . $id); + exit; + } + } else { + $action = 'create'; + setEventMessages($object->error, $object->errors, 'errors'); + } + } } else { @@ -147,15 +167,21 @@ if ($action == 'update' && $cancel <> $langs->trans("Cancel")) $object->town = GETPOST("town"); $object->country_id = GETPOST("country_id"); - if ( $object->update($id, $user) > 0) - { - $action = ''; - } - else - { + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) $error++; + + if (! $error) { + $ret = $object->update($id, $user); + if ($ret < 0) $error++; + } + + if ($error) { $action = 'edit'; setEventMessages($object->error, $object->errors, 'errors'); - } + } else { + $action = ''; + } } else { @@ -163,6 +189,22 @@ if ($action == 'update' && $cancel <> $langs->trans("Cancel")) setEventMessages($object->error, $object->errors, 'errors'); } } +elseif ($action == 'update_extras') { + $object->oldcopy = dol_clone($object); + + // Fill array 'array_options' with data from update form + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none')); + if ($ret < 0) $error++; + if (! $error) { + $result = $object->insertExtraFields(); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + if ($error) $action = 'edit_extras'; +} if ($cancel == $langs->trans("Cancel")) { @@ -257,6 +299,9 @@ if ($action == 'create') print ''; print ''; + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; + print ''; dol_fiche_end(); @@ -392,6 +437,9 @@ else } print ""; + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + print ""; print '
'; @@ -638,6 +686,7 @@ else if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; + // Status print ''.$langs->trans("Status").''; print ''; print ''; + // Other attributes + $parameters=array('colspan' => ' colspan="3"', 'cols'=>3); + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + } + print ''; dol_fiche_end(); diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 0032d17f97e..4593037da10 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -163,6 +163,19 @@ class Entrepot extends CommonObject } } + // Actions on extra fields + if (! $error) + { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + } + if (! $error) { $this->db->commit(); @@ -199,6 +212,10 @@ class Entrepot extends CommonObject */ public function update($id, $user) { + global $conf; + + $error=0; + if (empty($id)) $id = $this->id; // Check if new parent is already a child of current warehouse @@ -239,13 +256,24 @@ class Entrepot extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); - if ($resql) - { + + if (! $resql) { + $error++; + $this->errors[]="Error ".$this->db->lasterror(); + } + + if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) { + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } + } + + if (!$error) { $this->db->commit(); return 1; - } - else - { + } else { $this->db->rollback(); $this->error=$this->db->lasterror(); return -1; @@ -262,6 +290,10 @@ class Entrepot extends CommonObject */ public function delete($user, $notrigger = 0) { + global $conf; + + $error = 0; + $this->db->begin(); if (! $error && empty($notrigger)) @@ -293,17 +325,30 @@ class Entrepot extends CommonObject { $sql = "DELETE FROM ".MAIN_DB_PREFIX."entrepot"; $sql.= " WHERE rowid = " . $this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql1=$this->db->query($sql); + if (!$resql1) $error++; // Update denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET stock = (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql2=$this->db->query($sql); + if (!$resql2) $error++; - if ($resql1 && $resql2) + // Removed extrafields + if (! $error) { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $result=$this->deleteExtraFields(); + if ($result < 0) { + $error++; + $errorflag=-4; + dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); + } + } + } + + if (!$error) { $this->db->commit(); return 1; @@ -377,6 +422,10 @@ class Entrepot extends CommonObject $this->town = $obj->town; $this->country_id = $obj->country_id; + // Retreive all extrafield + // fetch optionals attributes and labels + $this->fetch_optionals(); + include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; $tmp=getCountry($this->country_id, 'all'); $this->country=$tmp['label']; @@ -386,6 +435,7 @@ class Entrepot extends CommonObject } else { + $this->error="Record Not Found"; return 0; } } diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index b9876bdf36a..8178df6b03c 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -49,6 +49,16 @@ $offset = $limit * $page; $year = strftime("%Y", time()); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$object = new Entrepot($db); +$hookmanager->initHooks(array('stocklist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('entrepot'); +$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + + // List of fields to search into when doing a "search in all" $fieldstosearchall = array( 'e.ref'=>"Ref", @@ -60,6 +70,16 @@ $fieldstosearchall = array( ); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); + } +} + + /* * Actions */ @@ -85,14 +105,19 @@ $warehouse=new Entrepot($db); $sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent,"; $sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot_extrafields as ef on (e.rowid = ef.fk_object)"; $sql.= " WHERE e.entity IN (".getEntity('stock').")"; if ($search_ref) $sql.= natural_search("e.ref", $search_ref); // ref if ($search_label) $sql.= natural_search("e.lieu", $search_label); // label if ($search_status != '' && $search_status >= 0) $sql.= " AND e.statut = ".$search_status; if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $sql.= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent"; $totalnboflines=0; $result=$db->query($sql); @@ -131,6 +156,9 @@ if ($result) if ($search_status) $param.="&search_status=".urlencode($search_status); if ($sall) $param.="&sall=".urlencode($sall); + // Add $param from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + $newcardbutton=''; if ($user->rights->stock->creer) { @@ -173,6 +201,9 @@ if ($result) print ''; print ''; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + print ''; print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); print ''; @@ -190,7 +221,9 @@ if ($result) print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stockqty", '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.statut", '', $param, '', $sortfield, $sortorder, 'right '); + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.statut", '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -198,40 +231,55 @@ if ($result) { $warehouse=new Entrepot($db); $var=false; + $totalarray=array(); while ($i < min($num, $limit)) { - $objp = $db->fetch_object($result); + $obj = $db->fetch_object($result); - $warehouse->id = $objp->rowid; - $warehouse->ref = $objp->ref; - $warehouse->label = $objp->ref; - $warehouse->lieu = $objp->lieu; - $warehouse->fk_parent = $objp->fk_parent; + $warehouse->id = $obj->rowid; + $warehouse->ref = $obj->ref; + $warehouse->label = $obj->ref; + $warehouse->lieu = $obj->lieu; + $warehouse->fk_parent = $obj->fk_parent; print ''; print '' . $warehouse->getNomUrl(1) . ''; + if (! $i) $totalarray['nbfield']++; // Location - print ''.$objp->lieu.''; + print ''.$obj->lieu.''; + if (! $i) $totalarray['nbfield']++; + // Stock qty - print ''.price2num($objp->stockqty, 5).''; + print ''.price2num($obj->stockqty, 5).''; + if (! $i) $totalarray['nbfield']++; + // PMP value print ''; - if (price2num($objp->estimatedvalue, 'MT')) print price(price2num($objp->estimatedvalue, 'MT'), 1); + if (price2num($obj->estimatedvalue, 'MT')) print price(price2num($obj->estimatedvalue, 'MT'), 1); else print ''; print ''; + if (! $i) $totalarray['nbfield']++; + // Selling value print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue, 'MT'), 1); + if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($obj->sellvalue, 'MT'), 1); else { $htmltext=$langs->trans("OptionMULTIPRICESIsOn"); print $form->textwithtooltip($langs->trans("Variable"), $htmltext); } print ''; + if (! $i) $totalarray['nbfield']++; + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Status - print ''.$warehouse->LibStatut($objp->statut, 5).''; + print ''.$warehouse->LibStatut($obj->statut, 5).''; + if (! $i) $totalarray['nbfield']++; print ''; + if (! $i) $totalarray['nbfield']++; print "\n"; @@ -255,6 +303,7 @@ if ($result) print ''; print ''; print ''; + print ''; print "\n"; } } From 9a974814fac002004afd5d9b8a90a501b6947653 Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Mon, 3 Jun 2019 15:53:21 +0200 Subject: [PATCH 029/151] NEW add extrafields in warehouses - fix load lang stocks --- htdocs/product/admin/stock_extrafields.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/admin/stock_extrafields.php b/htdocs/product/admin/stock_extrafields.php index 8b2a016415e..5dc2aa63357 100644 --- a/htdocs/product/admin/stock_extrafields.php +++ b/htdocs/product/admin/stock_extrafields.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page -$langs->loadLangs(array('companies', 'admin', 'stock')); +$langs->loadLangs(array('companies', 'admin', 'stocks')); $extrafields = new ExtraFields($db); $form = new Form($db); From 490e85f4941b1eb71013a6b06c432a5b7cb1762b Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Mon, 3 Jun 2019 16:34:49 +0200 Subject: [PATCH 030/151] Fix PSR2 --- htdocs/core/lib/stock.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php index fc7701877bc..50a7611af82 100644 --- a/htdocs/core/lib/stock.lib.php +++ b/htdocs/core/lib/stock.lib.php @@ -111,4 +111,3 @@ function stock_admin_prepare_head() return $head; } - From 20448475527b115affe098811b5d79564157e733 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 10 Jun 2019 22:33:11 +0200 Subject: [PATCH 031/151] New : add file area at bottom of supplier invoices list --- htdocs/fourn/facture/list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index fe3deb6459b..aba34d52e1b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1133,7 +1133,6 @@ if ($resql) print "\n"; - /* $hidegeneratedfilelistifempty=1; if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; @@ -1145,8 +1144,7 @@ if ($resql) $genallowed=$user->rights->facture->lire; $delallowed=$user->rights->facture->creer; - print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); - */ + print $formfile->showdocuments('massfilesarea_supplier_invoice','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); } else { From 330842d67eebc30f56ebc7dc9ed00246ec0a19a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Jun 2019 13:14:44 +0200 Subject: [PATCH 032/151] Update list.php --- htdocs/comm/propal/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ee8dacde380..555e89e7a61 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -162,8 +162,8 @@ $arrayfields=array( 'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), 'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0), 'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), - 'p.total_ht_invoiced'=>array('label'=>$langs->trans("AmountInvoicedHT"), 'checked'=>0), - 'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0), + 'p.total_ht_invoiced'=>array('label'=>$langs->trans("AmountInvoicedHT"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT), + 'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1), 'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), From 1a1f3493c90d5297509af0bf592a51b43bf8d6c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 17 Jun 2019 14:03:57 +0200 Subject: [PATCH 033/151] NEW can specify hour start end for selectDate and step for minutes --- htdocs/core/class/html.form.class.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 63246fb0287..29f2dd6ed6a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5234,10 +5234,12 @@ class Form * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field. * @param datetime $adddateof Add a link "Date of invoice" using the following date. + * @param string $openinghours Specify hour strat and hour end for the select ex 8,20 + * @param int $stepminutes Specify step for minutes between 1 and 30 * @return string Html for selectDate * @see form_date(), select_month(), select_year(), select_dayofweek() */ - public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '') + public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1) { global $conf,$langs; @@ -5248,6 +5250,7 @@ class Form if ($m == '') $m=0; $emptydate=0; $emptyhours=0; + if ($stepminutes<=0 || $stepminutes>30) $stepminutes = 1; if ($empty == 1) { $emptydate=1; $emptyhours=1; } if ($empty == 2) { $emptydate=0; $emptyhours=1; } $orig_set_time=$set_time; @@ -5468,10 +5471,18 @@ class Form if ($h) { + $hourstart = 0; + $hourend = 24; + if ($openinghours != '') { + $openinghours = explode(',', $openinghours); + $hourstart = $openinghours[0]; + $hourend = $openinghours[1]; + if ($hourend<$hourstart) $hourend = $hourstart; + } // Show hour $retstring.=''; if ($emptyhours) $retstring.=''; - for ($hour = 0; $hour < 24; $hour++) + for ($hour = $hourstart; $hour < $hourend; $hour++) { if (strlen($hour) < 2) $hour = "0" . $hour; $retstring.=''; @@ -5485,7 +5496,7 @@ class Form // Show minutes $retstring.=''; if ($emptyhours) $retstring.=''; - for ($min = 0; $min < 60 ; $min++) + for ($min = 0; $min < 60 ; $min+=$stepminutes) { if (strlen($min) < 2) $min = "0" . $min; $retstring.=''; From aa92bfd1e0a42fea433c2668ebc44533b895d404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 17 Jun 2019 15:31:48 +0200 Subject: [PATCH 034/151] Update bom_card.php --- htdocs/bom/bom_card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index c2ed2ca6705..d788be5354a 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -173,7 +173,6 @@ if (empty($reshook)) $action = ''; } } - } From 27c928d9d9f5685c2b6da463ae8ba652f649ad9a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 17 Jun 2019 20:53:10 +0200 Subject: [PATCH 035/151] NEW list of measuring units API --- htdocs/api/class/api_setup.class.php | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 783ec6540e3..a38a7cd83c2 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2017 Regis Houssin * Copyright (C) 2017 Neil Orley * Copyright (C) 2018 Frédéric France + * Copyright (C) 2019 Thibault FOUCART * * * This program is free software; you can redistribute it and/or modify @@ -707,6 +708,66 @@ class Setup extends DolibarrApi return $list; } + /** + * Get the list of measuring units. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param int $active Payment term is active or not {@min 0} {@max 1} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" + * @return List of events types + * + * @url GET dictionary/units + * + * @throws RestException + */ + public function getListOfMeasuringUnits($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + { + $list = array(); + //TODO link with multicurrency module + $sql = "SELECT t.rowid, t.code, t.label,t.short_label, t.active, t.scale, t.unit_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_units as t"; + $sql.= " WHERE t.active = ".$active; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of measuring units: '.$this->db->lasterror()); + } + + return $list; + } + /** * Get the list of tickets categories. * From 820c420ae5221f0d96a19624a72828c28e7cdd45 Mon Sep 17 00:00:00 2001 From: ICstage Date: Tue, 18 Jun 2019 14:07:52 +0200 Subject: [PATCH 036/151] FIX Missing hooks --- htdocs/adherents/index.php | 15 ++++++++++++--- htdocs/comm/index.php | 9 +++++++++ htdocs/comm/mailing/index.php | 9 +++++++++ htdocs/comm/propal/index.php | 9 +++++++++ htdocs/commande/index.php | 8 ++++++++ htdocs/compta/charges/index.php | 12 +++++++++++- htdocs/compta/index.php | 7 ++++++- htdocs/contrat/index.php | 8 ++++++++ htdocs/don/index.php | 8 ++++++++ htdocs/expedition/index.php | 9 +++++++++ htdocs/expensereport/index.php | 11 ++++++++++- htdocs/fichinter/index.php | 11 +++++++++-- htdocs/fourn/commande/index.php | 15 ++++++++++++--- htdocs/hrm/index.php | 8 ++++++++ htdocs/mrp/index.php | 15 ++++++++++++--- htdocs/opensurvey/index.php | 12 +++++++++++- htdocs/product/index.php | 4 ++++ htdocs/product/stock/index.php | 9 +++++++++ htdocs/projet/activity/index.php | 9 +++++++++ htdocs/projet/index.php | 9 +++++++++ htdocs/reception/index.php | 16 ++++++++++++---- htdocs/societe/index.php | 11 ++++++++++- htdocs/supplier_proposal/index.php | 9 +++++++++ htdocs/ticket/index.php | 11 ++++++++++- htdocs/user/home.php | 5 +++++ 25 files changed, 228 insertions(+), 21 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 1d1232a9d58..481a8e8fffd 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -1,8 +1,9 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -29,6 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('membersindex')); + // Load translation files required by the page $langs->loadLangs(array("companies","members")); @@ -435,6 +441,9 @@ print "
"; print '
'; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardUsersGroups', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 651d2c54ec7..15e4e226587 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -37,6 +38,11 @@ if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn if (! $user->rights->societe->lire) accessforbidden(); +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('commercialindex')); + // Load translation files required by the page $langs->loadLangs(array("commercial", "propal")); @@ -897,6 +903,9 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardCommercials', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index c5d8bc47232..a835ca241a3 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2010 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -27,6 +28,11 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT .'/comm/mailing/class/mailing.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('mailingindex')); + // Load translation files required by the page $langs->loadLangs(array('commercial', 'orders')); @@ -207,6 +213,9 @@ if ($langs->file_exists("html/spam.html", 0)) { print '
'; } +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardEmailings', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index e69dbbc8b6c..309712ae76b 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2004 Rodolphe Quiedeville * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -27,6 +28,11 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('proposalindex')); + // Load translation files required by the page $langs->loadLangs(array('propal', 'companies')); @@ -540,6 +546,9 @@ if (! empty($conf->propal->enabled)) //print ''; print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardPropals', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index c0091b43af0..a0e87bf63a3 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2004 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -31,6 +32,11 @@ require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php'; if (!$user->rights->commande->lire) accessforbidden(); +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('ordersindex')); + // Load translation files required by the page $langs->loadLangs(array('orders', 'bills')); @@ -478,6 +484,8 @@ if (! empty($conf->commande->enabled)) print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardOrders', $parameters, $object); // Note that $action and $object may have been modified by hook // End of page llxFooter(); diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 33a06e09136..4b62a98b80b 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -3,8 +3,9 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2011-2016 Alexandre Spangaro - * Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -34,6 +35,12 @@ require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('specialexpensesindex')); + // Load translation files required by the page $langs->loadLangs(array('compta', 'bills')); @@ -568,6 +575,9 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardSpecialBills', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index c57b073b487..932d9ed758c 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -2,10 +2,11 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin - * Copyright (C) 2015-2016 Juanjo Menent + * Copyright (C) 2015-2016 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Marcos García + * Copyright (C) 2019 Nicolas ZABOURI * * 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,6 +64,7 @@ if ($user->societe_id > 0) $max=3; +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('invoiceindex')); /* @@ -1080,6 +1082,9 @@ if ($resql) print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardAccountancy', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 10c2e2915b9..3bf047c87c8 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -28,6 +29,11 @@ require "../main.inc.php"; require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"; require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('contractindex')); + // Load translation files required by the page $langs->loadLangs(array('products', 'companies', 'contracts')); @@ -609,6 +615,8 @@ else //print ''; print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardContracts', $parameters, $object); // Note that $action and $object may have been modified by hook llxFooter(); diff --git a/htdocs/don/index.php b/htdocs/don/index.php index d632f316a25..4af0f0d81b0 100644 --- a/htdocs/don/index.php +++ b/htdocs/don/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2002 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -26,6 +27,11 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('donationindex')); + $langs->load("donations"); // Security check @@ -238,6 +244,8 @@ else dol_print_error($db); print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardDonation', $parameters, $object); // Note that $action and $object may have been modified by hook llxFooter(); diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index bbb5ef58c36..61838cc321b 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2005 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -27,6 +28,11 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('sendingindex')); + // Load translation files required by the page $langs->loadLangs(array('orders', 'sendings')); @@ -291,6 +297,9 @@ else dol_print_error($db); print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardWarehouseSendings', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index f7d4e2a8405..461a7aec4fe 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -3,7 +3,8 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -30,6 +31,11 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('expensereportindex')); + // Load translation files required by the page $langs->loadLangs(array('companies', 'users', 'trips')); @@ -230,6 +236,9 @@ else dol_print_error($db); print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardExpenseReport', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index d240aadf42d..f97c99dc839 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -2,8 +2,8 @@ /* Copyright (C) 2003-2004 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015 Charlie Benke - + * Copyright (C) 2015 Charlie Benke + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -32,6 +32,11 @@ require_once DOL_DOCUMENT_ROOT .'/fichinter/class/fichinter.class.php'; if (!$user->rights->ficheinter->lire) accessforbidden(); +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('interventionindex')); + // Load translation files required by the page $langs->load("interventions"); @@ -356,6 +361,8 @@ if (! empty($conf->ficheinter->enabled)) print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardInterventions', $parameters, $object); // Note that $action and $object may have been modified by hook llxFooter(); diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 6c2b66bc7f3..e66054dc750 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Vinicius Nogueira + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Vinicius Nogueira + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -34,6 +35,11 @@ $orderid = GETPOST('orderid'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande'); +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('orderssuppliersindex')); + // Load translation files required by the page $langs->loadLangs(array("suppliers", "orders")); @@ -432,6 +438,9 @@ print "
"; print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardOrdersSuppliers', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 066a21ebad0..0dad608a5a5 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2015 Laurent Destailleur * Copyright (C) 2012-2014 Regis Houssin * Copyright (C) 2015-2016 Alexandre Spangaro + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -36,6 +37,9 @@ if ($conf->deplacement->enabled) require_once DOL_DOCUMENT_ROOT.'/compta/deplace if ($conf->expensereport->enabled) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; +$hookmanager = new HookManager($db); +$hookmanager->initHooks('hrmindex'); + // Load translation files required by the page $langs->loadLangs(array('users', 'holidays', 'trips', 'boxes')); @@ -392,6 +396,10 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire print ''; +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardHRM', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index c30d75b1d40..a587706dbb7 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -1,8 +1,9 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -27,6 +28,11 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('mrpindex')); + // Load translation files required by the page $langs->loadLangs(array("companies","mrp")); @@ -122,6 +128,9 @@ else print ''; +$parameters = array('type' => $type, 'user' => $user); +$reshook = $hookmanager->executeHooks('dashboardBOM', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/opensurvey/index.php b/htdocs/opensurvey/index.php index 413572ca4f6..0a9e3483348 100644 --- a/htdocs/opensurvey/index.php +++ b/htdocs/opensurvey/index.php @@ -1,6 +1,7 @@ - * + * Copyright (C) 2019 Nicolas ZABOURI + * * 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 * the Free Software Foundation; either version 3 of the License, or @@ -32,6 +33,12 @@ if (!$user->rights->opensurvey->read) accessforbidden(); * View */ + +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('opensurveyindex')); + // Load translation files required by the page $langs->load("opensurvey"); @@ -78,6 +85,9 @@ print ''; print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardOpenSurvey', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 950f4d47b5f..fe93c4b5e6e 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -6,6 +6,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2019 Pierre Ardoin * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -397,6 +398,9 @@ if (! empty($conf->global->MAIN_SHOW_PRODUCT_ACTIVITY_TRIM)) print ''; +$parameters = array('type' => $type, 'user' => $user); +$reshook = $hookmanager->executeHooks('dashboardProductsServices', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index a19025b5dd6..a0b4895b669 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2006 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -27,6 +28,11 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('stockindex')); + // Load translation files required by the page $langs->loadLangs(array('stocks', 'productbatch')); @@ -184,6 +190,9 @@ if ($resql) //print ''; print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardWarehouse', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index b3fb66116bf..2148ba576d8 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2010 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -39,6 +40,11 @@ if ($user->societe_id > 0) $socid=$user->societe_id; //$result = restrictedArea($user, 'projet', $projectid); if (!$user->rights->projet->lire) accessforbidden(); +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('activityindex')); + // Load translation files required by the page $langs->load("projects"); @@ -573,6 +579,9 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardActivities', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index fa77cb4b52c..da148c1eda6 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -30,6 +31,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('projectsindex')); + // Load translation files required by the page $langs->loadLangs(array('projects', 'companies')); @@ -319,6 +325,9 @@ if (! empty($conf->global->PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA)) print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardProjects', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/reception/index.php b/htdocs/reception/index.php index 3b0bb7a05e0..97e25ab39e5 100644 --- a/htdocs/reception/index.php +++ b/htdocs/reception/index.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2018 Quentin Vial-Gouteyron +/* Copyright (C) 2003-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2018 Quentin Vial-Gouteyron + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -28,6 +29,11 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('receptionindex')); + $langs->load("orders"); $langs->load("receptions"); @@ -292,6 +298,8 @@ else dol_print_error($db); print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardWarehouseReceptions', $parameters, $object); // Note that $action and $object may have been modified by hook llxFooter(); $db->close(); diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 2404c11861e..d6df59f4740 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -2,9 +2,10 @@ /* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2014 Charles-Fr Benke + * Copyright (C) 2014 Charles-Fr Benke * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -29,6 +30,11 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('thirdpartiesindex')); + $langs->load("companies"); $socid = GETPOST('socid', 'int'); @@ -366,6 +372,9 @@ else //print ''; print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardThirdparties', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index 5a2e6df2f29..d75d0c1647c 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2004 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -27,6 +28,11 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT .'/supplier_proposal/class/supplier_proposal.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('suppliersproposalsindex')); + // Load translation files required by the page $langs->loadLangs(array('supplier_proposal', 'companies')); @@ -375,6 +381,9 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardSupplierProposal', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 824b1f1833e..09b8a208c3c 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -1,5 +1,6 @@ +/* Copyright (C) - 2013-2016 Jean-François FERRY + * Copyright (C) - 2019 Nicolas ZABOURI * * 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 @@ -25,6 +26,11 @@ require_once DOL_DOCUMENT_ROOT . '/ticket/class/actions_ticket.class.php'; require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticketstats.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/dolgraph.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('ticketsindex')); + // Load translation files required by the page $langs->loadLangs(array('companies', 'other', 'ticket')); @@ -371,6 +377,9 @@ if ($result) { print ''; print '
'; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardTickets', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(''); $db->close(); diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 9a7d0ab94fd..bc766f4dc4b 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2018 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -286,6 +287,10 @@ if ($canreadperms) //print ''; print ''; +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardUsersGroups', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); From 492c3b5625f28f2fe117ed6c8041d9415a0eaac8 Mon Sep 17 00:00:00 2001 From: Nicolas ZABOURI Date: Tue, 18 Jun 2019 15:13:08 +0200 Subject: [PATCH 037/151] FIX hook --- htdocs/adherents/index.php | 2 +- htdocs/mrp/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 481a8e8fffd..3e26ae1ce3a 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -442,7 +442,7 @@ print ""; print ''; $parameters = array('user' => $user); -$reshook = $hookmanager->executeHooks('dashboardUsersGroups', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('dashboardMembers', $parameters, $object); // Note that $action and $object may have been modified by hook // End of page llxFooter(); diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index a587706dbb7..325017c4fb7 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -129,7 +129,7 @@ else print ''; $parameters = array('type' => $type, 'user' => $user); -$reshook = $hookmanager->executeHooks('dashboardBOM', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('dashboardMRP', $parameters, $object); // Note that $action and $object may have been modified by hook // End of page llxFooter(); From 181375ff958955a0bd55684d8e4cd97592811672 Mon Sep 17 00:00:00 2001 From: Nicolas ZABOURI Date: Tue, 18 Jun 2019 17:09:46 +0200 Subject: [PATCH 038/151] FIX travis space left --- htdocs/opensurvey/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/opensurvey/index.php b/htdocs/opensurvey/index.php index 0a9e3483348..6ed0f2148fa 100644 --- a/htdocs/opensurvey/index.php +++ b/htdocs/opensurvey/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2019 Nicolas ZABOURI - * + * * 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 * the Free Software Foundation; either version 3 of the License, or From c000d897d7f38096a9980fb1dd009712b8c8b3ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 17:42:45 +0200 Subject: [PATCH 039/151] Fix rendering of amount --- htdocs/compta/facture/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index d12fc90fd77..b6beba5e12e 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -959,11 +959,11 @@ if ($resql) $totalcreditnotes = $facturestatic->getSumCreditNotesUsed(); $totaldeposits = $facturestatic->getSumDepositsUsed(); $totalpay = $paiement + $totalcreditnotes + $totaldeposits; - $remaintopay = $facturestatic->total_ttc - $totalpay; + $remaintopay = price2num($facturestatic->total_ttc - $totalpay); if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { $remaincreditnote = $discount->getAvailableDiscounts($obj->fk_soc, '', 'rc.fk_facture_source='.$facturestatic->id); $remaintopay = -$remaincreditnote; - $totalpay = $facturestatic->total_ttc - $remaintopay; + $totalpay = price2num($facturestatic->total_ttc - $remaintopay); } print ' Date: Wed, 19 Jun 2019 09:12:01 +0200 Subject: [PATCH 040/151] FIX travis Public underscore in load_ldap_info --- htdocs/adherents/class/adherent.class.php | 4 +++- htdocs/contact/class/contact.class.php | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1856de6182f..cda3a461027 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2018-2019 Thibault FOUCART + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -2460,7 +2461,8 @@ class Adherent extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** * Initialise tableau info (tableau des attributs LDAP) * * @return array Tableau info des attributs diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 5c4df6ab3f9..ca58882b224 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015 Marcos García + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -520,6 +521,7 @@ class Contact extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Initialise tableau info (tableau des attributs LDAP) * From df8fff843cb7fb6beece1a36b2e47a7eaf1ea045 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 13:16:46 +0200 Subject: [PATCH 041/151] Standardize code --- htdocs/includes/odtphp/odf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 6b3a6400bc3..a5ce9e3ba68 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -745,7 +745,7 @@ IMG; private function _rrmdir($dir) { if ($handle = opendir($dir)) { - while (false !== ($file = readdir($handle))) { + while (($file = readdir($handle))!==false) { if ($file != '.' && $file != '..') { if (is_dir($dir . '/' . $file)) { $this->_rrmdir($dir . '/' . $file); From 8e8199cc0f963530735ada6a083c1470ec363889 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 13:17:02 +0200 Subject: [PATCH 042/151] Fix scrutinizer --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 132cce1e52b..69708e06516 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2374,7 +2374,7 @@ class Ticket extends CommonObject if (file_exists($dir_osencoded)) { $handle = opendir($dir_osencoded); if (is_resource($handle)) { - while (($file = readdir($handle)) != false) { + while (($file = readdir($handle)) !== false) { if (!utf8_check($file)) { $file = utf8_encode($file); } From c109eebe383f240b4340732d5457e26a3f9e0384 Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Wed, 19 Jun 2019 14:42:56 +0100 Subject: [PATCH 043/151] New:Show c_country elements in modulebuilder --- htdocs/core/class/ccountry.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index a97d992bf89..5e744fbdb73 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -47,8 +47,8 @@ class Ccountry // extends CommonObject */ public $errors = array(); - //var $element='ccountry'; //!< Id that identify managed objects - //var $table_element='ccountry'; //!< Name of table without prefix where object is stored + var $element='ccountry'; //!< Id that identify managed objects + var $table_element='c_country'; //!< Name of table without prefix where object is stored /** * @var int ID @@ -65,7 +65,8 @@ class Ccountry // extends CommonObject public $active; - + public $fields=array( + 'label' => array('type'=>'varchar(250)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>15, 'notnull'=>-1, 'showoncombobox'=>'1',)); /** From 2034faf280528cdd444502dca25b4743c05d17f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 15:48:04 +0200 Subject: [PATCH 044/151] Fix duplicate 'option_' in prefix --- htdocs/core/class/extrafields.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8e0cf0946dc..eeb653aec8a 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -972,7 +972,10 @@ class ExtraFields $out=''; - $keyprefix = $keyprefix.'options_'; // Because we work on extrafields + if (! preg_match('/options_$/', $keyprefix)) // Because we work on extrafields, we add 'options_' to prefix if not already added + { + $keyprefix = $keyprefix.'options_'; + } if (! empty($extrafieldsobjectkey)) { From 1079535894f73cedb822d4fea049efe4e571b50e Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Wed, 19 Jun 2019 17:49:31 +0100 Subject: [PATCH 045/151] Fix:modulebuilder output folder --- htdocs/modulebuilder/template/myobject_document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index 0f4df0012f4..12da4769cf7 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -81,8 +81,8 @@ $extralabels = $extrafields->fetch_name_optionals_label('myobject'); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:1] . "/myobject/" . dol_sanitizeFileName($object->id); -if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:1] . "/myobject/" . dol_sanitizeFileName($object->ref); +//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/myobject/" . dol_sanitizeFileName($object->id); +if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$conf->entity] . "/myobject/" . dol_sanitizeFileName($object->ref); /* From 47c2f6fac4be2b9a56854d0df42e4182622f1647 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 21:35:35 +0200 Subject: [PATCH 046/151] NEW Add column VAT rate in product list --- htdocs/product/list.php | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 7677e82e1b4..5e348c2fe70 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -56,6 +56,7 @@ $search_barcode=GETPOST("search_barcode", 'alpha'); $search_label=GETPOST("search_label", 'alpha'); $search_type = GETPOST("search_type", 'int'); $search_sale = GETPOST("search_sale", 'int'); +$search_vatrate=GETPOST("search_vatrate", 'alpha'); $search_categ = GETPOST("search_categ", 'int'); $search_tosell = GETPOST("search_tosell", 'int'); $search_tobuy = GETPOST("search_tobuy", 'int'); @@ -174,7 +175,8 @@ $arrayfields=array( 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))), 'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))), - 'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))), + 'p.tva_tx'=>array('label'=>$langs->trans("VATRate"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))), + 'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))), 'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), 'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), 'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), @@ -229,6 +231,7 @@ if (empty($reshook)) $search_categ=0; $search_tosell=""; $search_tobuy=""; + $search_vatrate=""; $search_tobatch=''; //$search_type=''; // There is 2 types of list: a list of product and a list of services. No list with both. So when we clear search criteria, we must keep the filter on type. @@ -276,7 +279,7 @@ else $texte = $langs->trans("ProductsAndServices"); } -$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; +$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity,'; $sql.= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql.= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; $sql.= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock,'; @@ -323,6 +326,7 @@ if ($search_label) $sql .= natural_search('p.label', $search_label); if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode); if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($search_tosell); if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($search_tobuy); +if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate); if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid; if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL"; @@ -341,7 +345,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; -$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; +$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,"; $sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql.= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,'; $sql.= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; @@ -421,6 +425,7 @@ if ($resql) if ($search_label) $param.="&search_label=".urlencode($search_label); if ($search_tosell != '') $param.="&search_tosell=".urlencode($search_tosell); if ($search_tobuy != '') $param.="&search_tobuy=".urlencode($search_tobuy); + if ($search_vatrate) $sql .= natural_search('p.tva_tx', $search_vatrate); if ($fourn_id > 0) $param.=($fourn_id?"&fourn_id=".$fourn_id:""); if ($seach_categ) $param.=($search_categ?"&search_categ=".urlencode($search_categ):""); if ($show_childproducts) $param.=($show_childproducts?"&search_show_childproducts=".urlencode($show_childproducts):""); @@ -613,6 +618,13 @@ if ($resql) print ' '; print ''; } + // Sell price + if (! empty($arrayfields['p.tva_tx']['checked'])) + { + print ''; + print ''; + print ''; + } // WAP if (! empty($arrayfields['p.pmp']['checked'])) { @@ -715,6 +727,9 @@ if ($resql) if (! empty($arrayfields['p.numbuyprice']['checked'])) { print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } + if (! empty($arrayfields['p.tva_tx']['checked'])) { + print_liste_field_titre($arrayfields['p.tva_tx']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); + } if (! empty($arrayfields['p.pmp']['checked'])) { print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } @@ -983,6 +998,15 @@ if ($resql) print ''; } + // Sell Tax Rate + if (! empty($arrayfields['p.tva_tx']['checked'])) + { + print ''; + print vatrate($obj->tva_tx,true); + print ''; + if (! $i) $totalarray['nbfield']++; + } + // WAP if (! empty($arrayfields['p.pmp']['checked'])) { From 68e9712f0c30e17b7c4a78bd593cb8a60ceaf33d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 22:05:38 +0200 Subject: [PATCH 047/151] Fix support domains with 3 levels --- htdocs/core/lib/geturl.lib.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 714bc26b7da..83e483b3e97 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -172,14 +172,21 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = * For example: https://www.abc.mydomain.com/dir/page.html return 'mydomain' * * @param string $url Full URL. - * @param int $mode 0=return 'mydomain', 1=return 'mydomain.com' + * @param int $mode 0=return 'mydomain', 1=return 'mydomain.com', 2=return 'abc.mydomain.com' * @return string Returns domaine name */ function getDomainFromURL($url, $mode = 0) { $tmpdomain = preg_replace('/^https?:\/\//i', '', $url); // Remove http(s):// $tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after domain - $tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)$/', '\1.\2', $tmpdomain); // Remove part www.abc before domain name + if ($mode == 2) + { + $tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)\.([^\.]+)$/', '\1.\2.\3', $tmpdomain); // Remove part 'www.' before 'abc.mydomain.com' + } + else + { + $tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)$/', '\1.\2', $tmpdomain); // Remove part 'www.abc.' before 'mydomain.com' + } if (empty($mode)) { $tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...) From b4e47d289b5bb183fcb845b236aa6615a62cc8ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 02:43:56 +0200 Subject: [PATCH 048/151] Code comment --- htdocs/user/class/user.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a151fdb5574..8e52ba3028b 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -520,8 +520,8 @@ class User extends CommonObject * Add a right to the user * * @param int $rid Id of permission to add or 0 to add several permissions - * @param string $allmodule Add all permissions of module $allmodule - * @param string $allperms Add all permissions of module $allmodule, subperms $allperms only + * @param string $allmodule Add all permissions of module $allmodule or 'allmodules' to include all modules. + * @param string $allperms Add all permissions of module $allmodule, subperms $allperms only or '' to include all permissions. * @param int $entity Entity to use * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int > 0 if OK, < 0 if KO From 2b0b7b0dab0603a99d9a379a0dcef814976a0ebe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 03:32:28 +0200 Subject: [PATCH 049/151] Update ccountry.class.php --- htdocs/core/class/ccountry.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 5e744fbdb73..ef89fbcd9b6 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -66,7 +66,8 @@ class Ccountry // extends CommonObject public $active; public $fields=array( - 'label' => array('type'=>'varchar(250)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>15, 'notnull'=>-1, 'showoncombobox'=>'1',)); + 'label' => array('type'=>'varchar(250)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>15, 'notnull'=>-1, 'showoncombobox'=>'1') + ); /** From d8c2007d920200b0ac057c03b1eb0c522f3ea263 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 03:53:33 +0200 Subject: [PATCH 050/151] Prepare v11 alpha --- htdocs/install/check.php | 3 +- .../install/mysql/migration/10.0.0-11.0.0.sql | 31 ++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 55331634aff..6075ad14702 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -451,7 +451,8 @@ else array('from'=>'6.0.0', 'to'=>'7.0.0'), array('from'=>'7.0.0', 'to'=>'8.0.0'), array('from'=>'8.0.0', 'to'=>'9.0.0'), - array('from'=>'9.0.0', 'to'=>'10.0.0') + array('from'=>'9.0.0', 'to'=>'10.0.0'), + array('from'=>'10.0.0', 'to'=>'11.0.0') ); $count=0; diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 9f758b6bc40..520007e453c 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -2,6 +2,30 @@ -- Be carefull to requests order. -- This file must be loaded by calling /install/index.php page -- when current version is 11.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. create table llx_entrepot_extrafields @@ -12,4 +36,9 @@ create table llx_entrepot_extrafields import_key varchar(14) -- import key ) ENGINE=innodb; -ALTER TABLE llx_entrepot_extrafields ADD INDEX idx_entrepot_extrafields (fk_object); \ No newline at end of file +ALTER TABLE llx_entrepot_extrafields ADD INDEX idx_entrepot_extrafields (fk_object); + + +ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1; +ALTER TABLE llx_c_shipment_mode DROP INDEX uk_c_shipment_mode; +ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code, entity); From 5f32b5e23e79664156f01c02500a97c30df6acd4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 03:54:11 +0200 Subject: [PATCH 051/151] Prepare v11 alpha --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 6f1a773b7c1..d3aafe94f26 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION', '10.0.0'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION', '11.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO', chr(128)); From 5fe91afdc29e0aed5e87a7456e4aef69c94f390b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 03:54:50 +0200 Subject: [PATCH 052/151] Update 9.0.0-10.0.0.sql --- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 4 ---- 1 file changed, 4 deletions(-) diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 43e12c6c05f..e5b925b0d83 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -107,10 +107,6 @@ ALTER TABLE llx_prelevement_facture_demande ADD COLUMN sourcetype varchar(32); ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_id varchar(128) NULL; ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_site varchar(128) NULL; -ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1; -ALTER TABLE llx_c_shipment_mode DROP INDEX uk_c_shipment_mode; -ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code, entity); - -- Fix if table exists ALTER TABLE llx_c_units DROP INDEX uk_c_units_code; ALTER TABLE llx_c_units ADD COLUMN scale integer; From 77a45b878b94d2b6223effe83da164a29d37e89a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 03:56:42 +0200 Subject: [PATCH 053/151] Fix migration --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 520007e453c..5f0d04040de 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -39,6 +39,7 @@ create table llx_entrepot_extrafields ALTER TABLE llx_entrepot_extrafields ADD INDEX idx_entrepot_extrafields (fk_object); -ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1; +ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1 NOT NULL; + ALTER TABLE llx_c_shipment_mode DROP INDEX uk_c_shipment_mode; ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code, entity); From d15a300f02e0feec85e411e83a882de42cdec564 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 04:10:58 +0200 Subject: [PATCH 054/151] Removed not used var --- htdocs/compta/facture/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 10de9581dfe..44be21898f8 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1295,7 +1295,6 @@ if (empty($reshook)) $TTotalByTva[$line->tva_tx] += $line->total_ttc ; } - $amount_to_diff = 0; foreach ($TTotalByTva as $tva => &$total) { $coef = $total / $srcobject->total_ttc; // Calc coef From e60020140d01d3a17b4ca467641c083c410854fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 04:11:10 +0200 Subject: [PATCH 055/151] Update societe.class.php --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 6419eb11420..44b38856b90 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3455,7 +3455,7 @@ class Societe extends CommonObject } else // For backward compatibility { - dol_syslog("Your country setup use an old syntax. Reedit it using setup area.", LOG_ERR); + dol_syslog("Your country setup use an old syntax. Reedit it using setup area.", LOG_WARNING); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; $country_code=getCountry($country_id, 2, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore $country_label=getCountry($country_id, 0, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore From 4f9aa4caac8689194a6206db77590fa5eb06b97a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 13:53:31 +0200 Subject: [PATCH 056/151] Fix phpcs --- htdocs/compta/facture/list.php | 1 + htdocs/fourn/facture/list.php | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 6c325c865a9..0a5efadd832 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1298,6 +1298,7 @@ if ($resql) $filedir=$diroutputmassaction; $genallowed=$user->rights->facture->lire; $delallowed=$user->rights->facture->creer; + $title = ''; print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 102481b6adb..f72261a0802 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1138,13 +1138,14 @@ if ($resql) // Show list of available documents $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; - $urlsource.=str_replace('&','&',$param); + $urlsource.=str_replace('&', '&', $param); $filedir=$diroutputmassaction; $genallowed=$user->rights->facture->lire; $delallowed=$user->rights->facture->creer; + $title = ''; - print $formfile->showdocuments('massfilesarea_supplier_invoice','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); + print $formfile->showdocuments('massfilesarea_supplier_invoice', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } else { From bb9b0d401e926ce1b066caa49680d692eeb39988 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 13:56:20 +0200 Subject: [PATCH 057/151] Fix phpcs --- htdocs/core/class/ccountry.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index ef89fbcd9b6..a551857ded4 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -47,8 +47,8 @@ class Ccountry // extends CommonObject */ public $errors = array(); - var $element='ccountry'; //!< Id that identify managed objects - var $table_element='c_country'; //!< Name of table without prefix where object is stored + public $element='ccountry'; //!< Id that identify managed objects + public $table_element='c_country'; //!< Name of table without prefix where object is stored /** * @var int ID From 6975e182331d76190fd58873094dfcd8f7b0015f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 13:59:04 +0200 Subject: [PATCH 058/151] Fix phpcs --- htdocs/core/lib/accounting.lib.php | 7 ++++--- htdocs/product/list.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index c50ee1be869..9619bee580f 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -28,10 +28,11 @@ /** * Check if a value is empty with some options * - * @param allow_false : setting this to true will make the function consider a boolean value of false as NOT empty. This parameter is false by default. - * @param allow_ws : setting this to true will make the function consider a string with nothing but white space as NOT empty. This parameter is false by default. - * @return array Bool * @author Michael - https://www.php.net/manual/fr/function.empty.php#90767 + * @param mixed $var Value to test + * @param int|null $allow_false Setting this to true will make the function consider a boolean value of false as NOT empty. This parameter is false by default. + * @param int|null $allow_ws Setting this to true will make the function consider a string with nothing but white space as NOT empty. This parameter is false by default. + * @return boolean True of False */ function is_empty($var, $allow_false = false, $allow_ws = false) { diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 5e348c2fe70..7d766452186 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1002,7 +1002,7 @@ if ($resql) if (! empty($arrayfields['p.tva_tx']['checked'])) { print ''; - print vatrate($obj->tva_tx,true); + print vatrate($obj->tva_tx, true); print ''; if (! $i) $totalarray['nbfield']++; } From 476df203a7dd06329a4c7b386a91702aca6ae3da Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 20 Jun 2019 13:59:08 +0200 Subject: [PATCH 059/151] Add global task declared progression --- htdocs/projet/tasks/list.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index b97710ba7b6..a6b8c583da2 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -773,7 +773,7 @@ while ($i < min($num, $limit)) } print ''; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalprogress_calculated']=$totalarray['nbfield']; + if (! $i) $totalarray['totalprogress_calculatedfield']=$totalarray['nbfield']; } // Declared progress if (! empty($arrayfields['t.progress']['checked'])) @@ -785,6 +785,8 @@ while ($i < min($num, $limit)) } print ''; if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalprogress_declaredfield']=$totalarray['nbfield']; + $totalarray['totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100; } // Time not billed if (! empty($arrayfields['t.tobill']['checked'])) @@ -883,6 +885,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''.convertSecondToTime($totalarray['totalplannedworkload'], $plannedworkloadoutputformat).''; elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''.convertSecondToTime($totalarray['totaldurationeffective'], $timespentoutputformat).''; elseif ($totalarray['totalprogress_calculatedfield'] == $i) print ''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').''; + elseif ($totalarray['totalprogress_declaredfield'] == $i) print ''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationdeclared'] / $totalarray['totalplannedworkload'], 2).' %' : '').''; elseif ($totalarray['totaltobillfield'] == $i) print ''.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).''; elseif ($totalarray['totalbilledfield'] == $i) print ''.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).''; else print ''; From b0229d1b9a2dd187bec0456bdc24d8b53a793a7d Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 20 Jun 2019 14:07:44 +0200 Subject: [PATCH 060/151] Global task declared progression on project task tab --- htdocs/core/lib/project.lib.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index efcfeca61dd..77ac518c384 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -371,12 +371,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $numlines=count($lines); // We declare counter as global because we want to edit them into recursive call - global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned,$total_projectlinesa_tobill,$total_projectlinesa_billed; + global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned,$total_projectlinesa_declared_if_planned,$total_projectlinesa_tobill,$total_projectlinesa_billed; if ($level == 0) { $total_projectlinesa_spent=0; $total_projectlinesa_planned=0; $total_projectlinesa_spent_if_planned=0; + $total_projectlinesa_declared_if_planned=0; $total_projectlinesa_tobill=0; $total_projectlinesa_billed=0; } @@ -624,6 +625,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $total_projectlinesa_spent += $lines[$i]->duration; $total_projectlinesa_planned += $lines[$i]->planned_workload; if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration; + if ($lines[$i]->planned_workload) $total_projectlinesa_declared_if_planned += $lines[$i]->planned_workload * $lines[$i]->progress / 100; } } else @@ -652,7 +654,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2).' %'; print ''; - print ''; + print ''; + if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2).' %'; + print ''; if ($showbilltime) { print ''; From b111636ed0fe4ff2062886ee69aaa83bd60a5ffe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 18:32:25 +0200 Subject: [PATCH 061/151] Fix trans --- htdocs/langs/en_US/stocks.lang | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index fd89d432360..d42f1a82243 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -66,10 +66,12 @@ RuleForStockManagementIncrease=Choose Rule for automatic stock increase (manual DeStockOnBill=Decrease real stocks on validation of customer invoice/credit note DeStockOnValidateOrder=Decrease real stocks on validation of sales order DeStockOnShipment=Decrease real stocks on shipping validation -DeStockOnShipmentOnClosing=Decrease real stocks on shipping classification closed +DeStockOnShipmentOnClosing=Decrease real stocks when shipping is set to closed ReStockOnBill=Increase real stocks on validation of vendor invoice/credit note ReStockOnValidateOrder=Increase real stocks on purchase order approval ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouse, after purchase order receipt of goods +StockOnReception=Increase real stocks on validation of reception +StockOnReceptionOnClosing=Increase real stocks when reception is set to closed OrderStatusNotReadyToDispatch=Order has not yet or no more a status that allows dispatching of products in stock warehouses. StockDiffPhysicTeoric=Explanation for difference between physical and virtual stock NoPredefinedProductToDispatch=No predefined products for this object. So no dispatching in stock is required. From b0c76f48e1c203d7c508701b33d87b456082e64c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Jun 2019 09:38:26 +0200 Subject: [PATCH 062/151] error management --- htdocs/product/stock/class/entrepot.class.php | 2 ++ test/phpunit/EntrepotTest.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 593b5f1bcea..e857166e392 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -346,6 +346,7 @@ class Entrepot extends CommonObject { $error++; $this->errors[] = $this->db->lasterror(); + dol_syslog(get_class($this)."::delete Error ".$this->db->lasterror(), LOG_ERR); } } @@ -358,6 +359,7 @@ class Entrepot extends CommonObject { $error++; $this->errors[] = $this->db->lasterror(); + dol_syslog(get_class($this)."::delete Error ".$this->db->lasterror(), LOG_ERR); } } diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php index 16555d88e39..a2c0e78ee96 100644 --- a/test/phpunit/EntrepotTest.php +++ b/test/phpunit/EntrepotTest.php @@ -238,7 +238,7 @@ class EntrepotTest extends PHPUnit_Framework_TestCase $result=$localobject->delete($user); print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, $localobject->errorsToString()); return $result; } From 6f35c53f3ab25247df5812b81b0b8a0dc1ec4281 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Jun 2019 09:44:05 +0200 Subject: [PATCH 063/151] Prepare v11 --- .travis.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 63e48a051f0..b710e17c773 100644 --- a/.travis.yml +++ b/.travis.yml @@ -164,12 +164,6 @@ before_script: echo echo "Set timezone" echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini - if [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then - # Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1, 7.2 and nightly! - echo - echo "Enabling Memcached for PHP <= 5.4" - echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini - fi phpenv rehash echo @@ -350,6 +344,9 @@ script: php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log + php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log + php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log + php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log # Enable modules not enabled into original dump php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $TRAVIS_BUILD_DIR/enablemodule.log echo $? From 7ffcd3603b68331a2b5aea9e5023716433d966ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Jun 2019 13:33:24 +0200 Subject: [PATCH 064/151] Add option DOC_SHOW_CUSTOMER_CODE Because we have a lot of information and the REF is better to retrieve/search an order and know the customer code, i added a hidden option to show this field. --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 0aada45f7f0..176675415c2 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1320,7 +1320,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date, "%d %b %Y", false, $outputlangs, true), '', 'R'); - if ($object->thirdparty->code_client) + if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && ! empty($object->thirdparty->code_client)) { $posy+=4; $pdf->SetXY($posx, $posy); From b6266953e97fbc395a12b285e5f5fd1f704f6742 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Jun 2019 19:58:28 +0200 Subject: [PATCH 065/151] FIX Management of vat info in stripe --- .../interface_80_modStripe_Stripe.class.php | 54 ++++++++++++++++--- htdocs/public/payment/newpayment.php | 21 +++++++- htdocs/stripe/class/stripe.class.php | 18 ++++++- 3 files changed, 82 insertions(+), 11 deletions(-) diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index f9d28a0b984..fb400ecb7be 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -147,7 +147,7 @@ class InterfaceStripe if ($customer) { $namecleaned = $object->name ? $object->name : null; - $vatcleaned = $object->tva_intra ? $object->tva_intra : null; + $vatcleaned = $object->tva_intra ? $object->tva_intra : null; // Example of valid numbers are 'FR12345678901' or 'FR12345678902' $desccleaned = $object->name_alias ? $object->name_alias : null; $taxexemptcleaned = $object->tva_assuj ? 'none' : 'exempt'; $langcleaned = $object->default_lang ? array(substr($object->default_lang, 0, 2)) : null; @@ -173,10 +173,10 @@ class InterfaceStripe if ($desccleaned != $customer->description) $changerequested++; if (($customer->tax_exempt == 'exempt' && ! $object->tva_assuj) || (! $customer->tax_exempt == 'exempt' && empty($object->tva_assuj))) $changerequested++; if (! isset($customer->tax_ids['data']) && ! is_null($vatcleaned)) $changerequested++; - elseif (isset($customer->tax_ids['data']) && is_null($vatcleaned)) $changerequested++; - elseif (isset($customer->tax_ids['data']) && ! is_null($vatcleaned)) + elseif (isset($customer->tax_ids['data'])) { $taxinfo = reset($customer->tax_ids['data']); + if (empty($taxinfo) && ! empty($vatcleaned)) $changerequested++; if (isset($taxinfo->value) && $vatcleaned != $taxinfo->value) $changerequested++; } @@ -190,10 +190,42 @@ class InterfaceStripe $customer->description = $desccleaned; $customer->preferred_locales = $langcleaned; $customer->tax_exempt = $taxexemptcleaned; - if (! empty($vatcleaned)) $customer->tax_ids = array('object'=>'list', 'data'=>array('value'=>$vatcleaned)); - else $customer->tax_ids = null; - $customer->save(); + try { + // Update Tax info on Stripe + if (! empty($conf->global->STRIPE_SAVE_TAX_IDS)) // We setup to save Tax info on Stripe side. Warning: This may result in error when saving customer + { + if (! empty($vatcleaned)) + { + $isineec=isInEEC($object); + if ($object->country_code && $isineec) + { + //$taxids = $customer->allTaxIds($customer->id); + $customer->createTaxId($customer->id, array('type'=>'eu_vat', 'value'=>$vatcleaned)); + } + } + else + { + $taxids = $customer->allTaxIds($customer->id); + if (is_array($taxids->data)) + { + foreach($taxids->data as $taxidobj) + { + $customer->deleteTaxId($customer->id, $taxidobj->id); + } + } + } + } + + // Update Customer on Stripe + $customer->save(); + } + catch(Exception $e) + { + //var_dump(\Stripe\Stripe::getApiVersion()); + $this->errors[] = $e->getMessage(); + $ok = -1; + } } } } @@ -206,7 +238,13 @@ class InterfaceStripe $customer = $stripe->customerStripe($object, $stripeacc, $servicestatus); if ($customer) { - $customer->delete(); + try { + $customer->delete(); + } + catch(Exception $e) + { + dol_syslog("Failed to delete Stripe customer ".$e->getMessage(), LOG_WARNING); + } } $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account"; @@ -242,7 +280,7 @@ class InterfaceStripe if ($card) { $card->metadata=array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])); try { - $card->save($dataforcard); + $card->save(); } catch(Exception $e) { diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 90646ef9b41..5d04b6335c7 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -430,6 +430,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) 'dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'dol_company' => $mysoc->name, // Usefull when using multicompany + 'dol_tax_num' => $taxinfo, 'ipaddress'=> getUserRemoteIP() ); @@ -501,24 +502,40 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) { $vatcleaned = $vatnumber ? $vatnumber : null; - $taxinfo = array('type'=>'vat'); + /*$taxinfo = array('type'=>'vat'); if ($vatcleaned) { $taxinfo["tax_id"] = $vatcleaned; } // We force data to "null" if not defined as expected by Stripe if (empty($vatcleaned)) $taxinfo=null; + */ dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_stripe'); + $customer = \Stripe\Customer::create(array( 'email' => $email, 'description' => ($email?'Anonymous customer for '.$email:'Anonymous customer'), 'metadata' => $metadata, - 'tax_info' => $taxinfo, 'source' => $stripeToken // source can be a token OR array('object'=>'card', 'exp_month'=>xx, 'exp_year'=>xxxx, 'number'=>xxxxxxx, 'cvc'=>xxx, 'name'=>'Cardholder's full name', zip ?) )); // Return $customer = array('id'=>'cus_XXXX', ...) + // Create the VAT record in Stripe + /* We don't know country of customer, so we can't create tax + if (! empty($conf->global->STRIPE_SAVE_TAX_IDS)) // We setup to save Tax info on Stripe side. Warning: This may result in error when saving customer + { + if (! empty($vatcleaned)) + { + $isineec=isInEEC($object); + if ($object->country_code && $isineec) + { + //$taxids = $customer->allTaxIds($customer->id); + $customer->createTaxId($customer->id, array('type'=>'eu_vat', 'value'=>$vatcleaned)); + } + } + }*/ + if (! empty($FULLTAG)) $metadata["FULLTAG"] = $FULLTAG; if (! empty($dol_id)) $metadata["dol_id"] = $dol_id; if (! empty($dol_type)) $metadata["dol_type"] = $dol_type; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 27346a15f5e..d8d0c656dab 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -192,6 +192,7 @@ class Stripe extends CommonObject $vatcleaned = $object->tva_intra ? $object->tva_intra : null; + /* $taxinfo = array('type'=>'vat'); if ($vatcleaned) { @@ -199,8 +200,8 @@ class Stripe extends CommonObject } // We force data to "null" if not defined as expected by Stripe if (empty($vatcleaned)) $taxinfo=null; - $dataforcustomer["tax_info"] = $taxinfo; + */ //$a = \Stripe\Stripe::getApiKey(); //var_dump($a);var_dump($key);exit; @@ -215,6 +216,21 @@ class Stripe extends CommonObject $customer = \Stripe\Customer::create($dataforcustomer, array("stripe_account" => $key)); } + // Create the VAT record in Stripe + if (! empty($conf->global->STRIPE_SAVE_TAX_IDS)) // We setup to save Tax info on Stripe side. Warning: This may result in error when saving customer + { + if (! empty($vatcleaned)) + { + $isineec=isInEEC($object); + if ($object->country_code && $isineec) + { + //$taxids = $customer->allTaxIds($customer->id); + $customer->createTaxId($customer->id, array('type'=>'eu_vat', 'value'=>$vatcleaned)); + } + } + } + + // Create customer in Dolibarr $sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_account (fk_soc, login, key_account, site, status, entity, date_creation, fk_user_creat)"; $sql .= " VALUES (".$object->id.", '', '".$this->db->escape($customer->id)."', 'stripe', " . $status . ", " . $conf->entity . ", '".$this->db->idate(dol_now())."', ".$user->id.")"; $resql = $this->db->query($sql); From 3afa4175dbed20ce889ea1b750771b276f1fe228 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Jun 2019 11:22:04 +0200 Subject: [PATCH 066/151] Update company.php --- htdocs/admin/company.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index f707f531f9d..9778a4aa610 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -86,7 +86,9 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s,'chaine', 0, '', $conf->entity); } - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity); + $db->begin(); + + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS",'nohtml'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN",'nohtml'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP",'alpha'),'chaine',0,'',$conf->entity); From e9a8eb19bb521dd84e8ae7fa2a82409da3067bf3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Jun 2019 11:24:21 +0200 Subject: [PATCH 067/151] Update company.php --- htdocs/admin/company.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 9778a4aa610..2728448f031 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -75,7 +75,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) activateModulesRequiredByCountry($mysoc->country_code); } - $tmparray=getState(GETPOST('state_id','int'),'all',$db,$langs,0); + $tmparray=getState(GETPOST('state_id','int'), 'all', $db, $langs, 0); if (! empty($tmparray['id'])) { $mysoc->state_id =$tmparray['id']; From a9222c602f2b4b0a29a4deb0e47fe5ef73696255 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:04:26 +0200 Subject: [PATCH 068/151] translation --- htdocs/core/modules/bom/mod_bom_advanced.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/bom/mod_bom_advanced.php b/htdocs/core/modules/bom/mod_bom_advanced.php index ba5c437f0a0..aa8eef7aa59 100644 --- a/htdocs/core/modules/bom/mod_bom_advanced.php +++ b/htdocs/core/modules/bom/mod_bom_advanced.php @@ -23,7 +23,7 @@ /** * \file htdocs/core/modules/bom/mod_bom_advanced.php * \ingroup bom - * \brief Fichier contenant la classe du modele de numerotation de reference de bom advanced + * \brief File containing class for numbering model of bom advanced */ require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php'; @@ -52,7 +52,7 @@ class mod_bom_advanced extends ModeleNumRefboms /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From 053b129f52909b0bb586666afc0bd4f8207a52a9 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:06:01 +0200 Subject: [PATCH 069/151] translation --- htdocs/core/modules/cheque/mod_chequereceipt_thyme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index 7ff3bc6f6cc..545222c8b03 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -46,7 +46,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From 592591ff69de3cfcf6b10b3981053ccdcf1d0b72 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:06:37 +0200 Subject: [PATCH 070/151] translation --- htdocs/core/modules/commande/mod_commande_saphir.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index 8c96c237a0f..892a279cbe8 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -52,7 +52,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From 3cc97ec351e4b6c806e8e9051bf0763dbb3c3bf1 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:07:02 +0200 Subject: [PATCH 071/151] translation --- htdocs/core/modules/expensereport/mod_expensereport_sand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expensereport/mod_expensereport_sand.php b/htdocs/core/modules/expensereport/mod_expensereport_sand.php index c0a5aa0a031..5217e2dc1c3 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_sand.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_sand.php @@ -55,7 +55,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From d75f4eb1c86386504bf565fe08b980ee36af8f04 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:07:46 +0200 Subject: [PATCH 072/151] translation --- htdocs/core/modules/facture/mod_facture_mars.php | 2 +- htdocs/core/modules/facture/mod_facture_mercure.php | 2 +- htdocs/core/modules/facture/mod_facture_terre.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 752a80669c5..4c9d249d6c8 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -62,7 +62,7 @@ class mod_facture_mars extends ModeleNumRefFactures } /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 8c921d982bf..992a90b9731 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -46,7 +46,7 @@ class mod_facture_mercure extends ModeleNumRefFactures /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index a4cc1762766..db9a3e2e046 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -72,7 +72,7 @@ class mod_facture_terre extends ModeleNumRefFactures } /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From 4d4b5abb7e09c972492fe363ad05e007fc50b946 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:08:08 +0200 Subject: [PATCH 073/151] translation --- htdocs/core/modules/fichinter/mod_arctic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index 1902ffc70af..1d33cb7fc83 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -57,7 +57,7 @@ class mod_arctic extends ModeleNumRefFicheinter /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From a8d50228dbe136088ac352047a63dda85fe63178 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:08:36 +0200 Subject: [PATCH 074/151] translation --- htdocs/core/modules/livraison/mod_livraison_jade.php | 2 +- htdocs/core/modules/livraison/mod_livraison_saphir.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php index 531ff26a354..5cae280f245 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/livraison/mod_livraison_jade.php @@ -61,7 +61,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/livraison/mod_livraison_saphir.php b/htdocs/core/modules/livraison/mod_livraison_saphir.php index f05900600c2..23af66b1913 100644 --- a/htdocs/core/modules/livraison/mod_livraison_saphir.php +++ b/htdocs/core/modules/livraison/mod_livraison_saphir.php @@ -56,7 +56,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From 5379d4085f04e8b09ff455a1bb190dc01fc9d5cd Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:08:57 +0200 Subject: [PATCH 075/151] translation --- htdocs/core/modules/payment/mod_payment_ant.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 21ad0d91b9e..a9cde1b86cb 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -55,7 +55,7 @@ class mod_payment_ant extends ModeleNumRefPayments /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From 26af2d8fe35d2eacb43eba6e5e2ac0b7c1e47ddf Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:09:28 +0200 Subject: [PATCH 076/151] translation --- htdocs/core/modules/project/mod_project_universal.php | 2 +- htdocs/core/modules/project/task/mod_task_universal.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index d9287109d6e..70394f92129 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -55,7 +55,7 @@ class mod_project_universal extends ModeleNumRefProjects /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index f08067541e8..760caaa366e 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -55,7 +55,7 @@ class mod_task_universal extends ModeleNumRefTask /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From 2d3b0b8f9ed9ffd67fc7b0daa04fe06f7aac9dd7 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:09:50 +0200 Subject: [PATCH 077/151] translation --- .../supplier_order/mod_commande_fournisseur_orchidee.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index 6154ba5e1d9..c816953a298 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -57,7 +57,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From 8de36dc7c16995602caa21d6e50b6180c9b22c42 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:10:09 +0200 Subject: [PATCH 078/151] translation --- .../modules/supplier_payment/mod_supplier_payment_brodator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php index e2407877a7b..d06a2ccfcf3 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php @@ -55,7 +55,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From 9d698c257cae577a8dd853ffab06b836e2fad07b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:10:32 +0200 Subject: [PATCH 079/151] translation --- htdocs/core/modules/ticket/mod_ticket_universal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/ticket/mod_ticket_universal.php b/htdocs/core/modules/ticket/mod_ticket_universal.php index 361ecdd0c9d..007e0b318cd 100644 --- a/htdocs/core/modules/ticket/mod_ticket_universal.php +++ b/htdocs/core/modules/ticket/mod_ticket_universal.php @@ -53,7 +53,7 @@ class mod_ticket_universal extends ModeleNumRefTicket public $name='Universal'; /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ From e877f108ac6f0ca858fc674e61033cd43eb229d5 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 22 Jun 2019 12:18:56 +0200 Subject: [PATCH 080/151] translation --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 1abc6c95e20..53cdd50b644 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -27,7 +27,7 @@ /** * \file htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php * \ingroup commande - * \brief Fichier de la classe permettant de generer les commandes au modele Eratosthène + * \brief File of the class allowing to generate the orders to the Eratosthene model */ require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php'; @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; /** - * Classe to generate PDF orders with template Eratosthene + * Class to generate PDF orders with template Eratosthene */ class pdf_eratosthene extends ModelePDFCommandes { From fdff737329f5ad9c2f95999cbc65b2e0fd3b3dcc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Jun 2019 14:33:04 +0200 Subject: [PATCH 081/151] Fix clean of database --- htdocs/install/repair.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 8403bd44321..fc9c63e4a40 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -452,17 +452,19 @@ if ($ok && GETPOST('standard', 'alpha')) if ($obj2 && $obj2->nb == 0) { // Module not found, so we canremove entry - $sqldelete = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def WHERE file = '".$obj->file."' AND entity = ".$obj->entity; + $sqldeletea = "DELETE FROM ".MAIN_DB_PREFIX."boxes WHERE entity = ".$obj->entity." AND box_id IN (SELECT rowid FROM ".MAIN_DB_PREFIX."boxes_def WHERE file = '".$obj->file."' AND entity = ".$obj->entity.")"; + $sqldeleteb = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def WHERE file = '".$obj->file."' AND entity = ".$obj->entity; if (GETPOST('standard', 'alpha') == 'confirmed') { - $db->query($sqldelete); + $db->query($sqldeletea); + $db->query($sqldeleteb); - print 'Constant '.$obj->file.' set in llx_boxes for entity '.$obj->entity.' but MAIN_MODULE_'.strtoupper($module).' not defined in entity '.$obj->entity.', we delete record'; + print 'Constant '.$obj->file.' set in boxes_def for entity '.$obj->entity.' but MAIN_MODULE_'.strtoupper($module).' not defined in entity '.$obj->entity.', we delete record'; } else { - print 'Constant '.$obj->file.' set in llx_boxes for entity '.$obj->entity.' but MAIN_MODULE_'.strtoupper($module).' not defined in entity '.$obj->entity.', we should delete record (not done, mode test)'; + print 'Constant '.$obj->file.' set in boxes_def for entity '.$obj->entity.' but MAIN_MODULE_'.strtoupper($module).' not defined in entity '.$obj->entity.', we should delete record (not done, mode test)'; } } else From eb20df8e64b953b495527e5bfe7ea247b0814dcd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Jun 2019 14:47:46 +0200 Subject: [PATCH 082/151] Fix debug save of state into setup --- htdocs/admin/company.php | 22 ++++++++++++++++---- htdocs/core/class/html.formcompany.class.php | 4 ++-- htdocs/societe/class/societe.class.php | 3 +-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index c05305b6393..588383021a0 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -83,7 +83,11 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) $mysoc->state_label=$tmparray['label']; $s=$mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label; - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s,'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s, 'chaine', 0, '', $conf->entity); + } + else + { + dolibarr_del_const($db, "MAIN_INFO_SOCIETE_STATE", $conf->entity); } $db->begin(); @@ -385,7 +389,13 @@ if ($action == 'edit' || $action == 'updateedit') print ''; - $formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_STATE, $mysoc->country_code, 'state_id'); + $state_id=0; + if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) + { + $tmp=explode(':',$conf->global->MAIN_INFO_SOCIETE_STATE); + $state_id=$tmp[0]; + } + $formcompany->select_departement($state_id, $mysoc->country_code, 'state_id'); print ''."\n"; @@ -774,8 +784,12 @@ else if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print ''.$langs->trans("Region-State").''; else print ''.$langs->trans("State").''; - if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) print getState($conf->global->MAIN_INFO_SOCIETE_STATE, $conf->global->MAIN_SHOW_STATE_CODE, 0, $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT); - else print ' '; + if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) + { + $tmp=explode(':',$conf->global->MAIN_INFO_SOCIETE_STATE); + $state_id=$tmp[0]; + print getState($state_id, $conf->global->MAIN_SHOW_STATE_CODE, 0, $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT); + } print ''; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index d1366cb8511..17643e2d69a 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -211,13 +211,13 @@ class FormCompany * The key of the list is the code (there can be several entries for a given code but in this case, the country field differs). * Thus the links with the departments are done on a department independently of its name. * - * @param string $selected Code state preselected (mus be state id) + * @param int $selected Code state preselected (mus be state id) * @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show * @param string $htmlname Id of department. If '', we want only the string with