From 64e91fa25b1ccfdb8ba510293fcf0582be0dec01 Mon Sep 17 00:00:00 2001 From: Cristian Torres Date: Wed, 27 Mar 2019 17:09:59 -0600 Subject: [PATCH 001/515] [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/515] 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 502b1e4d31bcffb9e1542bdbd4b8b2096b1f7de3 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 16 Apr 2019 16:16:37 +0200 Subject: [PATCH 003/515] add lang management to freetext --- htdocs/admin/bom.php | 50 ++-------- htdocs/admin/chequereceipts.php | 52 +---------- htdocs/admin/commande.php | 50 ++-------- htdocs/admin/contract.php | 51 +++-------- htdocs/admin/expedition.php | 57 ++++-------- htdocs/admin/expensereport.php | 52 ++++------- htdocs/admin/facture.php | 51 ++--------- htdocs/admin/fichinter.php | 48 +--------- htdocs/admin/holiday.php | 52 ++++------- htdocs/admin/livraison.php | 48 +--------- htdocs/admin/propal.php | 50 ++-------- htdocs/admin/supplier_invoice.php | 57 ++---------- htdocs/admin/supplier_order.php | 42 ++------- htdocs/admin/supplier_proposal.php | 51 ++--------- htdocs/core/actions_setfreetext.inc.php | 54 +++++++++++ htdocs/core/lib/pdf.lib.php | 5 + htdocs/core/tpl/admin_freetext.tpl.php | 116 ++++++++++++++++++++++++ 17 files changed, 303 insertions(+), 583 deletions(-) create mode 100644 htdocs/core/actions_setfreetext.inc.php create mode 100644 htdocs/core/tpl/admin_freetext.tpl.php diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index b7f1f0e6db9..f862f7e69e5 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -44,6 +44,7 @@ $type = 'bom'; */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; if ($action == 'updateMask') { @@ -167,23 +168,7 @@ elseif ($action == 'set_BOM_DRAFT_WATERMARK') } } -elseif ($action == 'set_BOM_FREE_TEXT') -{ - $freetext = GETPOST("BOM_FREE_TEXT", 'none'); // No alpha here, we want exact string - - $res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} elseif ($action=="setshippableiconinlist") { +elseif ($action=="setshippableiconinlist") { // Activate Set Shippable Icon In List $setshippableiconinlist = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SHIPPABLE_BOM_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity); @@ -490,35 +475,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print " \n"; print "\n"; - $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); - $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); - $htmltext = ''.$langs->trans("AvailableVariables").':
'; - foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; - $htmltext.='
'; - - print '
'; - print ''; - print ''; - print ''; - print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; - $variablename='BOM_FREE_TEXT'; - if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) - { - print ''; - } - else - { - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); - } - print ''; - print ''; - print "\n"; - print '
'; + // free text + $freetexttitle = $langs->trans("FreeLegalTextOnBOMs"); + $freetextvar = "BOM_FREE_TEXT"; + require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); //Use draft Watermark - print "
"; print ''; print ""; diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index e8e035f8b49..05c2d023364 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -44,6 +44,7 @@ $value = GETPOST('value', 'alpha'); if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipts_mint.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; /* * Actions @@ -72,23 +73,6 @@ if ($action == 'setmod') dolibarr_set_const($db, "CHEQUERECEIPTS_ADDON", $value, 'chaine', 0, '', $conf->entity); } -if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') -{ - $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT', 'none'); // No alpha here, we want exact string - - $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} /* * view @@ -237,10 +221,6 @@ print '
'; */ print load_fiche_titre($langs->trans("OtherOptions"), '', ''); -print ''; -print ''; -print ''; - print ''; print ''; print ''; @@ -248,37 +228,15 @@ print ''; print ''; print "\n"; -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; - -print '\n"; -print '
'.$langs->trans("Parameters").'  
'; -print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='BANK_CHEQUERECEIPT_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print '
'; -print ''; -print "
'; -print "
"; +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnChequeReceipts"); +$freetextvar = "BANK_CHEQUERECEIPT_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); print ''."\n"; dol_fiche_end(); -print '
'; - // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 455175220a8..b7e1e3e0f75 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -47,12 +47,12 @@ $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); $type = 'order'; - /* * Actions */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; if ($action == 'updateMask') { @@ -176,23 +176,8 @@ elseif ($action == 'set_COMMANDE_DRAFT_WATERMARK') } } -elseif ($action == 'set_ORDER_FREE_TEXT') +elseif ($action=="setshippableiconinlist") { - $freetext = GETPOST("ORDER_FREE_TEXT", 'none'); // No alpha here, we want exact string - - $res = dolibarr_set_const($db, "ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} elseif ($action=="setshippableiconinlist") { // Activate Set Shippable Icon In List $setshippableiconinlist = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity); @@ -532,35 +517,12 @@ print ''.$langs->trans("Value").''; print " \n"; print "\n"; -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; - -print '
'; -print ''; -print ''; -print ''; -print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='ORDER_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print ''; -print ''; -print "\n"; -print '
'; +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnOrders"); +$freetextvar = "ORDER_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); //Use draft Watermark - print "
"; print ''; print ""; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index bf02df80b5b..36236fc1b30 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -50,6 +50,7 @@ if (empty($conf->global->CONTRACT_ADDON)) */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; if ($action == 'updateMask') { @@ -157,13 +158,10 @@ elseif ($action == 'setmod') elseif ($action == 'set_other') { - $freetext= GETPOST('CONTRACT_FREE_TEXT', 'none'); // No alpha here, we want exact string - $res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - $draft= GETPOST('CONTRACT_DRAFT_WATERMARK', 'alpha'); - $res2 = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (! $res1 > 0 || ! $res2 > 0) $error++; + if (! $res > 0) $error++; if (! $error) { @@ -458,55 +456,36 @@ print "
"; * */ -print ''; -print ''; -print ''; - print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print ''; print ''; print ''; print ''; +print "\n"; print "\n"; -$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnContracts"); +$freetextvar = "CONTRACT_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); -print ''."\n"; +print ''; +print ''; +print ''; //Use draft Watermark - print ''."\n"; -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; -print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp'); -print '
'; -$variablename='CONTRACT_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print '
'; print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print '
'; print ''; +print ''; +print ''; print '
'; - -print '
'; -print ''; -print '
'; - print '
'; +print ''; + dol_fiche_end(); // End of page diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 04dcf3ddc36..9ac7b2aa61a 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -57,6 +57,7 @@ if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; if ($action == 'updateMask') { @@ -76,14 +77,6 @@ if ($action == 'updateMask') elseif ($action == 'set_param') { - $freetext=GETPOST('SHIPPING_FREE_TEXT', 'none'); // No alpha here, we want exact string - $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - if ($res <= 0) - { - $error++; - setEventMessages($langs->trans("Error"), null, 'errors'); - } - $draft=GETPOST('SHIPPING_DRAFT_WATERMARK', 'alpha'); $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); if ($res <= 0) @@ -466,47 +459,35 @@ print '
'; */ print load_fiche_titre($langs->trans("OtherOptions")); +print ''; +print ''; +print ''; +print ''; +print "\n"; +print "\n"; + +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnShippings"); +$freetextvar = "SHIPPING_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); + + print ''; print ''; print ''; -print "
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
"; -print ""; -print "\n"; -print ""; - -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; - -print '\n"; - print '\n"; -print '
".$langs->trans("Parameter")."
'; -print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='SHIPPING_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print "
'; print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; +print '
'; print ''; +print ''; +print ''; print "
'; - -print '
'; - print ''; +print ''; + // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index cac83ef8d8b..dfe35ee7b56 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -51,6 +51,7 @@ $type='expensereport'; */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; if ($action == 'updateMask') { @@ -166,13 +167,10 @@ elseif ($action == 'setoptions') { $db->begin(); - $freetext= GETPOST('EXPENSEREPORT_FREE_TEXT', 'none'); // No alpha here, we want exact string - $res1 = dolibarr_set_const($db, "EXPENSEREPORT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - $draft= GETPOST('EXPENSEREPORT_DRAFT_WATERMARK', 'alpha'); - $res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (! $res1 > 0 || ! $res2 > 0) $error++; + if (! $res > 0) $error++; if (! $error) { @@ -464,53 +462,37 @@ print '
'; * Other options */ -print '
'; -print ''; -print ''; - print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print ''; print ''; -print ''; +print ''; print ''; +print "\n"; print "\n"; -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnExpenseReports"); +$freetextvar = "EXPENSEREPORT_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); -print ''."\n"; + +print ''; +print ''; +print ''; //Use draft Watermark print ''."\n"; -print '
'.$langs->trans("Parameter").''.$langs->trans("Parameter").' 
'; -print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='EXPENSEREPORT_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print '
'; print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; +print '
'; +print ''; print '
'; - -print '
'; -print ''; -print '
'; - print '
'; +print ''; + dol_fiche_end(); // End of page diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 57a18afcbd3..c25d26f3e0b 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -50,6 +50,7 @@ $type='invoice'; */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; if ($action == 'updateMask') { @@ -195,24 +196,6 @@ elseif ($action == 'set_FACTURE_DRAFT_WATERMARK') setEventMessages($langs->trans("Error"), null, 'errors'); } } - -elseif ($action == 'set_INVOICE_FREE_TEXT') -{ - $freetext = GETPOST('INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string - - $res = dolibarr_set_const($db, "INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} elseif ($action == 'setforcedate') { $forcedate = GETPOST('forcedate', 'alpha'); @@ -759,34 +742,12 @@ print '\n"; print ''; -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; - -print '
'; -print ''; -print ''; -print ''; -print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='INVOICE_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print ''; -print ''; -print "\n"; -print '
'; - +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnInvoices"); +$freetextvar = "INVOICE_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); +//Use draft Watermark print '
'; print ''; print ''; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index a407edd3864..8dcfadf9a6c 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -51,6 +51,7 @@ $type='ficheinter'; */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; if ($action == 'updateMask') { @@ -156,23 +157,6 @@ elseif ($action == 'setmod') dolibarr_set_const($db, "FICHEINTER_ADDON", $value, 'chaine', 0, '', $conf->entity); } -elseif ($action == 'set_FICHINTER_FREE_TEXT') -{ - $freetext= GETPOST('FICHINTER_FREE_TEXT', 'none'); // No alpha here, we want exact string - $res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK') { $draft= GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha'); @@ -532,32 +516,10 @@ print ''.$langs->trans("Value").''; print " \n"; print "\n"; -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; - -print ''; -print ''; -print ''; -print ''; -print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='FICHINTER_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print ''; -print ''; -print "\n"; -print '
'; +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnInterventions"); +$freetextvar = "FICHINTER_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); //Use draft Watermark print "
"; diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index d67451812c6..ce6d390aa69 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -52,6 +52,7 @@ if (empty($conf->global->HOLIDAY_ADDON)) */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; if ($action == 'updateMask') { @@ -159,13 +160,10 @@ elseif ($action == 'setmod') elseif ($action == 'set_other') { - $freetext= GETPOST('HOLIDAY_FREE_TEXT', 'none'); // No alpha here, we want exact string - $res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - $draft= GETPOST('HOLIDAY_DRAFT_WATERMARK', 'alpha'); - $res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); - if (! $res1 > 0 || ! $res2 > 0) $error++; + if (! $res > 0) $error++; if (! $error) { @@ -464,54 +462,36 @@ print "
"; * Other options */ -print ''; -print ''; -print ''; - print load_fiche_titre($langs->trans("OtherOptions"), '', ''); + print ''; print ''; print ''; print ''; +print "\n"; print "\n"; -$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnHolidays"); +$freetextvar = "HOLIDAY_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); -print ''."\n"; +print ''; +print ''; +print ''; //Use draft Watermark - print ''."\n"; -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; -print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp'); -print '
'; -$variablename='HOLIDAY_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print '
'; print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print '
'; print ''; +print ''; +print ''; print '
'; - -print '
'; -print ''; -print '
'; - print '
'; + +print ''; } diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index d11d07c5f38..dde70bc5314 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -51,6 +51,7 @@ $type='delivery'; */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; if ($action == 'updateMask') { @@ -70,23 +71,6 @@ if ($action == 'updateMask') } } -if ($action == 'set_DELIVERY_FREE_TEXT') -{ - $free=GETPOST('DELIVERY_FREE_TEXT', 'none'); // No alpha here, we want exact string - $res=dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - if ($action == 'specimen') { $modele=GETPOST('module', 'alpha'); @@ -449,32 +433,10 @@ print ''.$langs->trans("Value").''; print ' '; print "\n"; -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; - -print '
'; -print ''; -print ''; -print ''; -print $form->textwithpicto($langs->trans("FreeLegalTextOnDeliveryReceipts"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='DELIVERY_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print ''; -print ''; -print "\n"; -print '
'; +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnDeliveryReceipts"); +$freetextvar = "DELIVERY_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); print ''; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index db41876b02c..50faa61d87a 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -50,6 +50,7 @@ $type='propal'; */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; $error=0; if ($action == 'updateMask') @@ -148,23 +149,6 @@ elseif ($action == 'set_PROPALE_DRAFT_WATERMARK') setEventMessages($langs->trans("Error"), null, 'errors'); } } -elseif ($action == 'set_PROPOSAL_FREE_TEXT') -{ - $freetext = GETPOST('PROPOSAL_FREE_TEXT', 'none'); // No alpha here, we want exact string - - $res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} elseif ($action == 'setdefaultduration') { $res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity); @@ -653,34 +637,12 @@ print "\n"; print ''; */ -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; - -print '
'; -print ''; -print ''; -print ''; -print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='PROPOSAL_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print ''; -print ''; -print "\n"; -print '
'; - +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnProposal"); +$freetextvar = "PROPOSAL_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); +//Use draft Watermark print "
"; print ''; print ""; diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 6d8936fbe71..fcc3906150f 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -55,6 +55,8 @@ $specimenthirdparty->initAsSpecimen(); * Actions */ +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; + if ($action == 'updateMask') { $maskconstinvoice=GETPOST('maskconstinvoice', 'alpha'); @@ -174,25 +176,6 @@ if ($action == 'addcat') $fourn->CreateCategory($user, $_POST["cat"]); } -if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT') -{ - $freetext = GETPOST('SUPPLIER_INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string - - $res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - - /* * View */ @@ -461,11 +444,6 @@ print '
'; /* * Other options */ - -print ''; -print ''; -print ''; - print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print ''; print ''; @@ -474,33 +452,10 @@ print ''; print ''; print "\n"; -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; - -print '\n"; - -print '
'.$langs->trans("Value").' 
'; -print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='SUPPLIER_INVOICE_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print '
'; -print ''; -print "

'; - -print '
'; - +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnInvoices"); +$freetextvar = "SUPPLIER_INVOICE_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); /* * Notifications diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index c414eca8158..95eca54074a 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -54,6 +54,8 @@ $specimenthirdparty->initAsSpecimen(); * Actions */ +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; + if ($action == 'updateMask') { $maskconstorder=GETPOST('maskconstorder', 'alpha'); @@ -168,17 +170,15 @@ elseif ($action == 'addcat') elseif ($action == 'set_SUPPLIER_ORDER_OTHER') { - $freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT', 'none'); // No alpha here, we want exact string $doubleapproval = GETPOST('SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED', 'alpha'); $doubleapproval = price2num($doubleapproval); - $res1 = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - $res2 = dolibarr_set_const($db, "SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED", $doubleapproval, 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED", $doubleapproval, 'chaine', 0, '', $conf->entity); // TODO We add/delete permission here until permission can have a condition on a global var include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php'; $newmodule=new modFournisseur($db); - + if ($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED) { // clear default rights array @@ -191,7 +191,7 @@ elseif ($action == 'set_SUPPLIER_ORDER_OTHER') $newmodule->rights[$r][3] = 0; $newmodule->rights[$r][4] = 'commande'; $newmodule->rights[$r][5] = 'approve2'; - + // Insert $newmodule->insert_permissions(1); } @@ -199,7 +199,7 @@ elseif ($action == 'set_SUPPLIER_ORDER_OTHER') { // Remove all rights with Permission1190 $newmodule->delete_permissions(); - + // Add all right without Permission1190 $newmodule->insert_permissions(1); } @@ -541,34 +541,12 @@ else } */ -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; - -print ''; -print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='SUPPLIER_ORDER_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print ''; -print ''; -print "\n"; - -print '
'; - print ''; - +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnOrders"); +$freetextvar = "SUPPLIER_ORDER_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); /* * Notifications diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index b757fb66673..551572891ba 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -48,6 +48,7 @@ $error=0; */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php'; if ($action == 'updateMask') { @@ -129,24 +130,6 @@ if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK') } } -if ($action == 'set_SUPPLIER_PROPOSAL_FREE_TEXT') -{ - $freetext = GETPOST('SUPPLIER_PROPOSAL_FREE_TEXT', 'none'); // No alpha here, we want exact string - - $res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL') { $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL", $value, 'chaine', 0, '', $conf->entity); @@ -495,34 +478,12 @@ print ''.$langs->trans("Value")."\n"; print " \n"; print ""; -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; -foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; -$htmltext.='
'; - -print '
'; -print ''; -print ''; -print ''; -print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename='SUPPLIER_PROPOSAL_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); - print $doleditor->Create(); -} -print ''; -print ''; -print "\n"; -print '
'; - +// free text +$freetexttitle = $langs->trans("FreeLegalTextOnSupplierProposal"); +$freetextvar = "SUPPLIER_PROPOSAL_FREE_TEXT"; +require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); +//Use draft Watermark print "
"; print ''; print ""; diff --git a/htdocs/core/actions_setfreetext.inc.php b/htdocs/core/actions_setfreetext.inc.php new file mode 100644 index 00000000000..7e76a3d5a6d --- /dev/null +++ b/htdocs/core/actions_setfreetext.inc.php @@ -0,0 +1,54 @@ + + * + * 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/actions_setmoduleoptions.inc.php + * \brief Code for actions on setting notes of object page + */ + + +// $action must be defined +// $arrayofparameters must be set for action 'update' +// $nomessageinupdate can be set to 1 +// $nomessageinsetmoduleoptions can be set to 1 +if ($action == 'set_freetext') +{ + $freetextvar = GETPOST("freetextvar", 'alpha'); + $freetext = GETPOST("freetext", 'none'); // No alpha here, we want exact string + $freetextlang = GETPOST('freetextlang', 'alpha'); + + if ( ! empty($conf->global->MAIN_MULTILANGS) && !empty($freetextlang) ) + { + $res = dolibarr_set_const($db, $freetextvar."_".$freetextlang, $freetext, 'chaine', 0, '', $conf->entity); + } + else + { + $res = dolibarr_set_const($db, $freetextvar, $freetext, 'chaine', 0, '', $conf->entity); + } + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} \ No newline at end of file diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 2d6e41abe59..2e8d286fc26 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -874,6 +874,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $dims=$pdf->getPageDimensions(); + if ( ! empty($conf->global->$paramfreetext."_".$outputlangs->defaultlang) ) + { + $paramfreetext .= "_".$outputlangs->defaultlang; + } + // Line of free text if (empty($hidefreetext) && ! empty($conf->global->$paramfreetext)) { diff --git a/htdocs/core/tpl/admin_freetext.tpl.php b/htdocs/core/tpl/admin_freetext.tpl.php new file mode 100644 index 00000000000..f80ce8b224e --- /dev/null +++ b/htdocs/core/tpl/admin_freetext.tpl.php @@ -0,0 +1,116 @@ + + * + * 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 . + * + */ + +/** + * The following vars must be defined: + * $freetexttitle + * $freetextvar + * $conf, $langs, $db + * The following vars may also be defined: + * $freetextlang + */ + +// Protection to avoid direct call of template +if (empty($conf) || ! is_object($conf)) +{ + print "Error, template page can't be called as URL"; + exit; +} + +$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + +print ''; +print ''; +print ''; +print ''; +print ''; + +$form=new Form($db); +print $form->textwithpicto($freetexttitle, $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; + +$freetextconfvar = $freetextvar; +if (! empty($conf->global->MAIN_MULTILANGS) ) +{ + $freetextlang = GETPOST('freetextlang', 'alpha'); + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + $formadmin=new FormAdmin($db); + print '
'.$langs->trans('Language').' '; + print $formadmin->select_language($freetextlang, 'freetextlang', 0, $freetextlang, 1); + print '
'; + + if (! empty($freetextlang)) + { + $freetextconfvar .= '_'.$freetextlang; + } +} + +if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) +{ + print ''; +} +else +{ + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor("freetext", $conf->global->$freetextconfvar, '', 80, 'dolibarr_notes'); + print $doleditor->Create(); +} +print ''; +print ''; +print "\n"; +print ''; + +if (! empty($conf->global->MAIN_MULTILANGS) ) +{ +?> + + Date: Tue, 16 Apr 2019 16:21:32 +0200 Subject: [PATCH 004/515] add freetextsubstitutionexclude parameter --- htdocs/admin/contract.php | 1 + htdocs/admin/holiday.php | 1 + htdocs/core/tpl/admin_freetext.tpl.php | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 36236fc1b30..74df1b6af31 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -467,6 +467,7 @@ print "\n"; // free text $freetexttitle = $langs->trans("FreeLegalTextOnContracts"); $freetextvar = "CONTRACT_FREE_TEXT"; +$freetextsubstitutionexclude = array('objectamount'); require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); print '
'; diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index ce6d390aa69..f81bf8fa4a4 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -474,6 +474,7 @@ print "\n"; // free text $freetexttitle = $langs->trans("FreeLegalTextOnHolidays"); $freetextvar = "HOLIDAY_FREE_TEXT"; +$freetextsubstitutionexclude = array('objectamount'); require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php'); print ''; diff --git a/htdocs/core/tpl/admin_freetext.tpl.php b/htdocs/core/tpl/admin_freetext.tpl.php index f80ce8b224e..98b83215e86 100644 --- a/htdocs/core/tpl/admin_freetext.tpl.php +++ b/htdocs/core/tpl/admin_freetext.tpl.php @@ -23,6 +23,7 @@ * $conf, $langs, $db * The following vars may also be defined: * $freetextlang + * $freetextsubstitutionexclude */ // Protection to avoid direct call of template @@ -32,7 +33,7 @@ if (empty($conf) || ! is_object($conf)) exit; } -$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2); +$substitutionarray=pdf_getSubstitutionArray($langs, $freetextsubstitutionexclude, null, 2); $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; From ce4b67ecaa2ecd15fdf33240867ada0f978cdf90 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 16 Apr 2019 16:45:43 +0200 Subject: [PATCH 005/515] fix pagefoot --- htdocs/core/lib/pdf.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 2e8d286fc26..d38d6d3f3ca 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -874,9 +874,10 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $dims=$pdf->getPageDimensions(); - if ( ! empty($conf->global->$paramfreetext."_".$outputlangs->defaultlang) ) + $paramfreetextlang = $paramfreetext."_".$outputlangs->defaultlang; + if ( ! empty($conf->global->$paramfreetextlang) ) { - $paramfreetext .= "_".$outputlangs->defaultlang; + $paramfreetext = $paramfreetextlang; } // Line of free text From f4cc1695f46ee3d8677c600c42ebf4e3e7d36faf Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 16 Apr 2019 17:22:33 +0200 Subject: [PATCH 006/515] fix when ckeditor is not enabled --- htdocs/core/tpl/admin_freetext.tpl.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/admin_freetext.tpl.php b/htdocs/core/tpl/admin_freetext.tpl.php index 98b83215e86..55269b0d6fc 100644 --- a/htdocs/core/tpl/admin_freetext.tpl.php +++ b/htdocs/core/tpl/admin_freetext.tpl.php @@ -64,7 +64,7 @@ if (! empty($conf->global->MAIN_MULTILANGS) ) } } -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) +if (empty($conf->modFckeditor->enabled) || empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } @@ -97,10 +97,10 @@ if (! empty($conf->global->MAIN_MULTILANGS) ) $('#freetextlang').change(function() { global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) + if (empty($conf->modFckeditor->enabled) || empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { ?> - $('#freetext').html(freetext[$(this).val()]); + $('textarea[name=freetext]').val(freetext[$(this).val()]); Date: Tue, 16 Apr 2019 17:30:57 +0200 Subject: [PATCH 007/515] fix javascript --- htdocs/core/tpl/admin_freetext.tpl.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/admin_freetext.tpl.php b/htdocs/core/tpl/admin_freetext.tpl.php index 55269b0d6fc..d3b61ebf776 100644 --- a/htdocs/core/tpl/admin_freetext.tpl.php +++ b/htdocs/core/tpl/admin_freetext.tpl.php @@ -64,7 +64,7 @@ if (! empty($conf->global->MAIN_MULTILANGS) ) } } -if (empty($conf->modFckeditor->enabled) || empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) +if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } @@ -83,6 +83,8 @@ if (! empty($conf->global->MAIN_MULTILANGS) ) { ?> Date: Tue, 16 Apr 2019 17:36:42 +0200 Subject: [PATCH 008/515] fix javascript --- htdocs/core/tpl/admin_freetext.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/admin_freetext.tpl.php b/htdocs/core/tpl/admin_freetext.tpl.php index d3b61ebf776..37d014be7d9 100644 --- a/htdocs/core/tpl/admin_freetext.tpl.php +++ b/htdocs/core/tpl/admin_freetext.tpl.php @@ -64,7 +64,7 @@ if (! empty($conf->global->MAIN_MULTILANGS) ) } } -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) +if (empty($conf->fckeditor->enabled) || empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } @@ -99,7 +99,7 @@ if (! empty($conf->global->MAIN_MULTILANGS) ) $('#freetextlang').change(function() { global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) + if (empty($conf->fckeditor->enabled) || empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { ?> $('textarea[name=freetext]').val(freetext[$(this).val()]); From 660a1cea1d8ddca131114ec2c7c975ec2bb66db2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 17 Apr 2019 07:26:39 +0200 Subject: [PATCH 009/515] 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 010/515] 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 79fc351cbdf204807c01e065cf5fe4e064f1a107 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 17 Apr 2019 09:26:45 +0200 Subject: [PATCH 011/515] credentials --- htdocs/core/actions_setfreetext.inc.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/core/actions_setfreetext.inc.php b/htdocs/core/actions_setfreetext.inc.php index 7e76a3d5a6d..deb6efd9f86 100644 --- a/htdocs/core/actions_setfreetext.inc.php +++ b/htdocs/core/actions_setfreetext.inc.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2019 Christophe Battarel * * 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 @@ -23,9 +23,7 @@ // $action must be defined -// $arrayofparameters must be set for action 'update' -// $nomessageinupdate can be set to 1 -// $nomessageinsetmoduleoptions can be set to 1 + if ($action == 'set_freetext') { $freetextvar = GETPOST("freetextvar", 'alpha'); From 0b5cb9770f68081abad703961db11f903c6ce58a Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 18 Apr 2019 09:59:39 +0200 Subject: [PATCH 012/515] use dol_escapa_js --- htdocs/core/tpl/admin_freetext.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_freetext.tpl.php b/htdocs/core/tpl/admin_freetext.tpl.php index 37d014be7d9..99c4f62a209 100644 --- a/htdocs/core/tpl/admin_freetext.tpl.php +++ b/htdocs/core/tpl/admin_freetext.tpl.php @@ -93,7 +93,7 @@ if (! empty($conf->global->MAIN_MULTILANGS) ) foreach ($langs_available as $key => $value) { $freetextlangvar = $freetextvar."_".$key; - print 'freetext["'.$key.'"] = "'.$conf->global->$freetextlangvar.'";'; + print 'freetext["'.$key.'"] = "'.dol_escape_js($conf->global->$freetextlangvar,2).'";'; } ?> $('#freetextlang').change(function() From 01ea4c28cff6efe403c310ad5718fb03f70965c7 Mon Sep 17 00:00:00 2001 From: Joa Date: Fri, 3 May 2019 11:02:37 +0200 Subject: [PATCH 013/515] 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 014/515] 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 015/515] 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 016/515] 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 017/515] 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 018/515] 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 019/515] 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 020/515] 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 021/515] 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 022/515] 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 023/515] 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 024/515] 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 025/515] 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 026/515] 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 027/515] 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 028/515] 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 029/515] 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 030/515] 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 031/515] 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 032/515] 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 033/515] 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 034/515] 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 69e4420772841af91074503b3c6b6d31af9b79b7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 May 2019 11:53:36 +0200 Subject: [PATCH 035/515] FIX missing "dropdown-icon" replacement --- htdocs/main.inc.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b0d34db43eb..6563e60e239 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1738,7 +1738,7 @@ function top_menu_user(User $user, Translate $langs) $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); $userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1); } - else{ + else { $nophoto='/public/theme/common/user_anonymous.png'; if ($user->gender == 'man') $nophoto='/public/theme/common/user_man.png'; if ($user->gender == 'woman') $nophoto='/public/theme/common/user_woman.png'; @@ -1752,7 +1752,7 @@ function top_menu_user(User $user, Translate $langs) $dropdownBody.= '
'; // login infos - if (!empty($user->admin)) { + if (! empty($user->admin)) { $dropdownBody.= '
' . $langs->trans("Administrator").': '.yn($user->admin); } if (! empty($user->socid)) // Add thirdparty for external users @@ -1805,7 +1805,7 @@ function top_menu_user(User $user, Translate $langs) $profilName = $user->getFullName($langs).' ('.$user->login.')'; - if($user->admin){ + if (! empty($user->admin)) { $profilName = ' '.$profilName; } @@ -1851,6 +1851,8 @@ function top_menu_user(User $user, Translate $langs) if (!$(event.target).closest("#topmenu-login-dropdown").length) { // Hide the menus. $("#topmenu-login-dropdown").removeClass("open"); + $("#dropdown-icon-down").show(); // use show/hide instead toggle for avoid conflict + $("#dropdown-icon-up").hide(); // use show/hide instead toggle for avoid conflict } }); From 45fabede280fcf2ede6519b6be6c751a182740bf Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 26 May 2019 16:44:17 +0200 Subject: [PATCH 036/515] 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 43ada3fcd44b35bdbf8771ec409146848bd158b7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 3 Jun 2019 09:36:00 +0200 Subject: [PATCH 037/515] FIX better method to check if pdf is protected/encrypted --- htdocs/core/lib/pdf.lib.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 14c0435b4ad..1932fca31a2 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -175,18 +175,29 @@ function pdf_getInstance($format = '', $metric = 'mm', $pagetype = 'P') /** * Return if pdf file is protected/encrypted * - * @param TCPDF $pdf PDF initialized object * @param string $pathoffile Path of file * @return boolean True or false */ -function pdf_getEncryption(&$pdf, $pathoffile) +function pdf_getEncryption($pathoffile) { + require_once TCPDF_PATH.'tcpdf_parser.php'; + $isencrypted = false; - $pdfparser = $pdf->_getPdfParser($pathoffile); - $data = $pdfparser->getParsedData(); - if (isset($data[0]['trailer'][1]['/Encrypt'])) { - $isencrypted = true; + $content = file_get_contents($pathoffile); + + ob_start(); + @($parser = new \TCPDF_PARSER(ltrim($content))); + list($xref, $data) = $parser->getParsedData(); + unset($parser); + ob_end_clean(); + + if (isset($xref['trailer']['encrypt'])) { + $isencrypted = true; // Secured pdf file are currently not supported + } + + if (empty($data)) { + $isencrypted = true; // Object list not found. Possible secured file } return $isencrypted; From 439eafb6377780f9347aa4fabd185949621c73a6 Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Mon, 3 Jun 2019 15:44:17 +0200 Subject: [PATCH 038/515] 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 039/515] 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 040/515] 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 041/515] 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 042/515] 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 8afffc87627f1236d1355080c835a1dfc840dd76 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 14 Jun 2019 18:28:01 +0200 Subject: [PATCH 043/515] FIX: #11335 --- htdocs/fourn/facture/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 3956684d9b2..bca9cb8ad4e 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2019 Juanjo Menent * Copyright (C) 2013-2015 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2016 Marcos García @@ -831,6 +831,8 @@ if (empty($reshook)) // Auto calculation of date due if not filled by user if(empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement(); + $object->fetch_thirdparty(); + // If creation from another object of another module if (! $error && $_POST['origin'] && $_POST['originid']) { From a73ae49c4d623b3e9aabb31230187c4b5d264b04 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 14 Jun 2019 18:56:30 +0200 Subject: [PATCH 044/515] FIX: #11296 --- htdocs/projet/class/project.class.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 549865c63cd..5abf7e76d33 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2017 Marcos García * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2019 Juanjo Menent * * 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 @@ -695,6 +696,27 @@ class Project extends CommonObject $ret = $this->deleteTasks($user); if ($ret < 0) $error++; + + // Delete all child tables + if (! $error) { + $elements = array('categorie_project'); // elements to delete. TODO Make goodway to delete + foreach($elements as $table) + { + if (! $error) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$table; + $sql.= " WHERE fk_project = ".$this->id; + + $result = $this->db->query($sql); + if (! $result) { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + } + } + + + // Delete project if (! $error) { From dd5e42e3253b22d69a0c465e101a97e6f0871dc7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Jun 2019 22:17:04 +0200 Subject: [PATCH 045/515] FIX #11325 FIX #5249 --- htdocs/projet/tasks/time.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index f3da816fabd..766c2b38e2d 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -467,7 +467,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $object->project = clone $projectstatic; } - $userWrite = $projectstatic->restrictedProjectArea($user, 'write'); + $userRead = $projectstatic->restrictedProjectArea($user, 'read'); $linktocreatetime = ''; if ($projectstatic->id > 0) @@ -582,9 +582,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $linktocreatetimeBtnStatus = 0; $linktocreatetimeUrl = ''; $linktocreatetimeHelpText = ''; - if ($user->rights->projet->all->creer || $user->rights->projet->creer) + if ($user->rights->projet->all->lire || $user->rights->projet->lire) // To enter time, read permission is enough { - if ($projectstatic->public || $userWrite > 0) + if ($projectstatic->public || $userRead > 0) { $linktocreatetimeBtnStatus = 1; @@ -1017,7 +1017,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Duration - Time spent print ''; - print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text'); + $durationtouse = ($_POST['timespent_duration']?$_POST['timespent_duration']:''); + if (GETPOSTISSET('timespent_durationhour') || GETPOSTISSET('timespent_durationmin')) + { + $durationtouse = (GETPOST('timespent_durationhour') * 3600 + GETPOST('timespent_durationmin') * 60); + } + print $form->select_duration('timespent_duration', $durationtouse, 0, 'text'); print ''; // Progress declared From c0a30d1ff5484471a9bb9aa8ab4f6c1dad0472c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Jun 2019 22:17:04 +0200 Subject: [PATCH 046/515] FIX #11325 FIX #5249 Conflicts: htdocs/projet/tasks/time.php --- htdocs/projet/tasks/time.php | 61 +++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 48167edcc1d..e69f4fcd899 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -317,7 +317,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $object->project = clone $projectstatic; } - $userWrite = $projectstatic->restrictedProjectArea($user,'write'); + $userRead = $projectstatic->restrictedProjectArea($user, 'read'); + $linktocreatetime = ''; if ($projectstatic->id > 0) { @@ -427,33 +428,30 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; // Link to create time - //if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) - //{ - if ($user->rights->projet->all->creer || $user->rights->projet->creer) - { - if ($projectstatic->public || $userWrite > 0) - { - if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project - { - $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; - } - else // We are on tab 'Time Spent' of task - { - $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; - } - } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - //} + if ($user->rights->projet->all->lire || $user->rights->projet->lire)) // To enter time, read permission is enough + { + if ($projectstatic->public || $userRead > 0) + { + if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project + { + $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); + $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + } + else // We are on tab 'Time Spent' of task + { + $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); + $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + } + } + else + { + $linktocreatetime = ''.$langs->trans('AddTime').''; + } + } + else + { + $linktocreatetime = ''.$langs->trans('AddTime').''; + } } } @@ -803,7 +801,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Duration - Time spent print ''; - print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text'); + $durationtouse = ($_POST['timespent_duration']?$_POST['timespent_duration']:''); + if (GETPOSTISSET('timespent_durationhour') || GETPOSTISSET('timespent_durationmin')) + { + $durationtouse = (GETPOST('timespent_durationhour') * 3600 + GETPOST('timespent_durationmin') * 60); + } + print $form->select_duration('timespent_duration', $durationtouse, 0, 'text'); print ''; // Progress declared From 157526205d267c0d73aaefb525e97f45b4e0a9aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Jun 2019 23:00:40 +0200 Subject: [PATCH 047/515] Fix css --- htdocs/projet/tasks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index ccc8a0548c8..b05b27b5e90 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -667,7 +667,7 @@ elseif ($id > 0 || ! empty($ref)) print ''; $title=$langs->trans("ListOfTasks"); - $linktotasks = dolGetButtonTitle($langs->trans('GoToGanttView'), '', 'fa fa-calendar-minus-o', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1'); + $linktotasks = dolGetButtonTitle($langs->trans('GoToGanttView'), '', 'fa fa-calendar-minus-o paddingleft', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1'); //print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1); print load_fiche_titre($title, $linktotasks.'   '.$linktocreatetask, 'title_generic.png'); From 3afd4e15ad135b74b781a0170d79547fde4208da Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 17 Jun 2019 07:09:19 +0200 Subject: [PATCH 048/515] FIX try to remove ob_* functions --- htdocs/core/lib/pdf.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 1932fca31a2..56ca215e118 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -186,11 +186,11 @@ function pdf_getEncryption($pathoffile) $content = file_get_contents($pathoffile); - ob_start(); + //ob_start(); @($parser = new \TCPDF_PARSER(ltrim($content))); list($xref, $data) = $parser->getParsedData(); unset($parser); - ob_end_clean(); + //ob_end_clean(); if (isset($xref['trailer']['encrypt'])) { $isencrypted = true; // Secured pdf file are currently not supported From 8330078de18ddd00c322398e94c5bf560161f5b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Jun 2019 12:33:09 +0200 Subject: [PATCH 049/515] Fix default value --- htdocs/core/class/html.formcompany.class.php | 4 ++-- htdocs/societe/card.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index d2fb93000a9..d1366cb8511 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -908,7 +908,7 @@ class FormCompany $out = ''; - } - } - $object = new stdClass(); - // Other attributes - $parameters=array('objectsrc' => null, 'colspan' => ' colspan="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'); - } - }*/ +// Export is for current company only ! if (! empty($conf->multicompany->enabled) && is_object($mc)) { - print '   -   '.$langs->trans("Entity").' : '; + print '('.$langs->trans("Entity").' : '; $mc->dao->getEntities(); $mc->dao->fetch($conf->entity); print $mc->dao->label; - print "
\n"; + print ")
\n"; } print ''."\n"; @@ -376,10 +356,10 @@ if (!empty($date_start) && !empty($date_stop)) print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; - print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, 'class="nowrap"', $sortfield, $sortorder); print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -402,12 +382,10 @@ if (!empty($date_start) && !empty($date_stop)) // Balance calculation $balance = 0; foreach($TData as &$data1) { - if ($data1['item']!='Invoice'&& $data1['item']!='Donation' ){ + if ($data1['item']!='Invoice' && $data1['item']!='Donation') + { $data1['amount']=-$data1['amount']; } - if ($data1['amount']>0){ - }else{ - } $balance += $data1['amount']; $data1['balance'] = $balance; } @@ -419,14 +397,19 @@ if (!empty($date_start) && !empty($date_stop)) //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; print ''; - print "\n"; print ''; print ''; // File link - print '\n"; + print '\n"; print ''; print '\n"; diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 3a4ec85ec58..c7b2c8a69a7 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -281,6 +281,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__); -- Balance insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); + -- Export accounting documents + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/compta-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 17, __ENTITY__); -- Reports insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'MenuReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__); From 08d5ca4ddbc47fcbcddf94a471657dda1e81cb9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Jun 2019 17:53:43 +0200 Subject: [PATCH 058/515] Debug page to export accounting documents --- htdocs/admin/delais.php | 1 - htdocs/admin/mails_emailing.php | 3 +- htdocs/admin/menus/edit.php | 1 - htdocs/admin/sms.php | 2 +- htdocs/cashdesk/css/style.css | 2 +- ...{compta-files.php => accounting-files.php} | 292 ++++++++++-------- htdocs/core/menus/standard/eldy.lib.php | 8 +- htdocs/expensereport/list.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/holiday/card.php | 5 +- htdocs/holiday/list.php | 3 +- .../modulebuilder/template/myobject_card.php | 1 + htdocs/opensurvey/results.php | 2 +- htdocs/opensurvey/wizard/choix_date.php | 10 +- htdocs/opensurvey/wizard/create_survey.php | 2 +- htdocs/product/admin/product_tools.php | 3 +- htdocs/theme/eldy/btn.inc.php | 2 +- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 4 +- 19 files changed, 188 insertions(+), 159 deletions(-) rename htdocs/compta/{compta-files.php => accounting-files.php} (60%) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 1d05d5e0afe..6b46468b916 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -418,7 +418,6 @@ if($action == 'edit') { print '
'; } else { - // Boutons d'action print '
'; } diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 1e54fdea3dd..12076a00579 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -493,7 +493,8 @@ else } - // Boutons actions + // Buttons for actions + print '
'; print ''.$langs->trans("Modify").''; diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index b4f5fbd3355..cf42f294d03 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -415,7 +415,6 @@ if ($action == 'create') dol_fiche_end(); - // Boutons print '
'; print ''; print '     '; diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 2fb1e5a8a29..d6f2ee170d8 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -243,7 +243,7 @@ else print '
'.$langs->trans("Type").''.$langs->trans("Ref").''.$langs->trans("Link").''.$langs->trans("Document").''.$langs->trans("Paid").''.$langs->trans("Debit").''.$langs->trans("Credit").'
"; + print ""; print dol_print_date($data['date'], 'day'); print "'.$langs->trans($data['item']).''.$data['ref'].'".$data['name']."'; + if ($data['link']) + { + print ''.($data['name'] ? $data['name'] : $data['ref']).''; + } + print "'.$data['paid'].''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."
'; - // Boutons actions + // Buttons for actions print '
'; diff --git a/htdocs/cashdesk/css/style.css b/htdocs/cashdesk/css/style.css index dc579711aa3..9d9be27f3ce 100644 --- a/htdocs/cashdesk/css/style.css +++ b/htdocs/cashdesk/css/style.css @@ -320,7 +320,7 @@ p.titre { padding: 2px 2px; } -/* -------------- Boutons --------------------- */ +/* -------------- Buttons for SimplePOS --------------------- */ .bouton_ajout_article { margin-top: 10px; width: 60%; diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/accounting-files.php similarity index 60% rename from htdocs/compta/compta-files.php rename to htdocs/compta/accounting-files.php index 656824298fe..5a3097f6aa8 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/accounting-files.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2018 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2017 Pierre-Henry Favre * * This program is free software; you can redistribute it and/or modify @@ -16,11 +16,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -/** - * \file htdocs/compta/compta-files.php + + /** + * \file htdocs/compta/accounting-files.php * \ingroup compta * \brief Page to show portoflio and files of a thirdparty and download it */ + require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -89,149 +91,165 @@ $entity = GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity; $filesarray=array(); $result=false; -if(($action=="searchfiles" || $action=="dl" ) && $date_start && $date_stop) { - $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; - $sql="SELECT rowid as id, ref as ref, paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; - $sql.=" WHERE datef between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".Facture::STATUS_DRAFT; - $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref, paye as paid, total_ttc, fk_soc, datef as date, 'SupplierInvoice' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; - $sql.=" WHERE datef between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".FactureFournisseur::STATUS_DRAFT; - $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref, paid, total_ttc, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item FROM ".MAIN_DB_PREFIX."expensereport"; - $sql.=" WHERE date_fin between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".ExpenseReport::STATUS_DRAFT; - $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref, paid, amount as total_ttc, '0' as fk_soc, datedon as date, 'Donation' as item FROM ".MAIN_DB_PREFIX."don"; - $sql.=" WHERE datedon between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".Don::STATUS_DRAFT; - $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, label as ref, 1 as paid, amount as total_ttc, fk_user as fk_soc,datep as date, 'SalaryPayment' as item FROM ".MAIN_DB_PREFIX."payment_salary"; - $sql.=" WHERE datep between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; - $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, libelle as ref, paye as paid, amount as total_ttc, 0 as fk_soc, date_creation as date, 'SocialContributions' as item FROM ".MAIN_DB_PREFIX."chargesociales"; - $sql.=" WHERE date_creation between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; - $sql.= $db->order($sortfield, $sortorder); +if (($action=="searchfiles" || $action=="dl" )) { - $resd = $db->query($sql); - $files=array(); - $link=''; + if (empty($date_start)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart")), null, 'errors'); + $error++; + } + if (empty($date_stop)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors'); + $error++; + } - if ($resd) - { - $numd = $db->num_rows($resd); + if (! $error) + { + $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; - $tmpinvoice=new Facture($db); - $tmpinvoicesupplier=new FactureFournisseur($db); - $tmpdonation=new Don($db); + $sql="SELECT rowid as id, ref as ref, paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; + $sql.=" WHERE datef between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND fk_statut <> ".Facture::STATUS_DRAFT; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid as id, ref, paye as paid, total_ttc, fk_soc, datef as date, 'SupplierInvoice' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.=" WHERE datef between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND fk_statut <> ".FactureFournisseur::STATUS_DRAFT; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid as id, ref, paid, total_ttc, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item FROM ".MAIN_DB_PREFIX."expensereport"; + $sql.=" WHERE date_fin between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND fk_statut <> ".ExpenseReport::STATUS_DRAFT; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid as id, ref, paid, amount as total_ttc, '0' as fk_soc, datedon as date, 'Donation' as item FROM ".MAIN_DB_PREFIX."don"; + $sql.=" WHERE datedon between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND fk_statut <> ".Don::STATUS_DRAFT; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid as id, label as ref, 1 as paid, amount as total_ttc, fk_user as fk_soc,datep as date, 'SalaryPayment' as item FROM ".MAIN_DB_PREFIX."payment_salary"; + $sql.=" WHERE datep between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid as id, libelle as ref, paye as paid, amount as total_ttc, 0 as fk_soc, date_creation as date, 'SocialContributions' as item FROM ".MAIN_DB_PREFIX."chargesociales"; + $sql.=" WHERE date_creation between ".$wheretail; + $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; + $sql.= $db->order($sortfield, $sortorder); - $upload_dir =''; - $i=0; - while ($i < $numd) - { - $objd = $db->fetch_object($resd); + $resd = $db->query($sql); + $files=array(); + $link=''; - switch($objd->item) - { - case "Invoice": - $subdir = ''; - $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->facture->dir_output.'/'.$subdir; - $link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - case "SupplierInvoice": - $tmpinvoicesupplier->fetch($objd->id); - $subdir = get_exdir($tmpinvoicesupplier->id, 2, 0, 1, $tmpinvoicesupplier, 'invoice_supplier'); // TODO Use first file - $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir; - $link="document.php?modulepart=facture_fournisseur&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - case "ExpenseReport": - $subdir = ''; - $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; - $link="document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - case "SalaryPayment": - $subdir = ''; - $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); - $upload_dir = $conf->salaries->dir_output.'/'.$subdir; - $link="document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - case "Donation": - $tmpdonation->fetch($objp->id); - $subdir=get_exdir(0, 0, 0, 0, $tmpdonation, 'donation'); - $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); - $upload_dir = $conf->don->dir_output . '/' . $subdir; - $link="document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - case "SocialContributions": - $subdir = ''; - $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); - $upload_dir = $conf->tax->dir_output . '/' . $subdir; - $link="document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - default: - $subdir = ''; - $upload_dir = ''; - $link = ''; - break; - } + if ($resd) + { + $numd = $db->num_rows($resd); - if (!empty($upload_dir)) - { - $result=true; + $tmpinvoice=new Facture($db); + $tmpinvoicesupplier=new FactureFournisseur($db); + $tmpdonation=new Don($db); - $files=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); + $upload_dir =''; + $i=0; + while ($i < $numd) + { + $objd = $db->fetch_object($resd); - if (count($files) < 1) - { - $nofile['id']=$objd->id; - $nofile['date']=$db->idate($objd->date); - $nofile['paid']=$objd->paid; - $nofile['amount']=$objd->total_ttc; - $nofile['ref']=($objd->ref ? $objd->ref : $objd->id); - $nofile['fk']=$objd->fk_soc; - $nofile['item']=$objd->item; + switch($objd->item) + { + case "Invoice": + $subdir = ''; + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->facture->dir_output.'/'.$subdir; + $link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "SupplierInvoice": + $tmpinvoicesupplier->fetch($objd->id); + $subdir = get_exdir($tmpinvoicesupplier->id, 2, 0, 1, $tmpinvoicesupplier, 'invoice_supplier'); // TODO Use first file + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir; + $link="document.php?modulepart=facture_fournisseur&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "ExpenseReport": + $subdir = ''; + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; + $link="document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "SalaryPayment": + $subdir = ''; + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); + $upload_dir = $conf->salaries->dir_output.'/'.$subdir; + $link="document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "Donation": + $tmpdonation->fetch($objp->id); + $subdir=get_exdir(0, 0, 0, 0, $tmpdonation, 'donation'); + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); + $upload_dir = $conf->don->dir_output . '/' . $subdir; + $link="document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "SocialContributions": + $subdir = ''; + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); + $upload_dir = $conf->tax->dir_output . '/' . $subdir; + $link="document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + default: + $subdir = ''; + $upload_dir = ''; + $link = ''; + break; + } - $filesarray[]=$nofile; - } - else - { - foreach ($files as $key => $file) - { - $file['id']=$objd->id; - $file['date']=$db->idate($objd->date); - $file['paid']=$objd->paid; - $file['amount']=$objd->total_ttc; - $file['ref']=($objd->ref ? $objd->ref : $objd->id); - $file['fk']=$objd->fk_soc; - $file['item']=$objd->item; - $file['link']=$link.$file['name']; - $file['relpathnamelang'] = $langs->trans($file['item']).'/'.$file['name']; + if (!empty($upload_dir)) + { + $result=true; - $filesarray[]=$file; - } - } - } - $i++; - } - } - else - { - dol_print_error($db); - } + $files=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); - $db->free($resd); + if (count($files) < 1) + { + $nofile['id']=$objd->id; + $nofile['date']=$db->idate($objd->date); + $nofile['paid']=$objd->paid; + $nofile['amount']=$objd->total_ttc; + $nofile['ref']=($objd->ref ? $objd->ref : $objd->id); + $nofile['fk']=$objd->fk_soc; + $nofile['item']=$objd->item; + + $filesarray[]=$nofile; + } + else + { + foreach ($files as $key => $file) + { + $file['id']=$objd->id; + $file['date']=$db->idate($objd->date); + $file['paid']=$objd->paid; + $file['amount']=$objd->total_ttc; + $file['ref']=($objd->ref ? $objd->ref : $objd->id); + $file['fk']=$objd->fk_soc; + $file['item']=$objd->item; + $file['link']=$link.$file['name']; + $file['relpathnamelang'] = $langs->trans($file['item']).'/'.$file['name']; + + $filesarray[]=$file; + } + } + } + $i++; + } + } + else + { + dol_print_error($db); + } + + $db->free($resd); + } } /* @@ -318,7 +336,9 @@ if (! empty($conf->multicompany->enabled) && is_object($mc)) print ")\n"; } -print ''."\n"; +print ''; + +print ''."\n"; dol_fiche_end(); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 3576f35642e..7518093bf77 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1287,7 +1287,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Files if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 1) { - $newmenu->add("/compta/compta-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); } // Reports @@ -1329,6 +1329,12 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Accountancy (simple) if (! empty($conf->comptabilite->enabled)) { + // Files + if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 1) + { + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files'); + } + // Bilan, resultats $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca'); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 94033912a69..34cbdfe89bd 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -434,7 +434,7 @@ if ($resql) $canedit=((in_array($user_id, $childids) && $user->rights->expensereport->creer) || ($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->expensereport->writeall_advance)); - // Boutons d'actions + // Buttons for actions if ($canedit) { print ''.$langs->trans("AddTrip").''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 2cd27d6d688..1eb38cec66c 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3021,7 +3021,7 @@ else if ($action != 'presend') { /* - * Boutons actions + * Buttons actions */ print '
'; diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 6c4cb05a17e..c67daf8f92b 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1391,9 +1391,10 @@ else if (! $edit) { - print '
'; + // Buttons for actions + + print '
'; - // Boutons d'actions if ($cancreate && $object->statut == Holiday::STATUS_DRAFT) { print ''.$langs->trans("EditCP").''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 84e7b36c239..ce038709fcf 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -319,11 +319,12 @@ if ($id > 0) // For user tab dol_fiche_end(); + // Buttons for actions + print '
'; $canedit=(($user->id == $user_id && $user->rights->holiday->write) || ($user->id != $user_id && $user->rights->holiday->write_all)); - // Boutons d'actions if ($canedit) { print ''.$langs->trans("AddCP").''; diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index da6f3c5a466..cc2eb5062cb 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -421,6 +421,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Buttons for actions + if ($action != 'presend' && $action != 'editline') { print '
'."\n"; $parameters=array(); diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index 076461043b8..c648b15664e 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -619,7 +619,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; -//boucle pour l'affichage des boutons de suppression de colonne +// loop to show the delete link if ($user->rights->opensurvey->write) { for ($i = 0; isset($toutsujet[$i]); $i++) { diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 8840da3f3e7..76f390c470b 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -471,7 +471,7 @@ for ($i = 0; $i < $nbrejourmois + $premierjourmois; $i++) { { $nbofchoice=count($_SESSION["totalchoixjour"]); for ($j = 0; $j < $nbofchoice; $j++) { - //affichage des boutons ROUGES + // show red buttons if (date("j", $_SESSION["totalchoixjour"][$j]) == $numerojour && date("n", $_SESSION["totalchoixjour"][$j]) == $_SESSION["mois"] && date("Y", $_SESSION["totalchoixjour"][$j]) == $_SESSION["annee"]) { print ''."\n"; $dejafait = $numerojour; @@ -479,13 +479,13 @@ for ($i = 0; $i < $nbrejourmois + $premierjourmois; $i++) { } } - //Si pas de bouton ROUGE alors on affiche un bouton VERT ou GRIS avec le numéro du jour dessus + // If no red button, we show green or grey button with number of day if (isset($dejafait) === false || $dejafait != $numerojour){ - //bouton vert + // green button if (($numerojour >= $jourAJ && $_SESSION["mois"] == $moisAJ && $_SESSION["annee"] == $anneeAJ) || ($_SESSION["mois"] > $moisAJ && $_SESSION["annee"] == $anneeAJ) || $_SESSION["annee"] > $anneeAJ) { print ''."\n"; } else { - //bouton gris + // grey button print ''.$numerojour.''."\n"; } } @@ -547,7 +547,7 @@ if (issetAndNoEmpty('totalchoixjour', $_SESSION) || $erreur) print ''."\n"; - //affichage des boutons de formulaire pour annuler, effacer les jours ou créer le sondage + // show buttons to cancel, delete days or create survey print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index 0c746fcf8b2..c2e6db1a709 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -194,7 +194,7 @@ if (GETPOST('choix_sondage')) } else { - // affichage des boutons pour choisir sondage date ou autre + // Show image to selecte between date survey or other survey print '
'."\n"; print ' '."\n"; print ''."\n"; diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index e76c6884b7f..cfbedbcb7f1 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -333,7 +333,8 @@ else print '
'; - // Boutons actions + // Buttons for actions + print '
'; print ''; print '
'; diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index c0cd029126d..1d00718401b 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -5,7 +5,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> /* ============================================================================== */ -/* Boutons actions */ +/* Buttons for actions */ /* ============================================================================== */ div.divButAction { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index e5e68e59c48..9061595dd1d 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2362,7 +2362,7 @@ span.tabspan { } /* ============================================================================== */ -/* Boutons actions */ +/* Buttons for actions */ /* ============================================================================== */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 752f60541d1..8020a490181 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2400,7 +2400,7 @@ div.tabBar table.tableforservicepart2:last-child { } /* ============================================================================== */ -/* Boutons actions */ +/* Buttons for actions */ /* ============================================================================== */ div.divButAction { @@ -2503,7 +2503,7 @@ span.tabspan { } /* ============================================================================== */ -/* Boutons actions */ +/* Buttons for actions */ /* ============================================================================== */ div.divButAction { From f6f66f2a77ed56e5dc2798fc92792d29d59c11b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Jun 2019 18:11:38 +0200 Subject: [PATCH 059/515] Fix syntax error --- htdocs/projet/tasks/time.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index e69f4fcd899..f98c9c4ace5 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -428,7 +428,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; // Link to create time - if ($user->rights->projet->all->lire || $user->rights->projet->lire)) // To enter time, read permission is enough + if ($user->rights->projet->all->lire || $user->rights->projet->lire) // To enter time, read permission is enough { if ($projectstatic->public || $userRead > 0) { From f6f86927113f99e52343b10db1438a4f666cd3db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Jun 2019 18:12:28 +0200 Subject: [PATCH 060/515] Fix phpcs --- 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 bde49e05e7aca32b0da06eff0ed0b0235720134e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Jun 2019 18:23:38 +0200 Subject: [PATCH 061/515] Fix doc --- htdocs/societe/class/societeaccount.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 3fc7b225c77..a82ad69091b 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -320,7 +320,7 @@ class SocieteAccount extends CommonObject * @param string $id Id of customer in external system (example: 'cu_xxxxxxxxxxxxx', ...) * @param string $site Site (example: 'stripe', '...') * @param int $status Status (0=test, 1=live) - * @return string Id of third party + * @return int Id of third party * @see getCustomerAccount() */ public function getThirdPartyID($id, $site, $status = 0) From a6d4475afff68f0ce1c0e808aec631a553d97f6a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Jun 2019 18:24:45 +0200 Subject: [PATCH 062/515] Fix scrutinizer --- htdocs/stripe/class/stripe.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index dd66c7607e5..d754b8d3962 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -247,6 +247,8 @@ class Stripe extends CommonObject */ public function getPaymentMethodStripe($paymentmethod, $key = '', $status = 0) { + $stripepaymentmethod = null; + try { // Force to use the correct API key global $stripearrayofkeysbyenv; @@ -261,6 +263,7 @@ class Stripe extends CommonObject { $this->error = $e->getMessage(); } + return $stripepaymentmethod; } From 80d4d8754d5e548902878c50fca8a7571349e2a2 Mon Sep 17 00:00:00 2001 From: Eric Seigne <1468823+rycks@users.noreply.github.com> Date: Mon, 17 Jun 2019 18:28:11 +0200 Subject: [PATCH 063/515] allow zero as accountancy code nomber (replace all empty tests by != '') --- .../accountancy/bookkeeping/listbyaccount.php | 2 +- htdocs/accountancy/class/lettering.class.php | 30 +++++++++--------- htdocs/accountancy/journal/bankjournal.php | 14 ++++----- .../journal/expensereportsjournal.php | 14 ++++----- .../accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 14 ++++----- htdocs/compta/journal/purchasesjournal.php | 4 +-- htdocs/compta/journal/sellsjournal.php | 2 +- .../core/class/html.formaccounting.class.php | 2 +- htdocs/core/lib/accounting.lib.php | 31 ++++++++++++++----- .../societe/mod_codecompta_panicum.php | 4 +-- htdocs/societe/class/societe.class.php | 4 +-- 12 files changed, 70 insertions(+), 53 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index d1ef1377994..bacfdcb714a 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -348,7 +348,7 @@ while ($i < min($num, $limit)) $colspan = 9; print "
"; print ''; print ''; diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index a0c977a8d5a..2a89c6c1c96 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -67,11 +67,11 @@ class Lettering extends BookKeeping $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) "; $sql .= " WHERE ( "; - if (! empty($object->code_compta)) + if ($object->code_compta != "") $sql .= " bk.subledger_account = '" . $object->code_compta . "' "; - if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) + if ($object->code_compta != "" && $object->code_compta_fournisseur != "") $sql .= " OR "; - if (! empty($object->code_compta_fournisseur)) + if ($object->code_compta_fournisseur != "") $sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' "; $sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) "; @@ -99,13 +99,13 @@ class Lettering extends BookKeeping $sql .= " AND facf.entity = ".$conf->entity; $sql .= " AND code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4 AND entity=".$conf->entity.") "; $sql .= " AND ( "; - if (! empty($object->code_compta)) { + if ($object->code_compta != "") { $sql .= " bk.subledger_account = '" . $object->code_compta . "' "; } - if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) { + if ($object->code_compta != "" && $object->code_compta_fournisseur != "") { $sql .= " OR "; } - if (! empty($object->code_compta_fournisseur)) { + if ($object->code_compta_fournisseur != "") { $sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' "; } $sql .= " ) "; @@ -127,13 +127,13 @@ class Lettering extends BookKeeping $sql .= " WHERE bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=3 AND entity=".$conf->entity.") "; $sql .= " AND facf.entity = ".$conf->entity; $sql .= " AND ( "; - if (! empty($object->code_compta)) { + if ($object->code_compta != "") { $sql .= " bk.subledger_account = '" . $object->code_compta . "' "; } - if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) { + if ($object->code_compta != "" && $object->code_compta_fournisseur != "") { $sql .= " OR "; } - if (! empty($object->code_compta_fournisseur)) { + if ($object->code_compta_fournisseur != "") { $sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' "; } $sql .= ") "; @@ -159,13 +159,13 @@ class Lettering extends BookKeeping $sql .= " AND bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4 AND entity=".$conf->entity.") "; $sql .= " AND fac.entity IN (".getEntity('invoice', 0).")";// We don't share object for accountancy $sql .= " AND ( "; - if (! empty($object->code_compta)) { + if ($object->code_compta != "") { $sql .= " bk.subledger_account = '" . $object->code_compta . "' "; } - if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) { + if ($object->code_compta != "" && $object->code_compta_fournisseur != "") { $sql .= " OR "; } - if (! empty($object->code_compta_fournisseur)) { + if ($object->code_compta_fournisseur != "") { $sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' "; } $sql .= " ) "; @@ -187,13 +187,13 @@ class Lettering extends BookKeeping $sql .= " WHERE code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=2 AND entity=".$conf->entity.") "; $sql .= " AND fac.entity IN (".getEntity('invoice', 0).")";// We don't share object for accountancy $sql .= " AND ( "; - if (! empty($object->code_compta)) { + if ($object->code_compta != "") { $sql .= " bk.subledger_account = '" . $object->code_compta . "' "; } - if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) { + if ($object->code_compta != "" && $object->code_compta_fournisseur != "") { $sql .= " OR "; } - if (! empty($object->code_compta_fournisseur)) { + if ($object->code_compta_fournisseur != "") { $sql .= " bk.subledger_account = '" . $object->code_compta_fournisseur . "' "; } $sql .= " ) "; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index e4e07831b44..0f22789d630 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -171,8 +171,8 @@ if ($result) { //print $sql; // Variables - $account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word - $account_customer = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word + $account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word + $account_customer = ($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word $account_employee = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word $account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word $account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word @@ -218,7 +218,7 @@ if ($result) { // Set accountancy code for thirdparty $compta_soc = 'NotDefined'; if ($lineisapurchase > 0) - $compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier); + $compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier); if ($lineisasale > 0) $compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer); @@ -938,8 +938,8 @@ if (empty($action) || $action == 'view') { // Button to write into Ledger - if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' - || empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1' + if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' + || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1' || empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); @@ -950,8 +950,8 @@ if (empty($action) || $action == 'view') { if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; - if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' - || empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { + if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' + || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { print ''; } else { diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 4c50015a2ba..d82381533cf 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -444,10 +444,10 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! foreach ($taber as $key => $val) { $date = dol_print_date($val["date"], 'day'); - + $userstatic->id = $tabuser[$key]['id']; $userstatic->name = $tabuser[$key]['name']; - + // Fees foreach ($tabht[$key] as $k => $mt) { $accountingaccount = new AccountingAccount($db); @@ -474,7 +474,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print "\n"; } } - + // Third party foreach ($tabttc[$key] as $k => $mt) { print '"' . $date . '"' . $sep; @@ -585,7 +585,7 @@ if (empty($action) || $action == 'view') { // Account print "
'. $langs->trans("CreateSurveyDate") .'
'; - if (! empty($line->numero_compte) && $line->numero_compte != '-1') print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte); + if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte); else print ''.$langs->trans("Unknown").''; print '
"; $accountoshow = length_accountg($k); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("FeeAccountNotDefined").''; } @@ -615,7 +615,7 @@ if (empty($action) || $action == 'view') { // Account print ""; $accountoshow = length_accounta($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForUsersNotDefined").''; } @@ -624,7 +624,7 @@ if (empty($action) || $action == 'view') { // Subledger account print ""; $accountoshow = length_accounta($k); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("UserAccountNotDefined").''; } @@ -652,7 +652,7 @@ if (empty($action) || $action == 'view') { // Account print ""; $accountoshow = length_accountg($k); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("VATAccountNotDefined").''; } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index cab5069e1f8..cd82e9f2f27 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -749,7 +749,7 @@ if (empty($action) || $action == 'view') { } print '
'; if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; - if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { + if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { print ''; } else { diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 8f82fd95afb..3b0607d34a7 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -146,7 +146,7 @@ if ($result) { $num = $db->num_rows($result); // Variables - $cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'; + $cptcli = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "")) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'; $cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : 'NotDefined'; $i = 0; @@ -679,14 +679,14 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); // Button to write into Ledger - if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { + if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { print '
'; print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); } print '
'; if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; - if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { + if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { print ''; } else { @@ -813,7 +813,7 @@ if (empty($action) || $action == 'view') { // Account print "
"; $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForCustomersNotDefined").''; } @@ -822,7 +822,7 @@ if (empty($action) || $action == 'view') { // Subledger account print ""; $accountoshow = length_accounta($k); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("ThirdpartyAccountNotDefined").''; } @@ -849,7 +849,7 @@ if (empty($action) || $action == 'view') { // Account print ""; $accountoshow = length_accountg($k); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("ProductNotDefined").''; } @@ -884,7 +884,7 @@ if (empty($action) || $action == 'view') { // Account print ""; $accountoshow = length_accountg($k); - if (empty($accountoshow) || $accountoshow == 'NotDefined') + if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')'.''; } diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index cd3bf06f43a..5b4e54fd807 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -123,7 +123,7 @@ if ($result) { $num = $db->num_rows($result); // les variables - $cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)?$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER:$langs->trans("CodeNotDef")); + $cptfour = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "")?$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER:$langs->trans("CodeNotDef")); $cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)?$conf->global->ACCOUNTING_VAT_BUY_ACCOUNT:$langs->trans("CodeNotDef")); $tabfac = array(); @@ -139,7 +139,7 @@ if ($result) { $obj = $db->fetch_object($result); // contrôles - $compta_soc = (! empty($obj->code_compta_fournisseur)?$obj->code_compta_fournisseur:$cptfour); + $compta_soc = (($obj->code_compta_fournisseur != "")?$obj->code_compta_fournisseur:$cptfour); $compta_prod = $obj->accountancy_code_buy; if (empty($compta_prod)) { diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index fe51665163e..123bb3c7770 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -146,7 +146,7 @@ if ($result) { $obj = $db->fetch_object($result); // les variables - $cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)?$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER:$langs->trans("CodeNotDef")); + $cptcli = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "")?$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER:$langs->trans("CodeNotDef")); $compta_soc = (! empty($obj->code_compta)?$obj->code_compta:$cptcli); $compta_prod = $obj->accountancy_code_sell; if (empty($compta_prod)) diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 87b32902684..cf95e471ddd 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -392,7 +392,7 @@ class FormAccounting extends Form $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { - if (!empty($obj->code_compta_fournisseur)) { + if ($obj->code_compta_fournisseur != "") { $aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->nom.')'; } } diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 889d9da8a2c..4b5345da62b 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014 Florian Henry + * Copyright (C) 2019 Eric Seigne * * 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 @@ -23,6 +24,22 @@ * \brief Library of accountancy functions */ + /** + * 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 + */ + function is_empty($var, $allow_false = false, $allow_ws = false) { + if (!isset($var) || is_null($var) || ($allow_ws == false && trim($var) == "" && !is_bool($var)) || ($allow_false === false && is_bool($var) && $var === false) || (is_array($var) && empty($var))) { + return true; + } else { + return false; + } + } + /** * Prepare array with list of tabs * @@ -75,12 +92,12 @@ function length_accountg($account) { global $conf; - if ($account < 0 || empty($account)) return ''; + if ($account < 0 || is_empty($account)) return ''; - if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account; + if (! is_empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account; $g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT; - if (! empty($g)) { + if (! is_empty($g)) { // Clean parameters $i = strlen($account); @@ -110,12 +127,12 @@ function length_accounta($accounta) { global $conf; - if ($accounta < 0 || empty($accounta)) return ''; + if ($accounta < 0 || is_empty($accounta)) return ''; - if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta; + if (! is_empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta; $a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT; - if (! empty($a)) { + if (! is_empty($a)) { // Clean parameters $i = strlen($accounta); @@ -158,7 +175,7 @@ function journalHead($nom, $variante, $period, $periodlink, $description, $build print "\n\n\n"; - if(! empty($varlink)) $varlink = '?'.$varlink; + if(! is_empty($varlink)) $varlink = '?'.$varlink; $head=array(); $h=0; diff --git a/htdocs/core/modules/societe/mod_codecompta_panicum.php b/htdocs/core/modules/societe/mod_codecompta_panicum.php index 4c5ffcd66c5..f3106cef761 100644 --- a/htdocs/core/modules/societe/mod_codecompta_panicum.php +++ b/htdocs/core/modules/societe/mod_codecompta_panicum.php @@ -96,8 +96,8 @@ class mod_codecompta_panicum extends ModeleAccountancyCode $this->code=''; if (is_object($societe)) { - if ($type == 'supplier') $this->code = (! empty($societe->code_compta_fournisseur)?$societe->code_compta_fournisseur:''); - else $this->code = (! empty($societe->code_compta)?$societe->code_compta:''); + if ($type == 'supplier') $this->code = (($societe->code_compta_fournisseur != "")?$societe->code_compta_fournisseur:''); + else $this->code = (($societe->code_compta != "")?$societe->code_compta:''); } return 0; // return ok diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 84bda8abd54..ce7617f003d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -928,7 +928,7 @@ class Societe extends CommonObject if (! empty($allowmodcodefournisseur) && ! empty($this->fournisseur)) { // Attention get_codecompta peut modifier le code suivant le module utilise - if (empty($this->code_compta_fournisseur)) + if ($this->code_compta_fournisseur == "") { $ret=$this->get_codecompta('supplier'); if ($ret < 0) return -1; @@ -1085,7 +1085,7 @@ class Societe extends CommonObject if ($supplier) { $sql .= ", code_fournisseur = ".(! empty($this->code_fournisseur)?"'".$this->db->escape($this->code_fournisseur)."'":"null"); - $sql .= ", code_compta_fournisseur = ".(! empty($this->code_compta_fournisseur)?"'".$this->db->escape($this->code_compta_fournisseur)."'":"null"); + $sql .= ", code_compta_fournisseur = ".(($this->code_compta_fournisseur != "")?"'".$this->db->escape($this->code_compta_fournisseur)."'":"null"); } $sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id:"null"); $sql .= ", fk_multicurrency = ".(int) $this->fk_multicurrency; From 42e58d9ea59f6231dc08836f0e719fb7a83253bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Jun 2019 18:38:14 +0200 Subject: [PATCH 064/515] Fix preview of interventions --- htdocs/core/lib/functions.lib.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4bbd030b1eb..7341bc0c2cb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1330,10 +1330,10 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi $nophoto=''; $morehtmlleft.='
'; } - //elseif ($conf->browser->layout != 'phone') { // Show no photo link + else { // Show no photo link $nophoto='/public/theme/common/nophoto.png'; $morehtmlleft.='
No photo
'; - //} + } } } elseif ($object->element == 'ticket') @@ -1349,10 +1349,10 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi $nophoto=''; $morehtmlleft.='
'; } - //elseif ($conf->browser->layout != 'phone') { // Show no photo link - $nophoto='/public/theme/common/nophoto.png'; - $morehtmlleft.='
No photo
'; - //} + else { // Show no photo link + $nophoto='/public/theme/common/nophoto.png'; + $morehtmlleft.='
No photo
'; + } } } else @@ -5260,7 +5260,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart) // Here, object->id, object->ref and modulepart are required. //var_dump($modulepart); if (in_array($modulepart, array('thirdparty','contact','member','propal','proposal','commande','order','facture','invoice', - 'supplier_order','supplier_proposal','shipment','contract','expensereport'))) + 'supplier_order','supplier_proposal','shipment','contract','expensereport','ficheinter'))) { $path=($object->ref?$object->ref:$object->id); } From 0123a18ff86c89272404e57ae6cb65ccfd3c4566 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Jun 2019 18:44:08 +0200 Subject: [PATCH 065/515] Look and feel v10 --- htdocs/core/tpl/resource_view.tpl.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index d2e0441b60b..014560e0299 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -53,11 +53,11 @@ if( (array) $linked_resources && count($linked_resources) > 0) } else { - $style=''; + $class=''; if ($linked_resource['rowid'] == GETPOST('lineid')) - $style='style="background: orange;"'; + $class='highlight'; - print '
'; + print '
'; print '
'; print $object_resource->getNomUrl(1); @@ -81,7 +81,7 @@ if( (array) $linked_resources && count($linked_resources) > 0) print ''; print ' '; print ''; - print img_delete(); + print img_picto($langs->trans("Unlink"), 'unlink'); print ''; print '
'; From e4f5ca79f8d20ddff3c8b5d305c78d4bba9c9a96 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 17 Jun 2019 19:36:21 +0200 Subject: [PATCH 066/515] Fix access category API --- htdocs/categories/class/api_categories.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index c82d803f31c..c389e1b63d1 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -86,7 +86,7 @@ class Categories extends DolibarrApi throw new RestException(404, 'category not found'); } - if ( ! DolibarrApi::_checkAccessToResource('category', $this->category->id)) { + if ( ! DolibarrApi::_checkAccessToResource('categorie', $this->category->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } From 27c928d9d9f5685c2b6da463ae8ba652f649ad9a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 17 Jun 2019 20:53:10 +0200 Subject: [PATCH 067/515] 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 f1d64ad164152252a9cb901a966493e6b82aeb1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 17 Jun 2019 23:02:54 +0200 Subject: [PATCH 068/515] Update peruser.php --- htdocs/comm/action/peruser.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 754cb736bc9..d4020f4df92 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -1186,33 +1186,34 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } } - $ids1='';$ids2=''; - if (count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',', array_keys($cases1[$h])); - if (count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',', array_keys($cases2[$h])); + $ids1=''; + $ids2=''; + if (is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',', array_keys($cases1[$h])); + if (is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',', array_keys($cases2[$h])); if ($h == $begin_h) echo '
'; else echo ''; - if (count($cases1[$h]) == 1) // only 1 event + if (is_array($cases1[$h]) && count($cases1[$h]) == 1) // only 1 event { $output = array_slice($cases1[$h], 0, 1); $title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:''); if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string']; if ($output[0]['color']) $color1 = $output[0]['color']; } - elseif (count($cases1[$h]) > 1) + elseif (is_array($cases1[$h]) && count($cases1[$h]) > 1) { $title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:''); $color1='222222'; } - if (count($cases2[$h]) == 1) // only 1 event + if (is_array($cases2[$h]) && count($cases2[$h]) == 1) // only 1 event { $output = array_slice($cases2[$h], 0, 1); $title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:''); if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string']; if ($output[0]['color']) $color2 = $output[0]['color']; } - elseif (count($cases2[$h]) > 1) + elseif (is_array($cases2[$h]) && count($cases2[$h]) > 1) { $title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:''); $color2='222222'; From fd263cb316b34100ec1c4bd0d76a858b0fb0f0fe Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 18 Jun 2019 07:15:59 +0200 Subject: [PATCH 069/515] FIX add v10 in virtualmin script --- build/perl/virtualmin/dolibarr.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl index a28fc430caa..343cebc6abe 100644 --- a/build/perl/virtualmin/dolibarr.pl +++ b/build/perl/virtualmin/dolibarr.pl @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------- # \file dolibarr.pl # \brief Dolibarr script install for Virtualmin Pro -# \author (c)2009-2018 Regis Houssin +# \author (c)2009-2019 Regis Houssin #---------------------------------------------------------------------------- @@ -30,7 +30,7 @@ return "Regis Houssin"; # script_dolibarr_versions() sub script_dolibarr_versions { -return ( "9.0.0", "8.0.3", "7.0.4", "6.0.8", "5.0.7" ); +return ( "10.0.0", "9.0.3", "8.0.5", "7.0.5", "6.0.8" ); } sub script_dolibarr_release @@ -390,6 +390,7 @@ sub script_dolibarr_check_latest { local ($ver) = @_; local @vers = &osdn_package_versions("dolibarr", + $ver >= 10.0 ? "dolibarr\\-(10\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" : From 96c699482791ebd62614a0209849057799cdb924 Mon Sep 17 00:00:00 2001 From: Nicolas ZABOURI Date: Tue, 18 Jun 2019 10:55:16 +0200 Subject: [PATCH 070/515] =?UTF-8?q?FIX=202=20d=C3=A9clarations=20of=20date?= =?UTF-8?q?=5Fvalid=20in=20SQL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/install/mysql/tables/llx_bom_bom.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_bom_bom.sql b/htdocs/install/mysql/tables/llx_bom_bom.sql index 9c6e014586d..11e1ce74ffd 100644 --- a/htdocs/install/mysql/tables/llx_bom_bom.sql +++ b/htdocs/install/mysql/tables/llx_bom_bom.sql @@ -27,10 +27,9 @@ CREATE TABLE llx_bom_bom( qty double(24,8), efficiency double(8,4) DEFAULT 1, date_creation datetime NOT NULL, - date_valid datetime NOT NULL, + date_valid datetime, tms timestamp, - date_valid datetime, - fk_user_creat integer NOT NULL, + fk_user_creat integer NOT NULL, fk_user_modif integer, fk_user_valid integer, import_key varchar(14), From 820c420ae5221f0d96a19624a72828c28e7cdd45 Mon Sep 17 00:00:00 2001 From: ICstage Date: Tue, 18 Jun 2019 14:07:52 +0200 Subject: [PATCH 071/515] 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 8835b49f3fccc90cbe52d2a83c61d61323017f2e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 14:30:13 +0200 Subject: [PATCH 072/515] Debug the accounting-file tool --- htdocs/compta/accounting-files.php | 278 +++++++++++------- .../install/mysql/migration/9.0.0-10.0.0.sql | 2 + htdocs/install/mysql/migration/repair.sql | 1 + htdocs/user/param_ihm.php | 2 +- 4 files changed, 177 insertions(+), 106 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 5a3097f6aa8..c663a179d6d 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -16,13 +16,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - - /** +/** * \file htdocs/compta/accounting-files.php * \ingroup compta * \brief Page to show portoflio and files of a thirdparty and download it */ - require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -34,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -$langs->loadLangs(array("accountancy", "bills", "companies")); +$langs->loadLangs(array("accountancy", "bills", "companies", "salaries")); $date_start =GETPOST('date_start', 'alpha'); $date_startDay= GETPOST('date_startday', 'int'); @@ -46,11 +44,11 @@ $date_stopDay= GETPOST('date_stopday', 'int'); $date_stopMonth= GETPOST('date_stopmonth', 'int'); $date_stopYear= GETPOST('date_stopyear', 'int'); //FIXME doldate -$date_stop=($date_stopDay)?dol_mktime(0, 0, 0, $date_stopMonth, $date_stopDay, $date_stopYear):strtotime($date_stop); +$date_stop=($date_stopDay)?dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear):strtotime($date_stop); $action =GETPOST('action', 'alpha'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('comptafileslist', 'globallist')); +$hookmanager->initHooks(array('comptafileslist','globallist')); // Load variable for pagination $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; @@ -66,6 +64,7 @@ if (! $sortorder) $sortorder="DESC"; $arrayfields=array( + 'type'=>array('label'=>"Type", 'checked'=>1), 'date'=>array('label'=>"Date", 'checked'=>1), //... ); @@ -83,7 +82,7 @@ if ($user->societe_id > 0) * Actions */ -$entity = GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity; +$entity = GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity; //$parameters = array('socid' => $id); //$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks @@ -106,38 +105,45 @@ if (($action=="searchfiles" || $action=="dl" )) { if (! $error) { - $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; + $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; - $sql="SELECT rowid as id, ref as ref, paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; + $sql="SELECT t.rowid as id, t.ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql.=" WHERE datef between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".Facture::STATUS_DRAFT; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".Facture::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref, paye as paid, total_ttc, fk_soc, datef as date, 'SupplierInvoice' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.=" SELECT t.rowid as id, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql.=" WHERE datef between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".FactureFournisseur::STATUS_DRAFT; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref, paid, total_ttc, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item FROM ".MAIN_DB_PREFIX."expensereport"; + $sql.=" SELECT t.rowid as id, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql.=" WHERE date_fin between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".ExpenseReport::STATUS_DRAFT; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".ExpenseReport::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref, paid, amount as total_ttc, '0' as fk_soc, datedon as date, 'Donation' as item FROM ".MAIN_DB_PREFIX."don"; + $sql.=" SELECT t.rowid as id, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country"; $sql.=" WHERE datedon between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".Don::STATUS_DRAFT; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".Don::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, label as ref, 1 as paid, amount as total_ttc, fk_user as fk_soc,datep as date, 'SalaryPayment' as item FROM ".MAIN_DB_PREFIX."payment_salary"; + $sql.=" SELECT t.rowid as id, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql.=" WHERE datep between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, libelle as ref, paye as paid, amount as total_ttc, 0 as fk_soc, date_creation as date, 'SocialContributions' as item FROM ".MAIN_DB_PREFIX."chargesociales"; + $sql.=" SELECT t.rowid as id, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."chargesociales as t"; $sql.=" WHERE date_creation between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; $sql.= $db->order($sortfield, $sortorder); + //print $sql; $resd = $db->query($sql); $files=array(); @@ -162,63 +168,68 @@ if (($action=="searchfiles" || $action=="dl" )) { case "Invoice": $subdir = ''; $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->facture->dir_output.'/'.$subdir; - $link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; + $upload_dir = $conf->facture->dir_output.'/'.$subdir; + $link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; case "SupplierInvoice": $tmpinvoicesupplier->fetch($objd->id); $subdir = get_exdir($tmpinvoicesupplier->id, 2, 0, 1, $tmpinvoicesupplier, 'invoice_supplier'); // TODO Use first file - $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir; - $link="document.php?modulepart=facture_fournisseur&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir; + $link="document.php?modulepart=facture_fournisseur&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; case "ExpenseReport": $subdir = ''; $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; - $link="document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; + $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; + $link="document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; case "SalaryPayment": $subdir = ''; $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); - $upload_dir = $conf->salaries->dir_output.'/'.$subdir; - $link="document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; + $upload_dir = $conf->salaries->dir_output.'/'.$subdir; + $link="document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; case "Donation": - $tmpdonation->fetch($objp->id); - $subdir=get_exdir(0, 0, 0, 0, $tmpdonation, 'donation'); - $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); - $upload_dir = $conf->don->dir_output . '/' . $subdir; - $link="document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; + $tmpdonation->fetch($objp->id); + $subdir=get_exdir(0, 0, 0, 0, $tmpdonation, 'donation'); + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); + $upload_dir = $conf->don->dir_output . '/' . $subdir; + $link="document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; case "SocialContributions": $subdir = ''; $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); - $upload_dir = $conf->tax->dir_output . '/' . $subdir; - $link="document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; + $upload_dir = $conf->tax->dir_output . '/' . $subdir; + $link="document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; default: - $subdir = ''; - $upload_dir = ''; - $link = ''; + $subdir=''; + $upload_dir=''; + $link=''; break; } if (!empty($upload_dir)) { $result=true; - $files=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); - + //var_dump($upload_dir); if (count($files) < 1) { - $nofile['id']=$objd->id; - $nofile['date']=$db->idate($objd->date); + $nofile['id']=$objd->id; + $nofile['date']=$db->idate($objd->date); $nofile['paid']=$objd->paid; - $nofile['amount']=$objd->total_ttc; + $nofile['amount_ht']=$objd->total_ht; + $nofile['amount_ttc']=$objd->total_ttc; + $nofile['amount_vat']=$objd->total_vat; $nofile['ref']=($objd->ref ? $objd->ref : $objd->id); $nofile['fk']=$objd->fk_soc; $nofile['item']=$objd->item; + $nofile['thirdparty_name']=$objd->thirdparty_name; + $nofile['thirdparty_code']=$objd->thirdparty_code; + $nofile['country_code']=$objd->country_code; + $nofile['vatnum']=$objd->vatnum; $filesarray[]=$nofile; } @@ -226,13 +237,21 @@ if (($action=="searchfiles" || $action=="dl" )) { { foreach ($files as $key => $file) { - $file['id']=$objd->id; - $file['date']=$db->idate($objd->date); + $file['id']=$objd->id; + $file['date']=$db->idate($objd->date); $file['paid']=$objd->paid; - $file['amount']=$objd->total_ttc; + $file['amount_ht']=$objd->total_ht; + $file['amount_ttc']=$objd->total_ttc; + $file['amount_vat']=$objd->total_vat; $file['ref']=($objd->ref ? $objd->ref : $objd->id); $file['fk']=$objd->fk_soc; $file['item']=$objd->item; + + $file['thirdparty_name']=$objd->thirdparty_name; + $file['thirdparty_code']=$objd->thirdparty_code; + $file['country_code']=$objd->country_code; + $file['vatnum']=$objd->vatnum; + $file['link']=$link.$file['name']; $file['relpathnamelang'] = $langs->trans($file['item']).'/'.$file['name']; @@ -252,27 +271,30 @@ if (($action=="searchfiles" || $action=="dl" )) { } } -/* - * cleanup of old ZIP - */ -//FIXME + /* *ZIP creation */ -if ($result && $action == "dl") +$dirfortmpfile = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->comptabilite->dir_temp); +if (empty($dirfortmpfile)) { - if (! extension_loaded('zip')) - { - setEventMessages('PHPZIPExtentionNotLoaded', null, 'errors'); - exit; - } + setEventMessages($langs->trans("ErrorNoAccountingModuleEnabled"), null, 'errors'); + $error++; +} - $dirfortmpfile = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->compta->dir_temp); + +if ($result && $action == "dl" && ! $error) +{ + if (! extension_loaded('zip')) + { + setEventMessages('PHPZIPExtentionNotLoaded', null, 'errors'); + exit; + } dol_mkdir($dirfortmpfile); - $log='date,type,ref,total,paid,filename,item_id'."\n"; + $log=$langs->transnoentitiesnoconv("Type").','.$langs->transnoentitiesnoconv("Date").','.$langs->transnoentitiesnoconv("Ref").','.$langs->transnoentitiesnoconv("TotalHT").','.$langs->transnoentitiesnoconv("TotalTTC").','.$langs->transnoentitiesnoconv("TotalVAT").','.$langs->transnoentitiesnoconv("Paid").',filename,item_id,'.$langs->trans("ThirdParty").','.$langs->trans("Code").','.$langs->trans("Country").','.$langs->trans("VATIntra")."\n"; $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip'; dol_delete_file($zipname); @@ -281,10 +303,10 @@ if ($result && $action == "dl") $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); if ($res) { - foreach ($filesarray as $key=> $file) + foreach ($filesarray as $key => $file) { if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); // - $log.=dol_print_date($file['date'], 'dayrfc').','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; + $log.=$file['item'].','.dol_print_date($file['date'], 'dayrfc').','.$file['ref'].','.$file['amount_ht'].','.$file['amount_ttc'].','.$file['amount_vat'].','.$file['paid'].','.$file["name"].','.$file['fk'].','.$file['thirdparty_name'].','.$file['thirdparty_code'].','.$file['country_code'].',"'.$file['vatnum'].'"'."\n"; } $zip->addFromString('transactions.csv', $log); $zip->close(); @@ -299,6 +321,10 @@ if ($result && $action == "dl") exit(); } + else + { + setEventMessages($langs->trans("FailedToOpenFile", $zipname), null, 'errors'); + } } @@ -329,11 +355,11 @@ print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n // Export is for current company only ! if (! empty($conf->multicompany->enabled) && is_object($mc)) { - print '('.$langs->trans("Entity").' : '; - $mc->dao->getEntities(); - $mc->dao->fetch($conf->entity); - print $mc->dao->label; - print ")\n"; + print '('.$langs->trans("Entity").' : '; + $mc->dao->getEntities(); + $mc->dao->fetch($conf->entity); + print $mc->dao->label; + print ")\n"; } print ''; @@ -376,14 +402,18 @@ if (!empty($date_start) && !empty($date_stop)) print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; - print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, 'class="nowrap"', $sortfield, $sortorder); - print ''; + print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'nowrap '); + print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, '', $sortfield, $sortorder, 'center nowrap '); print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; if ($result) { @@ -397,18 +427,11 @@ if (!empty($date_start) && !empty($date_stop)) { // Sort array by date ASC to calculate balance + $totalET = 0; + $totalIT = 0; + $totalVAT = 0; $totalDebit = 0; $totalCredit = 0; - // Balance calculation - $balance = 0; - foreach($TData as &$data1) { - if ($data1['item']!='Invoice' && $data1['item']!='Donation') - { - $data1['amount']=-$data1['amount']; - } - $balance += $data1['amount']; - $data1['balance'] = $balance; - } // Display array foreach($TData as $data) @@ -417,11 +440,17 @@ if (!empty($date_start) && !empty($date_stop)) //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; print ''; - print "'; + + // Date + print '\n"; - print ''; - print ''; + + // Ref + print ''; // File link print '\n"; + print "\n"; + + // Paid + print ''; + + // Total ET + print '\n"; + // Total IT + print '\n"; + // Total VAT + print '\n"; + + print '\n"; + + print '\n"; + + print '\n"; + + print '\n"; + + // Debit + //print '\n"; + // Credit + //print '\n"; + + $totalET += $data['amount_ht']; + $totalIT += $data['amount_ttc']; + $totalVAT += $data['amount_vat']; + + $totalDebit += ($data['amount_ttc'] > 0) ? abs($data['amount_ttc']) : 0; + $totalCredit += ($data['amount_ttc'] > 0) ? 0 : abs($data['amount_ttc']); - print ''; - print '\n"; - $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0; - print '\n"; - $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']); // Balance - print '\n"; + //print '\n"; + print "\n"; } print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + /*print ''; + print ''; + print ''; + */ print "\n"; } } @@ -453,5 +520,6 @@ if (!empty($date_start) && !empty($date_stop)) print ''; } + llxFooter(); $db->close(); 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 40f7da3fa95..1270b8b279a 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 @@ -60,6 +60,8 @@ CREATE TABLE llx_pos_cash_fence( -- For 10.0 +UPDATE llx_chargesociales SET date_creation = tms WHERE date_creation IS NULL; + DROP TABLE llx_cotisation; ALTER TABLE llx_accounting_bookkeeping DROP COLUMN validated; ALTER TABLE llx_accounting_bookkeeping_tmp DROP COLUMN validated; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 387f8e159ec..37d3f984824 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -400,6 +400,7 @@ ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (accou -- p.tva_tx = 0 -- where price = 17.5 +UPDATE llx_chargesociales SET date_creation = tms WHERE date_creation IS NULL; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 2ded2013601..90228aa952e 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -173,7 +173,7 @@ if (! empty($conf->projet->enabled)) $tmparray['projet/index.php?mainmenu=projec if (! empty($conf->holiday->enabled) || ! empty($conf->expensereport->enabled)) $tmparray['hrm/index.php?mainmenu=hrm&leftmenu=']='HRMArea'; // TODO Complete list with first level of menus if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) $tmparray['product/index.php?mainmenu=products&leftmenu=']='ProductsAndServicesArea'; if (! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->contrat->enabled)) $tmparray['comm/index.php?mainmenu=commercial&leftmenu=']='CommercialArea'; -if (! empty($conf->compta->enabled) || ! empty($conf->accounting->enabled)) $tmparray['compta/index.php?mainmenu=compta&leftmenu=']='AccountancyTreasuryArea'; +if (! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled)) $tmparray['compta/index.php?mainmenu=compta&leftmenu=']='AccountancyTreasuryArea'; if (! empty($conf->adherent->enabled)) $tmparray['adherents/index.php?mainmenu=members&leftmenu=']='MembersArea'; if (! empty($conf->agenda->enabled)) $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu=']='Agenda'; From ad20a5158c2abe0a04efa3b4fa74a265b5071ead Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 14:32:28 +0200 Subject: [PATCH 073/515] Fix columns in csv --- htdocs/compta/accounting-files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index c663a179d6d..0954a194b73 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -294,7 +294,7 @@ if ($result && $action == "dl" && ! $error) dol_mkdir($dirfortmpfile); - $log=$langs->transnoentitiesnoconv("Type").','.$langs->transnoentitiesnoconv("Date").','.$langs->transnoentitiesnoconv("Ref").','.$langs->transnoentitiesnoconv("TotalHT").','.$langs->transnoentitiesnoconv("TotalTTC").','.$langs->transnoentitiesnoconv("TotalVAT").','.$langs->transnoentitiesnoconv("Paid").',filename,item_id,'.$langs->trans("ThirdParty").','.$langs->trans("Code").','.$langs->trans("Country").','.$langs->trans("VATIntra")."\n"; + $log=$langs->transnoentitiesnoconv("Type").','.$langs->transnoentitiesnoconv("Date").','.$langs->transnoentitiesnoconv("Ref").','.$langs->transnoentitiesnoconv("TotalHT").','.$langs->transnoentitiesnoconv("TotalTTC").','.$langs->transnoentitiesnoconv("TotalVAT").','.$langs->transnoentitiesnoconv("Paid").',filename,item_id,'.$langs->transnoentitiesnoconv("ThirdParty").','.$langs->transnoentitiesnoconv("Code").','.$langs->transnoentitiesnoconv("Country").','.$langs->transnoentitiesnoconv("VATIntra")."\n"; $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip'; dol_delete_file($zipname); From 27f52dd0bd73fdb2faa9c121ec95fb7fb512839c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 14:32:35 +0200 Subject: [PATCH 074/515] Fix columns in csv --- htdocs/compta/compta-files.php | 474 +++++++++++++++++++-------------- 1 file changed, 276 insertions(+), 198 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index be08e264a02..e28df61e658 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2018 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2017 Pierre-Henry Favre * * This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ * along with this program. If not, see . */ /** - * \file htdocs/compta/compta-files.php + * \file htdocs/compta/accounting-files.php * \ingroup compta * \brief Page to show portoflio and files of a thirdparty and download it */ @@ -25,15 +25,14 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -$langs->loadLangs(array("accountancy","bills")); +$langs->loadLangs(array("accountancy", "bills", "companies", "salaries")); $date_start =GETPOST('date_start', 'alpha'); $date_startDay= GETPOST('date_startday', 'int'); @@ -45,7 +44,7 @@ $date_stopDay= GETPOST('date_stopday', 'int'); $date_stopMonth= GETPOST('date_stopmonth', 'int'); $date_stopYear= GETPOST('date_stopyear', 'int'); //FIXME doldate -$date_stop=($date_stopDay)?dol_mktime(0, 0, 0, $date_stopMonth, $date_stopDay, $date_stopYear):strtotime($date_stop); +$date_stop=($date_stopDay)?dol_mktime(23, 59, 59, $date_stopMonth, $date_stopDay, $date_stopYear):strtotime($date_stop); $action =GETPOST('action', 'alpha'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -65,6 +64,7 @@ if (! $sortorder) $sortorder="DESC"; $arrayfields=array( + 'type'=>array('label'=>"Type", 'checked'=>1), 'date'=>array('label'=>"Date", 'checked'=>1), //... ); @@ -74,8 +74,9 @@ if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled)) { accessforbidden(); } if ($user->societe_id > 0) +{ accessforbidden(); - +} /* @@ -90,157 +91,211 @@ $entity = GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity; $filesarray=array(); $result=false; -if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ - $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; - $sql="SELECT rowid as id, facnumber as ref,paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; - $sql.=" WHERE datef between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".Facture::STATUS_DRAFT; - $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref, paye as paid, total_ttc, fk_soc, datef as date, 'SupplierInvoice' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; - $sql.=" WHERE datef between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".FactureFournisseur::STATUS_DRAFT; - $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref, paid, total_ttc, fk_user_author as fk_soc, date_fin as date,'ExpenseReport' as item FROM ".MAIN_DB_PREFIX."expensereport"; - $sql.=" WHERE date_fin between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".ExpenseReport::STATUS_DRAFT; - $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, ref,paid,amount as total_ttc, '0' as fk_soc, datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don"; - $sql.=" WHERE datedon between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - $sql.=" AND fk_statut <> ".Don::STATUS_DRAFT; - $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, label as ref, 1 as paid, amount as total_ttc, fk_user as fk_soc,datep as date,'SalaryPayment' as item FROM ".MAIN_DB_PREFIX."payment_salary"; - $sql.=" WHERE datep between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; - $sql.=" UNION ALL"; - $sql.=" SELECT rowid as id, libelle as ref, paye as paid, amount as total_ttc, 0 as fk_soc, date_creation as date, 'SocialContributions' as item FROM ".MAIN_DB_PREFIX."chargesociales"; - $sql.=" WHERE date_creation between ".$wheretail; - $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; - //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; - $sql.= $db->order($sortfield, $sortorder); +if (($action=="searchfiles" || $action=="dl" )) { - $resd = $db->query($sql); - $files=array(); - $link=''; - - if ($resd) + if (empty($date_start)) { - $numd = $db->num_rows($resd); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart")), null, 'errors'); + $error++; + } + if (empty($date_stop)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors'); + $error++; + } - $tmpinvoice=new Facture($db); - $tmpinvoicesupplier=new FactureFournisseur($db); - $tmpdonation=new Don($db); + if (! $error) + { + $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; - $upload_dir =''; - $i=0; - while ($i < $numd) + $sql="SELECT t.rowid as id, t.facnumber as ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; + $sql.=" WHERE datef between ".$wheretail; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".Facture::STATUS_DRAFT; + $sql.=" UNION ALL"; + $sql.=" SELECT t.rowid as id, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; + $sql.=" WHERE datef between ".$wheretail; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT; + $sql.=" UNION ALL"; + $sql.=" SELECT t.rowid as id, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; + $sql.=" WHERE date_fin between ".$wheretail; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".ExpenseReport::STATUS_DRAFT; + $sql.=" UNION ALL"; + $sql.=" SELECT t.rowid as id, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country"; + $sql.=" WHERE datedon between ".$wheretail; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + $sql.=" AND t.fk_statut <> ".Don::STATUS_DRAFT; + $sql.=" UNION ALL"; + $sql.=" SELECT t.rowid as id, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; + $sql.=" WHERE datep between ".$wheretail; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; + $sql.=" UNION ALL"; + $sql.=" SELECT t.rowid as id, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum"; + $sql.=" FROM ".MAIN_DB_PREFIX."chargesociales as t"; + $sql.=" WHERE date_creation between ".$wheretail; + $sql.=" AND t.entity IN (".($entity==1?'0,1':$entity).')'; + //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; + $sql.= $db->order($sortfield, $sortorder); + //print $sql; + + $resd = $db->query($sql); + $files=array(); + $link=''; + + if ($resd) { - $objd = $db->fetch_object($resd); + $numd = $db->num_rows($resd); - switch($objd->item) - { - case "Invoice": - $subdir=dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->facture->dir_output.'/'.$subdir; - $link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - case "SupplierInvoice": - $tmpinvoicesupplier->fetch($objd->id); - $subdir=get_exdir($tmpinvoicesupplier->id, 2, 0, 0, $tmpinvoicesupplier, 'invoice_supplier').'/'.dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir; - $link="document.php?modulepart=facture_fournisseur&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - case "ExpenseReport": - $subdir=dol_sanitizeFileName($objd->ref); - $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; - $link="document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - case "SalaryPayment": - $subdir=dol_sanitizeFileName($objd->id); - $upload_dir = $conf->salaries->dir_output.'/'.$subdir; - $link="document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - case "Donation": - $tmpdonation->fetch($objp->id); - $subdir=get_exdir(0, 0, 0, 1, $tmpdonation, 'donation'). '/'. dol_sanitizeFileName($objd->id); - $upload_dir = $conf->don->dir_output . '/' . $subdir; - $link="document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - case "SocialContributions": - $subdir=dol_sanitizeFileName($objd->id); - $upload_dir = $conf->tax->dir_output . '/' . $subdir; - $link="document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F'; - break; - default: - $subdir=''; - $upload_dir=''; - $link=''; - break; - } + $tmpinvoice=new Facture($db); + $tmpinvoicesupplier=new FactureFournisseur($db); + $tmpdonation=new Don($db); - if (!empty($upload_dir)) + $upload_dir =''; + $i=0; + while ($i < $numd) { - $result=true; - $files=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); - //var_dump($upload_dir); - if (count($files) < 1) + $objd = $db->fetch_object($resd); + + switch($objd->item) { - $nofile['date']=$db->idate($objd->date); - $nofile['paid']=$objd->paid; - $nofile['amount']=$objd->total_ttc; - $nofile['ref']=$objd->ref; - $nofile['fk']=$objd->fk_soc; - $nofile['item']=$objd->item; - - $filesarray[]=$nofile; + case "Invoice": + $subdir = ''; + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->facture->dir_output.'/'.$subdir; + $link="document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "SupplierInvoice": + $tmpinvoicesupplier->fetch($objd->id); + $subdir = get_exdir($tmpinvoicesupplier->id, 2, 0, 1, $tmpinvoicesupplier, 'invoice_supplier'); // TODO Use first file + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir; + $link="document.php?modulepart=facture_fournisseur&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "ExpenseReport": + $subdir = ''; + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; + $link="document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "SalaryPayment": + $subdir = ''; + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); + $upload_dir = $conf->salaries->dir_output.'/'.$subdir; + $link="document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "Donation": + $tmpdonation->fetch($objp->id); + $subdir=get_exdir(0, 0, 0, 0, $tmpdonation, 'donation'); + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); + $upload_dir = $conf->don->dir_output . '/' . $subdir; + $link="document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + case "SocialContributions": + $subdir = ''; + $subdir.=($subdir ? '/' : '').dol_sanitizeFileName($objd->id); + $upload_dir = $conf->tax->dir_output . '/' . $subdir; + $link="document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F'; + break; + default: + $subdir=''; + $upload_dir=''; + $link=''; + break; } - else - { - foreach ($files as $key => $file) - { - $file['date']=$db->idate($objd->date); - $file['paid']=$objd->paid; - $file['amount']=$objd->total_ttc; - $file['ref']=$objd->ref; - $file['fk']=$objd->fk_soc; - $file['item']=$objd->item; - $file['link']=$link.$file['name']; - $file['relpathnamelang'] = $langs->trans($file['item']).'/'.$file['name']; - $filesarray[]=$file; + if (!empty($upload_dir)) + { + $result=true; + $files=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); + //var_dump($upload_dir); + if (count($files) < 1) + { + $nofile['id']=$objd->id; + $nofile['date']=$db->idate($objd->date); + $nofile['paid']=$objd->paid; + $nofile['amount_ht']=$objd->total_ht; + $nofile['amount_ttc']=$objd->total_ttc; + $nofile['amount_vat']=$objd->total_vat; + $nofile['ref']=($objd->ref ? $objd->ref : $objd->id); + $nofile['fk']=$objd->fk_soc; + $nofile['item']=$objd->item; + $nofile['thirdparty_name']=$objd->thirdparty_name; + $nofile['thirdparty_code']=$objd->thirdparty_code; + $nofile['country_code']=$objd->country_code; + $nofile['vatnum']=$objd->vatnum; + + $filesarray[]=$nofile; + } + else + { + foreach ($files as $key => $file) + { + $file['id']=$objd->id; + $file['date']=$db->idate($objd->date); + $file['paid']=$objd->paid; + $file['amount_ht']=$objd->total_ht; + $file['amount_ttc']=$objd->total_ttc; + $file['amount_vat']=$objd->total_vat; + $file['ref']=($objd->ref ? $objd->ref : $objd->id); + $file['fk']=$objd->fk_soc; + $file['item']=$objd->item; + + $file['thirdparty_name']=$objd->thirdparty_name; + $file['thirdparty_code']=$objd->thirdparty_code; + $file['country_code']=$objd->country_code; + $file['vatnum']=$objd->vatnum; + + $file['link']=$link.$file['name']; + $file['relpathnamelang'] = $langs->trans($file['item']).'/'.$file['name']; + + $filesarray[]=$file; + } } } + $i++; } - $i++; } - } - else - { - dol_print_error($db); - } + else + { + dol_print_error($db); + } - $db->free($resd); + $db->free($resd); + } } -/* - * cleanup of old ZIP - */ -//FIXME + /* *ZIP creation */ -if ($result && $action == "dl") +$dirfortmpfile = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->comptabilite->dir_temp); +if (empty($dirfortmpfile)) { - $dirfortmpfile = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->compta->dir_temp); + setEventMessages($langs->trans("ErrorNoAccountingModuleEnabled"), null, 'errors'); + $error++; +} + + +if ($result && $action == "dl" && ! $error) +{ + if (! extension_loaded('zip')) + { + setEventMessages('PHPZIPExtentionNotLoaded', null, 'errors'); + exit; + } dol_mkdir($dirfortmpfile); - $log='date,type,ref,total,paid,filename,item_id'."\n"; + $log=$langs->transnoentitiesnoconv("Type").','.$langs->transnoentitiesnoconv("Date").','.$langs->transnoentitiesnoconv("Ref").','.$langs->transnoentitiesnoconv("TotalHT").','.$langs->transnoentitiesnoconv("TotalTTC").','.$langs->transnoentitiesnoconv("TotalVAT").','.$langs->transnoentitiesnoconv("Paid").',filename,item_id,'.$langs->transnoentitiesnoconv("ThirdParty").','.$langs->transnoentitiesnoconv("Code").','.$langs->transnoentitiesnoconv("Country").','.$langs->transnoentitiesnoconv("VATIntra")."\n"; $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip'; dol_delete_file($zipname); @@ -249,10 +304,10 @@ if ($result && $action == "dl") $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); if ($res) { - foreach ($filesarray as $key=> $file) + foreach ($filesarray as $key => $file) { if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); // - $log.=dol_print_date($file['date'], 'dayrfc').','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; + $log.=$file['item'].','.dol_print_date($file['date'], 'dayrfc').','.$file['ref'].','.$file['amount_ht'].','.$file['amount_ttc'].','.$file['amount_vat'].','.$file['paid'].','.$file["name"].','.$file['fk'].','.$file['thirdparty_name'].','.$file['thirdparty_code'].','.$file['country_code'].',"'.$file['vatnum'].'"'."\n"; } $zip->addFromString('transactions.csv', $log); $zip->close(); @@ -267,6 +322,10 @@ if ($result && $action == "dl") exit(); } + else + { + setEventMessages($langs->trans("FailedToOpenFile", $zipname), null, 'errors'); + } } @@ -283,7 +342,7 @@ llxHeader('', $title, $help_url); $h=0; $head[$h][0] = $_SERVER["PHP_SELF"].$varlink; -$head[$h][1] = $langs->trans("AccountancyFiles"); +$head[$h][1] = $langs->trans("AccountantFiles"); $head[$h][2] = 'AccountancyFiles'; dol_fiche_head($head, 'AccountancyFiles'); @@ -293,45 +352,20 @@ print '
'; print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0); print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n"; -// Multicompany -/*if (! empty($conf->multicompany->enabled) && is_object($mc)) - { - print '
'; - // This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module - if (method_exists($mc, 'formObjectOptions')) - { - if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) // condition must be same for create and edit mode - { - print "
".''; - print "\n"; - } - else - { - print ''; - } - } - $object = new stdClass(); - // Other attributes - $parameters=array('objectsrc' => null, 'colspan' => ' colspan="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'); - } - }*/ +// Export is for current company only ! if (! empty($conf->multicompany->enabled) && is_object($mc)) { - print '   -   '.$langs->trans("Entity").' : '; + print '('.$langs->trans("Entity").' : '; $mc->dao->getEntities(); $mc->dao->fetch($conf->entity); print $mc->dao->label; - print "
\n"; + print ")
\n"; } -print ''."\n"; +print ''; + +print ''."\n"; dol_fiche_end(); @@ -369,14 +403,18 @@ if (!empty($date_start) && !empty($date_stop)) print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '
'.$langs->trans("Type").''.$langs->trans("Ref").''.$langs->trans("Document").''.$langs->trans("Paid").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").''.$langs->trans("TotalHT").''.$langs->trans("TotalTTC").''.$langs->trans("TotalVAT").''.$langs->trans("ThirdParty").''.$langs->trans("Code").''.$langs->trans("Country").''.$langs->trans("VATIntra").'
"; + + // Type + print ''.$langs->trans($data['item']).''; print dol_print_date($data['date'], 'day'); print "'.$langs->trans($data['item']).''.$data['ref'].''.$data['ref'].''; @@ -429,23 +458,61 @@ if (!empty($date_start) && !empty($date_stop)) { print ''.($data['name'] ? $data['name'] : $data['ref']).''; } - print "'.$data['paid'].''.price($data['amount_ht'])."'.price($data['amount_ttc'])."'.price($data['amount_vat'])."'.$data['thirdparty_name']."'.$data['thirdparty_code']."'.$data['country_code']."'.$data['vatnum']."'.(($data['amount_ttc'] > 0) ? price(abs($data['amount_ttc'])) : '')."'.(($data['amount_ttc'] > 0) ? '' : price(abs($data['amount_ttc'])))."'.$data['paid'].''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."'.price($data['balance'])."'.price($data['balance'])."
 '.price($totalDebit).''.price($totalCredit).''.price(price2num($totalDebit - $totalCredit, 'MT')).''.price($totalET).''.price($totalIT).''.price($totalVAT).''.price($totalDebit).''.price($totalCredit).''.price(price2num($totalDebit - $totalCredit, 'MT')).'
'.$langs->trans("Entity").'".$mc->select_entities($entity); - print "
'; print ''; - print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - print ''; + print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'nowrap '); + print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, '', $sortfield, $sortorder, 'center nowrap '); print ''; - print ''; + print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; if ($result) { @@ -390,20 +428,11 @@ if (!empty($date_start) && !empty($date_stop)) { // Sort array by date ASC to calculate balance + $totalET = 0; + $totalIT = 0; + $totalVAT = 0; $totalDebit = 0; $totalCredit = 0; - // Balance calculation - $balance = 0; - foreach($TData as &$data1) { - if ($data1['item']!='Invoice'&& $data1['item']!='Donation' ){ - $data1['amount']=-$data1['amount']; - } - if ($data1['amount']>0){ - }else{ - } - $balance += $data1['amount']; - $data1['balance'] = $balance; - } // Display array foreach($TData as $data) @@ -412,30 +441,79 @@ if (!empty($date_start) && !empty($date_stop)) //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; print ''; - print "'; + + // Date + print '\n"; - print ''; + + // Ref print ''; // File link - print '\n"; + print '\n"; + // Paid print ''; - print '\n"; - $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0; - print '\n"; - $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']); + + // Total ET + print '\n"; + // Total IT + print '\n"; + // Total VAT + print '\n"; + + print '\n"; + + print '\n"; + + print '\n"; + + print '\n"; + + // Debit + //print '\n"; + // Credit + //print '\n"; + + $totalET += $data['amount_ht']; + $totalIT += $data['amount_ttc']; + $totalVAT += $data['amount_vat']; + + $totalDebit += ($data['amount_ttc'] > 0) ? abs($data['amount_ttc']) : 0; + $totalCredit += ($data['amount_ttc'] > 0) ? 0 : abs($data['amount_ttc']); + // Balance - print '\n"; + //print '\n"; + print "\n"; } print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + /*print ''; + print ''; + print ''; + */ print "\n"; } } From 6bda130835a347b075ae79f4132a0969c418e426 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 14:51:57 +0200 Subject: [PATCH 075/515] Protect from dir scan --- htdocs/bom/admin/index.html | 0 htdocs/bom/class/index.html | 0 htdocs/bom/index.html | 0 htdocs/bom/lib/index.html | 0 htdocs/datapolicy/admin/index.html | 0 htdocs/datapolicy/class/index.html | 0 htdocs/datapolicy/index.html | 0 htdocs/datapolicy/lib/index.html | 0 htdocs/debugbar/index.html | 0 htdocs/website/class/index.html | 0 htdocs/website/lib/index.html | 0 11 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 htdocs/bom/admin/index.html create mode 100644 htdocs/bom/class/index.html create mode 100644 htdocs/bom/index.html create mode 100644 htdocs/bom/lib/index.html create mode 100644 htdocs/datapolicy/admin/index.html create mode 100644 htdocs/datapolicy/class/index.html create mode 100644 htdocs/datapolicy/index.html create mode 100644 htdocs/datapolicy/lib/index.html create mode 100644 htdocs/debugbar/index.html create mode 100644 htdocs/website/class/index.html create mode 100644 htdocs/website/lib/index.html diff --git a/htdocs/bom/admin/index.html b/htdocs/bom/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/bom/class/index.html b/htdocs/bom/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/bom/index.html b/htdocs/bom/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/bom/lib/index.html b/htdocs/bom/lib/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/datapolicy/admin/index.html b/htdocs/datapolicy/admin/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/datapolicy/class/index.html b/htdocs/datapolicy/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/datapolicy/index.html b/htdocs/datapolicy/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/datapolicy/lib/index.html b/htdocs/datapolicy/lib/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/debugbar/index.html b/htdocs/debugbar/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/website/class/index.html b/htdocs/website/class/index.html new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/website/lib/index.html b/htdocs/website/lib/index.html new file mode 100644 index 00000000000..e69de29bb2d From 492c3b5625f28f2fe117ed6c8041d9415a0eaac8 Mon Sep 17 00:00:00 2001 From: Nicolas ZABOURI Date: Tue, 18 Jun 2019 15:13:08 +0200 Subject: [PATCH 076/515] 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 6afda6a47a8db60cf16e11d3475862c41c435016 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 15:57:22 +0200 Subject: [PATCH 077/515] FIX invalid link on user.fk_user --- htdocs/install/mysql/migration/repair.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 22409441eac..dc9fcc86df6 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -199,6 +199,15 @@ delete from llx_element_element where sourcetype='commande' and fk_source not in DELETE FROM llx_actioncomm_resources WHERE fk_actioncomm not in (select id from llx_actioncomm); +-- Fix link on parent that were removed +DROP table tmp_user; +CREATE TABLE tmp_user as (select * from llx_user); +UPDATE llx_user SET fk_user = NULL where fk_user NOT IN (select rowid from tmp_user); + + +update llx_user set fk_user = null where fk_user not in (select rowid from llx_user); + + UPDATE llx_product SET canvas = NULL where canvas = 'default@product'; UPDATE llx_product SET canvas = NULL where canvas = 'service@product'; From 6e9874b95ad50d6011fbd5677442cc9d69944804 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 16:01:24 +0200 Subject: [PATCH 078/515] FIX A user may read holiday and expense report without permissions --- htdocs/expensereport/list.php | 16 +++++++++++++++- htdocs/holiday/list.php | 12 ++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 3b153bcf843..8b5ef11f128 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -46,10 +46,25 @@ $confirm=GETPOST('confirm','alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'expensereportlist'; +$childids = $user->getAllChildIds(1); + // Security check $socid = GETPOST('socid','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'expensereport','',''); +$id = GETPOST('id', 'int'); +// If we are on the view of a specific user +if ($id > 0) +{ + $canread=0; + if ($id == $user->id) $canread=1; + if (! empty($user->rights->holiday->read_all)) $canread=1; + if (! empty($user->rights->holiday->read) && in_array($id, $childids)) $canread=1; + if (! $canread) + { + accessforbidden(); + } +} $diroutputmassaction=$conf->expensereport->dir_output . '/temp/massgeneration/'.$user->id; @@ -66,7 +81,6 @@ $pagenext = $page + 1; if (!$sortorder) $sortorder="DESC"; if (!$sortfield) $sortfield="d.date_debut"; -$id = GETPOST('id', 'int'); $sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST('search_ref', 'alpha'); diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 5df3fdb314b..d07ec98ca4c 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -60,6 +60,18 @@ if ($user->societe_id > 0) // Protection if external user } $result = restrictedArea($user, 'holiday', $id, ''); $id = GETPOST('id','int'); +// If we are on the view of a specific user +if ($id > 0) +{ + $canread=0; + if ($id == $user->id) $canread=1; + if (! empty($user->rights->holiday->read_all)) $canread=1; + if (! empty($user->rights->holiday->read) && in_array($id, $childids)) $canread=1; + if (! $canread) + { + accessforbidden(); + } +} // Load variable for pagination $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; From 81bca34a08186b79909c41f87ea95c087530c219 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 16:04:25 +0200 Subject: [PATCH 079/515] FIX A user may read holiday and expense report without permissions --- htdocs/expensereport/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 8b5ef11f128..0014cb7999c 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -58,8 +58,8 @@ if ($id > 0) { $canread=0; if ($id == $user->id) $canread=1; - if (! empty($user->rights->holiday->read_all)) $canread=1; - if (! empty($user->rights->holiday->read) && in_array($id, $childids)) $canread=1; + if (! empty($user->rights->expensereport->readall)) $canread=1; + if (! empty($user->rights->expensereport->lire) && in_array($id, $childids)) $canread=1; if (! $canread) { accessforbidden(); From 13abfc3140298227cbaaa02aef53503efe2b0db3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 16:46:12 +0200 Subject: [PATCH 080/515] Code comment --- htdocs/install/mysql/tables/llx_societe.sql | 34 ++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index ed4919c3fc5..e7a948d67c2 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -65,34 +65,34 @@ create table llx_societe fk_typent integer DEFAULT 0, -- fk_forme_juridique integer DEFAULT 0, -- juridical status fk_currency varchar(3), -- default currency - siren varchar(128), -- IDProf1: siren or RCS for france, ... - siret varchar(128), -- IDProf2: siret for france, ... - ape varchar(128), -- IDProf3: code ape for france, ... - idprof4 varchar(128), -- IDProf4: nu for france - idprof5 varchar(128), -- IDProf5: nu for france - idprof6 varchar(128), -- IDProf6: nu for france - tva_intra varchar(20), -- tva - capital double(24,8) DEFAULT NULL, -- capital de la societe - fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial statut + siren varchar(128), -- IDProf1: depends on country (example: siren or RCS for france, ...) + siret varchar(128), -- IDProf2: depends on country (example: siret for france, ...) + ape varchar(128), -- IDProf3: depends on country (example: code ape for france, ...) + idprof4 varchar(128), -- IDProf4: depends on country (example: nu for france, ...) + idprof5 varchar(128), -- IDProf5: depends on country (example: nu for france, ...) + idprof6 varchar(128), -- IDProf6: depends on country (example: nu for france, ... + tva_intra varchar(20), -- vat numero + capital double(24,8) DEFAULT NULL, -- capital of company + fk_stcomm integer DEFAULT 0 NOT NULL, -- commercial status note_private text, -- note_public text, -- model_pdf varchar(255), - prefix_comm varchar(5), -- prefix commercial + prefix_comm varchar(5), -- prefix commercial (deprecated) client tinyint DEFAULT 0, -- client 0/1/2 fournisseur tinyint DEFAULT 0, -- fournisseur 0/1 - supplier_account varchar(32), -- compte client chez un fournisseur + supplier_account varchar(32), -- Id of our customer account known by the supplier fk_prospectlevel varchar(12), -- prospect level (in llx_c_prospectlevel) fk_incoterms integer, -- for incoterms location_incoterms varchar(255), -- for incoterms customer_bad tinyint DEFAULT 0, -- mauvais payeur 0/1 customer_rate real DEFAULT 0, -- taux fiabilite client (0 a 1) supplier_rate real DEFAULT 0, -- taux fiabilite fournisseur (0 a 1) - remise_client real DEFAULT 0, -- remise systematique pour le client - remise_supplier real DEFAULT 0, -- remise systematique auprès du fournisseur - mode_reglement tinyint, -- mode de reglement - cond_reglement tinyint, -- condition de reglement - mode_reglement_supplier tinyint, -- mode de reglement fournisseur - cond_reglement_supplier tinyint, -- condition de reglement fournisseur + remise_client real DEFAULT 0, -- discount by default granted to this customer + remise_supplier real DEFAULT 0, -- discount by default granted by this supplier + mode_reglement tinyint, -- payment mode customer + cond_reglement tinyint, -- payment term customer + mode_reglement_supplier tinyint, -- payment mode supplier + cond_reglement_supplier tinyint, -- payment term supplier fk_shipping_method integer, -- preferred shipping method id tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1 From 181375ff958955a0bd55684d8e4cd97592811672 Mon Sep 17 00:00:00 2001 From: Nicolas ZABOURI Date: Tue, 18 Jun 2019 17:09:46 +0200 Subject: [PATCH 081/515] 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 082/515] 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: Tue, 18 Jun 2019 17:42:45 +0200 Subject: [PATCH 083/515] 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: Tue, 18 Jun 2019 18:07:47 +0200 Subject: [PATCH 084/515] Fix phpcs --- htdocs/compta/accounting-files.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 0954a194b73..9069045c8b3 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -73,16 +73,17 @@ $arrayfields=array( if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled)) { accessforbidden(); } -if ($user->societe_id > 0) +if ($user->societe_id > 0) { accessforbidden(); +} +$entity = GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity; /* * Actions */ -$entity = GETPOST('entity','int')?GETPOST('entity','int'):$conf->entity; //$parameters = array('socid' => $id); //$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks From 20e00ca2905f05474fb441d637c7eafb4029cdb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 19:41:16 +0200 Subject: [PATCH 085/515] FIX if last char of customercode is accent making the truncate of first chars wrong. --- htdocs/core/lib/functions2.lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 649988e785b..5d0f25892c8 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -716,8 +716,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m global $conf,$user; if (! is_object($objsoc)) $valueforccc=$objsoc; - else if ($table == "commande_fournisseur" || $table == "facture_fourn" ) $valueforccc=$objsoc->code_fournisseur; - else $valueforccc=$objsoc->code_client; + else if ($table == "commande_fournisseur" || $table == "facture_fourn" ) $valueforccc=dol_string_unaccent($objsoc->code_fournisseur); + else $valueforccc=dol_string_unaccent($objsoc->code_client); $sharetable = $table; if ($table == 'facture' || $table == 'invoice') $sharetable = 'invoicenumber'; // for getEntity function @@ -965,6 +965,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m // Define $maskLike $maskLike = dol_string_nospecial($mask); $maskLike = str_replace("%","_",$maskLike); + // Replace protected special codes with matching number of _ as wild card caracter $maskLike = preg_replace('/\{yyyy\}/i','____',$maskLike); $maskLike = preg_replace('/\{yy\}/i','__',$maskLike); @@ -1140,7 +1141,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m // Now we replace the refclient if ($maskrefclient) { - //print "maskrefclient=".$maskrefclient." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode."\n
"; + //print "maskrefclient=".$maskrefclient." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode." maskrefclient_clientcode=".$maskrefclient_clientcode."\n
";exit; $maskrefclient_maskbefore='{'.$maskrefclient.'}'; $maskrefclient_maskafter=$maskrefclient_clientcode.str_pad($maskrefclient_counter,dol_strlen($maskrefclient_maskcounter),"0",STR_PAD_LEFT); $numFinal = str_replace($maskrefclient_maskbefore,$maskrefclient_maskafter,$numFinal); From 525598f6aa925b0aeb8f7c02ebdd0edaeb065bde Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 20:01:28 +0200 Subject: [PATCH 086/515] Fix scrutinizer warnings --- htdocs/adherents/class/adherent.class.php | 8 ++++---- htdocs/contact/class/contact.class.php | 2 +- htdocs/user/class/user.class.php | 1 - htdocs/user/class/usergroup.class.php | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 3119e044be0..1856de6182f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -183,14 +183,14 @@ class Adherent extends CommonObject * @var integer */ public $datec; - + /** * Date modification record (tms) * * @var integer */ public $datem; - + public $datevalid; public $gender; @@ -1268,7 +1268,7 @@ class Adherent extends CommonObject $this->ref = $obj->rowid; $this->id = $obj->rowid; $this->ref_ext = $obj->ref_ext; - + $this->civility_id = $obj->civility_code; // Bad. Kept for backard compatibility $this->civility_code = $obj->civility_code; $this->civility = $obj->civility_code?($langs->trans("Civility".$obj->civility_code) != ("Civility".$obj->civility_code) ? $langs->trans("Civility".$obj->civility_code) : $obj->civility_code):''; @@ -2465,7 +2465,7 @@ class Adherent extends CommonObject * * @return array Tableau info des attributs */ - private function _load_ldap_info() + public function _load_ldap_info() { // phpcs:enable global $conf,$langs; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index dfefb8060fe..5c4df6ab3f9 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -525,7 +525,7 @@ class Contact extends CommonObject * * @return array Tableau info des attributs */ - private function _load_ldap_info() + public function _load_ldap_info() { // phpcs:enable global $conf, $langs; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 34651304b95..c5ac20e8cc7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2300,7 +2300,6 @@ class User extends CommonObject if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0; $result=''; $label=''; - $link=''; $linkstart=''; $linkend=''; if (! empty($this->photo)) { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index c3fe000292c..9fb6e600a3b 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -867,7 +867,6 @@ class UserGroup extends CommonObject if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpicto) $withpicto=0; $result=''; $label=''; - $link=''; $linkstart=''; $linkend=''; $label.= '
'; $label.= '' . $langs->trans("Group") . '
'; @@ -957,7 +956,7 @@ class UserGroup extends CommonObject public function _load_ldap_info() { // phpcs:enable - global $conf,$langs; + global $conf; $info=array(); From 663998bab11a371b4162c89c2f5893a8075b352d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 20:15:04 +0200 Subject: [PATCH 087/515] Fix scrutinizer errors --- htdocs/includes/odtphp/odf.php | 2 +- htdocs/opensurvey/results.php | 4 ++-- htdocs/product/price.php | 2 +- htdocs/user/class/user.class.php | 12 ++++++------ htdocs/user/class/usergroup.class.php | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 6b3a6400bc3..21e9b56b4bb 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); diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index c648b15664e..1b3034bb82c 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -249,8 +249,8 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D") $dateinsertion = substr("$dateinsertion", 1); - //mise a jour avec les nouveaux sujets dans la base - if (isset($erreur_ajout_date) && !$erreur_ajout_date) + // update with new topics into database + if (isset($erreur_ajout_date) && empty($erreur_ajout_date)) { $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; $sql.= " SET sujet = '".$db->escape($dateinsertion)."'"; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 5b5b9ad48fa..26970f1dd13 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -153,7 +153,7 @@ if (empty($reshook)) $db->begin(); $resql = $object->update($object->id, $user); - if (! $resql || $resql < 0) + if ($resql <= 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index c5ac20e8cc7..a151fdb5574 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -774,7 +774,7 @@ class User extends CommonObject dol_syslog(get_class($this)."::clearrights reset user->rights"); $this->rights=''; $this->nb_rights=0; - $this->all_permissions_are_loaded=false; + $this->all_permissions_are_loaded=0; $this->_tab_loaded=array(); } @@ -799,16 +799,16 @@ class User extends CommonObject return; } - if ($this->all_permissions_are_loaded) + if (! empty($this->all_permissions_are_loaded)) { // We already loaded all rights for this user, so we leave return; } } - // Recuperation des droits utilisateurs + recuperation des droits groupes + // Get permission of users + Get permissions of groups - // D'abord les droits utilisateurs + // First user permissions $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; $sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur"; $sql.= ", ".MAIN_DB_PREFIX."rights_def as r"; @@ -862,7 +862,7 @@ class User extends CommonObject $this->db->free($resql); } - // Maintenant les droits groupes + // Now permissions of groups $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; $sql.= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,"; $sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu,"; @@ -933,7 +933,7 @@ class User extends CommonObject } else { - // Si module defini, on le marque comme charge en cache + // If module defined, we flag it as loaded into cache $this->_tab_loaded[$moduletag]=1; } } diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 9fb6e600a3b..d51d82c8d13 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -552,13 +552,13 @@ class UserGroup extends CommonObject if ($moduletag && isset($this->_tab_loaded[$moduletag]) && $this->_tab_loaded[$moduletag]) { - // Le fichier de ce module est deja charge + // Rights for this module are already loaded, so we leave return; } if (! empty($this->all_permissions_are_loaded)) { - // Si les permissions ont deja ete chargees, on quitte + // We already loaded all rights for this group, so we leave return; } @@ -618,7 +618,7 @@ class UserGroup extends CommonObject } else { - // Si module defini, on le marque comme charge en cache + // If module defined, we flag it as loaded into cache $this->_tab_loaded[$moduletag]=1; } From 53923a8581e5a710a46f289b0df61769df1b4f56 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Jun 2019 20:21:22 +0200 Subject: [PATCH 088/515] Fix scrutinizer warnings --- htdocs/core/db/sqlite3.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index b7d06870ff5..360b72f80d9 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -403,9 +403,13 @@ class DoliDBSqlite3 extends DoliDB */ public function query($query, $usesavepoint = 0, $type = 'auto') { + global $conf; + $ret=null; + $query = trim($query); - $this->error = 0; + + $this->error = ''; // Convert MySQL syntax to SQLite syntax if (preg_match('/ALTER\s+TABLE\s*(.*)\s*ADD\s+CONSTRAINT\s+(.*)\s*FOREIGN\s+KEY\s*\(([\w,\s]+)\)\s*REFERENCES\s+(\w+)\s*\(([\w,\s]+)\)/i', $query, $reg)) { @@ -449,7 +453,8 @@ class DoliDBSqlite3 extends DoliDB } //print "After convertSQLFromMysql:\n".$query."
\n"; - dol_syslog('sql='.$query, LOG_DEBUG); + if (! in_array($query, array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG); + if (empty($query)) return false; // Return false = error if empty request // Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE) try { @@ -481,7 +486,8 @@ class DoliDBSqlite3 extends DoliDB $errormsg .= ' ('.$this->lasterrno.')'; } - dol_syslog($errormsg, LOG_ERR); + if ($conf->global->SYSLOG_LEVEL < LOG_DEBUG) dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR); // Log of request was not yet done previously + dol_syslog(get_class($this)."::query SQL Error message: ".$errormsg, LOG_ERR); } $this->lastquery=$query; $this->_results = $ret; From bcd5949bacffd3fdd722bc268e70d3556d5419e4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 18 Jun 2019 21:39:30 +0200 Subject: [PATCH 089/515] Responsive on project index --- htdocs/projet/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index fa77cb4b52c..38ef7ee7cf2 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -179,6 +179,7 @@ $sql.= $db->plimit($max, 0); $resql=$db->query($sql); if ($resql) { + print '
'; print '
'.$langs->trans("Type").''.$langs->trans("Ref").''.$langs->trans("Link").''.$langs->trans("Document").''.$langs->trans("Paid").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").''.$langs->trans("TotalHT").''.$langs->trans("TotalTTC").''.$langs->trans("TotalVAT").''.$langs->trans("ThirdParty").''.$langs->trans("Code").''.$langs->trans("Country").''.$langs->trans("VATIntra").'
"; + + // Type + print ''.$langs->trans($data['item']).''; print dol_print_date($data['date'], 'day'); print "'.$langs->trans($data['item']).''.$data['ref'].'".$data['name']."'; + if ($data['link']) + { + print ''.($data['name'] ? $data['name'] : $data['ref']).''; + } + print "'.$data['paid'].''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."'.price($data['amount_ht'])."'.price($data['amount_ttc'])."'.price($data['amount_vat'])."'.$data['thirdparty_name']."'.$data['thirdparty_code']."'.$data['country_code']."'.$data['vatnum']."'.(($data['amount_ttc'] > 0) ? price(abs($data['amount_ttc'])) : '')."'.(($data['amount_ttc'] > 0) ? '' : price(abs($data['amount_ttc'])))."'.price($data['balance'])."'.price($data['balance'])."
 '.price($totalDebit).''.price($totalCredit).''.price(price2num($totalDebit - $totalCredit, 'MT')).''.price($totalET).''.price($totalIT).''.price($totalVAT).''.price($totalDebit).''.price($totalCredit).''.price(price2num($totalDebit - $totalCredit, 'MT')).'
'; print ''; print ''; @@ -242,7 +243,7 @@ if ($resql) $i++; } } - print "
'.$langs->trans("LatestModifiedProjects", $max).'

"; + print "

"; } else dol_print_error($db); From 30fb89ad5e55b520588327de1bea36f93c6a8d03 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 18 Jun 2019 22:03:29 +0200 Subject: [PATCH 090/515] Responsive HRM index --- htdocs/hrm/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 066a21ebad0..54a0837e1fe 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -134,6 +134,7 @@ if (! empty($conf->holiday->enabled)) { $user_id = $user->id; + print '
'; print ''; print ''; print ""; @@ -152,7 +153,7 @@ if (! empty($conf->holiday->enabled)) print ''; print ''; - print '
'.$langs->trans("Holidays").'

'; + print '

'; } elseif (! is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) { From c59de4989455dfc1e438908c4c6d2bc49950e261 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 18 Jun 2019 22:38:52 +0200 Subject: [PATCH 091/515] Translate rights --- htdocs/core/class/html.formaccounting.class.php | 2 +- htdocs/core/lib/accounting.lib.php | 2 +- htdocs/langs/en_US/admin.lang | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 87b32902684..7d9e778ac41 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -21,7 +21,7 @@ /** * \file htdocs/core/class/html.formaccounting.class.php - * \ingroup Advanced accountancy + * \ingroup Accountancy (Double entries) * \brief File of class with all html predefined components */ require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php'; diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 889d9da8a2c..e55083c4822 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -19,7 +19,7 @@ /** * \file htdocs/core/lib/accounting.lib.php - * \ingroup Advanced accountancy + * \ingroup Accountancy (Double entries) * \brief Library of accountancy functions */ diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5fc1994247c..5f69be03dba 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -885,6 +885,12 @@ 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 +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 ce375440884d31c60a60e80e422870a966c8b47d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 18 Jun 2019 22:41:18 +0200 Subject: [PATCH 092/515] Translate rights --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5f69be03dba..f26088f747c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -804,6 +804,7 @@ Permission401=Read discounts Permission402=Create/modify discounts Permission403=Validate discounts Permission404=Delete discounts +Permission430=Use Debug Bar Permission511=Read payments of salaries Permission512=Create/modify payments of salaries Permission514=Delete payments of salaries From 4de0a57f5cc435afb5c1192e55bac6cf5753dff1 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 18 Jun 2019 22:44:43 +0200 Subject: [PATCH 093/515] Translate rights --- htdocs/langs/en_US/admin.lang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f26088f747c..56a8381021e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -883,6 +883,10 @@ Permission2503=Submit or delete documents Permission2515=Setup documents directories Permission2801=Use FTP client in read mode (browse and download only) Permission2802=Use FTP client in write mode (delete or upload files) +Permission10001=Read website content +Permission10002=Create/modify website content (html and javascript content) +Permission10003=Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers. +Permission10005=Delete website content Permission50101=Use Point of Sale Permission50201=Read transactions Permission50202=Import transactions From a0ae1e96a374e4e243b73f6b4f53757b49da3d5f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 18 Jun 2019 22:52:37 +0200 Subject: [PATCH 094/515] Translate rights --- htdocs/langs/en_US/admin.lang | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 56a8381021e..cfc244b0fe0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -838,6 +838,12 @@ Permission1101=Read delivery orders Permission1102=Create/modify delivery orders Permission1104=Validate delivery orders Permission1109=Delete delivery orders +Permission1121=Read supplier proposals +Permission1122=Create/modify supplier proposals +Permission1123=Validate supplier proposals +Permission1124=Send supplier proposals +Permission1125=Delete supplier proposals +Permission1126=Close supplier price requests Permission1181=Read suppliers Permission1182=Read purchase orders Permission1183=Create/modify purchase orders From 42b03ec85893b0083161abcafa33b7082e118209 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 18 Jun 2019 22:53:50 +0200 Subject: [PATCH 095/515] Translate rights --- htdocs/langs/en_US/admin.lang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cfc244b0fe0..60a80bb15bc 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -902,6 +902,10 @@ Permission50412=Write/Edit operations in 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 +Permission51001=Read assets +Permission51002=Create/Update assets +Permission51003=Delete assets +Permission51005=Setup types of asset Permission54001=Print Permission55001=Read polls Permission55002=Create/modify polls From e1c476e744da16429c72e99b80263e844b0818dc Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 05:48:04 +0200 Subject: [PATCH 096/515] Translate rights --- htdocs/langs/en_US/admin.lang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 60a80bb15bc..0c4d7de3962 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -819,6 +819,9 @@ Permission532=Create/modify services Permission534=Delete services Permission536=See/manage hidden services Permission538=Export services +Permission650=Read bom of Bom +Permission651=Create/Update bom of Bom +Permission652=Delete bom of Bom Permission701=Read donations Permission702=Create/modify donations Permission703=Delete donations From 9234a5446872983f6cfa4bf01f46234c1b17a445 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 05:49:23 +0200 Subject: [PATCH 097/515] Translate rights --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0c4d7de3962..820fac9e2d4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -892,6 +892,7 @@ Permission2503=Submit or delete documents Permission2515=Setup documents directories Permission2801=Use FTP client in read mode (browse and download only) Permission2802=Use FTP client in write mode (delete or upload files) +Permission3200=Read archived events and fingerprints Permission10001=Read website content Permission10002=Create/modify website content (html and javascript content) Permission10003=Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers. From f91c40a45c2907c9cd927330b9e58b8f4f8466c3 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 06:00:11 +0200 Subject: [PATCH 098/515] Translate rights --- htdocs/langs/en_US/admin.lang | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 820fac9e2d4..c135fe86206 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -869,16 +869,6 @@ Permission1251=Run mass imports of external data into database (data load) Permission1321=Export customer invoices, attributes and payments Permission1322=Reopen a paid bill Permission1421=Export sales orders and attributes -Permission20001=Read leave requests (your leave and those of your subordinates) -Permission20002=Create/modify your leave requests (your leave and those of your subordinates) -Permission20003=Delete leave requests -Permission20004=Read all leave requests (even of user not subordinates) -Permission20005=Create/modify leave requests for everybody (even of user not subordinates) -Permission20006=Admin leave requests (setup and update balance) -Permission23001=Read Scheduled job -Permission23002=Create/update Scheduled job -Permission23003=Delete Scheduled job -Permission23004=Execute Scheduled job Permission2401=Read actions (events or tasks) linked to his account Permission2402=Create/modify actions (events or tasks) linked to his account Permission2403=Delete actions (events or tasks) linked to his account @@ -893,10 +883,24 @@ Permission2515=Setup documents directories Permission2801=Use FTP client in read mode (browse and download only) Permission2802=Use FTP client in write mode (delete or upload files) Permission3200=Read archived events and fingerprints +Permission4001=See employees +Permission4002=Create employees +Permission4003=Delete employees +Permission4004=Export employees Permission10001=Read website content Permission10002=Create/modify website content (html and javascript content) Permission10003=Create/modify website content (dynamic php code). Dangerous, must be reserved to restricted developers. Permission10005=Delete website content +Permission20001=Read leave requests (your leave and those of your subordinates) +Permission20002=Create/modify your leave requests (your leave and those of your subordinates) +Permission20003=Delete leave requests +Permission20004=Read all leave requests (even of user not subordinates) +Permission20005=Create/modify leave requests for everybody (even of user not subordinates) +Permission20006=Admin leave requests (setup and update balance) +Permission23001=Read Scheduled job +Permission23002=Create/update Scheduled job +Permission23003=Delete Scheduled job +Permission23004=Execute Scheduled job Permission50101=Use Point of Sale Permission50201=Read transactions Permission50202=Import transactions From 13836d3e219514d5aaf84c1287fd9835c65d0634 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 06:21:53 +0200 Subject: [PATCH 099/515] Missing language ley --- htdocs/core/modules/modSalaries.class.php | 2 +- htdocs/langs/en_US/salaries.lang | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index e111e81ef6b..ed3aec4a48b 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -144,7 +144,7 @@ class modSalaries extends DolibarrModules $r++; $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='Salaries and payments'; + $this->export_label[$r]='SalariesAndPayments'; $this->export_permission[$r]=array(array("salaries","export")); $this->export_fields_array[$r]=array('u.firstname'=>"Firstname",'u.lastname'=>"Lastname",'u.login'=>"Login",'u.salary'=>'CurrentSalary','p.datep'=>'DatePayment','p.datesp'=>'DateStartPeriod','p.dateep'=>'DateEndPeriod','p.amount'=>'AmountPayment','p.num_payment'=>'Numero','p.label'=>'Label','p.note'=>'Note'); $this->export_TypeFields_array[$r]=array('u.firstname'=>"Text",'u.lastname'=>"Text",'u.login'=>'Text','u.salary'=>"Numeric",'p.datep'=>'Date','p.datesp'=>'Date','p.dateep'=>'Date','p.amount'=>'Numeric','p.num_payment'=>'Numeric','p.label'=>'Text'); diff --git a/htdocs/langs/en_US/salaries.lang b/htdocs/langs/en_US/salaries.lang index 1e3607ce7cc..7c3c08a65bd 100644 --- a/htdocs/langs/en_US/salaries.lang +++ b/htdocs/langs/en_US/salaries.lang @@ -17,3 +17,5 @@ TJMDescription=This value is currently for information only and is not used for LastSalaries=Latest %s salary payments AllSalaries=All salary payments SalariesStatistics=Salary statistics +# Export +SalariesAndPayments=Salaries and payments From ffbb14f40ef59410e0a01efcf7f51af2fbfbe1c6 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 06:28:22 +0200 Subject: [PATCH 100/515] Missing language key --- htdocs/langs/en_US/website.lang | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 43f82e9f1fb..2683c9a90eb 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -100,4 +100,6 @@ DynamicPHPCodeContainsAForbiddenInstruction=You add dynamic PHP code that contai NotAllowedToAddDynamicContent=You don't have permission to add or edit PHP dynamic content in websites. Ask permission or just keep code into php tags unmodified. ReplaceWebsiteContent=Replace website content DeleteAlsoJs=Delete also all javascript files specific to this website? -DeleteAlsoMedias=Delete also all medias files specific to this website? \ No newline at end of file +DeleteAlsoMedias=Delete also all medias files specific to this website? +# Export +MyWebsitePages=My website pages \ No newline at end of file From a849fbe42e812929ac43c6e90b40c506d03ac8bc Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 07:15:52 +0200 Subject: [PATCH 101/515] Nowrap on amount --- htdocs/compta/bank/treso.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 5a4374f47dd..1318dbd4e2d 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -293,9 +293,9 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) }else print ""; } print "".$refcomp.""; - if ($obj->total_ttc < 0) { print "".price(abs($total_ttc))." "; }; - if ($obj->total_ttc >= 0) { print " ".price($total_ttc).""; }; - print ''.price($solde).''; + if ($obj->total_ttc < 0) { print "".price(abs($total_ttc))." "; }; + if ($obj->total_ttc >= 0) { print " ".price($total_ttc).""; }; + print ''.price($solde).''; print ""; } From 9a32117b1d172f6a5e31cf086639be9e5c2cd286 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 08:43:57 +0200 Subject: [PATCH 102/515] Nowrap on amount --- htdocs/compta/resultat/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index addc56a240b..70129e80403 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -943,7 +943,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) } print ""; - print ' '; + print ' '; if ($modecompta == 'BOOKKEEPING') { if (isset($encaiss[$case])) @@ -978,8 +978,8 @@ print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { $nbcols+=2; - print ''.(isset($totsorties[$annee])?price(price2num($totsorties[$annee], 'MT')):' ').''; - print ''.(isset($totentrees[$annee])?price(price2num($totentrees[$annee], 'MT')):' ').''; + print ''.(isset($totsorties[$annee])?price(price2num($totsorties[$annee], 'MT')):' ').''; + print ''.(isset($totentrees[$annee])?price(price2num($totentrees[$annee], 'MT')):' ').''; } print "\n"; From b8311da26212e95c0a727e542dc2a7e60c8cbc5b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 08:56:45 +0200 Subject: [PATCH 103/515] Nowrap on amount --- htdocs/accountancy/customer/index.php | 20 ++++++++++---------- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 0131f51d515..f063f832f54 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -211,10 +211,10 @@ if ($resql) { else print $row[1]; print ''; for($i = 2; $i <= 12; $i ++) { - print '' . price($row[$i]) . ''; + print '' . price($row[$i]) . ''; } - print '' . price($row[13]) . ''; - print '' . price($row[14]) . ''; + print '' . price($row[13]) . ''; + print '' . price($row[14]) . ''; print ''; } $db->free($resql); @@ -289,10 +289,10 @@ if ($resql) { print ''; for($i = 2; $i <= 12; $i++) { - print '' . price($row[$i]) . ''; + print '' . price($row[$i]) . ''; } - print '' . price($row[13]) . ''; - print '' . price($row[14]) . ''; + print '' . price($row[13]) . ''; + print '' . price($row[14]) . ''; print ''; } $db->free($resql); @@ -348,9 +348,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. while ($row = $db->fetch_row($resql)) { print '' . $row[0] . ''; for($i = 1; $i <= 12; $i ++) { - print '' . price($row[$i]) . ''; + print '' . price($row[$i]) . ''; } - print '' . price($row[13]) . ''; + print '' . price($row[13]) . ''; print ''; } $db->free($resql); @@ -401,9 +401,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. print '' . $row[0] . ''; for($i = 1; $i <= 12; $i ++) { - print '' . price(price2num($row[$i])) . ''; + print '' . price(price2num($row[$i])) . ''; } - print '' . price(price2num($row[13])) . ''; + print '' . price(price2num($row[13])) . ''; print ''; } $db->free($resql); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 19e85cdb651..ea174638a2a 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -385,7 +385,7 @@ if ($result) { print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description); print ''; - print '' . price($objp->total_ht) . ''; + print '' . price($objp->total_ht) . ''; print '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index ed1c40a6ad7..5314099db1f 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -503,7 +503,7 @@ if ($result) { print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description); print ''; - print ''; + print ''; print price($objp->total_ht); print ''; From ec7523d3d2906975fab9e1cf662ff3eae3c074ee Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 09:01:37 +0200 Subject: [PATCH 104/515] Nowrap on amount --- htdocs/accountancy/expensereport/index.php | 16 ++++++++-------- htdocs/accountancy/supplier/index.php | 16 ++++++++-------- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index a5026f920a0..4fe2ee3120b 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -203,10 +203,10 @@ if ($resql) { else print $row[1]; print ''; for($i = 2; $i <= 12; $i ++) { - print '' . price($row[$i]) . ''; + print '' . price($row[$i]) . ''; } - print '' . price($row[13]) . ''; - print '' . price($row[14]) . ''; + print '' . price($row[13]) . ''; + print '' . price($row[14]) . ''; print ''; } $db->free($resql); @@ -276,10 +276,10 @@ if ($resql) { else print $row[1]; print ''; for($i = 2; $i <= 12; $i ++) { - print '' . price($row[$i]) . ''; + print '' . price($row[$i]) . ''; } - print '' . price($row[13]) . ''; - print '' . price($row[14]) . ''; + print '' . price($row[13]) . ''; + print '' . price($row[14]) . ''; print ''; } $db->free($resql); @@ -331,9 +331,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. while ($row = $db->fetch_row($resql)) { print '' . $row[0] . ''; for($i = 1; $i <= 12; $i ++) { - print '' . price($row[$i]) . ''; + print '' . price($row[$i]) . ''; } - print '' . price($row[13]) . ''; + print '' . price($row[13]) . ''; print ''; } diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index ca60735fcf0..bc632118da7 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -203,10 +203,10 @@ if ($resql) { else print $row[1]; print ''; for($i = 2; $i <= 12; $i ++) { - print '' . price($row[$i]) . ''; + print '' . price($row[$i]) . ''; } - print '' . price($row[13]) . ''; - print '' . price($row[14]) . ''; + print '' . price($row[13]) . ''; + print '' . price($row[14]) . ''; print ''; } $db->free($resql); @@ -274,10 +274,10 @@ if ($resql) { else print $row[1]; print ''; for($i = 2; $i <= 12; $i++) { - print '' . price($row[$i]) . ''; + print '' . price($row[$i]) . ''; } - print '' . price($row[13]) . ''; - print '' . price($row[14]) . ''; + print '' . price($row[13]) . ''; + print '' . price($row[14]) . ''; print ''; } $db->free($resql); @@ -329,9 +329,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. while ($row = $db->fetch_row($resql)) { print '' . $row[0] . ''; for($i = 1; $i <= 12; $i ++) { - print '' . price($row[$i]) . ''; + print '' . price($row[$i]) . ''; } - print '' . price($row[13]) . ''; + print '' . price($row[13]) . ''; print ''; } $db->free($resql); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 352a73200fb..a67386f6fbd 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -396,7 +396,7 @@ if ($result) { print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description); print ''; - print '' . price($objp->total_ht) . ''; + print '' . price($objp->total_ht) . ''; print '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index fc8cc10fec4..17284513650 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -491,7 +491,7 @@ if ($result) { print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description); print ''; - print ''; + print ''; print price($objp->total_ht); print ''; From e44b9113b7410a71ca423c1830f05c4ca3208d98 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 09:01:57 +0200 Subject: [PATCH 105/515] Nowrap on amount --- htdocs/accountancy/expensereport/lines.php | 2 +- htdocs/accountancy/expensereport/list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 508dfb7136e..d15ef52ad39 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -319,7 +319,7 @@ if ($result) { print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments); print ''; - print '' . price($objp->total_ht) . ''; + print '' . price($objp->total_ht) . ''; print '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . ''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 9f70d175d40..60b24638775 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -376,7 +376,7 @@ if ($result) { print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments); print ''; - print ''; + print ''; print price($objp->price); print ''; From b6bd4119d9a9f02b00d12b551b43fc600b893452 Mon Sep 17 00:00:00 2001 From: Nicolas ZABOURI Date: Wed, 19 Jun 2019 09:12:01 +0200 Subject: [PATCH 106/515] 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 9bde7c5229fc3584af4853e4f9707dd7751b238f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 19 Jun 2019 09:21:18 +0200 Subject: [PATCH 107/515] Nowrap on amount --- htdocs/core/boxes/box_activity.php | 2 +- htdocs/core/boxes/box_commandes.php | 2 +- htdocs/core/boxes/box_factures_fourn_imp.php | 2 +- htdocs/core/boxes/box_factures_imp.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 300040639a8..995ba93fb64 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -422,7 +422,7 @@ class box_activity extends ModeleBoxes ); $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 8575e739946..956e73b4acf 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -146,7 +146,7 @@ class box_commandes extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 09de3b874e3..74f8cbc6b64 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -151,7 +151,7 @@ class box_factures_fourn_imp extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index fd85f136f96..a0692c791b2 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -161,7 +161,7 @@ class box_factures_imp extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); From 7331e43db8e12ac4ee3ae0f2602c39053a1eb696 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 19 Jun 2019 10:19:33 +0200 Subject: [PATCH 108/515] FIX : we need to fetch fourn invoice with ref in current entity --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 3a27690e7ac..d7ded8546f1 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -504,7 +504,7 @@ class FactureFournisseur extends CommonInvoice */ public function fetch($id='',$ref='') { - global $langs; + global $langs, $conf; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -555,7 +555,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid'; if ($id) $sql.= " WHERE t.rowid=".$id; - if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'"; + if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."' AND t.entity = ".$conf->entity; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); From 3ad13adf31d6925760587c685f79bd6e694e90fd Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 19 Jun 2019 10:43:42 +0200 Subject: [PATCH 109/515] FIX : better syntax --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index d7ded8546f1..4f9cd93021f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -504,7 +504,7 @@ class FactureFournisseur extends CommonInvoice */ public function fetch($id='',$ref='') { - global $langs, $conf; + global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -555,7 +555,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid'; if ($id) $sql.= " WHERE t.rowid=".$id; - if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."' AND t.entity = ".$conf->entity; + if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."' AND t.entity IN (".getEntity('supplier_invoice').")"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); From 7afcdb46eb9fe7e989b1cf884f157c5e6615f930 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 12:10:05 +0200 Subject: [PATCH 110/515] Debug module ticket --- htdocs/admin/ticket.php | 2 +- htdocs/public/ticket/index.php | 34 +++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 331d7e992ba..8cb1e85afe4 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -190,7 +190,7 @@ $head = ticketAdminPrepareHead(); dol_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket"); -print ''.$langs->trans("TicketSetupDictionaries") . ' : ' . dol_buildpath('/admin/dict.php', 2) . '
'; +print ''.$langs->trans("TicketSetupDictionaries") . ' : '.$langs->trans("ClickHereToGoTo", $langs->transnoentitiesnoconv("DictionarySetup")).'
'; dol_fiche_end(); diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index 05b992b3e40..a3e4d63a4bc 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -1,5 +1,6 @@ +/* Copyright (C) - 2013-2016 Jean-François FERRY + * Copyright (C) - 2019 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 @@ -18,7 +19,7 @@ /** * \file htdocs/public/ticket/index.php * \ingroup ticket - * \brief Public file to add and manage ticket + * \brief Public page to add and manage ticket */ if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); @@ -56,21 +57,24 @@ $formticket = new FormTicket($db); $arrayofjs = array(); $arrayofcss = array('/ticket/css/styles.css.php'); + +if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) +{ + print $langs->trans('TicketPublicInterfaceForbidden'); + exit; +} + llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); -if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) { - print '
' . $langs->trans('TicketPublicInterfaceForbidden') . '
'; -} else { - print '
'; - print '

' . ($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")) . '

'; - print ''; - print '
'; -} +print '
'; +print '

' . ($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")) . '

'; +print ''; +print '
'; // End of page htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); From f9cc120d7569ae08e698d4e536e73eb8180c6b94 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 12:53:28 +0200 Subject: [PATCH 111/515] Debug module ticket --- htdocs/core/class/dolgraph.class.php | 2 +- htdocs/core/modules/modTicket.class.php | 1 + htdocs/langs/en_US/ticket.lang | 1 + htdocs/ticket/index.php | 71 +++++++++++++------------ 4 files changed, 39 insertions(+), 36 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index d70a63293c5..5cec0232603 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -229,7 +229,7 @@ class DolGraph /** * Set width * - * @param int $w Width + * @param int|string $w Width (Example: 320 or '100%') * @return boolean|null True */ public function SetWidth($w) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 9436bfa84e8..e16b6e87fd0 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -99,6 +99,7 @@ class modTicket extends DolibarrModules $this->conflictwith = array(); // List of module class names as string this module is in conflict with $this->phpmin = array(5,4); // Minimum version of PHP required by module $this->langfiles = array("ticket"); + // Constants // List of particular constants to add when module is enabled // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 6a2d7e89cb7..70bd8220af0 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -133,6 +133,7 @@ TicketsIndex=Ticket - home TicketList=List of tickets TicketAssignedToMeInfos=This page display ticket list created by or assigned to current user NoTicketsFound=No ticket found +NoUnreadTicketsFound=No unread ticket found TicketViewAllTickets=View all tickets TicketViewNonClosedOnly=View only open tickets TicketStatByStatus=Tickets by status diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 824b1f1833e..e7f7c6bff2f 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -24,6 +24,7 @@ require '../main.inc.php'; 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'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'other', 'ticket')); @@ -102,8 +103,8 @@ if (empty($endyear)) { } $startyear = $endyear - 1; -$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320'; -$HEIGHT = '192'; +$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '100%' : '80%'; +$HEIGHT = '228'; print '
'; @@ -120,16 +121,14 @@ $tick = array( 'closed' => 0, 'deleted' => 0, ); -$total = 0; + $sql = "SELECT t.fk_statut, COUNT(t.fk_statut) as nb"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t"; if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } - -$sql .= ' WHERE t.entity IN (' . getEntity('ticket', 1) . ')'; -$sql .= " AND t.fk_statut IS NOT NULL"; -$sql .= " AND date_format(datec,'%Y') = '" . $endyear . "'"; +$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')'; +$sql .= dolSqlDateFilter('datec', 0, 0, $endyear); if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id; } @@ -149,44 +148,41 @@ $result = $db->query($sql); if ($result) { while ($objp = $db->fetch_object($result)) { $found = 0; - if ($objp->fk_statut == 0) { + if ($objp->fk_statut == Ticket::STATUS_NOT_READ) { $tick['unread'] = $objp->nb; } - if ($objp->fk_statut == 1) { + if ($objp->fk_statut == Ticket::STATUS_READ) { $tick['read'] = $objp->nb; } - if ($objp->fk_statut == 3) { - $tick['answered'] = $objp->nb; + if ($objp->fk_statut == Ticket::STATUS_NEED_MORE_INFO) { + $tick['needmoreinfo'] = $objp->nb; } - if ($objp->fk_statut == 4) { + if ($objp->fk_statut == Ticket::STATUS_ASSIGNED) { $tick['assigned'] = $objp->nb; } - if ($objp->fk_statut == 5) { + if ($objp->fk_statut == Ticket::STATUS_IN_PROGRESS) { $tick['inprogress'] = $objp->nb; } - if ($objp->fk_statut == 6) { + if ($objp->fk_statut == Ticket::STATUS_WAITING) { $tick['waiting'] = $objp->nb; } - if ($objp->fk_statut == 8) { + if ($objp->fk_statut == Ticket::STATUS_CLOSED) { $tick['closed'] = $objp->nb; } - if ($objp->fk_statut == 9) { - $tick['deleted'] = $objp->nb; + if ($objp->fk_statut == Ticket::STATUS_CANCELED) { + $tick['canceled'] = $objp->nb; } } - if ((round($tick['unread']) ? 1 : 0) +(round($tick['read']) ? 1 : 0) +(round($tick['answered']) ? 1 : 0) +(round($tick['assigned']) ? 1 : 0) +(round($tick['inprogress']) ? 1 : 0) +(round($tick['waiting']) ? 1 : 0) +(round($tick['closed']) ? 1 : 0) +(round($tick['deleted']) ? 1 : 0) >= 2 - ) { - $dataseries = array(); - $dataseries[] = array('label' => $langs->trans("Unread"), 'data' => round($tick['unread'])); - $dataseries[] = array('label' => $langs->trans("Read"), 'data' => round($tick['read'])); - $dataseries[] = array('label' => $langs->trans("Answered"), 'data' => round($tick['answered'])); - $dataseries[] = array('label' => $langs->trans("Assigned"), 'data' => round($tick['assigned'])); - $dataseries[] = array('label' => $langs->trans("InProgress"), 'data' => round($tick['inprogress'])); - $dataseries[] = array('label' => $langs->trans("Waiting"), 'data' => round($tick['waiting'])); - $dataseries[] = array('label' => $langs->trans("Closed"), 'data' => round($tick['closed'])); - $dataseries[] = array('label' => $langs->trans("Deleted"), 'data' => round($tick['deleted'])); - } + $dataseries = array(); + $dataseries[] = array('label' => $langs->trans("Unread"), 'data' => round($tick['unread'])); + $dataseries[] = array('label' => $langs->trans("Read"), 'data' => round($tick['read'])); + $dataseries[] = array('label' => $langs->trans("NeedMoreInformation"), 'data' => round($tick['needmoreinfo'])); + $dataseries[] = array('label' => $langs->trans("Assigned"), 'data' => round($tick['assigned'])); + $dataseries[] = array('label' => $langs->trans("InProgress"), 'data' => round($tick['inprogress'])); + $dataseries[] = array('label' => $langs->trans("Waiting"), 'data' => round($tick['waiting'])); + $dataseries[] = array('label' => $langs->trans("Closed"), 'data' => round($tick['closed'])); + $dataseries[] = array('label' => $langs->trans("Canceled"), 'data' => round($tick['canceled'])); } else { dol_print_error($db); } @@ -210,11 +206,17 @@ $stringtoshow .= '
'; print ''; print ''; -print ''; print '
' . $langs->trans("Statistics") . ' ' . img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_by_status" class="linkobject"') . '
'; +print '
'; +print $stringtoshow; // don't display graph if no series if (! empty($dataseries) && count($dataseries) > 1) { - $data = array(); + $totalnb=0; + foreach ($dataseries as $key => $value) { + $totalnb += $value['data']; + } + + $data = array(); foreach ($dataseries as $key => $value) { $data[] = array($value['label'], $value['data']); } @@ -244,10 +246,9 @@ if (! empty($dataseries) && count($dataseries) > 1) { //$px1->SetTitle($langs->trans("TicketStatByStatus")); $px1->draw($filenamenb, $fileurlnb); - print $px1->show(); + print $px1->show($totalnb?0:1); } } -print $stringtoshow; print '
'; @@ -303,7 +304,7 @@ if ($result) { print '
'; print ''; print ''; - print ''; + print ''; print ''; if ($num > 0) { @@ -359,7 +360,7 @@ if ($result) { $db->free(); } else { - print ''; + print ''; } print "
' . $transRecordedType . ''.$langs->trans("FullList").''.$langs->trans("FullList").'
' . $langs->trans('NoTicketsFound') . '
' . $langs->trans('NoUnreadTicketsFound') . '
"; From df8fff843cb7fb6beece1a36b2e47a7eaf1ea045 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 13:16:46 +0200 Subject: [PATCH 112/515] 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 113/515] 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 a11c816a176da9b0fd930d3767208ad60aff4377 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 14:24:48 +0200 Subject: [PATCH 114/515] Fix tooltip --- htdocs/compta/facture/card.php | 3 ++- htdocs/fourn/facture/card.php | 3 ++- htdocs/langs/en_US/bills.lang | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0f2669014a8..10de9581dfe 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3444,6 +3444,7 @@ elseif ($id > 0 || ! empty($ref)) elseif($object->type == Facture::TYPE_CREDIT_NOTE) $type_fac = 'CreditNote'; elseif($object->type == Facture::TYPE_DEPOSIT) $type_fac = 'Deposit'; $text = $langs->trans('ConfirmConvertToReduc', strtolower($langs->transnoentities($type_fac))); + $text.='
'.$langs->trans('ConfirmConvertToReduc2'); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('ConvertToReduc'), $text, 'confirm_converttoreduc', '', "yes", 2); } @@ -4746,7 +4747,7 @@ elseif ($id > 0 || ! empty($ref)) } // For credit note if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $usercancreate && $object->getSommePaiement() == 0) { - print ''; + print ''; } // For deposit invoice if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > 0 && empty($discount->id)) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 1eb38cec66c..c25b0afa15b 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2221,6 +2221,7 @@ else elseif($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $type_fac = 'CreditNote'; elseif($object->type == FactureFournisseur::TYPE_DEPOSIT) $type_fac = 'Deposit'; $text = $langs->trans('ConfirmConvertToReducSupplier', strtolower($langs->transnoentities($type_fac))); + $text .= '
'.$langs->trans('ConfirmConvertToReducSupplier2'); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('ConvertToReduc'), $text, 'confirm_converttoreduc', '', "yes", 2); } @@ -3107,7 +3108,7 @@ else } // For credit note if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() == 0) { - print ''; + print ''; } // For deposit invoice if ($object->type == FactureFournisseur::TYPE_DEPOSIT && $object->paye == 1 && $resteapayer == 0 && $user->rights->fournisseur->facture->creer && empty($discount->id)) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 17882b3b270..9a86e941035 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -66,8 +66,10 @@ paymentInInvoiceCurrency=in invoices currency PaidBack=Paid back DeletePayment=Delete payment ConfirmDeletePayment=Are you sure you want to delete this payment? -ConfirmConvertToReduc=Do you want to convert this %s into an absolute discount?
The amount will be saved among all discounts and could be used as a discount for a current or a future invoice for this customer. -ConfirmConvertToReducSupplier=Do you want to convert this %s into an absolute discount?
The amount will be saved among all discounts and could be used as a discount for a current or a future invoice for this vendor. +ConfirmConvertToReduc=Do you want to convert this %s into an absolute discount? +ConfirmConvertToReduc2=The amount will be saved among all discounts and could be used as a discount for a current or a future invoice for this customer. +ConfirmConvertToReducSupplier=Do you want to convert this %s into an absolute discount? +ConfirmConvertToReducSupplier2=The amount will be saved among all discounts and could be used as a discount for a current or a future invoice for this vendor. SupplierPayments=Vendor payments ReceivedPayments=Received payments ReceivedCustomersPayments=Payments received from customers From c109eebe383f240b4340732d5457e26a3f9e0384 Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Wed, 19 Jun 2019 14:42:56 +0100 Subject: [PATCH 115/515] 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 116/515] 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 04f2fb604f680575acfcacd0e0f179cdbfb5b97a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 15:48:04 +0200 Subject: [PATCH 117/515] 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 daa8b43732d43ec6f391e601855737c691079541 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 15:51:48 +0200 Subject: [PATCH 118/515] css --- 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 b6beba5e12e..6c325c865a9 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1075,7 +1075,7 @@ if ($resql) // Town if (! empty($arrayfields['s.town']['checked'])) { - print ''; + print ''; print $obj->town; print ''; if (! $i) $totalarray['nbfield']++; @@ -1083,7 +1083,7 @@ if ($resql) // Zip if (! empty($arrayfields['s.zip']['checked'])) { - print ''; + print ''; print $obj->zip; print ''; if (! $i) $totalarray['nbfield']++; From c3b8582076b7144cf8d23bb07189a39cb1918263 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 15:55:18 +0200 Subject: [PATCH 119/515] Fix use of deprecated function --- htdocs/stripe/class/stripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index d754b8d3962..27346a15f5e 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -536,7 +536,7 @@ class Stripe extends CommonObject //$a = \Stripe\Stripe::getApiKey(); //var_dump($a);var_dump($stripeacc);exit; - dol_syslog("Try to create card dataforcard = ".dol_json_encode($dataforcard)); + dol_syslog("Try to create card dataforcard = ".json_encode($dataforcard)); try { if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage $card = $cu->sources->create($dataforcard); From 5b5028254f8d33215d96c60fdb83a9c526de1f3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 16:30:03 +0200 Subject: [PATCH 120/515] Fix label --- htdocs/langs/en_US/accountancy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 449a30acbbb..91234f72aef 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -291,7 +291,7 @@ Modelcsv_cogilog=Export for Cogilog Modelcsv_agiris=Export for Agiris Modelcsv_openconcerto=Export for OpenConcerto (Test) Modelcsv_configurable=Export CSV Configurable -Modelcsv_FEC=Export FEC (Art. L47 A) +Modelcsv_FEC=Export FEC Modelcsv_Sage50_Swiss=Export for Sage 50 Switzerland ChartofaccountsId=Chart of accounts Id From 7c4cddf28d3aacf718d226078b3d23dfcb78fc07 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 16:34:01 +0200 Subject: [PATCH 121/515] Fix missing trad --- htdocs/langs/en_US/accountancy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 91234f72aef..7797fdef7b1 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -336,7 +336,7 @@ UseMenuToSetBindindManualy=Lines not yet bound, use menu %s to ## Import ImportAccountingEntries=Accounting entries - +DateExport=Date export WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manually in the Ledger. If your journalization is up to date, the bookkeeping view is more accurate. ExpenseReportJournal=Expense Report Journal InventoryJournal=Inventory Journal From 31a53b72aec1bcd2b6524e17bd922a8eda05f028 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 19 Jun 2019 16:55:45 +0200 Subject: [PATCH 122/515] FIX var name --- htdocs/core/actions_massactions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 34ba465ebff..07766ac7fef 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -209,7 +209,7 @@ if (! $error && $massaction == 'confirm_presend') $resaction.='
'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction',$objectobj->ref).'

'; continue; // Payment done or started or canceled } - if ($objectclass == 'Commande' && $objectoj->statut == Commande::STATUS_DRAFT) + if ($objectclass == 'Commande' && $objectobj->statut == Commande::STATUS_DRAFT) { $langs->load("errors"); $nbignored++; From 1079535894f73cedb822d4fea049efe4e571b50e Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Wed, 19 Jun 2019 17:49:31 +0100 Subject: [PATCH 123/515] 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 124/515] 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 125/515] 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 d6b6f77e74beeab3cb41cbdbbd59b255e4c0614c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 22:05:38 +0200 Subject: [PATCH 126/515] 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 bf71731fc945afdf66216daf3e37359813638d15 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Jun 2019 22:28:33 +0200 Subject: [PATCH 127/515] Fix phpcs --- htdocs/adherents/class/adherent.class.php | 1 + htdocs/contact/class/contact.class.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1856de6182f..c1bb04d90fc 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2460,6 +2460,7 @@ class Adherent extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Initialise tableau info (tableau des attributs LDAP) * diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 5c4df6ab3f9..de9494fca8b 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -520,6 +520,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 b4e47d289b5bb183fcb845b236aa6615a62cc8ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 02:43:56 +0200 Subject: [PATCH 128/515] 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 e060af5c977b9a37cf6c054e77f483d617f583c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 02:50:23 +0200 Subject: [PATCH 129/515] Update treso.php --- htdocs/compta/bank/treso.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 1318dbd4e2d..f17e622210e 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -293,8 +293,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) }else print ""; } print "".$refcomp.""; - if ($obj->total_ttc < 0) { print "".price(abs($total_ttc))." "; }; - if ($obj->total_ttc >= 0) { print " ".price($total_ttc).""; }; + if ($obj->total_ttc < 0) { print ''.price(abs($total_ttc))." "; }; + if ($obj->total_ttc >= 0) { print ' '.price($total_ttc).""; }; print ''.price($solde).''; print ""; } From 6d38f5ec9cb1fe927106243ab6463c3a39e6d630 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 02:56:44 +0200 Subject: [PATCH 130/515] FIX #11369 --- htdocs/bom/class/bom.class.php | 16 ++++++++-------- .../class/emailcollector.class.php | 6 +++--- .../class/emailcollectoraction.class.php | 8 ++++---- .../class/emailcollectorfilter.class.php | 8 ++++---- .../template/class/myobject.class.php | 6 +++--- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 731136fb7f4..99331de8c62 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -165,7 +165,7 @@ class BOM extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs, $user; + global $conf, $langs; $this->db = $db; @@ -184,11 +184,11 @@ class BOM extends CommonObject // Translate some data of arrayofkeyval foreach($this->fields as $key => $val) { - if (is_array($this->fields['status']['arrayofkeyval'])) + if (is_array($this->fields[$key]['arrayofkeyval'])) { - foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2) + foreach($this->fields[$key]['arrayofkeyval'] as $key2 => $val2) { - $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2); + $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2); } } } @@ -1066,7 +1066,7 @@ class BOMLine extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs, $user; + global $conf, $langs; $this->db = $db; @@ -1085,11 +1085,11 @@ class BOMLine extends CommonObject // Translate some data of arrayofkeyval foreach($this->fields as $key => $val) { - if (is_array($this->fields['status']['arrayofkeyval'])) + if (is_array($this->fields[$key]['arrayofkeyval'])) { - foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2) + foreach($this->fields[$key]['arrayofkeyval'] as $key2 => $val2) { - $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2); + $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2); } } } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index f60051df970..ff4be06fcab 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -205,11 +205,11 @@ class EmailCollector extends CommonObject // Translate some data of arrayofkeyval foreach($this->fields as $key => $val) { - if (is_array($this->fields['status']['arrayofkeyval'])) + if (is_array($this->fields[$key]['arrayofkeyval'])) { - foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2) + foreach($this->fields[$key]['arrayofkeyval'] as $key2 => $val2) { - $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2); + $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2); } } } diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index 11ccfbc858e..ca710f99216 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -145,7 +145,7 @@ class EmailCollectorAction extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs, $user; + global $conf, $langs; $this->db = $db; @@ -164,11 +164,11 @@ class EmailCollectorAction extends CommonObject // Translate some data of arrayofkeyval foreach($this->fields as $key => $val) { - if (is_array($this->fields['status']['arrayofkeyval'])) + if (is_array($this->fields[$key]['arrayofkeyval'])) { - foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2) + foreach($this->fields[$key]['arrayofkeyval'] as $key2 => $val2) { - $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2); + $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2); } } } diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index f93ac51f673..5c7c7184ffc 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -114,7 +114,7 @@ class EmailCollectorFilter extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs, $user; + global $conf, $langs; $this->db = $db; @@ -133,11 +133,11 @@ class EmailCollectorFilter extends CommonObject // Translate some data of arrayofkeyval foreach($this->fields as $key => $val) { - if (is_array($this->fields['status']['arrayofkeyval'])) + if (is_array($this->fields[$key]['arrayofkeyval'])) { - foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2) + foreach($this->fields[$key]['arrayofkeyval'] as $key2 => $val2) { - $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2); + $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2); } } } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 266b8d1925f..1b4d1c7b52d 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -227,11 +227,11 @@ class MyObject extends CommonObject // Translate some data of arrayofkeyval foreach($this->fields as $key => $val) { - if (is_array($this->fields['status']['arrayofkeyval'])) + if (is_array($this->fields[$key]['arrayofkeyval'])) { - foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2) + foreach($this->fields[$key]['arrayofkeyval'] as $key2 => $val2) { - $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2); + $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2); } } } From 2b0b7b0dab0603a99d9a379a0dcef814976a0ebe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 03:32:28 +0200 Subject: [PATCH 131/515] 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 132/515] 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 133/515] 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 134/515] 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 135/515] 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 136/515] 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 137/515] 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 7c29fb614c34119ed919b3eb5fa86ba53eb4665f Mon Sep 17 00:00:00 2001 From: John Botella Date: Thu, 20 Jun 2019 09:21:35 +0200 Subject: [PATCH 138/515] Fix replacement and vars names --- htdocs/core/actions_massactions.inc.php | 77 ++++++++++++++++++------- 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 00ffe03c7ed..c40bd73eff5 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -93,7 +93,7 @@ if (! $error && $massaction == 'confirm_presend') } // Check mandatory parameters - if (empty($user->email)) + if (GETPOST('fromtype','alpha') === 'user' && empty($user->email)) { $error++; setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); @@ -208,7 +208,7 @@ if (! $error && $massaction == 'confirm_presend') $resaction.='
'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction',$objectobj->ref).'

'; continue; // Payment done or started or canceled } - if ($objectclass == 'Commande' && $objectoj->statut == Commande::STATUS_DRAFT) + if ($objectclass == 'Commande' && $objectobj->statut == Commande::STATUS_DRAFT) { $langs->load("errors"); $nbignored++; @@ -333,12 +333,16 @@ if (! $error && $massaction == 'confirm_presend') if ($objectclass == 'CommandeFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)); if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)); - // $listofqualifiedobj is array with key = object id of qualified objects for the current thirdparty + // $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet) $oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0); $looparray=array(); if (! $oneemailperrecipient) { $looparray = $listofqualifiedobj; + foreach ($looparray as $key => $objecttmp) + { + $looparray[$key]->thirdparty = $thirdparty; + } } else { @@ -347,8 +351,9 @@ if (! $error && $massaction == 'confirm_presend') $looparray[0]=$objectforloop; } //var_dump($looparray);exit; - - foreach ($looparray as $objecttmp) // $objecttmp is a real object or an empty if we choose to send one email per thirdparty instead of per record + dol_syslog("We have set an array of ".count($looparray)." emails to send. oneemailperrecipient=".$oneemailperrecipient); + //var_dump($oneemailperrecipient); var_dump($listofqualifiedobj); var_dump($listofqualifiedref); + foreach ($looparray as $objectid => $objecttmp) // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per object { // Make substitution in email content $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp); @@ -358,10 +363,18 @@ if (! $error && $massaction == 'confirm_presend') $substitutionarray['__CHECK_READ__'] = ''; $parameters=array('mode'=>'formemail'); + + if ( ! empty( $listofobjectthirdparties ) ) { + $parameters['listofobjectthirdparties'] = $listofobjectthirdparties; + } + if ( ! empty( $listofobjectref ) ) { + $parameters['listofobjectref'] = $listofobjectref; + } + complete_substitutions_array($substitutionarray, $langs, $objecttmp, $parameters); - $subject=make_substitutions($subject, $substitutionarray); - $message=make_substitutions($message, $substitutionarray); + $subjectreplaced=make_substitutions($subject, $substitutionarray); + $messagereplaced=make_substitutions($message, $substitutionarray); $filepath = $attachedfiles['paths']; $filename = $attachedfiles['names']; @@ -370,8 +383,8 @@ if (! $error && $massaction == 'confirm_presend') //var_dump($filepath); // Send mail (substitutionarray must be done just before this) - require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'); - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1); + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subjectreplaced, $sendto, $from, $messagereplaced, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); if ($mailfile->error) { $resaction.='
'.$mailfile->error.'
'; @@ -386,8 +399,12 @@ if (! $error && $massaction == 'confirm_presend') $error=0; // Insert logs into agenda - foreach($listofqualifiedobj as $objid => $objectobj) + foreach($listofqualifiedobj as $objid2 => $objectobj2) { + if ((! $oneemailperrecipient) && $objid2 != $objectid) continue; // We discard this pass to avoid duplicate with other pass in looparray at higher level + + dol_syslog("Try to insert email event into agenda for objid=".$objid2." => objectobj=".get_class($objectobj2)); + /*if ($objectclass == 'Propale') $actiontypecode='AC_PROP'; if ($objectclass == 'Commande') $actiontypecode='AC_COM'; if ($objectclass == 'Facture') $actiontypecode='AC_FAC'; @@ -399,18 +416,18 @@ if (! $error && $massaction == 'confirm_presend') if ($message) { if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subjectreplaced); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); + $actionmsg = dol_concatdesc($actionmsg, $messagereplaced); } $actionmsg2=''; // Initialisation donnees - $objectobj->sendtoid = 0; - $objectobj->actionmsg = $actionmsg; // Long text - $objectobj->actionmsg2 = $actionmsg2; // Short text - $objectobj->fk_element = $objid; - $objectobj->elementtype = $objectobj->element; + $objectobj2->sendtoid = 0; + $objectobj2->actionmsg = $actionmsg; // Long text + $objectobj2->actionmsg2 = $actionmsg2; // Short text + $objectobj2->fk_element = $objid2; + $objectobj2->elementtype = $objectobj2->element; $triggername = strtoupper(get_class($objectobj)) .'_SENTBYMAIL'; if ($triggername == 'SOCIETE_SENTBYMAIL') $triggername = 'COMPANY_SENTBYEMAIL'; @@ -425,9 +442,9 @@ if (! $error && $massaction == 'confirm_presend') if (! empty($triggername)) { // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"; $interface=new Interfaces($db); - $result=$interface->run_triggers($triggername, $objectobj, $user, $langs, $conf); + $result=$interface->run_triggers($triggername, $objectobj2, $user, $langs, $conf); if ($result < 0) { $error++; $errors=$interface->errors; } // Fin appel triggers @@ -437,9 +454,9 @@ if (! $error && $massaction == 'confirm_presend') dol_syslog("Error in trigger ".$triggername.' '.$db->lasterror(), LOG_ERR); } } - - $nbsent++; } + + $nbsent++; // Nb of email sent (may be lower than number of record selected if we group thirdparties) } else { @@ -504,6 +521,8 @@ if ($massaction == 'confirm_createbills') $objecttmp = new Facture($db); if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. else { + // Load extrafields of order + $cmd->fetch_optionals(); $objecttmp->socid = $cmd->socid; $objecttmp->type = Facture::TYPE_STANDARD; @@ -521,6 +540,8 @@ if ($massaction == 'confirm_createbills') $objecttmp->origin = 'commande'; $objecttmp->origin_id = $id_order; + $objecttmp->array_options = $cmd->array_options; // Copy extrafields + $res = $objecttmp->create($user); if($res > 0) $nb_bills_created++; @@ -560,6 +581,12 @@ if ($massaction == 'confirm_createbills') for ($i=0;$i<$num;$i++) { $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); + // If we build one invoice for several order, we must put the invoice of order on the line + if (! empty($createbills_onebythird)) + { + $desc=dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day', $langs)); + } + if ($lines[$i]->subprice < 0) { // Negative line, we create a discount line @@ -670,6 +697,7 @@ if ($massaction == 'confirm_createbills') if (! $error && $validate_invoices) { $massaction = $action = 'builddoc'; + foreach($TAllFact as &$objecttmp) { $result = $objecttmp->validate($user); @@ -687,7 +715,12 @@ if ($massaction == 'confirm_createbills') $donotredirect = 1; $upload_dir = $conf->facture->dir_output; $permissioncreate=$user->rights->facture->creer; + + // Call action to build doc + $savobject = $object; + $object = $objecttmp; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + $object = $savobject; } $massaction = $action = 'confirm_createbills'; @@ -696,7 +729,7 @@ if ($massaction == 'confirm_createbills') if (! $error) { $db->commit(); - setEventMessage($langs->trans('BillCreated', $nb_bills_created)); + setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); // Make a redirect to avoid to bill twice if we make a refresh or back $param=''; From 252bd6d9ba7122447790e6d48c83e4dd64474762 Mon Sep 17 00:00:00 2001 From: John Botella Date: Thu, 20 Jun 2019 09:48:08 +0200 Subject: [PATCH 139/515] FIX condition --- htdocs/core/tpl/massactions_pre.tpl.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 48989b2daec..0a273072e29 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -36,11 +36,12 @@ if ($massaction == 'presend') { $langs->load("mails"); + $listofselectedid = array(); + $listofselectedthirdparties = array(); + $listofselectedref = array(); + if (! GETPOST('cancel', 'alpha')) { - $listofselectedid = array(); - $listofselectedthirdparties = array(); - $listofselectedref = array(); foreach ($arrayofselected as $toselectid) { $result = $objecttmp->fetch($toselectid); @@ -106,7 +107,7 @@ if ($massaction == 'presend') $formmail->withtoreadonly = 1; } - $formmail->withoptiononeemailperrecipient = empty($liste)?0:((GETPOST('oneemailperrecipient')=='on')?1:-1); + $formmail->withoptiononeemailperrecipient = (count($listofselectedref) == 1 || empty($liste))? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1); $formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste; $formmail->withtofree = empty($liste)?1:0; $formmail->withtocc = 1; From 9305403bea79f07eef481067718110e03172dab5 Mon Sep 17 00:00:00 2001 From: John Botella Date: Thu, 20 Jun 2019 10:32:32 +0200 Subject: [PATCH 140/515] Fix duplicate pdf in mass sendmail --- htdocs/core/actions_massactions.inc.php | 40 ++++++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index c40bd73eff5..1d3d4b2adea 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -69,6 +69,8 @@ if (! $error && $massaction == 'confirm_presend') $listofobjectid=array(); $listofobjectthirdparties=array(); $listofobjectref=array(); + $attachedfilesThirdpartyObj=array(); + $oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0); if (! $error) { @@ -193,7 +195,6 @@ if (! $error && $massaction == 'confirm_presend') $sendtocc=implode(',',$tmparray); //var_dump($listofobjectref);exit; - $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); $listofqualifiedobj=array(); $listofqualifiedref=array(); $thirdpartywithoutemail=array(); @@ -263,12 +264,12 @@ if (! $error && $massaction == 'confirm_presend') if (dol_is_file($file)) { - // Create form object - $attachedfiles=array( - 'paths'=>array_merge($attachedfiles['paths'],array($file)), - 'names'=>array_merge($attachedfiles['names'],array($filename)), - 'mimes'=>array_merge($attachedfiles['mimes'],array($mime)) - ); + // Create form object + $attachedfilesThirdpartyObj[$thirdpartyid][$objectid]=array( + 'paths'=>array($file), + 'names'=>array($filename), + 'mimes'=>array($mime) + ); } else { @@ -334,7 +335,7 @@ if (! $error && $massaction == 'confirm_presend') if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)); // $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet) - $oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0); + $looparray=array(); if (! $oneemailperrecipient) { @@ -376,10 +377,33 @@ if (! $error && $massaction == 'confirm_presend') $subjectreplaced=make_substitutions($subject, $substitutionarray); $messagereplaced=make_substitutions($message, $substitutionarray); + $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); + if($oneemailperrecipient) + { + if(is_array($attachedfilesThirdpartyObj[$thirdparty->id]) && count($attachedfilesThirdpartyObj[$thirdparty->id])) + { + foreach ($attachedfilesThirdpartyObj[$thirdparty->id] as $keyObjId => $objAttachedFiles){ + // Create form object + $attachedfiles=array( + 'paths'=>array_merge($attachedfiles['paths'], $objAttachedFiles['paths']), + 'names'=>array_merge($attachedfiles['names'], $objAttachedFiles['names']), + 'mimes'=>array_merge($attachedfiles['mimes'], $objAttachedFiles['mimes']) + ); + } + } + } + elseif(!empty($attachedfilesThirdpartyObj[$thirdparty->id][$objectid])){ + // Create form object + $attachedfiles=$attachedfilesThirdpartyObj[$thirdparty->id][$objectid]; + } + $filepath = $attachedfiles['paths']; $filename = $attachedfiles['names']; $mimetype = $attachedfiles['mimes']; + + + //var_dump($filepath); // Send mail (substitutionarray must be done just before this) From 6a68c8cd996318c4d5997de97035157bddfbd87e Mon Sep 17 00:00:00 2001 From: John Botella Date: Thu, 20 Jun 2019 11:09:37 +0200 Subject: [PATCH 141/515] Fix display option email per participient --- htdocs/core/actions_massactions.inc.php | 3 +++ htdocs/core/tpl/massactions_pre.tpl.php | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 1d3d4b2adea..300c06216f7 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -377,9 +377,11 @@ if (! $error && $massaction == 'confirm_presend') $subjectreplaced=make_substitutions($subject, $substitutionarray); $messagereplaced=make_substitutions($message, $substitutionarray); + $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); if($oneemailperrecipient) { + // if "one email per recipient" isn't check we must collate $attachedfiles by thirdparty if(is_array($attachedfilesThirdpartyObj[$thirdparty->id]) && count($attachedfilesThirdpartyObj[$thirdparty->id])) { foreach ($attachedfilesThirdpartyObj[$thirdparty->id] as $keyObjId => $objAttachedFiles){ @@ -394,6 +396,7 @@ if (! $error && $massaction == 'confirm_presend') } elseif(!empty($attachedfilesThirdpartyObj[$thirdparty->id][$objectid])){ // Create form object + // if "one email per recipient" isn't check we must separate $attachedfiles by object $attachedfiles=$attachedfilesThirdpartyObj[$thirdparty->id][$objectid]; } diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 0a273072e29..e525bd739a3 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -107,7 +107,8 @@ if ($massaction == 'presend') $formmail->withtoreadonly = 1; } - $formmail->withoptiononeemailperrecipient = (count($listofselectedref) == 1 || empty($liste))? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1); + $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : ((GETPOST('oneemailperrecipient')=='on')?1:-1); + $formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste; $formmail->withtofree = empty($liste)?1:0; $formmail->withtocc = 1; @@ -126,6 +127,7 @@ if ($massaction == 'presend') // Make substitution in email content $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); + $substitutionarray['__EMAIL__'] = $sendto; $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; $substitutionarray['__PERSONALIZED__'] = ''; // deprecated From b21006614c874e9a59c7f25d2a711a0795474a11 Mon Sep 17 00:00:00 2001 From: John Botella Date: Thu, 20 Jun 2019 12:00:44 +0200 Subject: [PATCH 142/515] Fix substitutions null --- htdocs/core/class/html.formmail.class.php | 1 - htdocs/core/lib/functions.lib.php | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 9b9bb32865e..38987b36185 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -908,7 +908,6 @@ class FormMail extends Form $defaultmessage=preg_replace("/^(
)+/","",$defaultmessage); $defaultmessage=preg_replace("/^\n+/","",$defaultmessage); } - $out.= ''; $out.= ''.$langs->trans("MailText").''; $out.= ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7a70608f303..05024437a63 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5733,6 +5733,8 @@ function make_substitutions($text, $substitutionarray, $outputlangs=null) // Make substitition for array $substitutionarray foreach ($substitutionarray as $key => $value) { + if (! isset($value)) continue; // If value is null, it same than not having substitution key at all into array, we do not replace. + if ($key == '__SIGNATURE__' && (! empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) $value=''; // Protection if ($key == '__USER_SIGNATURE__' && (! empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) $value=''; // Protection From 0865bdb60f77460b969b730f9bd175bfd90a660b Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 20 Jun 2019 12:16:48 +0200 Subject: [PATCH 143/515] fix depending extrafeilds list --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 78729519775..006c80428f7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6446,7 +6446,7 @@ abstract class CommonObject jQuery(document).ready(function() { function showOptions(child_list, parent_list) { - var val = $("select[name=\"options_"+parent_list+"\"]").val(); + var val = $("select[name=\""+parent_list+"\"]").val(); var parentVal = parent_list + ":" + val; if(val > 0) { $("select[name=\""+child_list+"\"] option[parent]").hide(); From 1a6dc83d4c886cb69c5c845dd6339fc9f71e3522 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 12:25:58 +0200 Subject: [PATCH 144/515] Fix: default accounting account for eec and export sales were not used. --- htdocs/accountancy/customer/list.php | 66 +++++++++++++------ htdocs/accountancy/supplier/list.php | 44 ++++++++----- .../fourn/class/fournisseur.product.class.php | 6 +- htdocs/langs/en_US/accountancy.lang | 3 + htdocs/product/class/product.class.php | 14 ++-- 5 files changed, 90 insertions(+), 43 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 5314099db1f..192585ccedd 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -92,9 +92,6 @@ if (! $user->rights->accounting->bind->write) $hookmanager->initHooks(array('accountancycustomerlist')); $formaccounting = new FormAccounting($db); -$accounting = new AccountingAccount($db); -$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1); -$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1); $chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); @@ -384,11 +381,11 @@ if ($result) { print ''; print ''; //print ''; - print ''; + print ''; print ''; print ''; print ''; - print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1); + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1); //print ''; print ''; print ''; @@ -444,29 +441,50 @@ if ($result) { $isBuyerInEEC = isInEEC($objp); + $suggestedaccountingaccountbydefaultfor = ''; if ($objp->type_l == 1) { - $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); - if ($objp->aarowid == '') { - $objp->aarowid_suggest = $aarowid_s; - } + if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) + $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = ''; + } else { + if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'eec'; + } else { // Foreign sale + $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'export'; + } + } } elseif ($objp->type_l == 0) { - $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); - if ($objp->aarowid == '') { - $objp->aarowid_suggest = $aarowid_p; + if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) + $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = ''; + } else { + if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale + $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'eec'; + } else { + $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : ''); + $suggestedaccountingaccountbydefaultfor = 'export'; + } } } if ($objp->code_sell_l == -1) $objp->code_sell_l=''; + $suggestedaccountingaccountfor = ''; if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) $objp->code_sell_p = $objp->code_sell; $objp->aarowid_suggest = $objp->aarowid; + $suggestedaccountingaccountfor = ''; } else { if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale $objp->code_sell_p = $objp->code_sell_intra; $objp->aarowid_suggest = $objp->aarowid_intra; + $suggestedaccountingaccountfor = 'eec'; } else { // Foreign sale $objp->code_sell_p = $objp->code_sell_export; $objp->aarowid_suggest = $objp->aarowid_export; + $suggestedaccountingaccountfor = 'export'; } } @@ -477,8 +495,8 @@ if ($result) { } if (empty($objp->code_sell_l) && empty($objp->code_sell_p)) $code_sell_p_notset = 'color:red'; - // $objp->code_sell_p is now code of product/service // $objp->code_sell_l is now default code of product/service + // $objp->code_sell_p is now code of product/service print ''; @@ -492,7 +510,7 @@ if ($result) { // Ref Product print ''; - if ($product_static->id) + if ($product_static->id > 0) print $product_static->getNomUrl(1); if ($objp->product_label) print '
'.$objp->product_label; print ''; @@ -514,7 +532,7 @@ if ($result) { print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')); print ''; - print ''; + print ''; $labelcountry=($objp->country_code && ($langs->trans("Country".$objp->country_code)!="Country".$objp->country_code))?$langs->trans("Country".$objp->country_code):$objp->country_label; print $labelcountry; print ''; @@ -523,17 +541,27 @@ if ($result) { // Current account print ''; - print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown")); - if ($objp->product_id > 0) + $s = (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")).': '; + $shelp = ''; + if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp.= $langs->trans("SaleEEC"); + elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp.= $langs->trans("SaleExport"); + $s.= ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("NotDefined")); + print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); + if ($objp->product_id > 0) { print '
'; - print (($objp->type_l == 1)?$langs->trans("ThisService"):$langs->trans("ThisProduct")) . ' = ' . (empty($objp->code_sell_p) ? $langs->trans("Unknown") : length_accountg($objp->code_sell_p)); + $s = (($objp->type_l == 1)?$langs->trans("ThisService"):$langs->trans("ThisProduct")).': '; + $shelp = ''; + if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC"); + elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); + $s.= (empty($objp->code_sell_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_sell_p)); + print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); } print ''; // Suggested accounting account print ''; - print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; // Column with checkbox diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 17284513650..b3a426bbf5e 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -332,8 +332,8 @@ if ($result) { if ($search_desc) $param.='&search_desc='.urlencode($search_desc); if ($search_amount) $param.='&search_amount='.urlencode($search_amount); if ($search_vat) $param.='&search_vat='.urlencode($search_vat); - if ($search_country) $param .= "&search_country=" . urlencode($search_country); - if ($search_tvaintra) $param .= "&search_tvaintra=" . urlencode($search_tvaintra); + if ($search_country) $param.="&search_country=".urlencode($search_country); + if ($search_tvaintra) $param.="&search_tvaintra=".urlencode($search_tvaintra); $arrayofmassactions = array( 'ventil'=>$langs->trans("Ventilate") @@ -382,11 +382,11 @@ if ($result) { print ''; print ''; //print ''; - print ''; + print ''; print ''; print ''; print ''; - print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1); + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1); //print ''; print ''; print ''; @@ -418,7 +418,7 @@ if ($result) { print "\n"; $facturefourn_static = new FactureFournisseur($db); - $productfourn_static = new ProductFournisseur($db); + $product_static = new Product($db); while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); @@ -430,10 +430,10 @@ if ($result) { $objp->code_buy_p = ''; $objp->aarowid_suggest = ''; - $productfourn_static->ref = $objp->product_ref; - $productfourn_static->id = $objp->product_id; - $productfourn_static->type = $objp->type; - $productfourn_static->label = $objp->product_label; + $product_static->ref = $objp->product_ref; + $product_static->id = $objp->product_id; + $product_static->type = $objp->type; + $product_static->label = $objp->product_label; $facturefourn_static->ref = $objp->ref; $facturefourn_static->id = $objp->facid; @@ -479,8 +479,8 @@ if ($result) { // Ref product print ''; - if ($productfourn_static->id) - print $productfourn_static->getNomUrl(1); + if ($product_static->id > 0) + print $product_static->getNomUrl(1); if ($objp->product_label) print '
'.$objp->product_label; print ''; @@ -502,26 +502,38 @@ if ($result) { print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')); print ''; - print ''; + // Country + print ''; $labelcountry=($objp->country_code && ($langs->trans("Country".$objp->country_code)!="Country".$objp->country_code))?$langs->trans("Country".$objp->country_code):$objp->country_label; print $labelcountry; print ''; + // VAT Num print '' . $objp->tva_intra . ''; // Current account print ''; - print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("Unknown")); + $s = (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")).': '; + $shelp = ''; + if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp.= $langs->trans("SaleEEC"); + elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp.= $langs->trans("SaleExport"); + $s.= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("NotDefined")); + print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); if ($objp->product_id > 0) { - print '
'; - print (($objp->type_l == 1)?$langs->trans("ThisService"):$langs->trans("ThisProduct")) . ' = ' . (empty($objp->code_buy_p) ? $langs->trans("Unknown") : length_accountg($objp->code_buy_p)); + print '
'; + $s = (($objp->type_l == 1)?$langs->trans("ThisService"):$langs->trans("ThisProduct")).': '; + $shelp = ''; + if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC"); + elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); + $s.= (empty($objp->code_buy_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_buy_p)); + print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); } print ''; // Suggested accounting account print ''; - print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); + print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); print ''; // Column with checkbox diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index f2384b13cf2..fc74890f150 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -1009,7 +1009,8 @@ class ProductFournisseur extends Product /** - * Return a link to the object card (with optionaly the picto) + * Return a link to the object card (with optionaly the picto). + * Used getNomUrl of ProductFournisseur if a specific supplier ref is loaded. Otherwise use Product->getNomUrl(). * * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) * @param string $option On what the link point to ('nolink', ...) @@ -1025,11 +1026,10 @@ class ProductFournisseur extends Product if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips $result = ''; - $companylink = ''; $label = '' . $langs->trans("SupplierRef") . ''; $label.= '
'; - $label.= '' . $langs->trans('Ref') . ': ' . $this->fourn_ref; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref_supplier; $logPrices = $this->listProductFournisseurPriceLog($this->product_fourn_price_id, 'pfpl.datec', 'DESC'); // set sort order here if (is_array($logPrices) && count($logPrices) > 0) { diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 7797fdef7b1..3a08e422600 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -316,6 +316,9 @@ WithoutValidAccount=Without valid dedicated account WithValidAccount=With valid dedicated account ValueNotIntoChartOfAccount=This value of accounting account does not exist into chart of account AccountRemovedFromGroup=Account removed from group +SaleLocal=Local sale +SaleExport=Export sale +SaleEEC=Sale in EEC ## Dictionary Range=Range of accounting account diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index de0d28cee83..a5491045c16 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4059,16 +4059,18 @@ class Product extends CommonObject } } - $linkstart = ''; $linkend=''; $result.=$linkstart; if ($withpicto) { - if ($this->type == Product::TYPE_PRODUCT) { $result.=(img_object(($notooltip?'':$label), 'product', ($notooltip?'class="paddingright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); + if ($this->type == Product::TYPE_PRODUCT) { + $result.=(img_object(($notooltip?'':$label), 'product', ($notooltip?'class="paddingright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); } - if ($this->type == Product::TYPE_SERVICE) { $result.=(img_object(($notooltip?'':$label), 'service', ($notooltip?'class="paddinright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); + if ($this->type == Product::TYPE_SERVICE) { + $result.=(img_object(($notooltip?'':$label), 'service', ($notooltip?'class="paddinright"':'class="paddingright classfortooltip"'), 0, 0, $notooltip?0:1)); } } $result.= $newref; @@ -4078,8 +4080,10 @@ class Product extends CommonObject $hookmanager->initHooks(array('productdao')); $parameters=array('id'=>$this->id, 'getnomurl'=>$result); $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) { $result = $hookmanager->resPrint; - } else { $result .= $hookmanager->resPrint; + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; } return $result; From cb057e9c6db20b120fbebb0b11239cfb554904d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 12:32:14 +0200 Subject: [PATCH 145/515] NEW Add hidden option to be ready for BREXIT --- htdocs/core/lib/company.lib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c3b9bcec2cf..1e27cb112d3 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -649,6 +649,8 @@ function getFormeJuridiqueLabel($code) */ function getCountriesInEEC() { + global $conf; + // List of all country codes that are in europe for european vat rules // List found on http://ec.europa.eu/taxation_customs/common/faq/faq_1179_en.htm#9 $country_code_in_EEC=array( @@ -687,6 +689,12 @@ function getCountriesInEEC() //'CH', // Switzerland - No. Swizerland in not in EEC ); + if (! empty($conf->global->MAIN_COUNTRIES_IN_EEC)) + { + // For example MAIN_COUNTRIES_IN_EEC = 'AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,NL,HU,IE,IM,IT,LT,LU,LV,MC,MT,PL,PT,RO,SE,SK,SI,UK' + $country_code_in_EEC = explode(',', $conf->global->MAIN_COUNTRIES_IN_EEC); + } + return $country_code_in_EEC; } From 6e069385bc054a2bd2c0032f32f500cfc755b3eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 12:32:38 +0200 Subject: [PATCH 146/515] Update doc --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index e0f4159c49e..9b91afd128f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -114,6 +114,7 @@ NEW: Option in workflow module to set a reception billed on validate supplier bi NEW: Autocompletion on lists should be available on mobile applications. NEW: Add mass action to close several members. NEW: Add hidden option ADD_UNSPLASH_LOGIN_BACKGROUND for random background +NEW: Add hidden option to be ready for BREXIT For Developers: NEW: Module "DebugBar" is available as a stable module. From bff6260983d0a47f49d04f4e6b1629023b1e013a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 12:34:29 +0200 Subject: [PATCH 147/515] Fix syntax error --- htdocs/accountancy/journal/bankjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 0f22789d630..a9009e725b8 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -172,7 +172,7 @@ if ($result) { // Variables $account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word - $account_customer = ($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word + $account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word $account_employee = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word $account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word $account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word From afb63623178365f31be9b37658f805ead993c4b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 20 Jun 2019 13:37:06 +0200 Subject: [PATCH 148/515] Fix look and feel v10 Fix link to direct debit payment order --- htdocs/accountancy/admin/accountmodel.php | 4 +- htdocs/accountancy/admin/categories_list.php | 2 +- htdocs/accountancy/admin/closure.php | 5 +- htdocs/accountancy/admin/defaultaccounts.php | 3 +- htdocs/accountancy/admin/export.php | 5 +- htdocs/accountancy/admin/productaccount.php | 2 +- .../class/accountancyexport.class.php | 78 +++++++++---------- htdocs/accountancy/journal/bankjournal.php | 4 +- .../journal/expensereportsjournal.php | 2 +- .../accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 2 +- htdocs/admin/dict.php | 3 +- htdocs/compta/bank/bankentries_list.php | 12 ++- .../class/bonprelevement.class.php | 70 +++++++++++++---- htdocs/langs/en_US/banks.lang | 2 +- htdocs/langs/en_US/withdrawals.lang | 4 +- 16 files changed, 121 insertions(+), 79 deletions(-) diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index f44ff0071d2..102d268e218 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2016 Juanjo Menent @@ -462,8 +462,6 @@ $linkback=''; print load_fiche_titre($titre, $linkback, 'title_accountancy'); -print "
\n"; - // Confirmation de la suppression de la ligne if ($action == 'delete') diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 3a55e092d94..e7cdc800aee 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -412,7 +412,7 @@ $titlepicto='title_setup'; print load_fiche_titre($titre, $linkback, $titlepicto); -print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'

'; +print ''.$langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'

'; // Confirmation de la suppression de la ligne if ($action == 'delete') diff --git a/htdocs/accountancy/admin/closure.php b/htdocs/accountancy/admin/closure.php index a638d598ac9..479dd410f33 100644 --- a/htdocs/accountancy/admin/closure.php +++ b/htdocs/accountancy/admin/closure.php @@ -21,9 +21,8 @@ * \ingroup Accountancy (Double entries) * \brief Setup page to configure accounting expert module */ -require '../../main.inc.php'; -// Class +require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; @@ -89,7 +88,7 @@ llxHeader(); $linkback = ''; print load_fiche_titre($langs->trans('MenuClosureAccounts'), $linkback, 'title_accountancy'); -print $langs->trans("DefaultClosureDesc").'
'; +print ''.$langs->trans("DefaultClosureDesc").'
'; print '
'; print '
'; diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index cba9ac92f3b..079e3585341 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -78,7 +78,6 @@ $list_account = array ( $accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE; - if (GETPOST('change_chart', 'alpha')) { $chartofaccounts = GETPOST('chartofaccounts', 'int'); @@ -132,7 +131,7 @@ llxHeader(); $linkback = ''; print load_fiche_titre($langs->trans('MenuDefaultAccounts'), $linkback, 'title_accountancy'); -print $langs->trans("DefaultBindingDesc").'
'; +print ''.$langs->trans("DefaultBindingDesc").'
'; print '
'; print ''; diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 74090e54120..81dc83b2ae5 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -76,6 +76,7 @@ $model_option = array ( ), ); + /* * Actions */ @@ -138,6 +139,7 @@ $form = new Form($db); // $linkback = '' . $langs->trans("BackToModuleList") . ''; print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup'); + print "\n".''; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index bba5185c94a..b95cffdb499 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -221,6 +221,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index b06558393aa..271ed4911b4 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -220,6 +220,7 @@ class box_graph_orders_permonth extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 9cb11aed7c1..b7589e0efd2 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -219,6 +219,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 0fe5c66d532..0cdffafa050 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -338,6 +338,7 @@ class box_graph_product_distribution extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index b21381473c2..42643fb72bc 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -223,6 +223,7 @@ class box_graph_propales_permonth extends ModeleBoxes '; $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.=''; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d283abd7d15..5456e2ce1eb 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -374,6 +374,7 @@ if (! defined('NOTOKENRENEWAL')) //var_dump(GETPOST('token').' '.$_SESSION['token'].' - '.$_SESSION['newtoken'].' '.$_SERVER['SCRIPT_FILENAME']); // Check token +//var_dump((! defined('NOCSRFCHECK')).' '.empty($dolibarr_nocsrfcheck).' '.(! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)).' '.$_SERVER['REQUEST_METHOD'].' '.(! GETPOSTISSET('token'))); if ((! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && ! empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) || defined('CSRFCHECK_WITH_TOKEN')) // Check validity of token, only if option MAIN_SECURITY_CSRF_WITH_TOKEN enabled or if constant CSRFCHECK_WITH_TOKEN is set { From a75a2ae8e45a730e9a74ac9944acb43aac4c4ee2 Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 2 Jul 2019 15:44:42 +0200 Subject: [PATCH 388/515] Fix missing hidden input and short label --- htdocs/admin/dict.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d160793b735..6bffb7fe535 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1889,6 +1889,9 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') { print ''; } + else{ + print ''; + } print ''; } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) { @@ -1951,7 +1954,13 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } else { - if ($fieldlist[$field]=='sortorder') $fieldlist[$field]='position'; + + $fieldValue = isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''; + + if ($fieldlist[$field]=='sortorder') + { + $fieldlist[$field]='position'; + } $classtd=''; $class=''; if ($fieldlist[$field]=='code') $classtd='width100'; @@ -1972,7 +1981,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } if ($tabname == MAIN_DB_PREFIX.'c_payment_term') { $langs->load("bills"); - $transkey="PaymentCondition".strtoupper($obj->code); + $transkey="PaymentConditionShort".strtoupper($obj->code); } if ($transkey && $langs->trans($transkey) != $transkey) { @@ -1982,8 +1991,11 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } if (! $transfound) { - print ''; + print ''; } + else{ + print ''; + } print ''; } } From d9560dbb6187a26c6badf7af3be04e467cccc1bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jul 2019 18:02:06 +0200 Subject: [PATCH 389/515] Fix var not initialized --- htdocs/core/modules/export/export_csv.modules.php | 3 +++ htdocs/core/modules/export/export_excel.modules.php | 2 ++ htdocs/core/modules/export/export_excel2007new.modules.php | 2 ++ 3 files changed, 7 insertions(+) diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index c3c8431962e..9d606aadc33 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -261,6 +261,9 @@ class ExportCsv extends ModeleExports } $this->col=0; + + $reg=array(); + foreach($array_selected_sorted as $code => $value) { if (strpos($code, ' as ') == 0) $alias=str_replace(array('.','-','(',')'), '_', $code); diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index ffb1fd83cce..0e7fd0f1169 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -345,6 +345,8 @@ class ExportExcel extends ModeleExports // Define first row $this->col=0; + $reg=array(); + foreach($array_selected_sorted as $code => $value) { if (strpos($code, ' as ') == 0) $alias=str_replace(array('.','-','(',')'), '_', $code); diff --git a/htdocs/core/modules/export/export_excel2007new.modules.php b/htdocs/core/modules/export/export_excel2007new.modules.php index 266cedc1310..038446643a2 100644 --- a/htdocs/core/modules/export/export_excel2007new.modules.php +++ b/htdocs/core/modules/export/export_excel2007new.modules.php @@ -304,6 +304,8 @@ class ExportExcel2007new extends ModeleExports // Define first row $this->col=0; + $reg=array(); + foreach($array_selected_sorted as $code => $value) { if (strpos($code, ' as ') == 0) $alias=str_replace(array('.','-','(',')'), '_', $code); From 9d50c672088b16a6208358e4f1e890ca3ab0eaab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jul 2019 18:06:51 +0200 Subject: [PATCH 390/515] FIX option EXPORT_LABEL_FOR_SELECT to restore compatibility in export --- htdocs/core/extrafieldsinexport.inc.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 13b2d1ae520..78dbba9934e 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -34,6 +34,15 @@ if ($resql) // This can fail when class is used on old database (during migra case 'boolean': $typeFilter="Boolean"; break; + case 'select': + if (! empty($conf->global->EXPORT_LABEL_FOR_SELECT)) + { + $tmpparam=unserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...) + if ($tmpparam['options'] && is_array($tmpparam['options'])) { + $typeFilter="Select:".$obj->param; + } + } + break; case 'sellist': $tmp=''; $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null From 126479b5a9408bc3c6c55fa640e276fc44d36c4e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 2 Jul 2019 21:46:00 +0200 Subject: [PATCH 391/515] Fix paymentmethod detach --- htdocs/societe/paymentmodes.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 6a3596f6e24..21af1f0a35c 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -637,6 +637,16 @@ if (empty($reshook)) elseif ($action == 'deletecard' && $source) { try { + if (preg_match('/pm_/', $source)) + { + $payment_method = \Stripe\PaymentMethod::retrieve($source); + if ($payment_method) + { + $payment_method->detach(); + } + } + else + { $cu=$stripe->customerStripe($object, $stripeacc, $servicestatus); $card=$cu->sources->retrieve("$source"); if ($card) @@ -645,6 +655,7 @@ if (empty($reshook)) if (method_exists($card, 'detach')) $card->detach(); else $card->delete(); } + } $url=DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; header('Location: '.$url); From 03938e21239396b44353f234a2d8219694722332 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 2 Jul 2019 21:56:50 +0200 Subject: [PATCH 392/515] Update paymentmodes.php --- htdocs/societe/paymentmodes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 21af1f0a35c..0e41e11cbaa 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -639,7 +639,7 @@ if (empty($reshook)) try { if (preg_match('/pm_/', $source)) { - $payment_method = \Stripe\PaymentMethod::retrieve($source); + $payment_method = \Stripe\PaymentMethod::retrieve($source, ["stripe_account" => $stripeacc]); if ($payment_method) { $payment_method->detach(); From ff68b110b27aca9c0f76b12d0ddc38acdd73726a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Jul 2019 23:14:22 +0200 Subject: [PATCH 393/515] Fix phpcs --- .../debugbar/class/DataCollector/DolRequestDataCollector.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php index d6e939a9964..ebf9e2bfbd2 100644 --- a/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolRequestDataCollector.php @@ -8,6 +8,11 @@ use \DebugBar\DataCollector\RequestDataCollector; class DolRequestDataCollector extends RequestDataCollector { + /** + * Collects the data from the collectors + * + * @return array + */ public function collect() { $vars = array('_GET', '_POST', '_SESSION', '_COOKIE', '_SERVER'); From 221c202add5821ed95c81d855446fbdac86df68e Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Wed, 3 Jul 2019 06:59:52 +0200 Subject: [PATCH 394/515] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b065bb27470..8949dbc5f97 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5026,7 +5026,7 @@ abstract class CommonObject //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); - if (!empty($attrfieldcomputed)) + if ((!empty($attrfieldcomputed) && (! empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS))) { $value = dol_eval($attrfieldcomputed, 1, 0); $new_array_options[$key] = $value; From 9064737930307a62f75c0f406794925ddf7056df Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Wed, 3 Jul 2019 07:08:53 +0200 Subject: [PATCH 395/515] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8949dbc5f97..d164761366d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5026,7 +5026,7 @@ abstract class CommonObject //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); - if ((!empty($attrfieldcomputed) && (! empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS))) + if ((!empty($attrfieldcomputed)) && (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS))) { $value = dol_eval($attrfieldcomputed, 1, 0); $new_array_options[$key] = $value; From 818a8c7d5963c719f26ebaa92f069aef345c8ab4 Mon Sep 17 00:00:00 2001 From: Louis Sautier Date: Wed, 3 Jul 2019 10:44:12 +0200 Subject: [PATCH 396/515] Fix missing form end tag in prelevement --- htdocs/compta/prelevement/create.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index d9298c9f607..747bbdf828d 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -181,6 +181,7 @@ else print 'transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."\n"; } +print "\n"; print "
\n"; print '
'; From 116c6d7a6a9b03eb61ba8564646b4a22fe1a7cc1 Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Wed, 3 Jul 2019 11:09:24 +0200 Subject: [PATCH 397/515] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d164761366d..67d75a62169 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5026,10 +5026,19 @@ abstract class CommonObject //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); - if ((!empty($attrfieldcomputed)) && (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS))) + + if (!empty($attrfieldcomputed)) { + if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) + { $value = dol_eval($attrfieldcomputed, 1, 0); + dol_syslog($langs->trans("Extrafieldcomputed")." sur ".$attributeLabel."(".$value.")", LOG_DEBUG); $new_array_options[$key] = $value; + } + else + { + $new_array_options[$key] = null; + } } From 433835860c2cbf470b9421d75f035a2567c33aee Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 3 Jul 2019 13:12:41 +0200 Subject: [PATCH 398/515] FIX: When saving an action it didn't save the label based on the type of event if the label is empty and the type is customized --- htdocs/comm/action/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 470a90c355f..8989807a645 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2019 Ferran Marcet * * 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 @@ -246,7 +247,10 @@ if ($action == 'add') { $object->label = $langs->transnoentitiesnoconv("Action".$object->type_code)."\n"; } - else $object->label = $cactioncomm->libelle; + else { + $cactioncomm->fetch($object->type_code); + $object->label = $cactioncomm->label; + } } } $object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0; From 135e47892bcd7f62b27c801feec835b02be84692 Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Wed, 3 Jul 2019 16:15:20 +0200 Subject: [PATCH 399/515] Update admin_extrafields_add.tpl.php --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 04720004492..a7ae00b9ac9 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -179,7 +179,7 @@ $langs->load("modulebuilder"); trans("LanguageFile"); ?> -textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?> +textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning', '', 0, 2, 'tooltipcompute'); ?> trans("DefaultValue").' ('.$langs->trans("Database").')'; ?> From 123cf7ce502d494915c25ba03b1bd71f2faa8169 Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Wed, 3 Jul 2019 16:16:45 +0200 Subject: [PATCH 400/515] Update admin_extrafields_add.tpl.php --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index a7ae00b9ac9..5bd161c9893 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -179,7 +179,7 @@ $langs->load("modulebuilder"); trans("LanguageFile"); ?> -textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning', '', 0, 2, 'tooltipcompute'); ?> +textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?> trans("DefaultValue").' ('.$langs->trans("Database").')'; ?> From 3e53a06b2ef93b487dbb4b18ffb3b4c82292ad40 Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Wed, 3 Jul 2019 16:17:47 +0200 Subject: [PATCH 401/515] minor spelling issues --- htdocs/fourn/commande/dispatch.php | 4 ++-- htdocs/langs/fr_FR/stocks.lang | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 77fd4b1aa69..dd6fd76a46a 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -245,7 +245,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) // We ask to move a qty if (GETPOST($qty) != 0) { if (! (GETPOST($ent, 'int') > 0)) { - dol_syslog('No dispatch for line ' . $key . ' as no warehouse choosed'); + dol_syslog('No dispatch for line ' . $key . ' as no warehouse was chosen.'); $text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline); setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors'); $error ++; @@ -282,7 +282,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) // We ask to move a qty if (GETPOST($qty) > 0) { if (! (GETPOST($ent, 'int') > 0)) { - dol_syslog('No dispatch for line ' . $key . ' as no warehouse choosed'); + dol_syslog('No dispatch for line ' . $key . ' as no warehouse was chosen.'); $text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline) . '-' . ($reg[1] + 1); setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors'); $error ++; diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index 5898f7384e5..df9f738f4d8 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -65,7 +65,7 @@ RuleForStockManagementIncrease=Règle de gestion des incrémentations de stock ( DeStockOnBill=Décrémenter les stocks physiques sur validation des factures/avoirs clients DeStockOnValidateOrder=Décrémenterr les stocks physiques sur validation des commandes clients DeStockOnShipment=Décrémenter les stocks physiques sur validation des expéditions -DeStockOnShipmentOnClosing=Décrémenter les stocks phisiques au classement "clôturée" de l'expédition +DeStockOnShipmentOnClosing=Décrémenter les stocks physiques au classement "clôturée" de l'expédition ReStockOnBill=Incrémenter les stocks physiques sur validation des factures/avoirs fournisseurs ReStockOnValidateOrder=Incrémenter les stocks physiques sur approbation des commandes fournisseurs ReStockOnDispatchOrder=Incrémenter les stocks physiques sur ventilation manuelle dans les entrepôts, après réception de la marchandise From 9962243df3b772c64018c782bc15195856a8906f Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Wed, 3 Jul 2019 16:19:51 +0200 Subject: [PATCH 402/515] Update admin_extrafields_edit.tpl.php --- htdocs/core/tpl/admin_extrafields_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 7ed41af9281..2acdf7e864f 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -243,7 +243,7 @@ else trans("LanguageFile"); ?> -textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?> +textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?> trans("DefaultValue").' ('.$langs->trans("Database").')'; ?> From f8a5ae90e3cf8ac89feae9f4eb8d8e616528931e Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Wed, 3 Jul 2019 16:43:47 +0200 Subject: [PATCH 403/515] Update admin.lang --- htdocs/langs/en_US/admin.lang | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7480550195a..73d825d8320 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -422,6 +422,8 @@ ExtrafieldCheckBoxFromList=Checkboxes from table ExtrafieldLink=Link to an object ComputedFormula=Computed field ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: $db, $conf, $langs, $mysoc, $user, $object.
WARNING: Only some properties of $object may be available. If you need a properties not loaded, just fetch yourself the object into your formula like in the second example.
Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.

Example of formula:
$object->id < 10 ? round($object->id / 2, 2): ($object->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)

Example to reload object
(($reloadedobj = new Societe($db)) && ($reloadedobj->fetch($obj->id ? $obj->id: ($obj->rowid ? $obj->rowid: $object->id)) > 0)) ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5: '-1'

Other example of formula to force load of object and its parent object:
(($reloadedobj = new Task($db)) && ($reloadedobj->fetch($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetch($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref: 'Parent project not found' +Computedpersistent=Store computed field +ComputedpersistentDesc=Computed extra fields will be stored in the database, however, the value will only be recalculated when the object of this field is changed. If the computed field depends on other objects or global data this value might be wrong!! ExtrafieldParamHelpPassword=Leaving this field blank means this value will be stored without encryption (field must be only hidden with star on screen).
Set 'auto' to use the default encryption rule to save password into database (then value read will be the hash only, no way to retrieve original value) ExtrafieldParamHelpselect=List of values must be lines with format key,value (where key can't be '0')

for example:
1,value1
2,value2
code3,value3
...

In order to have the list depending on another complementary attribute list:
1,value1|options_parent_list_code:parent_key
2,value2|options_parent_list_code:parent_key

In order to have the list depending on another list:
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key ExtrafieldParamHelpcheckbox=List of values must be lines with format key,value (where key can't be '0')

for example:
1,value1
2,value2
3,value3
... @@ -1924,4 +1926,4 @@ UrlForIFTTT=URL endpoint for IFTTT YouWillFindItOnYourIFTTTAccount=You will find it on your IFTTT account EndPointFor=End point for %s : %s DeleteEmailCollector=Delete email collector -ConfirmDeleteEmailCollector=Are you sure you want to delete this email collector? \ No newline at end of file +ConfirmDeleteEmailCollector=Are you sure you want to delete this email collector? From cd7d4de6ecae99d7723ed55d7e9e1141242c6bbc Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Wed, 3 Jul 2019 16:53:26 +0200 Subject: [PATCH 404/515] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 67d75a62169..0a300476fb5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5029,7 +5029,7 @@ abstract class CommonObject if (!empty($attrfieldcomputed)) { - if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) + if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { $value = dol_eval($attrfieldcomputed, 1, 0); dol_syslog($langs->trans("Extrafieldcomputed")." sur ".$attributeLabel."(".$value.")", LOG_DEBUG); From 2f5b9ccb22b9bcd3cce64d3a234bdf3e945b6d1e Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 3 Jul 2019 17:00:18 +0200 Subject: [PATCH 405/515] fix case objecttmp is an invoice --- htdocs/core/class/html.form.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index fe8a812a8a2..a8d96ed4b34 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5558,7 +5558,8 @@ class Form if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company'; $confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT - $fieldstoshow='t.ref'; + if (DOL_VERSION < 10 && $objecttmp->element == 'facture') $fieldstoshow = 't.facnumber'; + else $fieldstoshow='t.ref'; if (! empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields ( like societe, contact, ...) { $tmpfieldstoshow=''; From 95b6f03bf52d019b3b978e73b686d441a5bfd169 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 01:58:25 +0200 Subject: [PATCH 406/515] Code comment --- htdocs/core/triggers/interface_20_all_Logevents.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 1ce13ff2193..92d93eef10f 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; /** - * Class of triggers for security events + * Class of triggers for security audit events */ class InterfaceLogevents extends DolibarrTriggers { @@ -47,7 +47,7 @@ class InterfaceLogevents extends DolibarrTriggers public $version = self::VERSION_DOLIBARR; /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarrr security audit event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * @param string $action Event action code From 27ba3408b43b1e990571c16ec6b8e6ab92f4bd49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 02:01:55 +0200 Subject: [PATCH 407/515] Fix code comment --- htdocs/core/class/events.class.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 50fc116611a..af87e25fad1 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2019 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -20,14 +20,8 @@ * \file htdocs/core/class/events.class.php * \ingroup core * \brief File of class to manage security events. - * \author Laurent Destailleur */ -// Put here all includes required by your class file -//require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - /** * Events class @@ -133,7 +127,7 @@ class Events // extends CommonObject */ public function create($user) { - global $conf, $langs; + global $conf; // Clean parameters $this->description=trim($this->description); @@ -185,8 +179,6 @@ class Events // extends CommonObject */ public function update($user = null, $notrigger = 0) { - global $conf, $langs; - // Clean parameters $this->id=trim($this->id); $this->type=trim($this->type); @@ -222,8 +214,6 @@ class Events // extends CommonObject */ public function fetch($id, $user = null) { - global $langs; - $sql = "SELECT"; $sql.= " t.rowid,"; $sql.= " t.tms,"; @@ -273,8 +263,6 @@ class Events // extends CommonObject */ public function delete($user) { - global $conf, $langs; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."events"; $sql.= " WHERE rowid=".$this->id; From 75aa11e5269efcccf6d3b4de08ebfa7f7dc6a217 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 01:58:25 +0200 Subject: [PATCH 408/515] Code comment --- htdocs/core/triggers/interface_20_all_Logevents.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 1ce13ff2193..92d93eef10f 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; /** - * Class of triggers for security events + * Class of triggers for security audit events */ class InterfaceLogevents extends DolibarrTriggers { @@ -47,7 +47,7 @@ class InterfaceLogevents extends DolibarrTriggers public $version = self::VERSION_DOLIBARR; /** - * Function called when a Dolibarrr business event is done. + * Function called when a Dolibarrr security audit event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * * @param string $action Event action code From 10e3e37c6c2d560b283263e673ad46d86cc6981a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 10:39:30 +0200 Subject: [PATCH 409/515] Update don.class.php --- htdocs/don/class/don.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index caeb70aca94..638de5580e4 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -396,7 +396,7 @@ class Don extends CommonObject $sql.= ", ".$conf->entity; $sql.= ", ".price2num($this->amount); $sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null"); - $sql.= ", ".($this->socid?$this->socid:"null"); + $sql.= ", ".($this->socid > 0 ? $this->socid : "null"); $sql.= ", '".$this->db->escape($this->firstname)."'"; $sql.= ", '".$this->db->escape($this->lastname)."'"; $sql.= ", '".$this->db->escape($this->societe)."'"; From cf458c77dccb086aae2cb485e72c3f1fbba7be1a Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Thu, 4 Jul 2019 11:43:17 +0200 Subject: [PATCH 410/515] FIX: hook added on fileupload.class.php to enable modules to override upload options --- htdocs/core/class/fileupload.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index c3a40599877..17444cb5358 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -45,6 +45,8 @@ class FileUpload { global $db, $conf; global $object; + global $hookmanager; + $hookmanager->initHooks(array('fileupload')); $this->fk_element=$fk_element; $this->element=$element; @@ -183,6 +185,18 @@ class FileUpload ) ) ); + + $hookmanager->executeHooks( + 'overrideUploadOptions', + array( + 'options' => &$options, + 'element' => $element + ), + $object, + $action, + $hookmanager + ); + if ($options) { $this->options = array_replace_recursive($this->options, $options); } From b065cbc6f88023a7f6bef9a2c225bd3098c7a5e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 12:09:04 +0200 Subject: [PATCH 411/515] FIX #11446 --- htdocs/product/class/product.class.php | 39 ++++++++++++++------------ test/phpunit/ProductTest.php | 27 +++++++++++++++++- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 69cd6ba077c..c0038ac17d8 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3716,7 +3716,7 @@ class Product extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fonction recursive uniquement utilisee par get_arbo_each_prod, recompose l'arborescence des sousproduits - * Define value of this->res + * Define value of this->res * * @param array $prod Products array * @param string $compl_path Directory path of parents to add before @@ -3730,7 +3730,7 @@ class Product extends CommonObject // phpcs:enable global $conf,$langs; - $product = new Product($this->db); + $tmpproduct = null; //var_dump($prod); foreach($prod as $id_product => $desc_pere) // $id_product is 0 (first call starting with root top) or an id of a sub_product { @@ -3746,23 +3746,26 @@ class Product extends CommonObject } //print "XXX We add id=".$id." - label=".$label." - nb=".$nb." - multiply=".$multiply." fullpath=".$compl_path.$label."\n"; - $this->fetch($id); // Load product - $this->load_stock('nobatch,novirtual'); // Load stock to get true this->stock_reel + if (is_null($tmpproduct)) $tmpproduct = new Product($this->db); // So we initialize tmpproduct only once for all loop. + $tmpproduct->fetch($id); // Load product to get ->ref + $tmpproduct->load_stock('nobatch,novirtual'); // Load stock to get true ->stock_reel + //$this->fetch($id); // Load product to get ->ref + //$this->load_stock('nobatch,novirtual'); // Load stock to get true ->stock_reel $this->res[]= array( - 'id'=>$id, // Id product - 'id_parent'=>$id_parent, - 'ref'=>$this->ref, // Ref product - 'nb'=>$nb, // Nb of units that compose parent product - 'nb_total'=>$nb*$multiply, // Nb of units for all nb of product - 'stock'=>$this->stock_reel, // Stock - 'stock_alert'=>$this->seuil_stock_alerte, // Stock alert - 'label'=>$label, - 'fullpath'=>$compl_path.$label, // Label - 'type'=>$type, // Nb of units that compose parent product - 'desiredstock'=>$this->desiredstock, - 'level'=>$level, - 'incdec'=>$incdec, - 'entity'=>$this->entity + 'id'=>$id, // Id product + 'id_parent'=>$id_parent, + 'ref'=>$tmpproduct->ref, // Ref product + 'nb'=>$nb, // Nb of units that compose parent product + 'nb_total'=>$nb*$multiply, // Nb of units for all nb of product + 'stock'=>$tmpproduct->stock_reel, // Stock + 'stock_alert'=>$tmpproduct->seuil_stock_alerte, // Stock alert + 'label'=>$label, + 'fullpath'=>$compl_path.$label, // Label + 'type'=>$type, // Nb of units that compose parent product + 'desiredstock'=>$tmpproduct->desiredstock, + 'level'=>$level, + 'incdec'=>$incdec, + 'entity'=>$tmpproduct->entity ); // Recursive call if there is childs to child diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php index c57ef426d0b..782d5f076e8 100644 --- a/test/phpunit/ProductTest.php +++ b/test/phpunit/ProductTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ProductTest extends PHPUnit_Framework_TestCase +class ProductTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; @@ -168,6 +168,31 @@ class ProductTest extends PHPUnit_Framework_TestCase return $localobject; } + /** + * testProductGetArboEachProd + * + * @return void + */ + public function testProductGetArboEachProd() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + /* + $localobject=new Product($db); + $localobject->fetch(208); + $localobject->get_sousproduits_arbo(); + $localobject->get_arbo_each_prod(); + + var_dump($localobject->res); print (json_encode($localobject->res)); exit; + */ + + return; + } + /** * testProductUpdate * From fb69f23bbaaa9270f0f3fd2cd78ca2c281e0ff79 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 12:10:29 +0200 Subject: [PATCH 412/515] Fix phpunit --- test/phpunit/ProductTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php index 782d5f076e8..115475113fa 100644 --- a/test/phpunit/ProductTest.php +++ b/test/phpunit/ProductTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ProductTest extends PHPUnit\Framework\TestCase +class ProductTest extends PHPUnit_Framework_TestCase { protected $savconf; protected $savuser; From 63c93be94e0a28be0cb05fb08ecc3c76c2f2e7cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 12:20:34 +0200 Subject: [PATCH 413/515] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a8d96ed4b34..a462f40ebdc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5558,7 +5558,7 @@ class Form if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode='company'; $confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT - if (DOL_VERSION < 10 && $objecttmp->element == 'facture') $fieldstoshow = 't.facnumber'; + if (((float) DOL_VERSION) < 10 && $objecttmp->element == 'facture') $fieldstoshow = 't.facnumber'; else $fieldstoshow='t.ref'; if (! empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields ( like societe, contact, ...) { From 657a3ae4c5bfd5d9f7c8d0f561a87922832e979b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 12:43:32 +0200 Subject: [PATCH 414/515] FIX permission to delete a draft purchase order --- htdocs/fourn/commande/card.php | 2 +- htdocs/modulebuilder/template/myobject_card.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index da2930ed667..3e42552a942 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2516,7 +2516,7 @@ elseif (! empty($object->id)) } // Delete - if ($user->rights->fournisseur->commande->supprimer) + if (! empty($user->rights->fournisseur->commande->supprimer) || ($object->statut == CommandeFournisseur::STATUS_DRAFT && ! empty($user->rights->fournisseur->commande->creer))) { print ''.$langs->trans("Delete").''; } diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index cc2eb5062cb..28c817658f6 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -434,7 +434,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '' . $langs->trans('SendMail') . ''."\n"; // Modify - if ($user->rights->mymodule->write) + if (! empty($user->rights->mymodule->write)) { print ''.$langs->trans("Modify").''."\n"; } @@ -444,7 +444,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Clone - if ($user->rights->mymodule->write) + if (! empty($user->rights->mymodule->write)) { print ''; } @@ -463,7 +463,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } */ - if ($user->rights->mymodule->delete) + // Delete (need delete permission, or if draft, just need create/modify permission) + if (! empty($user->rights->mymodule->delete) || (! empty($object->fields['status']) && $object->status == $object::STATUS_DRAFT && ! empty($user->rights->mymodule->write))) { print ''.$langs->trans('Delete').''."\n"; } From 512b832c77bd1247cd0684f54b7d77e4aca457bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 13:26:20 +0200 Subject: [PATCH 415/515] CSS --- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 15b986d4bff..6f4fd4fa660 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1349,7 +1349,7 @@ img.photorefnoborder { } .trextrafieldseparator td { /* border-bottom: 2px solid rgb() !important; */ - border-bottom: 2px solid rgb() !important; + border-bottom: 2px dashed rgb() !important; } .tdhrthin { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 6fd50fa42b3..332b4964a94 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1562,6 +1562,10 @@ img.photorefnoborder { .underbanner { border-bottom: px solid rgb(); } + +.trextrafieldseparator td { + border-bottom: 1px solid rgb() !important; +} .tdhrthin { margin: 0; padding-bottom: 0 !important; From bfa7f22209ecc36cb4c12bd2b0ab20b742645974 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 May 2019 11:53:36 +0200 Subject: [PATCH 416/515] FIX missing "dropdown-icon" replacement --- htdocs/main.inc.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5456e2ce1eb..4e1a6ecf01d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1741,7 +1741,7 @@ function top_menu_user(User $user, Translate $langs) $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); $userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1); } - else{ + else { $nophoto='/public/theme/common/user_anonymous.png'; if ($user->gender == 'man') $nophoto='/public/theme/common/user_man.png'; if ($user->gender == 'woman') $nophoto='/public/theme/common/user_woman.png'; @@ -1755,7 +1755,7 @@ function top_menu_user(User $user, Translate $langs) $dropdownBody.= '
'; // login infos - if (!empty($user->admin)) { + if (! empty($user->admin)) { $dropdownBody.= '
' . $langs->trans("Administrator").': '.yn($user->admin); } if (! empty($user->socid)) // Add thirdparty for external users @@ -1808,7 +1808,7 @@ function top_menu_user(User $user, Translate $langs) $profilName = $user->getFullName($langs).' ('.$user->login.')'; - if($user->admin){ + if (! empty($user->admin)) { $profilName = ' '.$profilName; } @@ -1868,6 +1868,8 @@ function top_menu_user(User $user, Translate $langs) if (!$(event.target).closest("#topmenu-login-dropdown").length) { // Hide the menus. $("#topmenu-login-dropdown").removeClass("open"); + $("#dropdown-icon-down").show(); // use show/hide instead toggle for avoid conflict + $("#dropdown-icon-up").hide(); // use show/hide instead toggle for avoid conflict } }); From 64d1ebf59cd6ee27117cca10fc552257d0e17ea4 Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Thu, 4 Jul 2019 15:06:39 +0200 Subject: [PATCH 417/515] FIX: on shipment delete confirm dialog, a new checkbox allows the user to choose if they want their stock re-incremented after the deletion. --- htdocs/expedition/card.php | 24 ++++++++++++++++++-- htdocs/expedition/class/expedition.class.php | 4 ++-- htdocs/langs/fr_FR/sendings.lang | 2 ++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index aa85132b243..ed6b0227f91 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -468,7 +468,8 @@ if (empty($reshook)) else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer) { - $result = $object->delete(); + $also_update_stock = GETPOST('alsoUpdateStock', 'alpha') ?: 0; + $result = $object->delete($also_update_stock); if ($result > 0) { header("Location: ".DOL_URL_ROOT.'/expedition/index.php'); @@ -1648,7 +1649,26 @@ else if ($id || $ref) // Confirm deleteion if ($action == 'delete') { - $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); + $formquestion = array(); + if ($object->statut == Expedition::STATUS_CLOSED && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { + $formquestion = array( + array( + 'label' => $langs->trans('ShipmentIncrementStockOnDelete'), + 'name' => 'alsoUpdateStock', + 'type' => 'checkbox', + 'value' => 0 + ), + ); + } + $formconfirm=$form->formconfirm( + $_SERVER['PHP_SELF'].'?id='.$object->id, + $langs->trans('DeleteSending'), + $langs->trans("ConfirmDeleteSending",$object->ref), + 'confirm_delete', + $formquestion, + 0, + 1 + ); } // Confirmation validation diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 3ab96fed1fa..814d8ccc5a1 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1079,7 +1079,7 @@ class Expedition extends CommonObject * * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO */ - function delete() + function delete($also_update_stock = false) { global $conf, $langs, $user; @@ -1111,7 +1111,7 @@ class Expedition extends CommonObject } // Stock control - if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT) + if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT && $also_update_stock) { require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); diff --git a/htdocs/langs/fr_FR/sendings.lang b/htdocs/langs/fr_FR/sendings.lang index 1071d5f23f9..4f4bfc514e2 100644 --- a/htdocs/langs/fr_FR/sendings.lang +++ b/htdocs/langs/fr_FR/sendings.lang @@ -60,6 +60,8 @@ NoProductToShipFoundIntoStock=Aucun produit à expédier n'a été trouver dans WeightVolShort=Poids/vol. ValidateOrderFirstBeforeShipment=Vous devez d'abord valider la commande pour pouvoir créer une expédition. +ShipmentIncrementStockOnDelete=Remettre en stock les éléments de cette expédition + # Sending methods # ModelDocument DocumentModelTyphon=Modèle de bon de réception/livraison complet (logo…) From f2c1568d0939125d81007dec93f1cced15ac285f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 15:43:05 +0200 Subject: [PATCH 418/515] NEW Extrafields separator can be collapsed or not --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 31 ++++++++------- .../core/tpl/admin_extrafields_edit.tpl.php | 39 +++++++++++-------- htdocs/langs/en_US/admin.lang | 1 + 3 files changed, 39 insertions(+), 32 deletions(-) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 04720004492..5d55009737e 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -44,7 +44,7 @@ $langs->load("modulebuilder"); jQuery(document).ready(function() { function init_typeoffields(type) { - console.log("We select a new type = "+type); + console.log("select a new type (add) = "+type); var size = jQuery("#size"); var computed_value = jQuery("#computed_value"); var langfile = jQuery("#langfile"); @@ -68,7 +68,6 @@ $langs->load("modulebuilder"); ?> // Case of computed field - console.log(type); if (type == '' || type == 'varchar' || type == 'int' || type == 'double' || type == 'price') { jQuery("tr.extra_computed_value").show(); } else { @@ -96,18 +95,19 @@ $langs->load("modulebuilder"); else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } else if (type == 'html') { size.val('2000').removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } - else if (type == 'password') { 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").show();} + else if (type == 'password') { 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(".spanforparamtooltip").hide(); jQuery("#helppassword").show();} else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'select') { 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 == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide();} - else if (type == 'radio') { 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 == '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 == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} + else if (type == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpsellist").show();} + else if (type == 'radio') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} + else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} + else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpchkbxlst").show();} + else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helplink").show();} 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").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide(); + jQuery("#value_choice").show(); + jQuery(".spanforparamtooltip").hide(); jQuery("#helpseparate").show(); } else { // type = string size.val('').prop('disabled', true); @@ -165,11 +165,12 @@ $langs->load("modulebuilder"); - textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"), 1, 0, '', 0, 2, 'helpvalue1')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"), 1, 0, '', 0, 2, 'helpvalue2')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"), 1, 0, '', 0, 2, 'helpvalue3')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelplink"), 1, 0, '', 0, 2, 'helpvalue4')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"), 1, 0, '', 0, 2, 'helpvalue5')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"), 1, 0, '', 0, 2, 'helpvalue1')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"), 1, 0, '', 0, 2, 'helpvalue2')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"), 1, 0, '', 0, 2, 'helpvalue3')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelplink"), 1, 0, '', 0, 2, 'helpvalue4')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"), 1, 0, '', 0, 2, 'helpvalue5')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpSeparator"), 1, 0, '', 0, 2, 'helpvalue6')?> diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 7ed41af9281..119d3db7478 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -43,7 +43,7 @@ $langs->load("modulebuilder"); jQuery(document).ready(function() { function init_typeoffields(type) { - console.log("select new type "+type); + console.log("select a new type (edit) = "+type); var size = jQuery("#size"); var computed_value = jQuery("#computed_value"); var langfile = jQuery("#langfile"); @@ -54,7 +54,7 @@ $langs->load("modulebuilder"); var list = jQuery("#list"); var totalizable = jQuery("#totalizable"); load("modulebuilder"); else if (type == 'text') { size.removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } else if (type == 'html') { size.removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } else if (type == 'varchar') { size.removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); } - else if (type == 'password') { 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").show();} - else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'select') { 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 == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide();} - else if (type == 'radio') { 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 == '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").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide();} + else if (type == 'password') { 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(".spanforparamtooltip").hide(); jQuery("#helppassword").show();} + else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + else if (type == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} + else if (type == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpsellist").show();} + else if (type == 'radio') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} + else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} + else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpchkbxlst").show();} + else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helplink").show();} + 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(".spanforparamtooltip").hide(); jQuery("#helpseparate").show(); + } else { // type = string size.val('').prop('disabled', true); unique.removeAttr('disabled'); @@ -229,11 +233,12 @@ else - textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"), 1, 0, '', 0, 2, 'helpvalue1')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"), 1, 0, '', 0, 2, 'helpvalue2')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"), 1, 0, '', 0, 2, 'helpvalue3')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelplink"), 1, 0, '', 0, 2, 'helpvalue4')?> - textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"), 1, 0, '', 0, 2, 'helpvalue5')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"), 1, 0, '', 0, 2, 'helpvalue1')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"), 1, 0, '', 0, 2, 'helpvalue2')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"), 1, 0, '', 0, 2, 'helpvalue3')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelplink"), 1, 0, '', 0, 2, 'helpvalue4')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpPassword"), 1, 0, '', 0, 2, 'helpvalue5')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpSeparator"), 1, 0, '', 0, 2, 'helpvalue6')?> diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7480550195a..e3aec89e613 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -429,6 +429,7 @@ ExtrafieldParamHelpradio=List of values must be lines with format key,value (whe ExtrafieldParamHelpsellist=List of values comes from a table
Syntax: table_name:label_field:id_field::filter
Example: c_typent:libelle:id::filter

- idfilter is necessarly a primary int key
- filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another complementary attribute list:
c_typent:libelle:id:options_parent_list_code|parent_column:filter

In order to have the list depending on another list:
c_typent:libelle:id:parent_list_code|parent_column:filter ExtrafieldParamHelpchkbxlst=List of values comes from a table
Syntax: table_name:label_field:id_field::filter
Example: c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another complementary attribute list:
c_typent:libelle:id:options_parent_list_code|parent_column:filter

In order to have the list depending on another list:
c_typent:libelle:id:parent_list_code|parent_column:filter ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath
Syntax: ObjectName:Classpath
Examples:
Societe:societe/class/societe.class.php
Contact:contact/class/contact.class.php +ExtrafieldParamHelpSeparator=Keep empty for a simple separator
Set this to 1 for a collapsing separator (open by default)
Set this to 2 for a collapsing separator (collapsed by default) LibraryToBuildPDF=Library used for PDF generation LocalTaxDesc=Some countries may apply two or three taxes on each invoice line. If this is the case, choose the type for the second and third tax and its rate. Possible type are:
1: local tax apply on products and services without vat (localtax is calculated on amount without tax)
2: local tax apply on products and services including vat (localtax is calculated on amount + main tax)
3: local tax apply on products without vat (localtax is calculated on amount without tax)
4: local tax apply on products including vat (localtax is calculated on amount + main vat)
5: local tax apply on services without vat (localtax is calculated on amount without tax)
6: local tax apply on services including vat (localtax is calculated on amount + tax) SMS=SMS From 1de499a320f7ca5bd4726ebe3d4f3eafdab1cfa8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 15:52:03 +0200 Subject: [PATCH 419/515] Update card.php --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ff1b1020ae6..2c3df524109 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2547,7 +2547,7 @@ elseif (! empty($object->id)) print load_fiche_titre($langs->trans("ToOrder"), '', ''); print ''; //print ''; - print '\n"; - print "'; } // Town - if (! empty($arrayfields['s.town']['checked'])) print ''; + if (! empty($arrayfields['s.town']['checked'])) print ''; // Zip - if (! empty($arrayfields['s.zip']['checked'])) print ''; + if (! empty($arrayfields['s.zip']['checked'])) print ''; // State if (! empty($arrayfields['state.nom']['checked'])) { print ''; } // Country @@ -1004,7 +1004,7 @@ if ($resql) // Town if (! empty($arrayfields['s.town']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -1012,7 +1012,7 @@ if ($resql) // Zip if (! empty($arrayfields['s.zip']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; From b691396fceedcda48a57550efd694c3e9724bf44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 16:19:24 +0200 Subject: [PATCH 423/515] Update admin_extrafields_add.tpl.php --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 5bd161c9893..0db5d6afb68 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -179,7 +179,11 @@ $langs->load("modulebuilder"); - +global->STORE_COMPUTED_EXTRAFIELDS)) { > + + + + From f14b0b4fcc79fa01ff5b1fb514ce6bb9c78550f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 16:20:01 +0200 Subject: [PATCH 424/515] Update admin_extrafields_add.tpl.php --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 0db5d6afb68..834462aab5f 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -179,7 +179,7 @@ $langs->load("modulebuilder"); -global->STORE_COMPUTED_EXTRAFIELDS)) { > +global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { > From 0d738a04f9d617b4efe0a6b1d2d24e48feaeab0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 16:22:10 +0200 Subject: [PATCH 425/515] Update admin_extrafields_edit.tpl.php --- htdocs/core/tpl/admin_extrafields_edit.tpl.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 2acdf7e864f..17399b0a824 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -243,7 +243,11 @@ else - +global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?> + + + + From 4c03aa6547bd927da00d023746ca26a84b2c9f4f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 17:03:36 +0200 Subject: [PATCH 426/515] Fix selection of profile for demo --- htdocs/public/demo/index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 0f6e21f0984..62de885eac6 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -97,7 +97,7 @@ if (empty($reshook)) ), // All demo profile array('default'=>'0', 'key'=>'profdemoall','label'=>'ChooseYourDemoProfilMore', - 'disablemodules'=>'adherent,don,externalsite,mailmanspip', + 'disablemodules'=>'adherent,don,externalsite,mailmanspip,takepos', //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png' 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-all.jpg' ) @@ -106,10 +106,10 @@ if (empty($reshook)) // Visible $alwayscheckedmodules=array('barcode','bookmark','categorie','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want - $alwaysuncheckedmodules=array('dav','dynamicprices','incoterm','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','skype','takepos','workflow','website'); // Module we dont want by default + $alwaysuncheckedmodules=array('dav','dynamicprices','incoterm','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','skype','website'); // Module we dont want by default // Not visible $alwayshiddencheckedmodules=array('accounting','api','barcode','blockedlog','bookmark','clicktodial','comptabilite','cron','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap', - 'mailmanspip','notification','oauth','syslog','user','webservices', + 'mailmanspip','notification','oauth','syslog','user','webservices','workflow', // Extended modules 'memcached','numberwords','zipautofillfr'); $alwayshiddenuncheckedmodules=array('debugbar','emailcollector','ftp','hrm','modulebuilder','webservicesclient','websites', @@ -392,10 +392,10 @@ foreach ($demoprofiles as $profilearray) //if ($modulo == 0) print ''; print ''; print '
'; - print '
'.$val->getName().'

'; + print '>
'; print '
'; //if ($modulo == ($nbcolsmod - 1)) print ''; $j++; From 01b1b2e4a7879319cc46c81b818f3dda3b6aa9c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 17:07:26 +0200 Subject: [PATCH 427/515] Fix syntax error --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 552d74955b2..360db1e94b0 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -180,9 +180,9 @@ $langs->load("modulebuilder"); -global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { > +global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?> - + From c3715646e746bd8b4ebeaee71b4b8b314d4857df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 21:29:27 +0200 Subject: [PATCH 428/515] Missing trans --- htdocs/langs/en_US/companies.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index ae189111c15..616b565496a 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -287,6 +287,7 @@ SupplierAbsoluteDiscountAllUsers=Absolute vendor discounts (entered by all users SupplierAbsoluteDiscountMy=Absolute vendor discounts (entered by yourself) DiscountNone=None Vendor=Vendor +Supplier=Vendor AddContact=Create contact AddContactAddress=Create contact/address EditContact=Edit contact From 3d076d8bf91d3b0512de2d34588144afcace2757 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Fri, 5 Jul 2019 11:15:43 +0200 Subject: [PATCH 429/515] FIX : We must save code instead of value in database for template invoice modelpdf --- htdocs/compta/facture/fiche-rec.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 8c45012085d..31a4affb95d 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1423,8 +1423,8 @@ else include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php'; $list = array(); $models = ModelePDFFactures::liste_modeles($db); - foreach ($models as $model) { - $list[] = $model . ':' . $model; + foreach ($models as $k => $model) { + $list[] = $k . ':' . $model; } $select = 'select;'.implode(',', $list); print $form->editfieldval($langs->trans("Model"), 'modelpdf', $object->modelpdf, $object, $user->rights->facture->creer, $select); From e3359c6f0fd861515e3c87b3fff52b1519e19da9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 11:21:04 +0200 Subject: [PATCH 430/515] FIX Can't submit a ticket from public interface --- htdocs/core/class/html.formticket.class.php | 2 +- htdocs/core/lib/ticket.lib.php | 2 +- htdocs/public/ticket/create_ticket.php | 35 +++++++++++-------- htdocs/public/ticket/index.php | 8 ++--- htdocs/public/ticket/list.php | 15 ++++---- htdocs/public/ticket/view.php | 14 ++++---- htdocs/theme/eldy/global.inc.php | 3 ++ htdocs/theme/md/style.css.php | 38 +++++++++++---------- 8 files changed, 65 insertions(+), 52 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 1d681d2672b..6f712fa6c4d 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -419,7 +419,7 @@ class FormTicket if ($withdolfichehead) dol_fiche_end(); - print '
'; + print '
'; print ''; if ($this->withcancel) { diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index c5791e5c89e..9e0c357be05 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -159,7 +159,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers - print ''; + print ''; if (! empty($conf->global->TICKET_SHOW_COMPANY_LOGO) || ! empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) { print '
'; diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 42774772eb5..b663aaa43c3 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -59,7 +59,7 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); */ // Add file in email form -if (GETPOST('addfile') && !GETPOST('add_ticket')) { +if (GETPOST('addfile', 'alpha') && ! GETPOST('add', 'alpha')) { ////$res = $object->fetch('','',GETPOST('track_id')); ////if($res > 0) ////{ @@ -77,7 +77,7 @@ if (GETPOST('addfile') && !GETPOST('add_ticket')) { } // Remove file -if (GETPOST('removedfile') && !GETPOST('add_ticket')) { +if (GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha')) { include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; @@ -89,7 +89,7 @@ if (GETPOST('removedfile') && !GETPOST('add_ticket')) { dol_remove_file_process($_POST['removedfile'], 0, 0); $action = 'create_ticket'; } -if ($action == 'create_ticket' && GETPOST('add_ticket')) { +if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { $error = 0; $origin_email = GETPOST('email', 'alpha'); if (empty($origin_email)) { @@ -311,7 +311,13 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) { $formmail->remove_attached_files($i); } - setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs'); + //setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs'); + + // Make a redirect to avoid to have ticket submitted twice if we make back + setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '' . $object->track_id . ''), null, 'warnings'); + setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings'); + header("Location: index.php"); + exit; } } else { setEventMessages($object->error, $object->errors, 'errors'); @@ -324,21 +330,23 @@ if ($action == 'create_ticket' && GETPOST('add_ticket')) { * View */ -$arrayofjs = array(); -$arrayofcss = array('/opensurvey/css/style.css', '/ticket/css/styles.css.php'); - -llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss); - $form = new Form($db); $formticket = new FormTicket($db); -if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) { +if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) +{ print '
' . $langs->trans('TicketPublicInterfaceForbidden') . '
'; $db->close(); exit(); } -print '
'; +$arrayofjs = array(); +$arrayofcss = array('/opensurvey/css/style.css', '/ticket/css/styles.css.php'); + +llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss); + + +print '
'; if ($action != "infos_success") { $formticket->withfromsocid = isset($socid) ? $socid : $user->societe_id; @@ -361,11 +369,8 @@ if ($action != "infos_success") { print '
' . $langs->trans('TicketPublicInfoCreateTicket') . '
'; $formticket->showForm(); -} else { - print '
' . $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '' . $object->track_id . ''); - print '
'; - print $langs->trans('PleaseRememberThisId'); } + print '
'; // End of page diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index a3e4d63a4bc..2e138312102 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -55,18 +55,18 @@ $action = GETPOST('action', 'alpha'); $form = new Form($db); $formticket = new FormTicket($db); -$arrayofjs = array(); -$arrayofcss = array('/ticket/css/styles.css.php'); - if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print $langs->trans('TicketPublicInterfaceForbidden'); exit; } +$arrayofjs = array(); +$arrayofcss = array('/ticket/css/styles.css.php'); + llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); -print '
'; +print '
'; print '

' . ($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")) . '

'; print '
'; print '
' . dol_escape_htmltag($langs->trans("CreateTicket")) . '
'; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 443af658cb5..9da0a4272e1 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -155,21 +155,23 @@ $user_assign = new User($db); $user_create = new User($db); $formTicket = new FormTicket($db); +if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) { + print '
' . $langs->trans('TicketPublicInterfaceForbidden') . '
'; + $db->close(); + exit(); +} + $arrayofjs = array(); $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); -if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) { - print '
' . $langs->trans('TicketPublicInterfaceForbidden') . '
'; - $db->close(); - exit(); -} -print '
'; +print '
'; if ($action == "view_ticketlist") { + print '
'; if ($display_ticket_list) { // Filters $search_fk_status = GETPOST("search_fk_status", 'alpha'); @@ -676,6 +678,7 @@ if ($action == "view_ticketlist") } } else { print '

' . $langs->trans("TicketPublicMsgViewLogIn") . '

'; + print '
'; print '
'; print ''; diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index a0311ce1430..4886a0cc3be 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -133,18 +133,18 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" | $form = new Form($db); $formticket = new FormTicket($db); +if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) { + print '
' . $langs->trans('TicketPublicInterfaceForbidden') . '
'; + $db->close(); + exit(); +} + $arrayofjs = array(); $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); -if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) { - print '
' . $langs->trans('TicketPublicInterfaceForbidden') . '
'; - $db->close(); - exit(); -} - -print '
'; +print '
'; if ($action == "view_ticket" || $action == "add_message" || $action == "close" || $action == "confirm_public_close") { if ($display_ticket) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 6f4fd4fa660..44c66a979d5 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5248,6 +5248,9 @@ div.tabsElem a.tab { /* Ticket module */ /* ============================================================================== */ +.publicnewticketform { + margin-top: 25px !important; +} #cd-timeline { position: relative; padding: 2em 0; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 332b4964a94..c15bbf26eef 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1936,7 +1936,6 @@ a.tmenuimage:focus { } - /* Login */ .bodylogin @@ -5388,7 +5387,6 @@ border-top-right-radius: 6px; } - /* ============================================================================== */ /* Public */ /* ============================================================================== */ @@ -5402,26 +5400,14 @@ border-top-right-radius: 6px; } - -::-webkit-scrollbar { - width: 12px; -} -::-webkit-scrollbar-button { - background: #aaa -} -::-webkit-scrollbar-track-piece { - background: #fff -} -::-webkit-scrollbar-thumb { - background: #ddd -}​ - - - /* ============================================================================== */ /* Ticket module */ /* ============================================================================== */ +.publicnewticketform { + margin-top: 25px !important; +} + #cd-timeline { position: relative; padding: 2em 0; @@ -5833,6 +5819,22 @@ border-top-right-radius: 6px; +/* This must be at end */ +::-webkit-scrollbar { + width: 12px; +} +::-webkit-scrollbar-button { + background: #aaa; +} +::-webkit-scrollbar-track-piece { + background: #fff; +} +::-webkit-scrollbar-thumb { + background: #ddd; +}​ + + + global->MAIN_DISABLE_FONT_AWESOME_5)) { ?> Date: Fri, 5 Jul 2019 11:45:10 +0200 Subject: [PATCH 431/515] Fix css --- htdocs/public/ticket/view.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 4886a0cc3be..69a77413b2e 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -298,7 +298,7 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" | print ''; } } else { - print '

' . $langs->trans("TicketPublicMsgViewLogIn") . '

'; + print '

' . $langs->trans("TicketPublicMsgViewLogIn") . '

'; print '
'; print ''; From 5c6684bb734fc963838cda82d9d82f40e7bcee25 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 11:53:33 +0200 Subject: [PATCH 432/515] Fix setup of ticket module --- htdocs/admin/ticket_public.php | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 1bcff705aef..4e6b6d75e85 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -185,12 +185,6 @@ if ($action == 'setvarother') { if (!$res > 0) { $error++; } - - $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } } @@ -260,7 +254,7 @@ if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) print ''; // Check if email exists - print '
'; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; } - // Auto assign ticket at user who created it - print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans("ToOrder").'
'.$langs->trans("OrderDate").''; + print '
'.$langs->trans("OrderDate").''; $date_com = dol_mktime(GETPOST('rehour', 'int'), GETPOST('remin', 'int'), GETPOST('resec', 'int'), GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($date_com)) $date_com=dol_now(); print $form->selectDate($date_com, '', 1, 1, '', "commande", 1, 1); From fb8c93a69ded1430d62baedf987707be0cec45a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 16:00:14 +0200 Subject: [PATCH 420/515] FIX Bad sql request --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index f4a25334e00..3e9b2ba8797 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2568,7 +2568,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed=1; } $original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file; - $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture_fourn WHERE facnumber='".$db->escape($refname)."' AND entity=".$conf->entity; + $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture_fourn WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } // Wrapping pour les rapport de paiements elseif ($modulepart == 'supplier_payment') From 4e00cfb455d93861e50a770619d5ae2780b6cc9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 16:02:04 +0200 Subject: [PATCH 421/515] Clean code --- htdocs/core/lib/files.lib.php | 2 +- htdocs/fourn/commande/card.php | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 8fe5f5b0db4..b578a6f5b8a 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2568,7 +2568,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed=1; } $original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file; - $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture_fourn WHERE facnumber='".$db->escape($refname)."' AND entity=".$conf->entity; + $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture_fourn WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } // Wrapping pour les rapport de paiements elseif ($modulepart == 'supplier_payment') diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index d96ce6cbd17..bae5741d4ea 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2536,11 +2536,11 @@ elseif (! empty($object->id)) - if ($user->rights->fournisseur->commande->commander && $object->statut == 2 && $action == 'makeorder') + if ($user->rights->fournisseur->commande->commander && $object->statut == CommandeFournisseur::STATUS_ACCEPTED && $action == 'makeorder') { // Set status to ordered (action=commande) print ''."\n"; - print '
'; + print ''; print ''; print ''; @@ -2574,9 +2574,7 @@ elseif (! empty($object->id)) { print '
'; - /* - * Documents generes - */ + // Generated documents $comfournref = dol_sanitizeFileName($object->ref); $file = $conf->fournisseur->dir_output . '/commande/' . $comfournref . '/' . $comfournref . '.pdf'; $relativepath = $comfournref.'/'.$comfournref.'.pdf'; @@ -2594,10 +2592,10 @@ elseif (! empty($object->id)) print '
'; - if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4)) + if ($user->rights->fournisseur->commande->receptionner && ($object->statut == CommandeFournisseur::STATUS_ORDERSENT || $object->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY)) { // Set status to received (action=livraison) - print ''."\n"; + print ''."\n"; print ''; print ''; print ''; @@ -2610,7 +2608,7 @@ elseif (! empty($object->id)) print $form->selectDate($datepreselected, '', 1, 1, '', "commande", 1, 1); print "
".$langs->trans("Delivery")."\n"; + print '
'.$langs->trans("Delivery")."\n"; $liv = array(); $liv[''] = ' '; $liv['tot'] = $langs->trans("CompleteOrNoMoreReceptionExpected"); From ed39849d335252923059502df9f1e857b1d13505 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Jul 2019 16:14:10 +0200 Subject: [PATCH 422/515] Fix css --- htdocs/fourn/commande/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 80645e2a486..18ba697bc20 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -777,14 +777,14 @@ if ($resql) print ''; - print ''; + print ''; print ''; + print ''; print $obj->town; print ''; + print ''; print $obj->zip; print '
trans("LanguageFile"); ?>
textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?>
textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?>
textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?>
trans("DefaultValue").' ('.$langs->trans("Database").')'; ?>
trans("LanguageFile"); ?>
textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?>
textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?>
trans("LanguageFile"); ?>
textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?>
textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?>
textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?>
trans("DefaultValue").' ('.$langs->trans("Database").')'; ?>
trans("LanguageFile"); ?>
textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?>
textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?>
' . $langs->trans("TicketsEmailMustExist") . '
' . $langs->trans("TicketsEmailMustExist") . ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS'); @@ -277,7 +271,7 @@ if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) /*if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // Show logo for module - print '
' . $langs->trans("TicketsShowModuleLogo") . '
' . $langs->trans("TicketsShowModuleLogo") . ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO'); @@ -293,7 +287,7 @@ if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) }*/ // Show logo for company - print '
' . $langs->trans("TicketsShowCompanyLogo") . '
' . $langs->trans("TicketsShowCompanyLogo") . ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO'); @@ -310,7 +304,7 @@ if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) // Also send to main email address if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - print '
' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '
' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); @@ -330,21 +324,6 @@ if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) print '
' . $langs->trans("TicketsAutoAssignTicket") . ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE); - } - print ''; - print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help'); - print '

'; if (!$conf->use_javascript_ajax) { From 575dce2dffb7cb0e2aee91d4a9b802c3ed0298eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 12:17:36 +0200 Subject: [PATCH 433/515] Fix css --- htdocs/compta/bank/bankentries_list.php | 5 +++-- htdocs/user/hierarchy.php | 2 +- htdocs/user/list.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 811fe663f8c..5609bb6b598 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -603,12 +603,13 @@ if ($resql) print $langs->trans("EventualyAddCategory").': '; print Form::selectarray('cat', $options, GETPOST('cat'), 1); } - print '
'.$langs->trans("ThenCheckLinesAndConciliate").' '; + print '
'.$langs->trans("ThenCheckLinesAndConciliate").' '; print ''; print ' '.$langs->trans("or").' '; print ''; print ' '.$langs->trans("or").' '; print ''; + print '
'; // Show last bank statements $nbmax=15; // We accept to show last 15 receipts (so we can have more than one year) @@ -617,7 +618,7 @@ if ($resql) $sql.= " WHERE fk_account=".$object->id." AND num_releve IS NOT NULL"; $sql.= $db->order("num_releve", "DESC"); $sql.= $db->plimit($nbmax+1); - print '

'; + print '
'; print $langs->trans("LastAccountStatements").' : '; $resqlr=$db->query($sql); if ($resqlr) diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index be18cb4051a..ca5e0b1862b 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -150,7 +150,7 @@ if ($canadduser) $newcardbutton.= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1': '').'&leftmenu='); } -$morehtmlright.= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ?'?search_statut='.$search_statut:'')); +$morehtmlright.= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ?'?search_statut='.$search_statut:'')); print load_fiche_titre($title, $morehtmlright.' '.$newcardbutton); diff --git a/htdocs/user/list.php b/htdocs/user/list.php index ad310b0041e..8c780c703f7 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -304,7 +304,7 @@ print ''; print ''; -$morehtmlright.= dolGetButtonTitle($langs->trans("HierarchicView"), '', 'fa fa-sitemap', DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ?'?search_statut='.$search_statut:'')); +$morehtmlright.= dolGetButtonTitle($langs->trans("HierarchicView"), '', 'fa fa-sitemap paddingleft', DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ?'?search_statut='.$search_statut:'')); print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, $morehtmlright.' '.$newcardbutton, '', $limit); From 675b7b2e3215a950ff47415c449d0483b7d72e1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 13:11:30 +0200 Subject: [PATCH 434/515] Fix link to reconcile --- htdocs/compta/bank/releve.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index ac4d17e4c49..b93f381c555 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -415,7 +415,7 @@ if (empty($numref)) if ($object->canBeConciliated() > 0) { // If not cash account and can be reconciliate if ($user->rights->banque->consolidate) { - print ''.$langs->trans("Conciliate").''; + print ''.$langs->trans("Conciliate").''; } else { print ''.$langs->trans("Conciliate").''; } From 9b327639197692f9eb5cf3ac970d594f6f79107f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 15:25:29 +0200 Subject: [PATCH 435/515] Fix label for report n ledger for transitionnal bank account on tranfer --- htdocs/accountancy/journal/bankjournal.php | 32 ++++++++++++++++++---- htdocs/core/lib/accounting.lib.php | 5 ++-- htdocs/langs/en_US/accountancy.lang | 1 + 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index cfe49764c74..d4a9ff0d3f6 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -573,7 +573,14 @@ if (! $error && $action == 'writebookkeeping') { { $reflabel = ''; if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":""); - $reflabel.= dol_string_nohtmltag($val['soclib']); + if ($tabtype[$key] == 'banktransfert') + { + $reflabel.= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); + } + else + { + $reflabel.= dol_string_nohtmltag($val['soclib']); + } $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; @@ -702,7 +709,7 @@ if (! $error && $action == 'writebookkeeping') { } } } - else { // If thirdparty unkown, output the waiting account + else { // If thirdparty unknown, output the waiting account foreach ($tabbq[$key] as $k => $mt) { if ($mt) { @@ -831,7 +838,6 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $langs->transnoentitiesnoconv("Note") . '"' . $sep; print "\n"; - foreach ($tabpay as $key => $val) { $date = dol_print_date($db->jdate($val["date"]), 'day'); @@ -869,7 +875,14 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! { $reflabel = ''; if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":""); - $reflabel.= dol_string_nohtmltag($val['soclib']); + if ($tabtype[$key] == 'banktransfert') + { + $reflabel.= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); + } + else + { + $reflabel.= dol_string_nohtmltag($val['soclib']); + } print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; @@ -1087,7 +1100,14 @@ if (empty($action) || $action == 'view') { { $reflabel = ''; if (! empty($val['lib'])) $reflabel .= $val['lib'] . ($val['soclib']?" - ":""); - $reflabel.= $val['soclib']; + if ($tabtype[$key] == 'banktransfert') + { + $reflabel.= $langs->trans('TransitionalAccount').' '.$account_transfer; + } + else + { + $reflabel.= $val['soclib']; + } print ''; print ''; @@ -1115,7 +1135,7 @@ if (empty($action) || $action == 'view') { } else { - print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).''; // We will a waiting account + print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).''; // We will use a waiting account } } else diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 9545b6961fd..d6bd38b5030 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -175,7 +175,7 @@ function journalHead($nom, $variante, $period, $periodlink, $description, $build { global $langs; - print "\n\n\n"; + print "\n\n\n"; if(! is_empty($varlink)) $varlink = '?'.$varlink; @@ -186,6 +186,7 @@ function journalHead($nom, $variante, $period, $periodlink, $description, $build $head[$h][2] = 'journal'; print ''; + print ''; dol_fiche_head($head, 'journal'); @@ -240,5 +241,5 @@ function journalHead($nom, $variante, $period, $periodlink, $description, $build print ''; - print "\n\n\n"; + print "\n\n\n"; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 3bb0df59812..ece95cfca29 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -158,6 +158,7 @@ ACCOUNTING_RESULT_LOSS=Result accounting account (Loss) ACCOUNTING_CLOSURE_DEFAULT_JOURNAL=Journal of closure ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transitional bank transfer +TransitionalAccount=Transitional bank transfer account ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations From 42576eb27a820cae0a756e932b6a0e02c6beac04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 17:22:13 +0200 Subject: [PATCH 436/515] Fix status of email templates not visible for non admin users --- htdocs/admin/mails_templates.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index e2f36f96fe9..b62009c2ba6 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -873,6 +873,7 @@ if ($resql) // Status / Active print ''; if ($canbedisabled) print ''.$actl[$obj->active].''; + else print ''.$actl[$obj->active].''; print ""; // Modify link / Delete link From 93d9f73f1d03c7786d3927c20247cd7bcb630cbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 17:44:31 +0200 Subject: [PATCH 437/515] Trans --- htdocs/langs/en_US/accountancy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index ece95cfca29..6dfe4fc8c4f 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -301,7 +301,7 @@ ChartofaccountsId=Chart of accounts Id InitAccountancy=Init accountancy InitAccountancyDesc=This page can be used to initialize an accounting account on products and services that does not have accounting account defined for sales and purchases. DefaultBindingDesc=This page can be used to set a default account to use to link transactions record about payment salaries, donation, taxes and vat when no specific accounting account were already set. -DefaultClosureDesc=This page can be used to set parameters to use to enclose a balance sheet. +DefaultClosureDesc=This page can be used to set parameters used for accounting closures. Options=Options OptionModeProductSell=Mode sales OptionModeProductSellIntra=Mode sales exported in EEC From 69db6e6aa7e834740eb3eb72ae325058aa2fb299 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 18:45:13 +0200 Subject: [PATCH 438/515] Fix look and feel v10 --- htdocs/admin/supplier_proposal.php | 2 +- .../supplier_proposal/admin/supplier_proposal_extrafields.php | 2 +- .../admin/supplier_proposaldet_extrafields.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 8b17c860fd4..e627068b692 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -220,7 +220,7 @@ print load_fiche_titre($langs->trans("SupplierProposalSetup"), $linkback, 'title $head = supplier_proposal_admin_prepare_head(); -dol_fiche_head($head, 'general', $langs->trans("CommRequests"), 0, 'supplier_proposal'); +dol_fiche_head($head, 'general', $langs->trans("CommRequests"), -1, 'supplier_proposal'); /* * Module numerotation diff --git a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php index 1b5c08119d1..c97ea508448 100644 --- a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php +++ b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php @@ -64,7 +64,7 @@ print load_fiche_titre($langs->trans("SupplierProposalSetup"), $linkback, 'title $head = supplier_proposal_admin_prepare_head(); -dol_fiche_head($head, 'attributes', $langs->trans("CommRequests"), 0, 'supplier_proposal'); +dol_fiche_head($head, 'attributes', $langs->trans("CommRequests"), -1, 'supplier_proposal'); print $langs->trans("DefineHereComplementaryAttributes", $textobject).'
'."\n"; diff --git a/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php index b3b0e482f62..c54e65ad825 100644 --- a/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php +++ b/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php @@ -69,7 +69,7 @@ print load_fiche_titre($langs->trans("SupplierProposalSetup"), $linkback, 'title $head = supplier_proposal_admin_prepare_head(); -dol_fiche_head($head, 'attributeslines', $langs->trans("CommRequests"), 0, 'supplier_proposal'); +dol_fiche_head($head, 'attributeslines', $langs->trans("CommRequests"), -1, 'supplier_proposal'); print $langs->trans("DefineHereComplementaryAttributes", $textobject).'
'."\n"; From 709b738d7579b7ebda9365182b3b9bd31666771c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 18:54:51 +0200 Subject: [PATCH 439/515] Fix regression --- htdocs/core/class/conf.class.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 6e3fc66f89a..9c403b98104 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -364,6 +364,7 @@ class Conf $this->livraison_bon->enabled=(! empty($this->global->MAIN_SUBMODULE_LIVRAISON)?$this->global->MAIN_SUBMODULE_LIVRAISON:0); // Module fournisseur + // TODO To split into module supplier_invoice and supplier_order if (! empty($this->fournisseur)) { $this->fournisseur->commande=new stdClass(); @@ -376,11 +377,7 @@ class Conf $this->fournisseur->facture->multidir_temp =array($this->entity => $rootfordata."/fournisseur/facture/temp"); $this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture"; // For backward compatibility $this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp"; // For backward compatibility - $this->supplierproposal=new stdClass(); - $this->supplierproposal->multidir_output=array($this->entity => $rootfordata."/supplier_proposal"); - $this->supplierproposal->multidir_temp =array($this->entity => $rootfordata."/supplier_proposal/temp"); - $this->supplierproposal->dir_output=$rootfordata."/supplier_proposal"; // For backward compatibility - $this->supplierproposal->dir_temp=$rootfordata."/supplier_proposal/temp"; // For backward compatibility + $this->fournisseur->payment=new stdClass(); $this->fournisseur->payment->multidir_output=array($this->entity => $rootfordata."/fournisseur/payment"); $this->fournisseur->payment->multidir_temp =array($this->entity => $rootfordata."/fournisseur/payment/temp"); @@ -409,15 +406,6 @@ class Conf $this->supplier_invoice->dir_output=$rootfordata."/fournisseur/facture"; // For backward compatibility $this->supplier_invoice->dir_temp=$rootfordata."/fournisseur/facture/temp"; // For backward compatibility } - - if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists - { - $this->supplier_proposal=new stdClass(); - $this->supplier_proposal->multidir_output=array($this->entity => $rootfordata."/supplier_proposal"); - $this->supplier_proposal->multidir_temp =array($this->entity => $rootfordata."/supplier_proposal/temp"); - $this->supplier_proposal->dir_output=$rootfordata."/supplier_proposal"; // For backward compatibility - $this->supplier_proposal->dir_temp=$rootfordata."/supplier_proposal/temp"; // For backward compatibility - } } } From bbb5b43e948367a8428df1ff3e5f95354299f0ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 19:03:16 +0200 Subject: [PATCH 440/515] Fix duplicate trans --- htdocs/fourn/commande/card.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index bae5741d4ea..4742774b868 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -392,7 +392,7 @@ if (empty($reshook)) } if ($prod_entry_mode =='free' && GETPOST('price_ht')==='' && GETPOST('price_ttc')==='' && $price_ht_devise === '') // Unit price can be 0 but not '' { - setEventMessages($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), null, 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice')), null, 'errors'); $error++; } if ($prod_entry_mode =='free' && ! GETPOST('dp_desc')) @@ -2281,14 +2281,13 @@ elseif (! empty($object->id)) print ''; // Add free products/services form - global $forceall, $senderissupplier, $dateSelector; - $forceall=1; $dateSelector=0; + global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; + $forceall=1; $dateSelector=0; $inputalsopricewithtax=0; $senderissupplier=2; // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum. //if (! empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) $senderissupplier=2; if (! empty($conf->global->SUPPLIER_ORDER_WITH_PREDEFINED_PRICES_ONLY)) $senderissupplier=1; // Show object lines - $inputalsopricewithtax=0; if (! empty($object->lines)) $ret = $object->printObjectLines($action, $societe, $mysoc, $lineid, 1); From d3b4a91f41b763ff07551b94383d3accf1031bdb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 20:24:22 +0200 Subject: [PATCH 441/515] NEW Can enter price tax incl on vendor proposal and purchase orders --- htdocs/fourn/commande/card.php | 39 ++++---- htdocs/fourn/facture/card.php | 4 +- htdocs/supplier_proposal/card.php | 96 ++++++++++++++----- .../class/supplier_proposal.class.php | 20 +++- 4 files changed, 106 insertions(+), 53 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 4742774b868..ff33a42e2a9 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -114,6 +114,7 @@ elseif (! empty($socid) && $socid > 0) $permissionnote=$user->rights->fournisseur->commande->creer; // Used by the include of actions_setnotes.inc.php $permissiondellink=$user->rights->fournisseur->commande->creer; // Used by the include of actions_dellink.inc.php $permissiontoedit=$user->rights->fournisseur->commande->creer; // Used by the include of actions_lineupdown.inc.php +$permissiontoadd=$user->rights->fournisseur->commande->creer; // Used by the include of actions_addupdatedelete.inc.php /* @@ -432,7 +433,7 @@ if (empty($reshook)) if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice', 'alpha'), $reg)) { $idprod=$reg[1]; - $res=$productsupplier->fetch($idprod); // Load product from its ID + $res=$productsupplier->fetch($idprod); // Load product from its id // Call to init some price properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price if (! empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER)) @@ -494,7 +495,7 @@ if (empty($reshook)) 0, // We already have the $idprod always defined $ref_supplier, $remise_percent, - 'HT', + $price_base_type, $pu_ttc, $type, $tva_npr, @@ -511,7 +512,7 @@ if (empty($reshook)) // Product not selected $error++; $langs->load("errors"); - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProductOrService")).' '.$langs->trans("or").' '.$langs->trans("NoPriceDefinedForThisSupplier"), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProductOrService")), null, 'errors'); } if ($idprod == -1) { @@ -523,8 +524,6 @@ if (empty($reshook)) } elseif (empty($error)) // $price_ht is already set { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); $tva_tx = str_replace('*', '', $tva_tx); $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); @@ -552,7 +551,7 @@ if (empty($reshook)) $price_base_type = 'HT'; $pu_ht_devise = price2num($price_ht_devise, 'MU'); - $result=$object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, '', '', $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise); + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, '', '', $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise); } //print "xx".$tva_tx; exit; @@ -652,28 +651,28 @@ if (empty($reshook)) if (preg_match('/\*/', $vat_rate)) $info_bits |= 0x01; - // Define vat_rate + // Define vat_rate $vat_rate = str_replace('*', '', $vat_rate); $localtax1_rate = get_localtax($vat_rate, 1, $mysoc, $object->thirdparty); $localtax2_rate = get_localtax($vat_rate, 2, $mysoc, $object->thirdparty); if (GETPOST('price_ht') != '') { - $price_base_type = 'HT'; - $ht = price2num(GETPOST('price_ht')); + $price_base_type = 'HT'; + $ht = price2num(GETPOST('price_ht')); } else { - $vatratecleaned = $vat_rate; - if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) // If vat is "xx (yy)" - { - $vatratecleaned = trim($reg[1]); - $vatratecode = $reg[2]; - } + $vatratecleaned = $vat_rate; + if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) // If vat is "xx (yy)" + { + $vatratecleaned = trim($reg[1]); + $vatratecode = $reg[2]; + } - $ttc = price2num(GETPOST('price_ttc')); - $ht = $ttc / (1 + ($vatratecleaned / 100)); - $price_base_type = 'HT'; + $ttc = price2num(GETPOST('price_ttc')); + $ht = $ttc / (1 + ($vatratecleaned / 100)); + $price_base_type = 'HT'; } $pu_ht_devise = GETPOST('multicurrency_subprice'); @@ -689,7 +688,7 @@ if (empty($reshook)) } } -$result = $object->updateline( + $result = $object->updateline( $lineid, $_POST['product_desc'], $ht, @@ -2282,7 +2281,7 @@ elseif (! empty($object->id)) // Add free products/services form global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; - $forceall=1; $dateSelector=0; $inputalsopricewithtax=0; + $forceall=1; $dateSelector=0; $inputalsopricewithtax=1; $senderissupplier=2; // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum. //if (! empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) $senderissupplier=2; if (! empty($conf->global->SUPPLIER_ORDER_WITH_PREDEFINED_PRICES_ONLY)) $senderissupplier=1; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a0a966e7210..ae042b4c4b8 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1175,7 +1175,7 @@ if (empty($reshook)) } if ($prod_entry_mode =='free' && GETPOST('price_ht')==='' && GETPOST('price_ttc')==='' && $price_ht_devise==='') // Unit price can be 0 but not '' { - setEventMessages($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), null, 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice')), null, 'errors'); $error++; } if ($prod_entry_mode =='free' && ! GETPOST('dp_desc')) @@ -1332,7 +1332,7 @@ if (empty($reshook)) $price_base_type = 'HT'; $pu_ht_devise = price2num($price_ht_devise, 'MU'); - $result=$object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_ht_devise, $ref_supplier); + $result = $object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_ht_devise, $ref_supplier); } //print "xx".$tva_tx; exit; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 56473959a39..60034cc7bc0 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -77,6 +77,9 @@ $NBLINES = 4; if (! empty($user->societe_id)) $socid = $user->societe_id; $result = restrictedArea($user, 'supplier_proposal', $id); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('supplier_proposalcard','globalcard')); + $object = new SupplierProposal($db); $extrafields = new ExtraFields($db); @@ -92,9 +95,6 @@ if ($id > 0 || ! empty($ref)) { dol_print_error('', $object->error); } -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('supplier_proposalcard','globalcard')); - $permissionnote = $user->rights->supplier_proposal->creer; // Used by the include of actions_setnotes.inc.php $permissiondellink=$user->rights->supplier_proposal->creer; // Used by the include of actions_dellink.inc.php $permissiontoedit=$user->rights->supplier_proposal->creer; // Used by the include of actions_lineupdown.inc.php @@ -565,9 +565,9 @@ if (empty($reshook)) $error ++; } - if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht == '') // Unit price can be 0 but not ''. Also price can be negative for proposal. + if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('price_ht')==='' && GETPOST('price_ttc')==='' && $price_ht_devise === '') // Unit price can be 0 but not ''. Also price can be negative for proposal. { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPrice")), null, 'errors'); $error ++; } if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) { @@ -585,7 +585,7 @@ if (empty($reshook)) // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $txtva par celui du produit - if ($prod_entry_mode != 'free' && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' + if (($prod_entry_mode != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' { $productsupplier = new ProductFournisseur($db); @@ -595,7 +595,7 @@ if (empty($reshook)) if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice', 'alpha'), $reg)) { $idprod=$reg[1]; - $res=$productsupplier->fetch($idprod); + $res=$productsupplier->fetch($idprod); // Load product from its ID // Call to init some price properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price if (! empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER)) @@ -632,23 +632,21 @@ if (empty($reshook)) if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); - $pu_ht = $productsupplier->fourn_pu; - $type = $productsupplier->type; $price_base_type = ($productsupplier->fourn_price_base_type?$productsupplier->fourn_price_base_type:'HT'); $ref_supplier = $productsupplier->ref_supplier; - $fk_unit = $productsupplier->fk_unit; - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice', 'alpha')); - if (empty($tva_tx)) $tva_npr=0; $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); - $result=$object->addline( + $pu_ht = $productsupplier->fourn_pu; + if (empty($pu_ht)) $pu_ht = 0; // If pu is '' or null, we force to have a numeric value + + $result=$object->addline( $desc, $pu_ht, $qty, @@ -669,7 +667,7 @@ if (empty($reshook)) $label, $array_options, $ref_supplier, - $fk_unit, + $productsupplier->fk_unit, '', 0, $productsupplier->fourn_multicurrency_unitprice @@ -730,6 +728,8 @@ if (empty($reshook)) { $db->commit(); + $ret=$object->fetch($object->id); // Reload to get new records + // Define output language if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { @@ -798,32 +798,52 @@ if (empty($reshook)) // Mise a jour d'une ligne dans la demande de prix elseif ($action == 'updateline' && $user->rights->supplier_proposal->creer && GETPOST('save') == $langs->trans("Save")) { + $vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); + // Define info_bits $info_bits = 0; - if (preg_match('/\*/', GETPOST('tva_tx'))) + if (preg_match('/\*/', $vat_rate)) $info_bits |= 0x01; - // Clean parameters + // Clean parameters $description = dol_htmlcleanlastbr(GETPOST('product_desc', 'none')); // Define vat_rate - $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $vat_rate = str_replace('*', '', $vat_rate); - $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty); - $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty); - $pu_ht = GETPOST('price_ht') ? GETPOST('price_ht') : 0; + $localtax1_rate = get_localtax($vat_rate, 1, $mysoc, $object->thirdparty); + $localtax2_rate = get_localtax($vat_rate, 2, $mysoc, $object->thirdparty); + + if (GETPOST('price_ht') != '') + { + $price_base_type = 'HT'; + $ht = price2num(GETPOST('price_ht')); + } + else + { + $vatratecleaned = $vat_rate; + if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) // If vat is "xx (yy)" + { + $vatratecleaned = trim($reg[1]); + $vatratecode = $reg[2]; + } + + $ttc = price2num(GETPOST('price_ttc')); + $ht = $ttc / (1 + ($vatratecleaned / 100)); + $price_base_type = 'HT'; + } + + $pu_ht_devise = GETPOST('multicurrency_subprice'); // Add buying price $fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : ''); $buyingprice = (GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value - // Extrafields + // Extrafields Lines $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); - // Unset extrafield + // Unset extrafield POST Data if (is_array($extralabelsline)) { - // Get extra fields foreach ($extralabelsline as $key => $value) { unset($_POST["options_" . $key]); } @@ -869,9 +889,33 @@ if (empty($reshook)) if (! $error) { $db->begin(); + $ref_supplier = GETPOST('fourn_ref', 'alpha'); $fk_unit = GETPOST('units'); - $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_options, $ref_supplier, $fk_unit); + + $result = $object->updateline( + GETPOST('lineid'), + $ht, + GETPOST('qty'), + GETPOST('remise_percent'), + $vat_rate, + $localtax1_rate, + $localtax2_rate, + $description, + $price_base_type, + $info_bits, + $special_code, + GETPOST('fk_parent_line'), + 0, + $fournprice, + $buyingprice, + $label, + $type, + $array_options, + $ref_supplier, + $fk_unit, + $pu_ht_devise + ); if ($result >= 0) { $db->commit(); @@ -1705,8 +1749,8 @@ if ($action == 'create') print '
'; // Add free products/services form - global $forceall, $senderissupplier, $dateSelector; - $forceall=1; $dateSelector=0; + global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; + $forceall=1; $dateSelector=0; $inputalsopricewithtax=1; $senderissupplier=2; // $senderissupplier=2 is same than 1 but disable test on minimum qty. if (! empty($conf->global->SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY)) $senderissupplier=1; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 74073c0d7e4..2725cd18190 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -655,9 +655,10 @@ class SupplierProposal extends CommonObject * @param array $array_option extrafields array * @param string $ref_supplier Supplier price reference * @param int $fk_unit Id of the unit to use. + * @param double $pu_ht_devise Unit price in currency * @return int 0 if OK, <0 if KO */ - public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $array_option = 0, $ref_supplier = '', $fk_unit = '') + public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $array_option = 0, $ref_supplier = '', $fk_unit = '', $pu_ht_devise = 0) { global $conf,$user,$langs, $mysoc; @@ -684,10 +685,17 @@ class SupplierProposal extends CommonObject // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); - $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty); - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx); + // Clean vat code + $vat_src_code=''; + if (preg_match('/\((.*)\)/', $txtva, $reg)) + { + $vat_src_code = $reg[1]; + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + } + + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -726,7 +734,9 @@ class SupplierProposal extends CommonObject $this->line->label = $label; $this->line->desc = $desc; $this->line->qty = $qty; - $this->line->product_type = $type; + $this->line->product_type = $type; + + $this->line->vat_src_code = $vat_src_code; $this->line->tva_tx = $txtva; $this->line->localtax1_tx = $txlocaltax1; $this->line->localtax2_tx = $txlocaltax2; From ac9282667dfbc908d52e976f80be87e0cf49272e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 21:09:21 +0200 Subject: [PATCH 442/515] Try new phpunit syntax --- test/phpunit/ActionCommTest.php | 2 +- test/phpunit/AdherentTest.php | 2 +- test/phpunit/AdminLibTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/phpunit/ActionCommTest.php b/test/phpunit/ActionCommTest.php index f9c0928bad2..921d0e6d70d 100644 --- a/test/phpunit/ActionCommTest.php +++ b/test/phpunit/ActionCommTest.php @@ -44,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ActionCommTest extends PHPUnit_Framework_TestCase +class ActionCommTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index bd5ae5571cc..c83df4da0d2 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -46,7 +46,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class AdherentTest extends PHPUnit_Framework_TestCase +class AdherentTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/AdminLibTest.php b/test/phpunit/AdminLibTest.php index bbf5ae2da00..21133d21072 100644 --- a/test/phpunit/AdminLibTest.php +++ b/test/phpunit/AdminLibTest.php @@ -44,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class AdminLibTest extends PHPUnit_Framework_TestCase +class AdminLibTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; From 3af4ad7fc36f4861f54f104f01d321e0eff933c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 21:28:27 +0200 Subject: [PATCH 443/515] Compatibility with phpunit v6 --- test/phpunit/BOMTest.php | 2 +- test/phpunit/BankAccountTest.php | 2 +- test/phpunit/BonPrelevementTest.php | 2 +- test/phpunit/BuildDocTest.php | 2 +- test/phpunit/CMailFileTest.php | 2 +- test/phpunit/CategorieTest.php | 2 +- test/phpunit/ChargeSocialesTest.php | 2 +- test/phpunit/CodingPhpTest.php | 2 +- test/phpunit/CommandeFournisseurTest.php | 2 +- test/phpunit/CommandeTest.php | 2 +- test/phpunit/CommonObjectTest.php | 2 +- test/phpunit/CompanyBankAccountTest.php | 2 +- test/phpunit/CompanyLibTest.php | 2 +- test/phpunit/ContactTest.php | 2 +- test/phpunit/ContratTest.php | 2 +- test/phpunit/CoreTest.php | 2 +- test/phpunit/DateLibTest.php | 2 +- test/phpunit/DateLibTzFranceTest.php | 2 +- test/phpunit/DiscountTest.php | 2 +- test/phpunit/EntrepotTest.php | 2 +- test/phpunit/ExpenseReportTest.php | 2 +- test/phpunit/ExportTest.php | 2 +- test/phpunit/FactureFournisseurTest.php | 2 +- test/phpunit/FactureRecTest.php | 2 +- test/phpunit/FactureTest.php | 2 +- test/phpunit/FactureTestRounding.php | 2 +- test/phpunit/FichinterTest.php | 2 +- test/phpunit/FilesLibTest.php | 2 +- test/phpunit/FormAdminTest.php | 2 +- test/phpunit/Functions2LibTest.php | 2 +- test/phpunit/HolidayTest.php | 2 +- test/phpunit/ImagesLibTest.php | 2 +- test/phpunit/ImportTest.php | 2 +- test/phpunit/JsonLibTest.php | 2 +- test/phpunit/LangTest.php | 2 +- test/phpunit/LoanTest.php | 2 +- test/phpunit/MarginsLibTest.php | 2 +- test/phpunit/ModulesTest.php | 2 +- test/phpunit/MouvementStockTest.php | 2 +- test/phpunit/NumberingModulesTest.php | 2 +- test/phpunit/PaypalTest.php | 2 +- test/phpunit/PdfDocTest.php | 2 +- test/phpunit/PgsqlTest.php | 2 +- test/phpunit/PricesTest.php | 2 +- test/phpunit/ProductTest.php | 2 +- test/phpunit/ProjectTest.php | 2 +- test/phpunit/PropalTest.php | 2 +- test/phpunit/RestAPIDocumentTest.php | 2 +- test/phpunit/RestAPIUserTest.php | 2 +- test/phpunit/ScriptsTest.php | 2 +- test/phpunit/SecurityTest.php | 2 +- test/phpunit/SocieteTest.php | 2 +- test/phpunit/SupplierProposalTest.php | 2 +- test/phpunit/TicketTest.php | 2 +- test/phpunit/UserGroupTest.php | 2 +- test/phpunit/UserTest.php | 2 +- test/phpunit/UtilsTest.php | 2 +- test/phpunit/WebservicesInvoicesTest.php | 2 +- test/phpunit/WebservicesOrdersTest.php | 2 +- test/phpunit/WebservicesOtherTest.php | 2 +- test/phpunit/WebservicesProductsTest.php | 2 +- test/phpunit/WebservicesThirdpartyTest.php | 2 +- test/phpunit/WebservicesUserTest.php | 2 +- test/phpunit/XCalLibTest.php | 2 +- 64 files changed, 64 insertions(+), 64 deletions(-) diff --git a/test/phpunit/BOMTest.php b/test/phpunit/BOMTest.php index ace04f7ba71..1179b35e6e1 100644 --- a/test/phpunit/BOMTest.php +++ b/test/phpunit/BOMTest.php @@ -28,7 +28,7 @@ namespace test\unit; * Class BillOfMaterialsTest * @package Testbillofmaterials */ -class BOMTest extends \PHPUnit_Framework_TestCase +class BOMTest extends \PHPUnit\Framework\TestCase { /** * Global test setup diff --git a/test/phpunit/BankAccountTest.php b/test/phpunit/BankAccountTest.php index fa150742c4b..94149bd0ad5 100644 --- a/test/phpunit/BankAccountTest.php +++ b/test/phpunit/BankAccountTest.php @@ -46,7 +46,7 @@ $langs->load("main"); * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class BankAccountTest extends PHPUnit_Framework_TestCase +class BankAccountTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/BonPrelevementTest.php b/test/phpunit/BonPrelevementTest.php index 4ba05b2c0b6..d65d2066c2a 100644 --- a/test/phpunit/BonPrelevementTest.php +++ b/test/phpunit/BonPrelevementTest.php @@ -47,7 +47,7 @@ $langs->load("main"); * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class BonPrelevementTest extends PHPUnit_Framework_TestCase +class BonPrelevementTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php index e8fa72a8f40..442b76091ff 100644 --- a/test/phpunit/BuildDocTest.php +++ b/test/phpunit/BuildDocTest.php @@ -74,7 +74,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class BuildDocTest extends PHPUnit_Framework_TestCase +class BuildDocTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/CMailFileTest.php b/test/phpunit/CMailFileTest.php index b664b345c26..9941eaa67da 100755 --- a/test/phpunit/CMailFileTest.php +++ b/test/phpunit/CMailFileTest.php @@ -44,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class CMailFileTest extends PHPUnit_Framework_TestCase +class CMailFileTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index 80761a6e594..46d8dbe875b 100644 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class CategorieTest extends PHPUnit_Framework_TestCase +class CategorieTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/ChargeSocialesTest.php b/test/phpunit/ChargeSocialesTest.php index b037e50752d..9eabbf20fa0 100644 --- a/test/phpunit/ChargeSocialesTest.php +++ b/test/phpunit/ChargeSocialesTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ChargeSocialesTest extends PHPUnit_Framework_TestCase +class ChargeSocialesTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index db6b3299bd5..b7636a5c934 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -57,7 +57,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class CodingPhpTest extends PHPUnit_Framework_TestCase +class CodingPhpTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/CommandeFournisseurTest.php b/test/phpunit/CommandeFournisseurTest.php index 277328339ee..c249c47bd91 100644 --- a/test/phpunit/CommandeFournisseurTest.php +++ b/test/phpunit/CommandeFournisseurTest.php @@ -46,7 +46,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class CommandeFournisseurTest extends PHPUnit_Framework_TestCase +class CommandeFournisseurTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/CommandeTest.php b/test/phpunit/CommandeTest.php index 00a0a4983c9..570165f3382 100644 --- a/test/phpunit/CommandeTest.php +++ b/test/phpunit/CommandeTest.php @@ -44,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class CommandeTest extends PHPUnit_Framework_TestCase +class CommandeTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/CommonObjectTest.php b/test/phpunit/CommonObjectTest.php index 549540bb0d0..e4bd0f73518 100644 --- a/test/phpunit/CommonObjectTest.php +++ b/test/phpunit/CommonObjectTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class CommonObjectTest extends PHPUnit_Framework_TestCase +class CommonObjectTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/CompanyBankAccountTest.php b/test/phpunit/CompanyBankAccountTest.php index 58eebfd0207..08749d12619 100644 --- a/test/phpunit/CompanyBankAccountTest.php +++ b/test/phpunit/CompanyBankAccountTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class CompanyBankAccountTest extends PHPUnit_Framework_TestCase +class CompanyBankAccountTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/CompanyLibTest.php b/test/phpunit/CompanyLibTest.php index 0fb1722aee9..9e211441103 100644 --- a/test/phpunit/CompanyLibTest.php +++ b/test/phpunit/CompanyLibTest.php @@ -44,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class CompanyLibTest extends PHPUnit_Framework_TestCase +class CompanyLibTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index ef43bd06311..c0ed8d7843f 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -53,7 +53,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ContactTest extends PHPUnit_Framework_TestCase +class ContactTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/ContratTest.php b/test/phpunit/ContratTest.php index c5342865979..c763a976172 100644 --- a/test/phpunit/ContratTest.php +++ b/test/phpunit/ContratTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ContratTest extends PHPUnit_Framework_TestCase +class ContratTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/CoreTest.php b/test/phpunit/CoreTest.php index 51a0f54698f..4720df9014c 100644 --- a/test/phpunit/CoreTest.php +++ b/test/phpunit/CoreTest.php @@ -47,7 +47,7 @@ if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page i * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class CoreTest extends PHPUnit_Framework_TestCase +class CoreTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 6424cb4d8df..cc4f50705e0 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class DateLibTest extends PHPUnit_Framework_TestCase +class DateLibTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/DateLibTzFranceTest.php b/test/phpunit/DateLibTzFranceTest.php index fa7aef2bed8..8913c56a77d 100644 --- a/test/phpunit/DateLibTzFranceTest.php +++ b/test/phpunit/DateLibTzFranceTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class DateLibTzFranceTest extends PHPUnit_Framework_TestCase +class DateLibTzFranceTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/DiscountTest.php b/test/phpunit/DiscountTest.php index cd73a7ad173..8c461aba88a 100644 --- a/test/phpunit/DiscountTest.php +++ b/test/phpunit/DiscountTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class DiscountTest extends PHPUnit_Framework_TestCase +class DiscountTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php index a2c0e78ee96..61bb5fe1b49 100644 --- a/test/phpunit/EntrepotTest.php +++ b/test/phpunit/EntrepotTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class EntrepotTest extends PHPUnit_Framework_TestCase +class EntrepotTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/ExpenseReportTest.php b/test/phpunit/ExpenseReportTest.php index c4b3e2a707a..570afd8bb18 100644 --- a/test/phpunit/ExpenseReportTest.php +++ b/test/phpunit/ExpenseReportTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ExpenseReportTest extends PHPUnit_Framework_TestCase +class ExpenseReportTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 7403cba3ddf..5497f88cd67 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -49,7 +49,7 @@ if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page i * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ExportTest extends PHPUnit_Framework_TestCase +class ExportTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/FactureFournisseurTest.php b/test/phpunit/FactureFournisseurTest.php index 33d503825ac..4d7df1f0ed7 100644 --- a/test/phpunit/FactureFournisseurTest.php +++ b/test/phpunit/FactureFournisseurTest.php @@ -46,7 +46,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class FactureFournisseurTest extends PHPUnit_Framework_TestCase +class FactureFournisseurTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/FactureRecTest.php b/test/phpunit/FactureRecTest.php index de1bb164451..5d9021032a2 100644 --- a/test/phpunit/FactureRecTest.php +++ b/test/phpunit/FactureRecTest.php @@ -46,7 +46,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class FactureRecTest extends PHPUnit_Framework_TestCase +class FactureRecTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 4f680ba32db..3c066380b09 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class FactureTest extends PHPUnit_Framework_TestCase +class FactureTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/FactureTestRounding.php b/test/phpunit/FactureTestRounding.php index a0df47cd97f..1716bd51153 100644 --- a/test/phpunit/FactureTestRounding.php +++ b/test/phpunit/FactureTestRounding.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class FactureTestRounding extends PHPUnit_Framework_TestCase +class FactureTestRounding extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/FichinterTest.php b/test/phpunit/FichinterTest.php index 35680559581..c81e1c99e1a 100644 --- a/test/phpunit/FichinterTest.php +++ b/test/phpunit/FichinterTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class FichinterTest extends PHPUnit_Framework_TestCase +class FichinterTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 2411c5c9cf3..cbe6ad948d8 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -46,7 +46,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class FilesLibTest extends PHPUnit_Framework_TestCase +class FilesLibTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/FormAdminTest.php b/test/phpunit/FormAdminTest.php index 8532d6ac283..20c22a76cd8 100644 --- a/test/phpunit/FormAdminTest.php +++ b/test/phpunit/FormAdminTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class FormAdminTest extends PHPUnit_Framework_TestCase +class FormAdminTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/Functions2LibTest.php b/test/phpunit/Functions2LibTest.php index 50efabf9403..a83ba0f4859 100644 --- a/test/phpunit/Functions2LibTest.php +++ b/test/phpunit/Functions2LibTest.php @@ -48,7 +48,7 @@ if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page i * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class Functions2LibTest extends PHPUnit_Framework_TestCase +class Functions2LibTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/HolidayTest.php b/test/phpunit/HolidayTest.php index a352a1722b9..7e3fc6a8069 100644 --- a/test/phpunit/HolidayTest.php +++ b/test/phpunit/HolidayTest.php @@ -47,7 +47,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class HolidayTest extends PHPUnit_Framework_TestCase +class HolidayTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/ImagesLibTest.php b/test/phpunit/ImagesLibTest.php index 4ecaab49d39..445fe572b61 100644 --- a/test/phpunit/ImagesLibTest.php +++ b/test/phpunit/ImagesLibTest.php @@ -46,7 +46,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ImagesLibTest extends PHPUnit_Framework_TestCase +class ImagesLibTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/ImportTest.php b/test/phpunit/ImportTest.php index 10d906f2ede..5a11a770842 100644 --- a/test/phpunit/ImportTest.php +++ b/test/phpunit/ImportTest.php @@ -47,7 +47,7 @@ if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page i * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ImportTest extends PHPUnit_Framework_TestCase +class ImportTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/JsonLibTest.php b/test/phpunit/JsonLibTest.php index a84a78a7c75..c123f2e6ff6 100644 --- a/test/phpunit/JsonLibTest.php +++ b/test/phpunit/JsonLibTest.php @@ -47,7 +47,7 @@ if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page i * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class JsonLibTest extends PHPUnit_Framework_TestCase +class JsonLibTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/LangTest.php b/test/phpunit/LangTest.php index 228cde51901..71d467b78d3 100644 --- a/test/phpunit/LangTest.php +++ b/test/phpunit/LangTest.php @@ -57,7 +57,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class LangTest extends PHPUnit_Framework_TestCase +class LangTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/LoanTest.php b/test/phpunit/LoanTest.php index b0ecd583514..e0cc1f5b5ff 100644 --- a/test/phpunit/LoanTest.php +++ b/test/phpunit/LoanTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class LoanTest extends PHPUnit_Framework_TestCase +class LoanTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/MarginsLibTest.php b/test/phpunit/MarginsLibTest.php index 81f4a512e4f..84fb59c81ec 100644 --- a/test/phpunit/MarginsLibTest.php +++ b/test/phpunit/MarginsLibTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class MarginsLibTest extends PHPUnit_Framework_TestCase +class MarginsLibTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/ModulesTest.php b/test/phpunit/ModulesTest.php index ea16813d873..38a630b46e0 100755 --- a/test/phpunit/ModulesTest.php +++ b/test/phpunit/ModulesTest.php @@ -44,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ModulesTest extends PHPUnit_Framework_TestCase +class ModulesTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/MouvementStockTest.php b/test/phpunit/MouvementStockTest.php index cac49f34a7a..ba7b093596f 100644 --- a/test/phpunit/MouvementStockTest.php +++ b/test/phpunit/MouvementStockTest.php @@ -47,7 +47,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class MouvementStockTest extends PHPUnit_Framework_TestCase +class MouvementStockTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/NumberingModulesTest.php b/test/phpunit/NumberingModulesTest.php index 66c4c670128..57c376b702b 100644 --- a/test/phpunit/NumberingModulesTest.php +++ b/test/phpunit/NumberingModulesTest.php @@ -44,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class NumberingModulesTest extends PHPUnit_Framework_TestCase +class NumberingModulesTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/PaypalTest.php b/test/phpunit/PaypalTest.php index 98300a6a86a..54913b1e5f9 100644 --- a/test/phpunit/PaypalTest.php +++ b/test/phpunit/PaypalTest.php @@ -46,7 +46,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class PaypalTest extends PHPUnit_Framework_TestCase +class PaypalTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/PdfDocTest.php b/test/phpunit/PdfDocTest.php index 634a931da56..bece387b93f 100644 --- a/test/phpunit/PdfDocTest.php +++ b/test/phpunit/PdfDocTest.php @@ -48,7 +48,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class PdfDocTest extends PHPUnit_Framework_TestCase +class PdfDocTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/PgsqlTest.php b/test/phpunit/PgsqlTest.php index a1fcc180528..743328abb71 100644 --- a/test/phpunit/PgsqlTest.php +++ b/test/phpunit/PgsqlTest.php @@ -47,7 +47,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class PgsqlTest extends PHPUnit_Framework_TestCase +class PgsqlTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/PricesTest.php b/test/phpunit/PricesTest.php index 0203a1d4275..32babae209c 100755 --- a/test/phpunit/PricesTest.php +++ b/test/phpunit/PricesTest.php @@ -52,7 +52,7 @@ if (! empty($conf->global->MAIN_ROUNDING_RULE_TOT)) * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class PricesTest extends PHPUnit_Framework_TestCase +class PricesTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php index 115475113fa..782d5f076e8 100644 --- a/test/phpunit/ProductTest.php +++ b/test/phpunit/ProductTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ProductTest extends PHPUnit_Framework_TestCase +class ProductTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/ProjectTest.php b/test/phpunit/ProjectTest.php index faa533e2c00..886463be104 100644 --- a/test/phpunit/ProjectTest.php +++ b/test/phpunit/ProjectTest.php @@ -46,7 +46,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ProjectTest extends PHPUnit_Framework_TestCase +class ProjectTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/PropalTest.php b/test/phpunit/PropalTest.php index 6a3d17d7806..b0331a5575f 100644 --- a/test/phpunit/PropalTest.php +++ b/test/phpunit/PropalTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class PropalTest extends PHPUnit_Framework_TestCase +class PropalTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/RestAPIDocumentTest.php b/test/phpunit/RestAPIDocumentTest.php index f0d3efe34e6..08ea79352d3 100644 --- a/test/phpunit/RestAPIDocumentTest.php +++ b/test/phpunit/RestAPIDocumentTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_UMASK = '0666'; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class RestAPIDocumentTest extends PHPUnit_Framework_TestCase +class RestAPIDocumentTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index 39f924e7e04..b44fb7aaccc 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -47,7 +47,7 @@ $conf->global->MAIN_UMASK='0666'; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class RestAPIUserTest extends PHPUnit_Framework_TestCase +class RestAPIUserTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/ScriptsTest.php b/test/phpunit/ScriptsTest.php index 4e43a036c7e..e4a2263e849 100644 --- a/test/phpunit/ScriptsTest.php +++ b/test/phpunit/ScriptsTest.php @@ -57,7 +57,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class ScriptsTest extends PHPUnit_Framework_TestCase +class ScriptsTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 636fa923bc0..b457c4c0fa7 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -57,7 +57,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class SecurityTest extends PHPUnit_Framework_TestCase +class SecurityTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 11eb6711862..f823d8a4803 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class SocieteTest extends PHPUnit_Framework_TestCase +class SocieteTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/SupplierProposalTest.php b/test/phpunit/SupplierProposalTest.php index 14a63776444..ee95e882572 100644 --- a/test/phpunit/SupplierProposalTest.php +++ b/test/phpunit/SupplierProposalTest.php @@ -48,7 +48,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class SupplierProposalTest extends PHPUnit_Framework_TestCase +class SupplierProposalTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/TicketTest.php b/test/phpunit/TicketTest.php index e5367d03fbe..4d7ce3363ed 100644 --- a/test/phpunit/TicketTest.php +++ b/test/phpunit/TicketTest.php @@ -45,7 +45,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class TicketTest extends PHPUnit_Framework_TestCase +class TicketTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/UserGroupTest.php b/test/phpunit/UserGroupTest.php index e524b989172..be230655fe1 100644 --- a/test/phpunit/UserGroupTest.php +++ b/test/phpunit/UserGroupTest.php @@ -44,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class UserGroupTest extends PHPUnit_Framework_TestCase +class UserGroupTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index b87dfd84494..e993ed981a6 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -44,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class UserTest extends PHPUnit_Framework_TestCase +class UserTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/UtilsTest.php b/test/phpunit/UtilsTest.php index 58074af1c1f..5a913977ccc 100644 --- a/test/phpunit/UtilsTest.php +++ b/test/phpunit/UtilsTest.php @@ -44,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class UtilsTest extends PHPUnit_Framework_TestCase +class UtilsTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index fb8e36af6a1..77ad0902ec2 100644 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -49,7 +49,7 @@ $conf->global->MAIN_UMASK='0666'; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase +class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/WebservicesOrdersTest.php b/test/phpunit/WebservicesOrdersTest.php index 8b989df273f..8e6312ac039 100644 --- a/test/phpunit/WebservicesOrdersTest.php +++ b/test/phpunit/WebservicesOrdersTest.php @@ -48,7 +48,7 @@ $conf->global->MAIN_UMASK='0666'; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class WebservicesOrdersTest extends PHPUnit_Framework_TestCase +class WebservicesOrdersTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/WebservicesOtherTest.php b/test/phpunit/WebservicesOtherTest.php index bdc3a15b2b9..5c19414966b 100644 --- a/test/phpunit/WebservicesOtherTest.php +++ b/test/phpunit/WebservicesOtherTest.php @@ -48,7 +48,7 @@ $conf->global->MAIN_UMASK='0666'; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class WebservicesOtherTest extends PHPUnit_Framework_TestCase +class WebservicesOtherTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/WebservicesProductsTest.php b/test/phpunit/WebservicesProductsTest.php index 90147a429a4..ff78d9d91bb 100644 --- a/test/phpunit/WebservicesProductsTest.php +++ b/test/phpunit/WebservicesProductsTest.php @@ -55,7 +55,7 @@ if (empty($conf->service->enabled)) * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class WebservicesProductsTest extends PHPUnit_Framework_TestCase +class WebservicesProductsTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php index cb1f26d1980..4effe555d2f 100644 --- a/test/phpunit/WebservicesThirdpartyTest.php +++ b/test/phpunit/WebservicesThirdpartyTest.php @@ -48,7 +48,7 @@ $conf->global->MAIN_UMASK='0666'; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase +class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php index 7ca0d9e8ee8..d7df632e413 100644 --- a/test/phpunit/WebservicesUserTest.php +++ b/test/phpunit/WebservicesUserTest.php @@ -48,7 +48,7 @@ $conf->global->MAIN_UMASK='0666'; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class WebservicesUserTest extends PHPUnit_Framework_TestCase +class WebservicesUserTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; diff --git a/test/phpunit/XCalLibTest.php b/test/phpunit/XCalLibTest.php index 4783bf4bc8f..602ec11e46d 100644 --- a/test/phpunit/XCalLibTest.php +++ b/test/phpunit/XCalLibTest.php @@ -44,7 +44,7 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; * @backupStaticAttributes enabled * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. */ -class XCalLibTest extends PHPUnit_Framework_TestCase +class XCalLibTest extends PHPUnit\Framework\TestCase { protected $savconf; protected $savuser; From 0a7d70829f566b63eb1c1d1b3674c3462ec6f20f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 21:37:25 +0200 Subject: [PATCH 444/515] Translation of some comments --- htdocs/adherents/type.php | 2 +- htdocs/admin/tools/listevents.php | 2 +- htdocs/comm/propal/list.php | 2 +- htdocs/commande/customer.php | 2 +- htdocs/commande/orderstoinvoice.php | 2 +- htdocs/compta/clients.php | 2 +- htdocs/compta/paiement/cheque/list.php | 2 +- htdocs/expedition/list.php | 2 +- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/commande/orderstoinvoice.php | 2 +- htdocs/fourn/product/list.php | 2 +- htdocs/product/reassort.php | 2 +- htdocs/product/reassortlot.php | 2 +- htdocs/product/stock/list.php | 2 +- htdocs/product/stock/movement_card.php | 2 +- htdocs/product/stock/movement_list.php | 2 +- htdocs/product/stock/replenish.php | 2 +- htdocs/reception/list.php | 2 +- htdocs/supplier_proposal/list.php | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 19790159c22..2c8c108b3d5 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -603,7 +603,7 @@ if ($rowid > 0) print '
'; print '
'."\n"; - // Lignes des champs de filtre + // Fields title search print ''; print '
'; diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index d508afe63d2..39ed6162f0f 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -233,7 +233,7 @@ if ($result) print '
'; print ''; - // Lignes des champs de filtres + // Fields title search print ''; print ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 555e89e7a61..241f22cfe38 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -446,7 +446,7 @@ if ($resql) $newcardbutton.= dolGetButtonTitle($langs->trans('NewPropal'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/propal/card.php?action=create'); } - // Lignes des champs de filtre + // Fields title search print ''; if ($optioncss != '') print ''; print ''; diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 8b7fef878ed..3fa3f90774f 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -133,7 +133,7 @@ if ($resql) print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "datec", $addu, "", 'class="right"', $sortfield, $sortorder); print "\n"; - // Lignes des champs de filtre + // Fields title search print ''; print ''; - // Lignes des champs de filtre + // Fields title search print ''; print ''; print ''; diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 36cc40c851c..58631937955 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -151,7 +151,7 @@ if ($resql) print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "datec", $addu, "", '', $sortfield, $sortorder, 'right '); print "\n"; - // Lignes des champs de filtre + // Fields title search print ''; print '
'.$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0).'
'; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 0d0b202a8c3..33acc2b4969 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -615,7 +615,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print_liste_field_titre('GenerateBill', '', '', '', '', 'align="center"'); print '
'; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 11de8aa48a2..64ae1dea1f2 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -157,7 +157,7 @@ if ($resql) print '
'; print ''."\n"; - // Lignes des champs de filtre + // Fields title search print ''; print '
'; print ''; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index f5c111f2268..8bd8c702d03 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -318,7 +318,7 @@ if ($resql) print '
'; print ''."\n"; - // Lignes des champs de filtre + // Fields title search print ''; // Ref if (! empty($arrayfields['e.ref']['checked'])) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 18ba697bc20..475d42f66dc 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -635,7 +635,7 @@ if ($resql) $newcardbutton.= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/fourn/commande/card.php?action=create'); } - // Lignes des champs de filtre + // Fields title search print ''; if ($optioncss != '') print ''; print ''; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 093e0fd331b..6775e9f9b65 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -509,7 +509,7 @@ if (($action != 'create' && $action != 'add') && !$error) { print_liste_field_titre('GenerateBill', '', '', '', '', '', '', '', 'center '); print "\n"; - // Lignes des champs de filtre + // Fields title search print ''; print '
'; // REF diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 7b319490815..8fd7b809587 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -228,7 +228,7 @@ if ($resql) print ''; - // Lignes des champs de filtre + // Fields title search print ''; print '
'; print ''; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 476fec36c2a..f75ba10a03c 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -274,7 +274,7 @@ if ($resql) print '
'; print ''; - // Lignes des champs de filtre + // Fields title search print ''; print '
'; print ''; diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index faf91184dd1..d0803f40b95 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -271,7 +271,7 @@ if ($resql) print '
'; print ''; - // Lignes des champs de filtre + // Fields title search print ''; print '
'; print ''; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 8178df6b03c..8e19242d1c1 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -187,7 +187,7 @@ if ($result) print '
'; print ''."\n"; - // Lignes des champs de filtre + // Fields title search print ''; print ''; print ''; print ''; @@ -1816,6 +1812,11 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) dol_fiche_end(); print '
'; + print '
'; + print ' '; + print $langs->trans('ForceUpdateChildPriceSoc'); + print "
"; + print ''; print '     '; print ''; @@ -2162,7 +2163,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // Action if ($user->rights->produit->supprimer || $user->rights->service->supprimer) { - print '
'; diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index b75042c7cca..85065e8ec2b 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -766,7 +766,7 @@ if ($resql) print '
'; print ''."\n"; - // Lignes des champs de filtre + // Fields title search print ''; if (! empty($arrayfields['m.rowid']['checked'])) { diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 836bb97e50c..efcbc534c08 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -742,7 +742,7 @@ if ($resql) print '
'; print '
'."\n"; - // Lignes des champs de filtre + // Fields title search print ''; if (! empty($arrayfields['m.rowid']['checked'])) { diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 069be8aca96..b9799865e20 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -551,7 +551,7 @@ print '' ''. ''; -// Lignes des champs de filtre +// Fields title search print ''; print ''; print ''; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index e40be9f0d10..17518df8ab6 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -628,7 +628,7 @@ if ($resql) print '
'; print '
 
'."\n"; - // Lignes des champs de filtre + // Fields title search print ''; // Ref if (! empty($arrayfields['e.ref']['checked'])) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index fe010c95e9c..dabf49215fd 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -391,7 +391,7 @@ if ($resql) $newcardbutton.= dolGetButtonTitle($langs->trans('NewAskPrice'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/supplier_proposal/card.php?action=create'); } - // Lignes des champs de filtre + // Fields title search print ''; if ($optioncss != '') print ''; print ''; From f5cc29417d8f550c1265844de8c9f543a20b9f00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 21:50:35 +0200 Subject: [PATCH 445/515] Translation lignes -> lines --- htdocs/compta/facture/card.php | 4 ++-- .../class/ligneprelevement.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- .../commande/doc/pdf_einstein.modules.php | 2 +- .../expensereport/doc/pdf_standard.modules.php | 4 ++-- .../modules/facture/doc/pdf_crabe.modules.php | 2 +- .../modules/facture/doc/pdf_sponge.modules.php | 2 +- htdocs/core/modules/modFournisseur.class.php | 4 ++-- .../product/doc/pdf_standard.modules.php | 2 +- .../reception/doc/pdf_squille.modules.php | 2 +- .../modules/stock/doc/pdf_standard.modules.php | 2 +- htdocs/expedition/contact.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/fourn/product/list.php | 2 +- .../tables/llx_commande_fournisseurdet.sql | 2 +- .../mysql/tables/llx_expensereport_det.sql | 2 +- .../mysql/tables/llx_facture_fourn_det.sql | 2 +- .../mysql/tables/llx_facturedet_rec.sql | 2 +- htdocs/install/step2.php | 2 +- htdocs/install/upgrade2.php | 18 +++++++++--------- htdocs/livraison/class/livraison.class.php | 4 +--- .../product/actions_card_product.class.php | 2 +- .../canvas/product/tpl/card_view.tpl.php | 2 +- .../service/actions_card_service.class.php | 2 +- .../canvas/service/tpl/card_view.tpl.php | 2 +- htdocs/product/reassort.php | 2 +- htdocs/product/reassortlot.php | 2 +- htdocs/reception/contact.php | 2 +- 28 files changed, 39 insertions(+), 41 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0adfb4e7ac2..968469ff1e0 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -638,7 +638,7 @@ if (empty($reshook)) $resteapayer = $object->total_ttc - $totalpaye; - // On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees + // We check that invlice lines are transferred into accountancy $ventilExportCompta = $object->getVentilExportCompta(); // On verifie si aucun paiement n'a ete effectue @@ -4616,7 +4616,7 @@ elseif ($id > 0 || ! empty($ref)) // Editer une facture deja validee, sans paiement effectue et pas exporte en compta if ($object->statut == Facture::STATUS_VALIDATED) { - // On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees + // We check that invlice lines are transferred into accountancy $ventilExportCompta = $object->getVentilExportCompta(); if ($ventilExportCompta == 0) diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index e76cc9d184d..c0e6921c95d 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -22,7 +22,7 @@ /** * \file htdocs/compta/prelevement/class/ligneprelevement.class.php * \ingroup prelevement - * \brief Fichier de la classe des lignes de prelevements + * \brief File of class to manage lines of Direct Debit orders */ diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 7273ffc3a8e..e7461e2a053 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -862,7 +862,7 @@ class Contrat extends CommonObject } else { - dol_syslog(get_class($this)."::Fetch Erreur lecture des lignes de contrats liees aux produits"); + dol_syslog(get_class($this)."::Fetch Error when reading lines of contracts linked to products"); return -3; } diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 0e064991444..0d95646c441 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -549,7 +549,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Passe espace entre les lignes + $nexY+=2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 99d2ab322e0..e322ef1aa84 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -414,8 +414,8 @@ class pdf_standard extends ModeleExpenseReport // $nblineFollowComment = max($nbLineCommentNeed, $nbLineTypeNeed); // } - //$nexY+=$nblineFollowComment*($pdf->getFontSize()*1.3); // Passe espace entre les lignes - $nexY += ($pdf->getFontSize()*1.3); // Passe espace entre les lignes + //$nexY+=$nblineFollowComment*($pdf->getFontSize()*1.3); // Add space between lines + $nexY += ($pdf->getFontSize()*1.3); // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 4536add16bb..53929f28e75 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -318,7 +318,7 @@ class pdf_crabe extends ModelePDFFactures global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - // Set nblignes with the new facture lines content after hook + // Set nblines with the new facture lines content after hook $nblines = count($object->lines); $nbpayments = count($object->getListOfPayments()); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 422060ab30b..b5529c78d8e 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -329,7 +329,7 @@ class pdf_sponge extends ModelePDFFactures global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - // Set nblignes with the new facture lines content after hook + // Set nblines with the new facture lines content after hook $nblines = count($object->lines); $nbpayments = count($object->getListOfPayments()); diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index a545ce1378b..8ba2f173ffd 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -276,7 +276,7 @@ class modFournisseur extends DolibarrModules $r++; $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='Factures fournisseurs et lignes de facture'; + $this->export_label[$r]='Vendor invoices and lines of invoices'; $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("fournisseur","facture","export")); $this->export_fields_array[$r]=array( @@ -484,7 +484,7 @@ class modFournisseur extends DolibarrModules // Order $r++; $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='Commandes fournisseurs et lignes de commandes'; + $this->export_label[$r]='Purchase Orders and lines of purchase orders'; $this->export_icon[$r]='order'; $this->export_permission[$r]=array(array("fournisseur","commande","export")); $this->export_fields_array[$r]=array( diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 6089a9fe66e..a9bc06f1021 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -493,7 +493,7 @@ class pdf_standard extends ModelePDFProduct $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Passe espace entre les lignes + $nexY+=2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 10be4430aea..71e78368d9c 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -216,7 +216,7 @@ class pdf_squille extends ModelePdfReception global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - // Set nblignes with the new facture lines content after hook + // Set nblines with the new facture lines content after hook $nblines = count($object->lines); $pdf=pdf_getInstance($this->format); diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index 4be99b07c11..6c222f96dca 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -461,7 +461,7 @@ class pdf_standard extends ModelePDFStock $pdf->SetLineStyle(array('dash'=>0)); } - $nexY+=2; // Passe espace entre les lignes + $nexY+=2; // Add space between lines // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 4acb2fce932..9310df52ddf 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -255,7 +255,7 @@ if ($id > 0 || ! empty($ref)) dol_fiche_end(); - // Lignes de contacts + // Lines of contacts echo '
'; // Contacts lines (modules that overwrite templates must declare this into descriptor) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 807b547a4bc..d9e01a6579f 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1386,7 +1386,7 @@ class Fichinter extends CommonObject } /** - * Classe permettant la gestion des lignes d'intervention + * Class to manage intervention lines */ class FichinterLigne extends CommonObjectLine { diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 8fd7b809587..bd5c0f1fd1e 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -249,7 +249,7 @@ if ($resql) print ''; print '
'; - // Lignes des titres + // Line for title print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("RefSupplierShort", $_SERVER["PHP_SELF"], "ppf.ref_fourn", $param, "", "", $sortfield, $sortorder); diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql index dfbf4e261eb..f107e348bbe 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql @@ -47,7 +47,7 @@ create table llx_commande_fournisseurdet date_start datetime DEFAULT NULL, -- date debut si service date_end datetime DEFAULT NULL, -- date fin si service info_bits integer DEFAULT 0, -- TVA NPR ou non - special_code integer DEFAULT 0, -- code pour les lignes speciales + special_code integer DEFAULT 0, -- code for special lines rang integer DEFAULT 0, import_key varchar(14), fk_unit integer DEFAULT NULL, diff --git a/htdocs/install/mysql/tables/llx_expensereport_det.sql b/htdocs/install/mysql/tables/llx_expensereport_det.sql index 75d503ac181..ee583852deb 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_det.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_det.sql @@ -43,7 +43,7 @@ CREATE TABLE llx_expensereport_det total_ttc double(24,8) DEFAULT 0 NOT NULL, date date NOT NULL, info_bits integer DEFAULT 0, -- TVA NPR ou non - special_code integer DEFAULT 0, -- code pour les lignes speciales + special_code integer DEFAULT 0, -- code for special lines fk_multicurrency integer, multicurrency_code varchar(255), multicurrency_subprice double(24,8) DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql index 2f75f9ff54e..57097f600c0 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql @@ -47,7 +47,7 @@ create table llx_facture_fourn_det date_end datetime DEFAULT NULL, -- date fin si service info_bits integer DEFAULT 0, -- TVA NPR ou non fk_code_ventilation integer DEFAULT 0 NOT NULL, - special_code integer DEFAULT 0, -- code pour les lignes speciales + special_code integer DEFAULT 0, -- code for special lines rang integer DEFAULT 0, import_key varchar(14), fk_unit integer DEFAULT NULL, diff --git a/htdocs/install/mysql/tables/llx_facturedet_rec.sql b/htdocs/install/mysql/tables/llx_facturedet_rec.sql index 267abcd5053..8bb0c06e8f8 100644 --- a/htdocs/install/mysql/tables/llx_facturedet_rec.sql +++ b/htdocs/install/mysql/tables/llx_facturedet_rec.sql @@ -52,7 +52,7 @@ create table llx_facturedet_rec buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it). fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created) - special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales + special_code integer UNSIGNED DEFAULT 0, -- code for special lines rang integer DEFAULT 0, -- ordre d'affichage fk_contract_line integer NULL, -- id of contract line when template invoice comes from contract lines fk_unit integer DEFAULT NULL, diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 1a8a4108827..4e645bb6934 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -311,7 +311,7 @@ if ($action == "set") { $buf = fgets($fp, 4096); - // Cas special de lignes autorisees pour certaines versions uniquement + // Special case of lines allowed for some version only if ($choix == 1 && preg_match('/^--\sV([0-9\.]+)/i', $buf, $reg)) { $versioncommande=explode('.', $reg[1]); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index c932b2631e8..11bfe9ff99f 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -1432,7 +1432,7 @@ function migrate_paiementfourn_facturefourn($db, $langs, $conf) } /** - * Mise a jour des totaux lignes de facture + * Update total of invoice lines * * @param DoliDB $db Database handler * @param Translate $langs Object langs @@ -1453,7 +1453,7 @@ function migrate_price_facture($db, $langs, $conf) print '
'; print ''.$langs->trans('MigrationInvoice')."
\n"; - // Liste des lignes facture non a jour + // List of invoice lines not up to date $sql = "SELECT fd.rowid, fd.qty, fd.subprice, fd.remise_percent, fd.tva_tx as vatrate, fd.total_ttc, fd.info_bits,"; $sql.= " f.rowid as facid, f.remise_percent as remise_percent_global, f.total_ttc as total_ttc_f"; $sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd, ".MAIN_DB_PREFIX."facture as f"; @@ -1551,7 +1551,7 @@ function migrate_price_facture($db, $langs, $conf) } /** - * Mise a jour des totaux lignes de propal + * Update total of proposal lines * * @param DoliDB $db Database handler * @param Translate $langs Object langs @@ -1570,7 +1570,7 @@ function migrate_price_propal($db, $langs, $conf) print '
'; print ''.$langs->trans('MigrationProposal')."
\n"; - // Liste des lignes propal non a jour + // List of proposal lines not up to date $sql = "SELECT pd.rowid, pd.qty, pd.subprice, pd.remise_percent, pd.tva_tx as vatrate, pd.info_bits,"; $sql.= " p.rowid as propalid, p.remise_percent as remise_percent_global"; $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd, ".MAIN_DB_PREFIX."propal as p"; @@ -1679,7 +1679,7 @@ function migrate_price_contrat($db, $langs, $conf) print '
'; print ''.$langs->trans('MigrationContract')."
\n"; - // Liste des lignes contrat non a jour + // List of contract lines not up to date $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,"; $sql.= " c.rowid as contratid"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c"; @@ -1748,7 +1748,7 @@ function migrate_price_contrat($db, $langs, $conf) } /** - * Mise a jour des totaux lignes de commande + * Update total of sales order lines * * @param DoliDB $db Database handler * @param Translate $langs Object langs @@ -1767,7 +1767,7 @@ function migrate_price_commande($db, $langs, $conf) print '
'; print ''.$langs->trans('MigrationOrder')."
\n"; - // Liste des lignes commande non a jour + // List of sales orders lines not up to date $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,"; $sql.= " c.rowid as commandeid, c.remise_percent as remise_percent_global"; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."commande as c"; @@ -1865,7 +1865,7 @@ function migrate_price_commande($db, $langs, $conf) } /** - * Mise a jour des totaux lignes de commande fournisseur + * Update total of purchase order lines * * @param DoliDB $db Database handler * @param Translate $langs Object langs @@ -1884,7 +1884,7 @@ function migrate_price_commande_fournisseur($db, $langs, $conf) print '
'; print ''.$langs->trans('MigrationSupplierOrder')."
\n"; - // Liste des lignes commande non a jour + // List of purchase order lines not up to date $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as vatrate, cd.info_bits,"; $sql.= " c.rowid as commandeid, c.remise_percent as remise_percent_global"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd, ".MAIN_DB_PREFIX."commande_fournisseur as c"; diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 5d01dffa886..9021faf7542 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -322,9 +322,7 @@ class Livraison extends CommonObject // fetch optionals attributes and labels $this->fetch_optionals(); - /* - * Lignes - */ + // Load lines $result=$this->fetch_lines(); if ($result < 0) { diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index db7ad4d2b70..6247d84b045 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -199,7 +199,7 @@ class ActionsCardProduct if ($action == 'view') { // Photo - $this->tpl['nblignes'] = 4; + $this->tpl['nblines'] = 4; if ($this->object->is_photo_available($conf->product->multidir_output[$this->object->entity])) { $this->tpl['photos'] = $this->object->show_photos('product', $conf->product->multidir_output[$this->object->entity], 1, 1, 0, 0, 0, 80); diff --git a/htdocs/product/canvas/product/tpl/card_view.tpl.php b/htdocs/product/canvas/product/tpl/card_view.tpl.php index 06d9faf05b7..1f330257073 100644 --- a/htdocs/product/canvas/product/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_view.tpl.php @@ -56,7 +56,7 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); photos) { ?> - diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index fab5794c82a..85b1feb6795 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -195,7 +195,7 @@ class ActionsCardService if ($action == 'view') { // Photo - $this->tpl['nblignes'] = 4; + $this->tpl['nblines'] = 4; if ($this->object->is_photo_available($conf->service->multidir_output[$this->object->entity])) { $this->tpl['photos'] = $this->object->show_photos('product', $conf->service->multidir_output[$this->object->entity], 1, 1, 0, 0, 0, 80); diff --git a/htdocs/product/canvas/service/tpl/card_view.tpl.php b/htdocs/product/canvas/service/tpl/card_view.tpl.php index 8d2409ba5e2..29a0e18a8b7 100644 --- a/htdocs/product/canvas/service/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_view.tpl.php @@ -56,7 +56,7 @@ dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); photos) { ?> - diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index f75ba10a03c..1ecb136d817 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -303,7 +303,7 @@ if ($resql) print ''; print ''; - // Lignes des titres + //Line for column titles print ""; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", $param, "", "", $sortfield, $sortorder); diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index d0803f40b95..5d569fc41be 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -299,7 +299,7 @@ if ($resql) print ''; print ''; - // Lignes des titres + //Line for column titles print ""; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", $param, "", "", $sortfield, $sortorder); diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index d51062ef7ef..c3deb28c4bc 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -257,7 +257,7 @@ if ($id > 0 || ! empty($ref)) dol_fiche_end(); - // Lignes de contacts + // Lines of contacts echo '
'; // Contacts lines (modules that overwrite templates must declare this into descriptor) From 4387d40b9a5f243ecc48cbc70885201d1ab3ad9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Jul 2019 21:55:08 +0200 Subject: [PATCH 446/515] Translation lignes -> lines --- htdocs/core/class/commonstickergenerator.class.php | 2 +- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 2 +- htdocs/core/modules/expensereport/doc/pdf_standard.modules.php | 2 +- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 18bcfcee8d5..a1d0d7f8728 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -267,7 +267,7 @@ abstract class CommonStickerGenerator protected function _Get_Height_Chars($pt) { // phpcs:enable - // Tableau de concordance entre la hauteur des caracteres et de l'espacement entre les lignes + // Array for link between height of characters and space between lines $_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>3.5, 10=>4, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10); if (in_array($pt, array_keys($_Table_Hauteur_Chars))) { return $_Table_Hauteur_Chars[$pt]; diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 745c09c8130..5bcd6d153d0 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -253,7 +253,7 @@ class pdf_espadon extends ModelePdfExpedition global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - // Set nblignes with the new facture lines content after hook + // Set nblines with the new facture lines content after hook $nblines = count($object->lines); $pdf=pdf_getInstance($this->format); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index d255c4486fd..44d0e3a5dda 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -282,7 +282,7 @@ class pdf_rouget extends ModelePdfExpedition global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - // Set nblignes with the new facture lines content after hook + // Set nblines with the new facture lines content after hook $nblines = count($object->lines); $pdf=pdf_getInstance($this->format); diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index e322ef1aa84..b85ca573188 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -400,7 +400,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. //$nblineFollowComment = 1; - // Cherche nombre de lignes a venir pour savoir si place suffisante + // Search number of lines coming to know if there is enough room // if ($i < ($nblines - 1)) // If it's not last line // { // //Fetch current description to know on which line the next one should be placed diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index ebcca580870..ca677fc5224 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -284,7 +284,7 @@ CREATE TABLE llx_expensereport_det total_ttc double(24,8) DEFAULT 0 NOT NULL, date date NOT NULL, info_bits integer DEFAULT 0, -- TVA NPR ou non - special_code integer DEFAULT 0, -- code pour les lignes speciales + special_code integer DEFAULT 0, -- code for special lines rang integer DEFAULT 0, -- position of line import_key varchar(14) ) ENGINE=innodb; From 266ed86194b0ac6be2f19d72f7613597b3cda876 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 8 Jul 2019 12:37:24 +0200 Subject: [PATCH 447/515] NEW Add a category to a contact in API --- htdocs/societe/class/api_contacts.class.php | 42 +++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 772d8d3fe10..f94e182b010 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -378,6 +378,48 @@ class Contacts extends DolibarrApi return $result; } + /** + * Add a category to a contact + * + * @url POST {id}/categories/{category_id} + * + * @param int $id Id of contact + * @param int $category_id Id of category + * + * @return mixed + * + * @throws 401 RestException Insufficient rights + * @throws 401 RestException Access not allowed for login + * @throws 404 RestException Category not found + * @throws 404 RestException Contact not found + */ + public function addCategory($id, $category_id) + { + if(! DolibarrApiAccess::$user->rights->societe->contact->creer) { + throw new RestException(401, 'Insufficient rights'); + } + + $result = $this->contact->fetch($id); + if (! $result) { + throw new RestException(404, 'Contact not found'); + } + $category = new Categorie($this->db); + $result = $category->fetch($category_id); + if (! $result) { + throw new RestException(404, 'category not found'); + } + + if (! DolibarrApi::_checkAccessToResource('contact', $this->contact->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + if (! DolibarrApi::_checkAccessToResource('category', $category->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $category->add_type($this->contact, 'contact'); + + return $this->_cleanObjectDatas($this->contact); + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** From e5d34de877fe194c096fa83b5cb62f5b10aded42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Jul 2019 00:14:01 +0200 Subject: [PATCH 448/515] FIX compatibility mysql 8. rank is reserved FIX Permission for BOM menu --- htdocs/bom/class/bom.class.php | 6 +++--- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 3 ++- htdocs/install/mysql/tables/llx_bom_bomline.sql | 2 +- htdocs/modulebuilder/template/class/myobject.class.php | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 73682c7698c..10601303a61 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -889,7 +889,7 @@ class BOM extends CommonObject $this->lines=array(); $objectline = new BOMLine($this->db); - $result = $objectline->fetchAll('ASC', 'rank', 0, 0, array('customsql'=>'fk_bom = '.$this->id)); + $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.$this->id)); if (is_numeric($result)) { @@ -1044,7 +1044,7 @@ class BOMLine extends CommonObject 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',), 'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), - 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,), + 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), ); public $rowid; @@ -1053,7 +1053,7 @@ class BOMLine extends CommonObject public $description; public $qty; public $efficiency; - public $rank; + public $position; public $import_key; // END MODULEBUILDER PROPERTIES diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c966f39680b..b6fa5e419b1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2443,9 +2443,9 @@ abstract class CommonObject */ public function updateRangOfLine($rowid, $rang) { - $fieldposition = 'rang'; // @TODO Rename 'rang' and 'position' into 'rank' + $fieldposition = 'rang'; // @TODO Rename 'rang' into 'position' if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position'; - if (in_array($this->table_element_line, array('bom_bomline'))) $fieldposition = 'rank'; + if (in_array($this->table_element_line, array('bom_bomline'))) $fieldposition = 'position'; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang; $sql.= ' WHERE rowid = '.$rowid; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7518093bf77..88595cd366a 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1579,7 +1579,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM { $langs->load("mrp"); - $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->service->lire, '', $mainmenu, 'service'); + $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom'); $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->rights->bom->write); $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read); } 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 bf08e794a65..c2d4809f958 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 @@ -252,12 +252,13 @@ CREATE TABLE llx_bom_bomline( import_key varchar(14), qty double(24,8) NOT NULL, efficiency double(8,4) NOT NULL DEFAULT 1, - rank integer NOT NULL + position integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; ALTER TABLE llx_bom_bomline ADD COLUMN efficiency double(8,4) DEFAULT 1; ALTER TABLE llx_bom_bomline ADD COLUMN fk_bom_child integer NULL; +ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL; create table llx_bom_bomline_extrafields ( diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.sql b/htdocs/install/mysql/tables/llx_bom_bomline.sql index bafaaf73694..4b0aa515950 100644 --- a/htdocs/install/mysql/tables/llx_bom_bomline.sql +++ b/htdocs/install/mysql/tables/llx_bom_bomline.sql @@ -23,6 +23,6 @@ CREATE TABLE llx_bom_bomline( import_key varchar(14), qty double(24,8) NOT NULL, efficiency double(8,4) NOT NULL DEFAULT 1, - rank integer NOT NULL + position integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 13157b2c18f..f6020882502 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -696,7 +696,7 @@ class MyObject extends CommonObject $this->lines=array(); $objectline = new MyObjectLine($this->db); - $result = $objectline->fetchAll('ASC', 'rank', 0, 0, array('customsql'=>'fk_myobject = '.$this->id)); + $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_myobject = '.$this->id)); if (is_numeric($result)) { @@ -781,5 +781,5 @@ class MyObject extends CommonObject class MyObjectLine { // To complete with content of an object MyObjectLine - // We should have a field rowid, fk_myobject and rank + // We should have a field rowid, fk_myobject and position } From 61c83117fe3a98d473239a9dda5af68aae130d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 9 Jul 2019 15:18:51 +0200 Subject: [PATCH 449/515] Update ihm.php --- htdocs/admin/ihm.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 8a065190373..509a04494d2 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -60,6 +60,7 @@ if (GETPOST('cancel', 'alpha')) if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity); require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $logofile=$conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND; @@ -81,6 +82,7 @@ if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACK if ($action == 'update') { dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["MAIN_LANG_DEFAULT"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"], 'chaine', 0, '', $conf->entity); From 96723db86f284f2ddb09bf10158cdc7584a1f34f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 9 Jul 2019 15:20:43 +0200 Subject: [PATCH 450/515] Update main.inc.php --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 458e6649d8a..ee2b14fdf11 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1200,7 +1200,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (! is_object($hookmanager)) $hookmanager = new HookManager($db); $hookmanager->initHooks(array("main")); - $ext='layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); + $ext='layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); print "\n"; @@ -1246,7 +1246,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (GETPOST('version', 'int')) $ext='version='.GETPOST('version', 'int'); // usefull to force no cache on css/js $themeparam='?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss', 'aZ09')?'&optioncss='.GETPOST('optioncss', 'aZ09', 1):'').'&userid='.$user->id.'&entity='.$conf->entity; - $themeparam.=($ext?'&'.$ext:''); + $themeparam.=($ext?'&'.$ext:'').'&revision='.$conf->global->MAIN_IHM_PARAMS_REV; if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache']; if (GETPOST('dol_hide_topmenu', 'int')) { $themeparam.='&dol_hide_topmenu='.GETPOST('dol_hide_topmenu', 'int'); } if (GETPOST('dol_hide_leftmenu', 'int')) { $themeparam.='&dol_hide_leftmenu='.GETPOST('dol_hide_leftmenu', 'int'); } From 0aa42fefae40fabaff529fde7a082e4ff20da613 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 9 Jul 2019 18:13:06 +0200 Subject: [PATCH 451/515] Fix : use RUM if defined in bank account --- htdocs/compta/prelevement/class/bonprelevement.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 2187b99eaf3..89aa09523e7 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1349,7 +1349,7 @@ class BonPrelevement extends CommonObject $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; $sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; - $sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum"; + $sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum"; $sql.= " FROM"; $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql.= " ".MAIN_DB_PREFIX."facture as f,"; @@ -1375,7 +1375,7 @@ class BonPrelevement extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum, $obj->rum); $this->total = $this->total + $obj->somme; $i++; } @@ -1586,9 +1586,10 @@ class BonPrelevement extends CommonObject * @param string $row_bic rib.bic AS bic, * @param string $row_datec rib.datec, * @param string $row_drum rib.rowid used to generate rum + * @param string $row_rum rib.rum Rum defined on company bank account * @return string Return string with SEPA part DrctDbtTxInf */ - function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) + function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum, $row_rum) { // phpcs:enable global $conf; @@ -1597,7 +1598,7 @@ class BonPrelevement extends CommonObject // Define value for RUM // Example: RUMCustomerCode-CustomerBankAccountId-01424448606 (note: Date is date of creation of CustomerBankAccountId) - $Rum = $this->buildRumNumber($row_code_client, $row_datec, $row_drum); + $Rum = empty($row_rum) ? $this->buildRumNumber($row_code_client, $row_datec, $row_drum) : $row_rum; // Define date of RUM signature $DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d'); From 41b004c2b837806eaaa29ffa4b63204e3c7a230e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 10 Jul 2019 12:16:32 +0200 Subject: [PATCH 452/515] FIX better compatibility with multicompany transverse mode --- htdocs/core/class/html.formother.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 1883ffd0304..28683d23771 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -421,7 +421,7 @@ class FormOther if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) { $sql_usr.= " WHERE u.entity IS NOT NULL"; // Show all users } else { - $sql_usr.= " WHERE EXISTS (SELECT ug.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug WHERE u.rowid = ug.fk_user AND ug.entity IN (".getEntity('user')."))"; + $sql_usr.= " WHERE EXISTS (SELECT ug.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug WHERE u.rowid = ug.fk_user AND ug.entity IN (".getEntity('usergroup')."))"; $sql_usr.= " OR u.entity = 0"; // Show always superadmin } } @@ -444,7 +444,7 @@ class FormOther if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) { $sql_usr.= " WHERE u2.entity IS NOT NULL"; // Show all users } else { - $sql_usr.= " WHERE EXISTS (SELECT ug2.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug2 WHERE u2.rowid = ug2.fk_user AND ug2.entity IN (".getEntity('user')."))"; + $sql_usr.= " WHERE EXISTS (SELECT ug2.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug2 WHERE u2.rowid = ug2.fk_user AND ug2.entity IN (".getEntity('usergroup')."))"; } } else From cebf81a5146a6d02b4c9f1ebd736e6298e29b769 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 10 Jul 2019 15:18:25 +0200 Subject: [PATCH 453/515] FIX helpp text --- htdocs/core/tpl/commonfields_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php index ce41cff24d0..d23b9f09c2a 100644 --- a/htdocs/core/tpl/commonfields_edit.tpl.php +++ b/htdocs/core/tpl/commonfields_edit.tpl.php @@ -47,7 +47,7 @@ foreach($object->fields as $key => $val) if ($val['notnull'] > 0) print ' fieldrequired'; if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; print '">'; - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); + if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); else print $langs->trans($val['label']); print ''; print ''; print ''; print ''; if (! $i) $totalarray['nbfield']++; From 332abd2a9f845ab0cfe969698ac0dbf38759853c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 13 Jul 2019 11:02:45 +0200 Subject: [PATCH 460/515] FIX __INFOS__ tag not exists --- htdocs/install/mysql/data/llx_c_email_templates.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql index 0c64fcf7d0d..87741d1054b 100644 --- a/htdocs/install/mysql/data/llx_c_email_templates.sql +++ b/htdocs/install/mysql/data/llx_c_email_templates.sql @@ -24,7 +24,7 @@ INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_u INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnMemberValidation)' ,20,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__INFOS__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnMemberValidation)' ,20,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__(FirstName)__ : __MEMBER_FIRSTNAME__
__(LastName)__ : __MEMBER_LASTNAME__
__(ID)__ : __MEMBER_ID__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnNewSubscription)' ,30,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingReminderForExpiredSubscription)',40,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(YourMembershipWasCanceled)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); From b7df4a2cd04b6b8c13f78162e85a3ee660355dc6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 13 Jul 2019 11:21:07 +0200 Subject: [PATCH 461/515] FIX this function can not be private --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 115d1fb8ab4..2001959240d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2447,7 +2447,7 @@ class Adherent extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - private function _load_ldap_dn($info, $mode = 0) + public function _load_ldap_dn($info, $mode = 0) { // phpcs:enable global $conf; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index de9494fca8b..74ff7bf5fb4 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -507,7 +507,7 @@ class Contact extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - private function _load_ldap_dn($info, $mode = 0) + public function _load_ldap_dn($info, $mode = 0) { // phpcs:enable global $conf; From 4dab57b4947a4d965f253a824582db656239fd24 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 13 Jul 2019 11:24:25 +0200 Subject: [PATCH 462/515] FIX phpcs --- htdocs/adherents/class/adherent.class.php | 1 + htdocs/contact/class/contact.class.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 2001959240d..d20fc34ec9d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2438,6 +2438,7 @@ class Adherent extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 74ff7bf5fb4..d6053a46b35 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -498,6 +498,7 @@ class Contact extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * From f041110a7ef88cd8057d515bce96946c0242bf3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 13 Jul 2019 22:29:50 +0200 Subject: [PATCH 463/515] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 43f78b571de..579deec88e3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2615,7 +2615,7 @@ abstract class CommonObject $MODULE = ""; if ($this->element == 'propal') $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_PROPOSAL"; - elseif ($this->element == 'commande') + elseif ($this->element == 'commande' || $this->element == 'order') $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_ORDER"; elseif ($this->element == 'facture') $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_INVOICE"; From b6571d9fc3a27f147ace6d6794f6d58a9690a749 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 13 Jul 2019 22:39:25 +0200 Subject: [PATCH 464/515] Update byratecountry.php --- htdocs/compta/stats/byratecountry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index cd41649cc89..045f5e6429c 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class. // Load translation files required by the page $langs->loadLangs(array("other","compta","banks","bills","companies","product","trips","admin","accountancy")); -$modecompta = $conf->global->ACCOUNTING_MODE; +$modecompta = (GETPOST('modecompta', 'alpha') ? GETPOST('modecompta', 'alpha') : $conf->global->ACCOUNTING_MODE); // Date range $year=GETPOST("year",'int'); From 8090a8abb66619753ea5cca54d04ce92d71eae1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Jul 2019 00:07:27 +0200 Subject: [PATCH 465/515] Fix param [] -> null --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 0fbee667522..f0d8df454cf 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -646,7 +646,7 @@ if (empty($reshook)) if (empty($labeltouse) || (int) $labeltouse === -1) { //fallback on the old configuration. - setEventMessages('WarningMandatorySetupNotComplete', [], 'errors'); + setEventMessages('WarningMandatorySetupNotComplete', null, 'errors'); $error++; } else { From b66ad24d85577a95b2280285c6dc946fecffe0c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Jul 2019 00:10:15 +0200 Subject: [PATCH 466/515] Fix save of doc template for recuring invoices. --- htdocs/compta/facture/fiche-rec.php | 2 +- htdocs/core/class/html.form.class.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 31a4affb95d..f195ab84324 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1424,7 +1424,7 @@ else $list = array(); $models = ModelePDFFactures::liste_modeles($db); foreach ($models as $k => $model) { - $list[] = $k . ':' . $model; + $list[] = str_replace(':', '|', $k) . ':' . $model; } $select = 'select;'.implode(',', $list); print $form->editfieldval($langs->trans("Model"), 'modelpdf', $object->modelpdf, $object, $user->rights->facture->creer, $select); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a462f40ebdc..d2130e24291 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -152,7 +152,7 @@ class Form * @param string $value Value to show/edit * @param object $object Object * @param boolean $perm Permission to allow button to edit parameter - * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datepickerhour', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...) + * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols%', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datepickerhour', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select;xkey:xval,ykey:yval,...') * @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of value). Use '' to use same than $value * @param object $extObject External object * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') @@ -172,7 +172,7 @@ class Form if (empty($typeofdata)) return 'ErrorBadParameter'; // When option to edit inline is activated - if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;|datehourpicker/',$typeofdata)) // TODO add jquery timepicker + if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;|datehourpicker/',$typeofdata)) // TODO add jquery timepicker and support select { $ret.=$this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg); } @@ -229,7 +229,8 @@ class Form foreach($arraydata as $val) { $tmp=explode(':',$val); - $arraylist[$tmp[0]]=$tmp[1]; + $tmpkey=str_replace('|', ':', $tmp[0]); + $arraylist[$tmpkey]=$tmp[1]; } $ret.=$this->selectarray($htmlname,$arraylist,$value); } @@ -298,7 +299,7 @@ class Form * @param string $value Value to show/edit * @param string $htmlname DIV ID (field name) * @param int $condition Condition to edit - * @param string $inputType Type of input ('string', 'numeric', 'datepicker' ('day' do not work, don't know why), 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:xxx') + * @param string $inputType Type of input ('string', 'numeric', 'datepicker' ('day' do not work, don't know why), 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:loadmethod:savemethod:buttononly') * @param string $editvalue When in edit mode, use this value as $value instead of value * @param object $extObject External object * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') From 2a05164bb119520e8a68c43aea99c399d10a8e43 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Jul 2019 00:31:28 +0200 Subject: [PATCH 467/515] FIX Better PHP compatibility --- htdocs/adherents/card.php | 2 +- .../class/DataCollector/DolLogsCollector.php | 6 +++--- htdocs/public/stripe/confirm_payment.php | 20 ++++++++++--------- .../societe/class/api_thirdparties.class.php | 16 +++++++-------- htdocs/societe/paymentmodes.php | 2 +- htdocs/stripe/class/stripe.class.php | 2 +- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 1e777d003d9..373e8b953f6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -734,7 +734,7 @@ if (empty($reshook)) if (empty($labeltouse) || (int) $labeltouse === -1) { //fallback on the old configuration. - setEventMessages('WarningMandatorySetupNotComplete', [], 'errors'); + setEventMessages('WarningMandatorySetupNotComplete', null, 'errors'); $error++; } else { diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php index 8e39c68b6b7..dd6fabd508f 100644 --- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php @@ -144,7 +144,7 @@ class DolLogsCollector extends MessagesCollector $linecounter = $lines; $pos = -2; $beginning = false; - $text = []; + $text = array(); while ($linecounter > 0) { $t = " "; while ($t != "\n") { @@ -179,12 +179,12 @@ class DolLogsCollector extends MessagesCollector $pattern = "/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.*/"; $log_levels = $this->getLevels(); preg_match_all($pattern, $file, $matches); - $log = []; + $log = array(); foreach ($matches as $lines) { foreach ($lines as $line) { foreach ($log_levels as $level_key => $level) { if (strpos(strtolower($line), strtolower($level_key)) == 20) { - $log[] = ['level' => $level, 'line' => $line]; + $log[] = array('level' => $level, 'line' => $line); } } } diff --git a/htdocs/public/stripe/confirm_payment.php b/htdocs/public/stripe/confirm_payment.php index ea59b13dcb9..9ff9662ff84 100644 --- a/htdocs/public/stripe/confirm_payment.php +++ b/htdocs/public/stripe/confirm_payment.php @@ -15,6 +15,8 @@ * along with this program. If not, see . */ +// TODO Do we really need this page. We alread have a ipn.php page ! + define("NOLOGIN", 1); // This means this output page does not require to be logged. define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. @@ -105,13 +107,13 @@ $intent = null; try { if (isset($json_obj->payment_method_id)) { // Create the PaymentIntent - $intent = \Stripe\PaymentIntent::create([ + $intent = \Stripe\PaymentIntent::create(array( 'payment_method' => $json_obj->payment_method_id, 'amount' => 1099, 'currency' => 'eur', 'confirmation_method' => 'manual', 'confirm' => true, - ]); + )); } if (isset($json_obj->payment_intent_id)) { $intent = \Stripe\PaymentIntent::retrieve( @@ -122,9 +124,9 @@ try { generatePaymentResponse($intent); } catch (\Stripe\Error\Base $e) { // Display error on client - echo json_encode([ + echo json_encode(array( 'error' => $e->getMessage() - ]); + )); } /* @@ -138,22 +140,22 @@ function generatePaymentResponse($intent) if ($intent->status == 'requires_source_action' && $intent->next_action->type == 'use_stripe_sdk') { // Tell the client to handle the action - echo json_encode([ + echo json_encode(array( 'requires_action' => true, 'payment_intent_client_secret' => $intent->client_secret - ]); + )); } elseif ($intent->status == 'succeeded') { // The payment didn’t need any additional actions and completed! // Handle post-payment fulfillment // TODO - echo json_encode([ + echo json_encode(array( "success" => true - ]); + )); } else { // Invalid status http_response_code(500); - echo json_encode(['error' => 'Invalid PaymentIntent status']); + echo json_encode(array('error' => 'Invalid PaymentIntent status')); } } diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index adae31e7677..95aad3a003b 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1041,7 +1041,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( $i=0; - $accounts =[]; + $accounts = array(); if ($result) { @@ -1061,12 +1061,12 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( } - $fields = ['socid', 'default_rib', 'frstrecur', '1000110000001', 'datec', 'datem', 'label', 'bank', 'bic', 'iban', 'id', 'rum']; + $fields = array('socid', 'default_rib', 'frstrecur', '1000110000001', 'datec', 'datem', 'label', 'bank', 'bic', 'iban', 'id', 'rum'); - $returnAccounts = []; + $returnAccounts = array(); foreach($accounts as $account){ - $object= []; + $object= array(); foreach($account as $key => $value) if(in_array($key, $fields)){ $object[$key] = $value; @@ -1308,7 +1308,7 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( $i=0; - $accounts =[]; + $accounts = array(); $num = $db->num_rows($result); while ($i < $num) @@ -1322,12 +1322,12 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( $i++; } - $fields = ['id', 'fk_soc', 'key_account', 'site', 'date_creation', 'tms']; + $fields = array('id', 'fk_soc', 'key_account', 'site', 'date_creation', 'tms'); - $returnAccounts = []; + $returnAccounts = array(); foreach($accounts as $account){ - $object= []; + $object= array(); foreach($account as $key => $value) if(in_array($key, $fields)){ $object[$key] = $value; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 0e41e11cbaa..51a7ccb24bb 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -639,7 +639,7 @@ if (empty($reshook)) try { if (preg_match('/pm_/', $source)) { - $payment_method = \Stripe\PaymentMethod::retrieve($source, ["stripe_account" => $stripeacc]); + $payment_method = \Stripe\PaymentMethod::retrieve($source, array("stripe_account" => $stripeacc)); if ($payment_method) { $payment_method->detach(); diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index d8d0c656dab..6b910236e96 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -389,7 +389,7 @@ class Stripe extends CommonObject "confirmation_method" => $mode, "amount" => $stripeamount, "currency" => $currency_code, - "payment_method_types" => ["card"], + "payment_method_types" => array("card"), "description" => $description, "statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) //"save_payment_method" => true, From e1d49177040c197c6027e53bd302e031ee46ab12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Jul 2019 00:39:42 +0200 Subject: [PATCH 468/515] FIX Missing field "Conciliated" into bank transaction export --- htdocs/core/modules/modBanque.class.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index fb2c818043e..21c33d35170 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -150,14 +150,15 @@ class modBanque extends DolibarrModules $this->export_fields_array[$r]=array( 'b.rowid'=>'IdTransaction','ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.dateo'=>'DateOperation','b.label'=>'Label', 'b.num_chq'=>'ChequeOrTransferNumber','b.fk_bordereau'=>'ChequeBordereau','-b.amount'=>'Debit','b.amount'=>'Credit', - 'b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation","bu.url_id"=>"IdThirdParty","s.nom"=>"ThirdParty", - "s.code_compta"=>"CustomerAccountancyCode","s.code_compta_fournisseur"=>"SupplierAccountancyCode" + 'b.num_releve'=>'AccountStatement','b.rappro'=>'Conciliated','b.datec'=>"DateCreation","bu.url_id"=>"IdThirdParty", + "s.nom"=>"ThirdParty","s.code_compta"=>"CustomerAccountancyCode","s.code_compta_fournisseur"=>"SupplierAccountancyCode" ); - $this->export_TypeFields_array[$r]=array('ba.ref'=>'Text','ba.label'=>'Text','b.datev'=>'Date','b.dateo'=>'Date','b.label'=>'Text','b.num_chq'=>'Text','b.fk_bordereau'=>'Text','-b.amount'=>'Numeric','b.amount'=>'Numeric','b.num_releve'=>'Text','b.datec'=>"Date","bu.url_id"=>"Text","s.nom"=>"Text","s.code_compta"=>"Text","s.code_compta_fournisseur"=>"Text"); + $this->export_TypeFields_array[$r]=array('ba.ref'=>'Text','ba.label'=>'Text','b.datev'=>'Date','b.dateo'=>'Date','b.label'=>'Text','b.num_chq'=>'Text','b.fk_bordereau'=>'Text','-b.amount'=>'Numeric','b.amount'=>'Numeric','b.num_releve'=>'Text','b.rappro'=>'Boolean','b.datec'=>"Date","bu.url_id"=>"Text","s.nom"=>"Text","s.code_compta"=>"Text","s.code_compta_fournisseur"=>"Text"); $this->export_entities_array[$r]=array( 'b.rowid'=>'account','ba.ref'=>'account','ba.label'=>'account','b.datev'=>'account','b.dateo'=>'account','b.label'=>'account', - 'b.num_chq'=>'account','b.fk_bordereau'=>'account','-b.amount'=>'account','b.amount'=>'account','b.num_releve'=>'account', - 'b.datec'=>"account","bu.url_id"=>"company","s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company" + 'b.num_chq'=>'account','b.fk_bordereau'=>'account','-b.amount'=>'account','b.amount'=>'account', + 'b.num_releve'=>'account','b.rappro'=>'account','b.datec'=>"account","bu.url_id"=>"company", + "s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company" ); $this->export_special_array[$r]=array('-b.amount'=>'NULLIFNEG','b.amount'=>'NULLIFNEG'); if (empty($conf->fournisseur->enabled)) From 294bc5dcb5e0fedca685b6976e4d7e042fa03067 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 15 Jul 2019 10:19:06 +0200 Subject: [PATCH 469/515] FIX avoid conflict with "$classname" in card.php --- htdocs/commande/card.php | 4 ++-- htdocs/core/tpl/object_discounts.tpl.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 10629ec3452..96ea54c5c84 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1436,11 +1436,11 @@ if ($action == 'create' && $user->rights->commande->creer) if ($element == 'order' || $element == 'commande') { $element = $subelement = 'commande'; } - if ($element == 'propal') { + elseif ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; } - if ($element == 'contract') { + elseif ($element == 'contract') { $element = $subelement = 'contrat'; } diff --git a/htdocs/core/tpl/object_discounts.tpl.php b/htdocs/core/tpl/object_discounts.tpl.php index 70698bfa7eb..3d02d3c5a73 100644 --- a/htdocs/core/tpl/object_discounts.tpl.php +++ b/htdocs/core/tpl/object_discounts.tpl.php @@ -24,7 +24,7 @@ * $backtopage URL to come back to from discount modification pages */ -$classname = get_class($object); +$objclassname = get_class($object); $isInvoice = in_array($object->element, array('facture', 'invoice', 'facture_fourn', 'invoice_supplier')); $isNewObject = empty($object->id) && empty($object->rowid); @@ -53,11 +53,11 @@ if($isNewObject) print ' ('.$addrelativediscount.')'; // Is there is commercial discount or down payment available ? if ($absolute_discount > 0) { - if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $classname::STATUS_DRAFT || $object->type == $classname::TYPE_CREDIT_NOTE || $object->type == $classname::TYPE_DEPOSIT) { + if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) { $translationKey = ! empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount'; $text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency)).'.'; - if ($isInvoice && ! $isNewObject && $object->statut > $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) { + if ($isInvoice && ! $isNewObject && $object->statut > $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) { $text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse')); } @@ -77,11 +77,11 @@ if ($absolute_discount > 0) { if ($absolute_creditnote > 0) { // If validated, we show link "add credit note to payment" - if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $classname::STATUS_VALIDATED || $object->type == $classname::TYPE_CREDIT_NOTE) { + if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $objclassname::STATUS_VALIDATED || $object->type == $objclassname::TYPE_CREDIT_NOTE) { $translationKey = ! empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote'; $text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.'; - if ($isInvoice && ! $isNewObject && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_DEPOSIT) { + if ($isInvoice && ! $isNewObject && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_DEPOSIT) { $text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse')); } @@ -101,7 +101,7 @@ if($absolute_discount <= 0 && $absolute_creditnote <= 0) { $translationKey = ! empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount'; print '
'.$langs->trans($translationKey).'.'; - if ($isInvoice && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) { + if ($isInvoice && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) { print ' (' . $addabsolutediscount . ')'; } } From ae540cb25e5b6b671258f2c4ae71b2c5bca5d4ee Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Tue, 9 Jul 2019 18:00:54 +0200 Subject: [PATCH 470/515] FIX: add missing hook calls --- htdocs/fourn/product/list.php | 57 ++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 16ed559814d..90ff76231d1 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -75,7 +75,12 @@ if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } $parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks( + 'doActions', + $parameters, + $object, + $action +); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) @@ -128,6 +133,17 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type, p.entity,"; $sql.= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,"; $sql.= " s.rowid as socid, s.nom as name"; + +// Add fields to SELECT from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks( + 'printFieldListSelect', + $parameters, + $object, + $action +); +$sql .= $hookmanager->resPrint; + $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; if ($catid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON p.rowid = ppf.fk_product"; @@ -158,6 +174,14 @@ if ($fourn_id > 0) $sql .= " AND ppf.fk_soc = ".$fourn_id; } +// Add WHERE filters from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks( + 'printFieldListWhere', + $parameters +); +$sql .= $hookmanager->resPrint; + $sql .= $db->order($sortfield,$sortorder); // Count total nb of records without orderby and limit @@ -242,6 +266,17 @@ if ($resql) print '
'; print ''; print ''; + + // add filters from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldPreListTitle', + $parameters, + $object, + $action + ); + if (!empty($reshook)) print $hookmanager->resPrint; + print '\n"; @@ -292,6 +337,16 @@ if ($resql) print ''; + // add additional columns from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListValue', + $parameters, + $objp, + $action + ); + if (!empty($reshook)) print $hookmanager->resPrint; + print ''; print "\n"; From 8aa147a4e518f7b1a4ba203c7825bcc8e82b2d79 Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Wed, 10 Jul 2019 19:00:20 +0200 Subject: [PATCH 471/515] # missing hooks from dispatch.php and list.php --- htdocs/fourn/commande/dispatch.php | 83 ++++++++++++++++++++++++++++++ htdocs/fourn/product/list.php | 11 ++-- 2 files changed, 91 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 4b15f04faa0..af2a2218410 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -491,11 +491,35 @@ if ($id > 0 || ! empty($ref)) { $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, SUM(l.qty) as qty,"; $sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse"; + + // Enable hooks to alter the SQL query (SELECT) + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListSelect', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $sql .= $hookmanager->resPrint; + $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid"; $sql .= " WHERE l.fk_commande = " . $object->id; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND l.product_type = 0"; + + // Enable hooks to alter the SQL query (WHERE) + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListWhere', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $sql .= $hookmanager->resPrint; + $sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent, p.fk_default_warehouse"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product $sql .= " ORDER BY p.ref, p.label"; @@ -526,6 +550,18 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; print ''; + + // Enable hooks to append additional columns + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListTitle', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print "\n"; } @@ -608,6 +644,23 @@ if ($id > 0 || ! empty($ref)) { //print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); print ''; // Dispatch column print ''; // Warehouse column + + // Enable hooks to append additional columns + $parameters = array( + 'is_information_row' => true, // allows hook to distinguish between the + // rows with information and the rows with + // dispatch form input + 'objp' => $objp + ); + $reshook = $hookmanager->executeHooks( + 'printFieldListValue', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print ''; print ''; @@ -648,6 +701,23 @@ if ($id > 0 || ! empty($ref)) { //print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); print ''; // Dispatch column print ''; // Warehouse column + + // Enable hooks to append additional columns + $parameters = array( + 'is_information_row' => true, // allows hook to distinguish between the + // rows with information and the rows with + // dispatch form input + 'objp' => $objp + ); + $reshook = $hookmanager->executeHooks( + 'printFieldListValue', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print ''; print ''; @@ -699,6 +769,19 @@ if ($id > 0 || ! empty($ref)) { } print "\n"; + // Enable hooks to append additional columns + $parameters = array( + 'is_information_row' => false // this is a dispatch form row + ); + $reshook = $hookmanager->executeHooks( + 'printFieldListValue', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print "\n"; } } diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 90ff76231d1..acfeb87fca9 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -142,6 +142,7 @@ $reshook = $hookmanager->executeHooks( $object, $action ); +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $sql .= $hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; @@ -180,6 +181,7 @@ $reshook = $hookmanager->executeHooks( 'printFieldListWhere', $parameters ); +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $sql .= $hookmanager->resPrint; $sql .= $db->order($sortfield,$sortorder); @@ -275,7 +277,8 @@ if ($resql) $object, $action ); - if (!empty($reshook)) print $hookmanager->resPrint; + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; print '\n"; @@ -345,7 +349,8 @@ if ($resql) $objp, $action ); - if (!empty($reshook)) print $hookmanager->resPrint; + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; print ''; From b0d46d492fdd738cab5b15202abb4414da373828 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2019 18:40:42 +0200 Subject: [PATCH 472/515] FIX #11509 --- htdocs/adherents/subscription/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index e3eb9b595ee..e7967aa4782 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -229,7 +229,7 @@ if ($search_type) $param.="&search_type=".urlencode($search_type); if ($date_select) $param.="&date_select=".urlencode($date_select); if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname); if ($search_login) $param.="&search_login=".urlencode($search_login); -if ($search_acount) $param.="&search_account=".urlencode($search_account); +if ($search_account) $param.="&search_account=".urlencode($search_account); if ($search_amount) $param.="&search_amount=".urlencode($search_amount); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields From 5778a02ee1f195ad457a07de6b4f986d6e4cb49a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2019 18:44:33 +0200 Subject: [PATCH 473/515] FIX #11505 --- htdocs/accountancy/journal/bankjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index d4a9ff0d3f6..8003cf1c523 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -964,7 +964,7 @@ if (empty($action) || $action == 'view') { $varlink = 'id_journal=' . $id_journal; - journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); + journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); // Test that setup is complete From e3968241335b6dea66c1b5b2e7ed0d7768c40ae1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2019 19:08:57 +0200 Subject: [PATCH 474/515] FIX #11507 --- htdocs/accountancy/admin/productaccount.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 562dfd1505b..1c72ea61abd 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -462,7 +462,7 @@ if ($result) // print ''; // TODO: we shoul set a user defined value to adjust user square / wide screen size $trunclengh = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; - print ''; + print ''; } if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') From 6c23154a91f683f300bac2b114acce2aa4c2d201 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2019 22:59:18 +0200 Subject: [PATCH 475/515] FIX #11506 --- htdocs/accountancy/admin/journals_list.php | 20 +++++++++----------- htdocs/langs/en_US/accountancy.lang | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index cac81bfbcae..78cd92f90e0 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -162,7 +162,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; - if ($fieldnamekey == 'nature') $fieldnamekey = 'Nature'; + if ($fieldnamekey == 'nature') $fieldnamekey = 'NatureOfJournal'; } // Other checks if (isset($_POST["code"])) @@ -437,7 +437,7 @@ if ($id) $valuetoshow=$langs->trans("Label"); } if ($fieldlist[$field]=='nature') { - $valuetoshow=$langs->trans("Nature"); + $valuetoshow=$langs->trans("NatureOfJournal"); } if ($valuetoshow != '') { @@ -516,7 +516,7 @@ if ($id) } // Title line with search boxes - print ''; + /*print ''; print ''; print ''; print ''; @@ -524,16 +524,14 @@ if ($id) print ''; print ''; print ''; print ''; - + */ + // Title of lines - print ''; + print ''; foreach ($fieldlist as $field => $value) { // Determine le nom du champ par rapport aux noms possibles @@ -558,7 +556,7 @@ if ($id) $valuetoshow=$langs->trans("Label"); } if ($fieldlist[$field]=='nature') { - $valuetoshow=$langs->trans("Nature"); + $valuetoshow=$langs->trans("NatureOfJournal"); } // Affiche nom du champ diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 6dfe4fc8c4f..4b22f512826 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -265,7 +265,7 @@ AccountingJournals=Accounting journals AccountingJournal=Accounting journal NewAccountingJournal=New accounting journal ShowAccoutingJournal=Show accounting journal -Nature=Nature +NatureOfJournal=Nature of Journal AccountingJournalType1=Miscellaneous operations AccountingJournalType2=Sales AccountingJournalType3=Purchases From ea349de0818dddff6859aaca349d0878d9a57cf3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2019 23:25:42 +0200 Subject: [PATCH 476/515] FIX #11498 --- dev/dolibarr_changes.txt | 9 +++++++++ htdocs/includes/mike42/escpos-php/Escpos.php | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 5bad55fd4d2..e87b082dd06 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -27,6 +27,15 @@ With +ESCPOS: +------- +Replace + private $connector; +With + protected $connector; + + + NUSOAP: ------- * In file nusoap.php, to avoid a warning, diff --git a/htdocs/includes/mike42/escpos-php/Escpos.php b/htdocs/includes/mike42/escpos-php/Escpos.php index 57e7eb2c8ac..b8568260738 100644 --- a/htdocs/includes/mike42/escpos-php/Escpos.php +++ b/htdocs/includes/mike42/escpos-php/Escpos.php @@ -144,9 +144,11 @@ class Escpos { /** * @var PrintConnector + * @CHANGE */ - private $connector; - + protected $connector; + // private $connector; + /** * @var AbstractCapabilityProfile */ From d694360c66bea525997c471f535948864574ece4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2019 23:46:54 +0200 Subject: [PATCH 477/515] Fix warning --- htdocs/core/modules/modAgenda.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 3b7c05c5ad1..f84ad6cbcfa 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -418,6 +418,6 @@ class modAgenda extends DolibarrModules $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); - $this->export_sql_order[$r] .=' ORDER BY ac.datep'; + $this->export_sql_order[$r] =' ORDER BY ac.datep'; } } From fb5af65f4d1bdb6925e95bca0f1ddb02f01355a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2019 23:56:05 +0200 Subject: [PATCH 478/515] FIX #11466 --- htdocs/product/price.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 26970f1dd13..6bc7033ec23 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1711,20 +1711,18 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) } print ''; - // Update all child soc - print ''; - print ''; - print ''; - print '
label; ?> + photos; ?> label; ?> + photos; ?>
'; From a3f5397988c7437e34d1435ff86feec19104e0e6 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 10 Jul 2019 15:55:50 +0200 Subject: [PATCH 454/515] FIX help text 2 --- htdocs/core/tpl/commonfields_view.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index b6b2e572e49..86a58d346fe 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -52,7 +52,7 @@ foreach($object->fields as $key => $val) if ($val['notnull'] > 0) print ' fieldrequired'; if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; print '">'; - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); + if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); else print $langs->trans($val['label']); print ''; @@ -91,7 +91,7 @@ foreach($object->fields as $key => $val) if ($val['notnull'] > 0) print ' fieldrequired'; if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; print '">'; - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); + if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); else print $langs->trans($val['label']); print ''; From cce8f98afc7638becb92e2a4e9344c7de40c2b21 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 10 Jul 2019 16:33:03 +0200 Subject: [PATCH 455/515] FIX : accounting mode must be taken from global conf, because there's no way to choose a mode with interface --- htdocs/compta/stats/byratecountry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 2c43db42d13..cd41649cc89 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class. // Load translation files required by the page $langs->loadLangs(array("other","compta","banks","bills","companies","product","trips","admin","accountancy")); -$modecompta = GETPOST('modecompta','alpha'); +$modecompta = $conf->global->ACCOUNTING_MODE; // Date range $year=GETPOST("year",'int'); From abd0abf11531b196fe07e8bac545ea95071b95ef Mon Sep 17 00:00:00 2001 From: Nicolas ZABOURI Date: Wed, 10 Jul 2019 18:36:12 +0200 Subject: [PATCH 456/515] FIX element name in update_price --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f0fe7bf437c..43f78b571de 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Bahfir abbes * Copyright (C) 2017 ATM Consulting - * Copyright (C) 2017 Nicolas ZABOURI + * Copyright (C) 2017-2019 Nicolas ZABOURI * Copyright (C) 2017 Rui Strecht * Copyright (C) 2018 Frederic France * @@ -2615,7 +2615,7 @@ abstract class CommonObject $MODULE = ""; if ($this->element == 'propal') $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_PROPOSAL"; - elseif ($this->element == 'order') + elseif ($this->element == 'commande') $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_ORDER"; elseif ($this->element == 'facture') $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_INVOICE"; From 4f0316580672122e1154c148935d5e17264ad433 Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Thu, 11 Jul 2019 12:28:24 +0200 Subject: [PATCH 457/515] FIX: outdated phpdoc --- htdocs/expedition/class/expedition.class.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index a8d9acc7b48..ea6e003d326 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1073,12 +1073,14 @@ class Expedition extends CommonObject } } - /** - * Delete shipment. - * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element) - * - * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO - */ + /** + * Delete shipment. + * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element) + * + * @param bool $also_update_stock true if the stock should be increased back (false by default) + * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO + * @throws Exception + */ function delete($also_update_stock = false) { global $conf, $langs, $user; From 694be619b26adfa705b2fd92675a4599da1f3fe7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Jul 2019 22:16:32 +0200 Subject: [PATCH 458/515] Fix doxygen --- htdocs/product/class/product.class.php | 30 +++++++++++++++----------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index fc966f7f19a..9c515d619c6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -272,13 +272,26 @@ class Product extends CommonObject public $accountancy_code_buy; /** - * Main barcode - * barcode value + * Main Barcode value * * @var string */ public $barcode; + /** + * Main Barcode type ID + * + * @var int + */ + public $barcode_type; + + /** + * Main Barcode type code + * + * @var string + */ + public $barcode_type_code; + /** * Additional barcodes (Some products have different barcodes according to the country of origin of manufacture) * @@ -294,7 +307,7 @@ class Product extends CommonObject public $multilangs=array(); - //! Taille de l'image + //! Size of image public $imgWidth; public $imgHeight; @@ -348,16 +361,7 @@ class Product extends CommonObject public $fields = array( - 'rowid' => array( - 'type'=>'integer', - 'label'=>'TechnicalID', - 'enabled'=>1, - 'visible'=>-2, - 'notnull'=>1, - 'index'=>1, - 'position'=>1, - 'comment'=>'Id', - ), + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), From b1e21ed5fc302ebef8fe6b63dc336074ec997233 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Jul 2019 22:18:44 +0200 Subject: [PATCH 459/515] FIX Computed field were not calculated into lists. --- htdocs/core/class/extrafields.class.php | 2 ++ .../core/tpl/extrafields_list_print_fields.tpl.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index eeb653aec8a..9e83a1d836b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1627,6 +1627,8 @@ class ExtraFields if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method. + //if ($computed) $value = // $value is already calculated into $value before calling this method + $showsize=0; if ($type == 'date') { diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 1dad8a6739d..35aefb9f719 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -40,7 +40,17 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_ { $value = $obj->$tmpkey; } - + // If field is a computed field, we make computation to get value + if ($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]) + { + //global $obj, $object; + //var_dump($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]); + //var_dump($obj); + //var_dump($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]); + $value = dol_eval($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1); + //var_dump($value); + } + print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey); print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; @@ -257,6 +292,16 @@ if ($resql) print_liste_field_titre("BuyingPrice",$_SERVER["PHP_SELF"], "ppf.price",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre("QtyMin",$_SERVER["PHP_SELF"], "ppf.quantity",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre("UnitPrice",$_SERVER["PHP_SELF"], "ppf.unitprice",$param,"",'align="right"',$sortfield,$sortorder); + + // add header cells from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListTitle', + $parameters, + $object, + $action + ); + if (!empty($reshook)) print $hookmanager->resPrint; print_liste_field_titre('',$_SERVER["PHP_SELF"]); print "
'.(isset($objp->unitprice) ? price($objp->unitprice) : '').'
' . $langs->trans("QtyToDispatchShort") . '' . $langs->trans("Warehouse") . '
'; $searchpicto=$form->showFilterButtons(); @@ -301,7 +304,8 @@ if ($resql) $object, $action ); - if (!empty($reshook)) print $hookmanager->resPrint; + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; print_liste_field_titre('',$_SERVER["PHP_SELF"]); print "
' . $obj->description . '' . nl2br(dol_trunc($obj->description, $trunclengh)) . '' . nl2br(dol_trunc($obj->description, $trunclengh)) . '
'; - if ($filterfound) - { - $searchpicto=$form->showFilterAndCheckAddButtons(0); - print $searchpicto; - } + $searchpicto=$form->showFilterButtons(); + print $searchpicto; print '
'; - print $langs->trans('ForceUpdateChildPriceSoc'); - print ''; - print ''; - print '
'; dol_fiche_end(); print '
'; + + // Update all child soc + print '
'; + print ' '; + print $langs->trans('ForceUpdateChildPriceSoc'); + print '
'; + print ''; print '     '; print ''; @@ -1804,10 +1802,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // Update all child soc print '
'; - print $langs->trans('ForceUpdateChildPriceSoc'); print ''; - print ''; print '
'; + print ''; print 'id . '&socid=' . $line->fk_soc . '">'; print img_info($langs->trans('PriceByCustomerLog')); print ''; From f826e9631cafe5e54cc6918714b81445713d4ea0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Jul 2019 00:12:22 +0200 Subject: [PATCH 479/515] FIX #11463 --- htdocs/societe/agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 13838812d9d..53a1ee5d7ed 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -$langs->load(array("companies", "bills", "propal", "orders")); +$langs->loadLangs(array("companies", "bills", "propal", "orders")); if (GETPOST('actioncode', 'array')) { From 70ff806fdffdd50435afb1e043ea59f5011bbe90 Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 16 Jul 2019 10:41:01 +0200 Subject: [PATCH 480/515] fix fourn code preload --- htdocs/societe/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a8991614301..2a86465d4f2 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -949,12 +949,13 @@ else if(empty($duplicate_code_error)) { $object->code_client = GETPOST('customer_code', 'alpha'); $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); } else { setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'),'', 'warnings'); } - $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); + $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); $object->town = GETPOST('town', 'alpha'); From c9fe91138d42963e6343923b0b812bfcb893051b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 16 Jul 2019 12:39:43 +0200 Subject: [PATCH 481/515] FIX better compatibility with Multicompany --- htdocs/opensurvey/index.php | 16 +++------------- htdocs/ticket/index.php | 4 ++-- htdocs/ticket/list.php | 3 +-- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/htdocs/opensurvey/index.php b/htdocs/opensurvey/index.php index 4c60a807445..1ddfc47d99a 100644 --- a/htdocs/opensurvey/index.php +++ b/htdocs/opensurvey/index.php @@ -37,18 +37,6 @@ $langs->load("opensurvey"); llxHeader(); -$nbsondages=0; -$sql='SELECT COUNT(*) as nb FROM '.MAIN_DB_PREFIX.'opensurvey_sondage'; -$resql=$db->query($sql); -if ($resql) -{ - $obj=$db->fetch_object($resql); - $nbsondages=$obj->nb; -} -else dol_print_error($db,''); - - - print load_fiche_titre($langs->trans("OpenSurveyArea")); @@ -56,7 +44,9 @@ print '
'; $nbsondages=0; -$sql='SELECT COUNT(*) as nb FROM '.MAIN_DB_PREFIX.'opensurvey_sondage'; +$sql = 'SELECT COUNT(*) as nb'; +$sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_sondage'; +$sql.= ' WHERE entity IN ('.getEntity('survey').')'; $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 086ea63bc0e..59a2bae5f46 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -127,7 +127,7 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } -$sql .= ' WHERE t.entity IN (' . getEntity('ticket', 1) . ')'; +$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')'; $sql .= " AND t.fk_statut IS NOT NULL"; $sql .= " AND date_format(datec,'%Y') = '" . $endyear . "'"; if (!$user->rights->societe->client->voir && !$socid) { @@ -271,7 +271,7 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } -$sql .= ' WHERE t.entity IN (' . getEntity('ticket', 1) . ')'; +$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')'; $sql .= " AND t.fk_statut=0"; if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 64ec859cc0c..965677ded0e 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -209,8 +209,7 @@ $sql.=$hookmanager->resPrint; $sql=preg_replace('/, $/','', $sql); $sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; -if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")"; -else $sql.=" WHERE 1 = 1"; +$sql.= " WHERE t.entity IN (".getEntity($object->element).")"; foreach($search as $key => $val) { if ($key == 'fk_statut' && $search[$key] == -1) continue; From 464bda996c5a846e3fea7d0df8d729285c6e2630 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Tue, 16 Jul 2019 13:59:00 +0200 Subject: [PATCH 482/515] FIX: propal createFrom hook: undefined parameter attached --- htdocs/comm/propal/class/propal.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 647be1d0233..082281af1da 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1316,9 +1316,9 @@ class Propal extends CommonObject // Hook of thirdparty module if (is_object($hookmanager)) { - $parameters=array('objFrom'=>$this,'clonedObj'=>$clonedObj); + $parameters=array('objFrom'=>$this,'clonedObj'=>$object); $action=''; - $reshook=$hookmanager->executeHooks('createFrom',$parameters,$clonedObj,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) $error++; } } From c72a59ad36641ab13dbe382c8d52fb36d68b0461 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 16 Jul 2019 14:55:19 +0200 Subject: [PATCH 483/515] FIX : we need to be able to add freeline with qty between 0 & 1 in supplierorder line --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9198cf3ac22..f32d9d24c01 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1485,7 +1485,7 @@ class CommandeFournisseur extends CommonOrder $desc=trim($desc); // Check parameters - if ($qty < 1 && ! $fk_product) + if ($qty < 0 && ! $fk_product) { $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Product")); return -1; From b9771db13116b9a685b8d7536c1ed25a0791909c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Jul 2019 17:16:49 +0300 Subject: [PATCH 484/515] Fix phpcs --- htdocs/compta/tva/quadri_detail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 0f359dd9721..c48bc385c53 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -118,7 +118,7 @@ foreach ($listofparams as $param) } $title = $langs->trans("VATReport") . " " . dol_print_date($date_start) . " -> " . dol_print_date($date_end); -llxHeader('',$title,'','',0,0,'','',$morequerystring); +llxHeader('', $title, '', '', 0, 0, '', '', $morequerystring); //print load_fiche_titre($langs->trans("VAT"),""); From aab23a15317a62e44f551eb71d43058e8f96b24e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 16 Jul 2019 17:50:43 +0200 Subject: [PATCH 485/515] FIX : do not return formatted prices in json string --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a68f09e5ee1..64c5063e8a2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2594,7 +2594,7 @@ class Form } $opt.= "\n"; - $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); + $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 61a574701ba43a9a64eef9ed7ceb6e13ee3879b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Jul 2019 01:11:10 +0200 Subject: [PATCH 486/515] New Add field prefix_session in llx_events --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_events.sql | 1 + 2 files changed, 3 insertions(+) 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 b10ab3b9a85..4ec9fbdaffb 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 @@ -48,3 +48,5 @@ ALTER TABLE llx_facture_fourn DROP COLUMN total; ALTER TABLE llx_user ADD COLUMN iplastlogin varchar(250); ALTER TABLE llx_user ADD COLUMN ippreviouslogin varchar(250); + +ALTER TABLE llx_events ADD COLUMN prefix_session varchar(250) NULL; diff --git a/htdocs/install/mysql/tables/llx_events.sql b/htdocs/install/mysql/tables/llx_events.sql index f906cf0fcbd..c9f8f034a34 100644 --- a/htdocs/install/mysql/tables/llx_events.sql +++ b/htdocs/install/mysql/tables/llx_events.sql @@ -27,6 +27,7 @@ create table llx_events tms timestamp, -- date creation/modification type varchar(32) NOT NULL, -- action type entity integer DEFAULT 1 NOT NULL, -- multi company id + prefix_session varchar(255) NULL, -- prefix of session, obtained with dol_getprefix dateevent datetime, -- date event fk_user integer, -- id user description varchar(250) NOT NULL, -- full description of action From fed598236c185406f59a504ed57181464c26b1b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Jul 2019 01:12:48 +0200 Subject: [PATCH 487/515] Add field --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 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 4ec9fbdaffb..f8cc3062bde 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 @@ -49,4 +49,4 @@ ALTER TABLE llx_facture_fourn DROP COLUMN total; ALTER TABLE llx_user ADD COLUMN iplastlogin varchar(250); ALTER TABLE llx_user ADD COLUMN ippreviouslogin varchar(250); -ALTER TABLE llx_events ADD COLUMN prefix_session varchar(250) NULL; +ALTER TABLE llx_events ADD COLUMN prefix_session varchar(255) NULL; From b5d348356dbc590b50ec97b25fceae111e7ac91a Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 17 Jul 2019 16:49:41 +0200 Subject: [PATCH 488/515] Fix socpeople assigned list in action com list --- htdocs/comm/action/list.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 2d8be09ee7a..aae2d48e9cf 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -524,6 +524,7 @@ if ($resql) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; $caction=new CActionComm($db); $arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), '', 1); + $contactListCache = array(); while ($i < min($num,$limit)) { @@ -634,7 +635,34 @@ if ($resql) // Contact if (! empty($arrayfields['a.fk_contact']['checked'])) { print '
'; - if ($obj->fk_contact > 0) + + + $actionstatic->fetchResources(); + if(!empty($actionstatic->socpeopleassigned)) + { + $contactList = array(); + foreach ($actionstatic->socpeopleassigned as $socpeopleId => $socpeopleassigned) + { + if(!isset($contactListCache[$socpeopleassigned['id']])) + { + // if no cache found we fetch it + $contact = new Contact($db); + if($contact->fetch($socpeopleassigned['id'])>0) + { + $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1,'',28); + $contactList[] = $contact->getNomUrl(1,'',28); + } + } + else{ + // use cache + $contactList[] = $contactListCache[$socpeopleassigned['id']]; + } + } + if(!empty($contactList)){ + print implode(', ', $contactList); + } + } + elseif ($obj->fk_contact > 0) //keep for retrocompatibility with faraway event { $contactstatic->id=$obj->fk_contact; $contactstatic->email=$obj->email; From 27a0c046dfc2e69ff700468e685f0f99ff55a52c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 18 Jul 2019 09:58:26 +0200 Subject: [PATCH 489/515] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 6b910236e96..b5db41a424e 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -392,14 +392,14 @@ class Stripe extends CommonObject "payment_method_types" => array("card"), "description" => $description, "statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) - //"save_payment_method" => true, + "setup_future_usage" => "off_session", "metadata" => $metadata ); if (! is_null($customer)) $dataforintent["customer"]=$customer; // payment_method = // payment_method_types = array('card') //var_dump($dataforintent); - + if ($conf->entity!=$conf->global->STRIPECONNECT_PRINCIPAL && $stripefee > 0) { $dataforintent["application_fee"] = $stripefee; From 8a5aad34337723af0fa479c0f67487efbe0f97e3 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 18 Jul 2019 10:00:57 +0200 Subject: [PATCH 490/515] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index b5db41a424e..e4b021167e0 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -399,7 +399,7 @@ class Stripe extends CommonObject // payment_method = // payment_method_types = array('card') //var_dump($dataforintent); - + if ($conf->entity!=$conf->global->STRIPECONNECT_PRINCIPAL && $stripefee > 0) { $dataforintent["application_fee"] = $stripefee; From 4235f0b3523694c1ef7d3587e3539dae3dd75fd1 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 18 Jul 2019 10:05:54 +0200 Subject: [PATCH 491/515] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index e4b021167e0..993fe6a07dd 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -392,7 +392,7 @@ class Stripe extends CommonObject "payment_method_types" => array("card"), "description" => $description, "statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) - "setup_future_usage" => "off_session", + "setup_future_usage" => "on_session", "metadata" => $metadata ); if (! is_null($customer)) $dataforintent["customer"]=$customer; From 32bc8a5fafb51d4070014f29f84456b4690b1762 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 18 Jul 2019 11:05:51 +0200 Subject: [PATCH 492/515] FIX fournrprice log for insert --- htdocs/fourn/class/fournisseur.product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index fc74890f150..49a7b1935cb 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -439,7 +439,7 @@ class ProductFournisseur extends Product $resql = $this->db->query($sql); if ($resql) { - $idinserted = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); + $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); } else { $error++; @@ -462,7 +462,7 @@ class ProductFournisseur extends Product if (empty($error)) { $this->db->commit(); - return $idinserted; + return $this->product_fourn_price_id; } else { $this->db->rollback(); return -1; From a23bae6c9664fdd845b9594f57504cb011c9a387 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jul 2019 11:10:09 +0200 Subject: [PATCH 493/515] Work to mke the page perf.php public by default. --- htdocs/admin/system/perf.php | 51 ++++++++++++++++++++++++++++++++--- htdocs/langs/en_US/admin.lang | 5 ++-- 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 67f75c911aa..66148fb01ab 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -144,6 +144,21 @@ if (! $foundcache && $test) if (! $foundcache) print $langs->trans("NoOPCodeCacheFound"); print '
'; +// Use of preload bootstrap +if (ini_get('opcache.preload')) +{ + print '
'; + print ''.$langs->trans("PreloadOPCode").': '; + print ini_get('opcache.preload'); +} +else +{ + print '
'; + print ''.$langs->trans("PreloadOPCode").': '; + print $langs->trans("No"); +} +print '
'; + // HTTPCacheStaticResources print ' - Date: Thu, 18 Jul 2019 18:53:51 +0200 Subject: [PATCH 511/515] Fix phpcs --- htdocs/comm/action/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 6e46aee2435..1fbae964dff 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -660,8 +660,8 @@ if ($resql) $contact = new Contact($db); if($contact->fetch($socpeopleassigned['id'])>0) { - $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1,'',28); - $contactList[] = $contact->getNomUrl(1,'',28); + $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1, '', 28); + $contactList[] = $contact->getNomUrl(1, '', 28); } } else{ From 8857d0acf5404dfc5f966cbd771386ba2d07bc36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Jul 2019 03:18:53 +0200 Subject: [PATCH 512/515] Keep save_payment_method to true. Keep it to true because i see no reason to not save the credit card on Stripe side. --- htdocs/stripe/class/stripe.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 993fe6a07dd..319ff08d2cd 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -392,7 +392,8 @@ class Stripe extends CommonObject "payment_method_types" => array("card"), "description" => $description, "statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) - "setup_future_usage" => "on_session", + "save_payment_method" => true, + "setup_future_usage" => "on_session", "metadata" => $metadata ); if (! is_null($customer)) $dataforintent["customer"]=$customer; From 03aa8c4b83baa9361c8e0cee89c693787cc15055 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Jul 2019 03:22:52 +0200 Subject: [PATCH 513/515] Better log --- htdocs/public/payment/newpayment.php | 7 ++++++- htdocs/stripe/class/stripe.class.php | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index b36e115deea..deda54bf996 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -21,6 +21,11 @@ * For Paypal test: https://developer.paypal.com/ * For Paybox test: ??? * For Stripe test: Use credit card 4242424242424242 .More example on https://stripe.com/docs/testing + * + * Variants: + * - When option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is on, we use the new checkout API + * - When option STRIPE_USE_NEW_CHECKOUT is on, we use the new checkout API + * - If no option set, we use old APIS (charge) */ /** @@ -2099,7 +2104,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment else { ?> - // Code for payment with option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION off and STRIPE_USE_NEW_CHECKOUT off + // Old code for payment with option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION off and STRIPE_USE_NEW_CHECKOUT off // Create a Stripe client. var stripe = Stripe(''); diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 6b910236e96..d9e6a077b96 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -286,9 +286,11 @@ class Stripe extends CommonObject /** * Get the Stripe payment intent. Create it with confirm=false * Warning. If a payment was tried and failed, a payment intent was created. - * But if we change someting on object to pay (amount or other), reusing same payment intent is not allowed. + * But if we change something on object to pay (amount or other), reusing same payment intent is not allowed. * Recommanded solution is to recreate a new payment intent each time we need one (old one will be automatically closed after a delay), * that's why i comment the part of code to retreive a payment intent with object id (never mind if we cumulate payment intent with old ones that will not be used) + * Note: This is used when option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is on when making a payment from the public/payment/newpayment.php page + * but not when using the STRIPE_USE_NEW_CHECKOUT. * * @param double $amount Amount * @param string $currency_code Currency code @@ -307,7 +309,7 @@ class Stripe extends CommonObject { global $conf; - dol_syslog("getPaymentIntent"); + dol_syslog("getPaymentIntent", LOG_INFO, 1); $error = 0; @@ -479,7 +481,7 @@ class Stripe extends CommonObject } } - dol_syslog("getPaymentIntent return error=".$error); + dol_syslog("getPaymentIntent return error=".$error, LOG_INFO, -1); if (! $error) { From efe27d335b31b8a3241448ffb8bf6f55171cc168 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Jul 2019 03:53:34 +0200 Subject: [PATCH 514/515] Fix param --- htdocs/stripe/class/stripe.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index cb71c686ebf..92c6335cd29 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -394,7 +394,6 @@ class Stripe extends CommonObject "payment_method_types" => array("card"), "description" => $description, "statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) - "save_payment_method" => true, "setup_future_usage" => "on_session", "metadata" => $metadata ); From 2afefada40ca52d431792429cdbb6d983c6644b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Jul 2019 04:02:42 +0200 Subject: [PATCH 515/515] Fix: Avoid deletion of system entries in dictionary --- htdocs/admin/dict.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 11cd105137c..87e072b8d7e 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1622,7 +1622,11 @@ if ($id) elseif ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; } elseif ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; } } - + if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'other', 'page'))) + { + $iserasable = 0; $canbedisabled = 0; + if (in_array($obj->code, array('banner'))) $canbedisabled = 1; + } if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; } if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; } $canbemodified=$iserasable;