From 97dbb40ad6f9e62de72b73fc4587002b718dddf7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Aug 2017 18:42:35 +0200 Subject: [PATCH 01/11] Fix syntax error --- htdocs/compta/bank/index.php | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 7d5046d18c9..9e5ddf8008a 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -492,21 +492,36 @@ foreach ($accounts as $key=>$type) // Account number if (! empty($arrayfields['b.account_number']['checked'])) { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('',$acc->account_number); - - print ''.$accountingaccount->getNomUrl(0,1,1,'',1).''; - + print ''; + if (! empty($conf->accounting->enabled)) + { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('',$acc->account_number); + print $accountingaccount->getNomUrl(0,1,1,'',1); + } + else + { + print $acc->account_number; + } + print ''; if (! $i) $totalarray['nbfield']++; } // Accountancy journal if (! empty($arrayfields['b.fk_accountancy_journal']['checked'])) { - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($acc->fk_accountancy_journal); - - print ''.$accountingjournal->getNomUrl(0,1,1,'',1).''; + print ''; + if (! empty($conf->accounting->enabled)) + { + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch('',$acc->fk_accountancy_journal); + print $accountingjournal->getNomUrl(0,1,1,'',1); + } + else + { + print ''; + } + print ''; if (! $i) $totalarray['nbfield']++; } From aae24c26a3a0f99061669fd0d6d253b0a23267fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Aug 2017 20:20:34 +0200 Subject: [PATCH 02/11] Some fixes with smartphones --- htdocs/comm/action/card.php | 6 +++--- htdocs/compta/bank/transfer.php | 2 +- htdocs/core/lib/functions.lib.php | 10 ++++++---- htdocs/main.inc.php | 4 ++-- htdocs/projet/ganttview.php | 5 +++++ htdocs/projet/tasks.php | 2 ++ 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 16bb308c966..d33968b4fb2 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -709,7 +709,7 @@ if ($action == 'create') // Location if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { - print ''.$langs->trans("Location").''; + print ''.$langs->trans("Location").''; } // Assigned to @@ -965,7 +965,7 @@ if ($id > 0) } // Title - print 'global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").''; + print 'global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").''; // Full day event print ''.$langs->trans("EventOnFullDay").'fulldayevent?' checked':'').'>'; @@ -1049,7 +1049,7 @@ if ($id > 0) // Location if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { - print ''.$langs->trans("Location").''; + print ''.$langs->trans("Location").''; } // Assigned to diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 0d9a9a94aea..1f3ca1cde8e 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -55,7 +55,7 @@ if ($action == 'add_confirm') if (! $label) { - + $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Description")), null, 'errors'); } if (! $amount) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0b629c1f215..9d30d93ad43 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1190,10 +1190,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $nophoto=''; $morehtmlleft.='
'; } - elseif ($conf->browser->layout != 'phone') { // Show no photo link + //elseif ($conf->browser->layout != 'phone') { // Show no photo link $nophoto='/public/theme/common/nophoto.png'; $morehtmlleft.='
No photo
'; - } + //} } } else @@ -1270,7 +1270,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r } } - if (! $phototoshow && $conf->browser->layout != 'phone') // Show No photo link (picto of pbject) + if (! $phototoshow) // Show No photo link (picto of pbject) { $morehtmlleft.='
'; if ($object->element == 'action') @@ -1286,7 +1286,9 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if ($object->element == 'project' && ! $object->public) $picto = 'project'; // instead of projectpub $nophoto=img_picto('', 'object_'.$picto, '', false, 1); } - $morehtmlleft.='
No photo
'; + $morehtmlleft.=''; + $morehtmlleft.='
No photo
'; + $morehtmlleft.='
'; } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 89b99a61041..8d34517686b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1075,10 +1075,10 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; // Do not index print ''; // Scale for mobile device print ''."\n"; - // Favicon. Note, even if we remove this meta, the browser and android webview try to find a favicon.ico + // Favicon $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL; - print ''."\n"; + if (empty($conf->dol_use_jmobile)) print ''."\n"; // Not required into an Android webview //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser','int')) print ''."\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser','int')) print ''."\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser','int')) print ''."\n"; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index ca3c0ba35e6..16f719a3a8f 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -307,9 +307,14 @@ if (count($tasksarray)>0) $dateformatinput2="%m/%d/%Y"; // How the date for data are formated //var_dump($dateformatinput); //var_dump($dateformatinput2); + + print '
'; + print '
'."\n"; include_once DOL_DOCUMENT_ROOT.'/projet/ganttchart.inc.php'; print '
'."\n"; + + print '
'; } else { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 112c2697706..204b393cc6d 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -494,6 +494,7 @@ else if ($id > 0 || ! empty($ref)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } + print '
'; print ''; if (count($tasksarray) > 0) @@ -536,6 +537,7 @@ else if ($id > 0 || ! empty($ref)) } print "
"; + print '
'; print ''; From 6dda2f3670c783680ad2f595d940fa500af66fea Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 23 Aug 2017 10:07:00 +0200 Subject: [PATCH 03/11] Fix: "scandir" in url is blocked in some providers --- htdocs/admin/agenda_other.php | 8 ++++---- htdocs/admin/bank.php | 6 +++--- htdocs/admin/commande.php | 6 +++--- htdocs/admin/contract.php | 6 +++--- htdocs/admin/expedition.php | 10 +++++----- htdocs/admin/expensereport.php | 8 ++++---- htdocs/admin/fichinter.php | 8 ++++---- htdocs/admin/livraison.php | 8 ++++---- htdocs/admin/payment.php | 2 +- htdocs/admin/prelevement.php | 4 ++-- htdocs/admin/propal.php | 6 +++--- htdocs/admin/supplier_invoice.php | 10 +++++----- htdocs/admin/supplier_order.php | 8 ++++---- htdocs/admin/supplier_payment.php | 2 +- htdocs/admin/supplier_proposal.php | 6 +++--- htdocs/don/admin/donation.php | 6 +++--- htdocs/product/admin/product.php | 2 +- htdocs/projet/admin/project.php | 14 +++++++------- htdocs/societe/admin/societe.php | 4 ++-- 19 files changed, 62 insertions(+), 62 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 9406f8ecc5d..2053a61e370 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -40,7 +40,7 @@ $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $param = GETPOST('param','alpha'); $cancel = GETPOST('cancel','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type = 'action'; @@ -286,7 +286,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print ''."\n"; if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") { - print 'scandir.'&label='.urlencode($module->name).'&type=action">'; + print 'scandir.'&label='.urlencode($module->name).'&type=action">'; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; } @@ -299,7 +299,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -311,7 +311,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } else { - print 'scandir.'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 58d97842017..ba5ad9800b9 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -43,7 +43,7 @@ if (!$user->admin) $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type = 'bankaccount'; @@ -324,7 +324,7 @@ foreach ($dirmodels as $reldir) print ''; } else { print '' . "\n"; - print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; + print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; print ""; } @@ -333,7 +333,7 @@ foreach ($dirmodels as $reldir) if ($conf->global->BANKADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + print '' . img_picto($langs->trans("Disabled"), 'off') . ''; } print ''; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index c2f8cf2d4d6..884672e7eab 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -45,7 +45,7 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type = 'order'; @@ -490,7 +490,7 @@ foreach ($dirmodels as $reldir) else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -502,7 +502,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index acfe7de156f..6d88a62619f 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -36,7 +36,7 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type='contract'; if (empty($conf->global->CONTRACT_ADDON)) @@ -425,7 +425,7 @@ foreach ($dirmodels as $reldir) else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -437,7 +437,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 34a561121b2..c1e2b8daaaf 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -44,7 +44,7 @@ if (! $user->admin) $action=GETPOST('action','alpha'); $value=GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type='shipping'; if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) @@ -291,7 +291,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Disabled"),'switch_off'); print ''; } @@ -432,7 +432,7 @@ foreach ($dirmodels as $reldir) else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -444,7 +444,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; @@ -470,7 +470,7 @@ foreach ($dirmodels as $reldir) print ''; if ($module->type == 'pdf') { - print 'scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').''; } else { diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index a26a21fbede..92efa213e25 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -43,7 +43,7 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type='expensereport'; @@ -423,7 +423,7 @@ foreach ($dirmodels as $reldir) if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; print ""; @@ -431,7 +431,7 @@ foreach ($dirmodels as $reldir) else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -443,7 +443,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index a67407b818c..5daeedf6f7d 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -43,7 +43,7 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type='ficheinter'; @@ -458,7 +458,7 @@ foreach ($dirmodels as $reldir) if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; print ""; @@ -466,7 +466,7 @@ foreach ($dirmodels as $reldir) else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -478,7 +478,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 42d7fa69ac8..daba32f2fda 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -43,7 +43,7 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type='delivery'; /* @@ -412,7 +412,7 @@ foreach ($dirmodels as $reldir) if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; print ""; @@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir) else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -432,7 +432,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 93f7c301519..50170b145c6 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -36,7 +36,7 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type='invoice'; if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON = 'mod_payment_cicada.php'; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 6d5c915dae2..0b1087413ad 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -332,7 +332,7 @@ foreach ($dirmodels as $reldir) else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 57c5560a185..8ab3f0cab83 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -42,7 +42,7 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type='propal'; /* @@ -469,7 +469,7 @@ foreach ($dirmodels as $reldir) else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -481,7 +481,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 540cd4a4b98..b97d32f56a8 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -43,7 +43,7 @@ accessforbidden(); $type=GETPOST('type', 'alpha'); $value=GETPOST('value', 'alpha'); $action=GETPOST('action', 'alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $specimenthirdparty=new Societe($db); $specimenthirdparty->initAsSpecimen(); @@ -398,7 +398,7 @@ foreach ($dirmodels as $reldir) //if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") //{ // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'; + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; /*} @@ -411,7 +411,7 @@ foreach ($dirmodels as $reldir) else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -421,11 +421,11 @@ foreach ($dirmodels as $reldir) { //print img_picto($langs->trans("Default"),'on'); // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').''; + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').''; } else { - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 5c288b9e78a..20e15ba6eae 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -44,7 +44,7 @@ $type=GETPOST('type', 'alpha'); $value=GETPOST('value', 'alpha'); $label = GETPOST('label','alpha'); $action=GETPOST('action', 'alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $specimenthirdparty=new Societe($db); $specimenthirdparty->initAsSpecimen(); @@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir) print ''."\n"; if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") { - print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'; + print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; } @@ -433,7 +433,7 @@ foreach ($dirmodels as $reldir) else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -445,7 +445,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index b5732d1f1c9..dbeb81a55a0 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -39,7 +39,7 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); /* diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 6752566a70f..505b77e0481 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -37,7 +37,7 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type='supplier_proposal'; /* @@ -446,7 +446,7 @@ foreach ($dirmodels as $reldir) else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -458,7 +458,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index b6043539c0d..e122a2d020e 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -397,14 +397,14 @@ if (is_resource($handle)) else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"),'switch_on').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"),'switch_on').''; print ''; } } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -418,7 +418,7 @@ if (is_resource($handle)) else { print ""; - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; print ''; } diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index c42c3981494..ee4b2d5f5bb 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -46,7 +46,7 @@ $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $type = GETPOST('type','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); // Pricing Rules $select_pricing_rules=array( diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index fca5eeb22f6..9863eaff0de 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -43,7 +43,7 @@ if (!$user->admin) accessforbidden(); $value = GETPOST('value','alpha'); $action = GETPOST('action','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type='project'; @@ -672,7 +672,7 @@ foreach ($dirmodels as $reldir) if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; print ""; @@ -680,7 +680,7 @@ foreach ($dirmodels as $reldir) else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -692,7 +692,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; @@ -831,7 +831,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; print ""; @@ -839,7 +839,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } @@ -851,7 +851,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 8e7fe40859b..6f0dd36c72e 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -134,7 +134,7 @@ if ($action == 'setModuleOptions') if ($action == 'set') { $label = GETPOST('label','alpha'); - $scandir = GETPOST('scandir','alpha'); + $scandir = GETPOST('scan_dir','alpha'); $type='company'; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; @@ -161,7 +161,7 @@ if ($action== 'del') if ($action == 'setdoc') { $label = GETPOST('label','alpha'); - $scandir = GETPOST('scandir','alpha'); + $scandir = GETPOST('scan_dir','alpha'); $db->begin(); From 2492b9968a2a5ff8716e0547612e14244e2951ca Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 23 Aug 2017 10:21:10 +0200 Subject: [PATCH 04/11] Fix: missing scandir --- htdocs/admin/chequereceipts.php | 2 +- htdocs/admin/payment.php | 2 +- htdocs/admin/supplier_payment.php | 2 +- htdocs/don/admin/donation.php | 4 +++- htdocs/product/admin/product.php | 4 ++-- htdocs/societe/admin/societe.php | 4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index f319692f27d..b07821fb076 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -189,7 +189,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').''; } print ''; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 50170b145c6..b4b1fb9ce57 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -201,7 +201,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').''; } print ''; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index dbeb81a55a0..3d7e3588886 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -172,7 +172,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').''; } print ''; diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index e122a2d020e..41cfa713702 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -42,6 +42,8 @@ $typeconst=array('yesno','texte','chaine'); $action = GETPOST('action','alpha'); $value = GETPOST('value'); +$label = GETPOST('label','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type='donation'; @@ -420,7 +422,7 @@ if (is_resource($handle)) print ""; print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; print ''; - } + } // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index ee4b2d5f5bb..2757234251d 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -479,7 +479,7 @@ if ($resql) if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; print ""; @@ -495,7 +495,7 @@ if ($resql) else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } } diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 6f0dd36c72e..e5498646d8c 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -547,7 +547,7 @@ foreach ($dirsociete as $dirroot) print "\n"; //if ($conf->global->COMPANY_ADDON_PDF != "$name") //{ - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; //} @@ -568,7 +568,7 @@ foreach ($dirsociete as $dirroot) else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } } From e25a42811826084af583fee2111af496c4f09258 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Aug 2017 12:32:28 +0200 Subject: [PATCH 05/11] Fix compatibility with Internet Explorer --- htdocs/core/lib/functions.lib.php | 6 ++++-- htdocs/theme/eldy/style.css.php | 7 ++++--- htdocs/theme/md/style.css.php | 5 +++-- test/phpunit/FunctionsLibTest.php | 15 ++++++++++++--- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9d30d93ad43..5bd060c878a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -190,8 +190,9 @@ function getBrowserInfo($user_agent) } // OS - if (preg_match('/linux/i', $user_agent)) { $os='linux'; } + if (preg_match('/linux/i', $user_agent)) { $os='linux'; } elseif (preg_match('/macintosh/i', $user_agent)) { $os='macintosh'; } + elseif (preg_match('/windows/i', $user_agent)) { $os='windows'; } // Name if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='firefox'; $version=$reg[2]; } @@ -201,7 +202,8 @@ function getBrowserInfo($user_agent) elseif (preg_match('/epiphany/i', $user_agent)) { $name='epiphany'; } elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='safari'; $version=$reg[2]; } // Safari is often present in string for mobile but its not. elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='opera'; $version=$reg[2]; } - elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end + elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end + elseif (preg_match('/(Windows NT\s([0-9]+\.[0-9])).*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { $name='lynxlinks'; $version=$reg[4]; } if ($tablet) { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index daa2edb87c0..68f580f4b23 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -706,7 +706,7 @@ div.fiche>form>div.div-table-responsive { } .flexcontainer { - display: inline-flex; + browser->name, array('chrome','firefox'))) echo 'display: inline-flex;'."\n"; ?> flex-flow: row wrap; justify-content: flex-start; } @@ -716,10 +716,11 @@ div.fiche>form>div.div-table-responsive { .thumbstat150 { flex: 1 1 170px; } -.thumbstat, thumbstat150 { +.thumbstat, .thumbstat150 { /* flex-grow: 1; */ /* flex-shrink: 1; */ /* flex-basis: 140px; */ + display: inline; width: 100%; justify-content: flex-start; align-self: flex-start; @@ -2819,7 +2820,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { width: 103px; } .boxstats130 { - width: 160px; + width: 158px; height: 48px; padding: 3px } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index f75b1375894..91f576f5195 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -707,7 +707,7 @@ div.fiche>form>div.div-table-responsive { } .flexcontainer { - display: inline-flex; + browser->browsername, array('chrome','firefox'))) echo 'display: inline-flex;' ?> flex-flow: row wrap; justify-content: flex-start; } @@ -717,10 +717,11 @@ div.fiche>form>div.div-table-responsive { .thumbstat150 { flex: 1 1 150px; } -.thumbstat, thumbstat150 { +.thumbstat, .thumbstat150 { /* flex-grow: 1; */ /* flex-shrink: 1; */ /* flex-basis: 140px; */ + display: inline; width: 100%; justify-content: flex-start; align-self: flex-start; diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 0821e6c7a6c..77953ed0141 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -82,7 +82,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase //$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. if (! function_exists('mb_substr')) { print "\n".__METHOD__." function mb_substr must be enabled.\n"; die(); } - + print __METHOD__."\n"; } @@ -278,6 +278,15 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); + //Internet Explorer 11 bis + $user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; NP06; rv:11.0) like Gecko'; + $tmp=getBrowserInfo($user_agent); + $this->assertEquals('ie',$tmp['browsername']); + $this->assertEquals('11.0',$tmp['browserversion']); + $this->assertEmpty($tmp['phone']); + $this->assertFalse($tmp['tablet']); + $this->assertEquals('classic', $tmp['layout']); + //iPad $user_agent = 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25'; $tmp=getBrowserInfo($user_agent); @@ -445,11 +454,11 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $text='ABC'; $after=dol_string_nohtmltag($text,1); $this->assertEquals("ABC",$after,"test6"); - + $text='DEF'; $after=dol_string_nohtmltag($text,1); $this->assertEquals("DEF",$after,"test7"); - + return true; } From e3370b6a9811e2d7d9b9c389fbb92ec9c7c0ccc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Aug 2017 12:47:59 +0200 Subject: [PATCH 06/11] FIX #7265 --- htdocs/webservices/server_order.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index c84eefa3480..1bc0fa6a60e 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -924,8 +924,8 @@ function updateOrder($authentication,$order) { // Define output language $outputlangs = $langs; - $order->generateDocument($order->modelpdf, $outputlangs); - + $object->generateDocument($order->modelpdf, $outputlangs); + } } if ($order['status'] == 0) $result=$object->set_reopen($fuser); From 4da49dfc2d35e6cc505ae3093e34062f81829364 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Aug 2017 15:02:38 +0200 Subject: [PATCH 07/11] FIX #7239 --- ChangeLog | 2 +- htdocs/core/class/html.form.class.php | 9 -- htdocs/core/lib/ajax.lib.php | 12 ++- htdocs/core/tpl/objectline_create.tpl.php | 46 +++++----- .../class/fournisseur.commande.class.php | 4 +- htdocs/fourn/commande/card.php | 23 +++-- htdocs/fourn/facture/card.php | 92 ++++++++++++------- htdocs/supplier_proposal/card.php | 9 +- 8 files changed, 117 insertions(+), 80 deletions(-) diff --git a/ChangeLog b/ChangeLog index 228a2fd6291..ad00051939c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -507,7 +507,7 @@ NEW: Disabled users are striked. NEW: Enhance navigation of project module NEW: fichinter lines ordered by rang AND DATE NEW: hidden conf to use input file multiple from mail form -NEW: hidden feature: SUPPLIERORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined +NEW: hidden feature: SUPPLIER_ORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined NEW: Hidden option MAIN_LANDING_PAGE to choose the first page to show after login works as a "global" option (llx_const) and as a "per user" option (llx_user_param). NEW: Holiday is a now a RH module. All RH module provides by default visilibity on users of its hierarchy. NEW: If error is reported during migration process, you can ignore it to avoid to be locked. diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 59142e4c060..bad85dfac95 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2207,10 +2207,6 @@ class Form unset($producttmpselect); } - if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) - { - print ''; - } // mode=2 means suppliers products $urloption=($socid > 0?'socid='.$socid.'&':'').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); @@ -2218,11 +2214,6 @@ class Form } else { - if (!empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) - { - print ''; - print ''; - } print $this->select_produits_fournisseurs_list($socid,$selected,$htmlname,$filtertype,$filtre,'',-1,0,0,$alsoproductwithnosupplierprice); } } diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index e7d8a7cf538..f793bb2601d 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -40,6 +40,7 @@ * Ex: array('disabled'=> * Ex: array('show'=> * Ex: array('update_textarea'=> + * Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax) * @return string Script */ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array()) @@ -140,6 +141,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt $("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value // Disable an element if (options.option_disabled) { + console.log("Make action option_disabled on #"+options.option_disabled+" with disabled="+ui.item.disabled) if (ui.item.disabled) { $("#" + options.option_disabled).prop("disabled", true); if (options.error) { @@ -148,28 +150,32 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt if (options.warning) { $.jnotify(options.warning, "warning", false); // Output with jnotify the warning message } - } else { + } else { $("#" + options.option_disabled).removeAttr("disabled"); } } if (options.disabled) { + console.log("Make action disabled on each "+options.option_disabled) $.each(options.disabled, function(key, value) { $("#" + value).prop("disabled", true); }); } if (options.show) { + console.log("Make action show on each "+options.show) $.each(options.show, function(key, value) { $("#" + value).show().trigger("show"); }); } // Update an input if (ui.item.update) { + console.log("Make action update on each ui.item.update") // loop on each "update" fields $.each(ui.item.update, function(key, value) { $("#" + key).val(value).trigger("change"); }); } if (ui.item.textarea) { + console.log("Make action textarea on each ui.item.textarea") $.each(ui.item.textarea, function(key, value) { if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") { CKEDITOR.instances[key].setData(value); @@ -181,12 +187,12 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt }); } console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'"); - + $("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code. } ,delay: 500 }).data("ui-autocomplete")._renderItem = function( ul, item ) { - + return $("
  • ") .data( "ui-autocomplete-item", item ) // jQuery UI > 1.10.0 .append( \'\' + item.label + "" ) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 5e9786f2ba4..f14af2b838f 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -26,7 +26,7 @@ * $langs * $dateSelector * $forceall (0 by default, 1 for supplier invoices/orders) - * $senderissupplier (0 by default, 1 for supplier invoices/orders) + * $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) */ @@ -52,7 +52,7 @@ if (in_array($object->element,array('propal', 'supplier_proposal','facture','fac ?> -lines) == 0 || $forcetoshowtitlelines); if ($nolinesbefore) { ?> @@ -94,7 +94,7 @@ if ($nolinesbefore) { global->MARGIN_TYPE == "1") echo $langs->trans('BuyingPrice'); else @@ -108,7 +108,7 @@ if ($nolinesbefore) { ?>   - @@ -200,20 +200,22 @@ else { } else { + // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum if ($senderissupplier != 2) { $ajaxoptions=array( 'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key - 'option_disabled' => 'addPredefinedProductButton', // html id to disable once select is done - 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error' + 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done + 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo) ); $alsoproductwithnosupplierprice=0; } - else + else { $ajaxoptions = array(); $alsoproductwithnosupplierprice=1; } + $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice); } echo ''; @@ -263,13 +265,13 @@ else { "> - + multicurrency->enabled)) { $colspan++;?> "> - + "> @@ -306,7 +308,7 @@ else { rights->margins->creer) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) @@ -561,9 +563,9 @@ jQuery(document).ready(function() { $("#idprod, #idprodfournprice").change(function() { console.log("#idprod, #idprodfournprice change triggered"); - + setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva - + jQuery('#trlinefordates').show(); global->MARGIN_TYPE)) { if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice'; @@ -598,7 +600,7 @@ jQuery(document).ready(function() { if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice'; } ?>'; console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice); - + var i = 0; $(data).each(function() { if (this.id != 'pmpprice' && this.id != 'costprice') @@ -615,7 +617,7 @@ jQuery(document).ready(function() { //console.log("id="+this.id+"-price="+this.price); if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice) { - if (this.price > 0) { + if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price; //console.log("pmppricevalue="+pmppricevalue); } @@ -634,22 +636,22 @@ jQuery(document).ready(function() { options += ''; }); options += ''; - + console.log("finally selected defaultkey="+defaultkey+" defaultprice="+defaultprice); - + $("#fournprice_predef").html(options).show(); if (defaultkey != '') { $("#fournprice_predef").val(defaultkey); } - + /* At loading, no product are yet selected, so we hide field of buying_price */ $("#buying_price").hide(); - + /* Define default price at loading */ var defaultprice = $("#fournprice_predef").find('option:selected').attr("price"); $("#buying_price").val(defaultprice); - + $("#fournprice_predef").change(function() { console.log("change on fournprice_predef"); /* Hide field buying_price according to choice into list (if 'inputprice' or not) */ diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e9da56d2093..1d099ee9265 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1157,7 +1157,7 @@ class CommandeFournisseur extends CommonOrder // insert products details into database for ($i=0;$i<$num;$i++) { - $result = $this->addline( // This include test on qty if option SUPPLIERORDER_WITH_NOPRICEDEFINED is not set + $result = $this->addline( // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set $this->lines[$i]->desc, $this->lines[$i]->subprice, $this->lines[$i]->qty, @@ -1393,7 +1393,7 @@ class CommandeFournisseur extends CommonOrder if ($fk_product > 0) { - if (empty($conf->global->SUPPLIERORDER_WITH_NOPRICEDEFINED)) + if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) { // Check quantity is enough dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." fourn_ref=".$fourn_ref); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index bbc91bc3871..74d96158f65 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -346,21 +346,29 @@ if (empty($reshook)) { $productsupplier = new ProductFournisseur($db); - if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) + if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) // TODO this test seems useless { $idprod=0; if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) } - - if (GETPOST('idprodfournprice') > 0) + if (preg_match('/^idprod_([0-9]+)$/',GETPOST('idprodfournprice'), $reg)) + { + $idprod=$reg[1]; + $res=$productsupplier->fetch($idprod); + // Call to init properties of $productsupplier + // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price + $productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist + } + elseif (GETPOST('idprodfournprice') > 0) { - $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. + $qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat. + //$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist + $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch); + $res=$productsupplier->fetch($idprod); } if ($idprod > 0) { - $res=$productsupplier->fetch($idprod); - $label = $productsupplier->label; $desc = $productsupplier->description; @@ -381,8 +389,8 @@ if (empty($reshook)) $tva_tx, $localtax1_tx, $localtax2_tx, + $idprod, $productsupplier->id, - GETPOST('idprodfournprice'), $productsupplier->fourn_ref, $remise_percent, 'HT', @@ -2074,6 +2082,7 @@ elseif (! empty($object->id)) // Add free products/services form global $forceall, $senderissupplier, $dateSelector; $forceall=1; $senderissupplier=1; $dateSelector=0; + if (! empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) $senderissupplier=2; // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum. // Show object lines $inputalsopricewithtax=0; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index e90af97cfd9..8402b298f93 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -201,7 +201,7 @@ if (empty($reshook)) } $model=$object->modelpdf; $ret = $object->fetch($id); // Reload to get new records - + $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db,$result); } @@ -945,21 +945,30 @@ if (empty($reshook)) if (GETPOST('prod_entry_mode') != 'free' && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' { - $idprod=0; $productsupplier=new ProductFournisseur($db); - if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-2; // Same behaviour than with combolist. When not select idprodfournprice is now -2 (to avoid conflict with next action that may return -1) + $idprod=0; + if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) - if (GETPOST('idprodfournprice') > 0) + if (preg_match('/^idprod_([0-9]+)$/',GETPOST('idprodfournprice'), $reg)) + { + $idprod=$reg[1]; + $res=$productsupplier->fetch($idprod); + // Call to init properties of $productsupplier + // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price + $productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist + } + elseif (GETPOST('idprodfournprice') > 0) { - $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. + $qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat. + //$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist + $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch); + $res=$productsupplier->fetch($idprod); } //Replaces $fk_unit with the product's if ($idprod > 0) { - $result=$productsupplier->fetch($idprod); - $label = $productsupplier->label; $desc = $productsupplier->description; @@ -974,10 +983,29 @@ if (empty($reshook)) $type = $productsupplier->type; $price_base_type = 'HT'; - // TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first) - $result=$object->addline($desc, $productsupplier->fourn_pu, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $productsupplier->fk_unit); + // TODO Save the product supplier ref into database (like done for supplier propal and order) into field ref_supplier (must rename field ref into ref_supplier first) + $result=$object->addline( + $desc, + $productsupplier->fourn_pu, + $tva_tx, + $localtax1_tx, + $localtax2_tx, + $qty, + $idprod, + $remise_percent, + $date_start, + $date_end, + 0, + $tva_npr, + $price_base_type, + $type, + -1, + 0, + $array_options, + $productsupplier->fk_unit + ); } - if ($idprod == -2 || $idprod == 0) + if ($idprod == -99 || $idprod == 0) { // Product not selected $error++; @@ -1019,7 +1047,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); } @@ -1518,7 +1546,7 @@ if ($action == 'create') if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) { // Deposit - if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) + if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { print '
    '; $tmp=' '; @@ -1548,12 +1576,12 @@ if ($action == 'create') } } */ - + /* Not yet supporter for supplier if ($societe->id > 0) { // Replacement - if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) + if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) { print ''; print '
    '; @@ -1603,7 +1631,7 @@ if ($action == 'create') if ($societe->id > 0) { // Credit note - if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) + if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) { print '
    '; $tmp='textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); print $desc; - + print '
    '; print '    0 ? 'checked':'').' /> "; print '
        0 ? 'checked':'').' /> "; print '
    '; - + print '
    '; } } @@ -2029,7 +2057,7 @@ else $object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print '
    '; print '
    '; @@ -2229,9 +2257,9 @@ else // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - + print ''; - + print '
    '; print '
    '; print '
    '; @@ -2245,12 +2273,12 @@ else print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount VAT print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; - + // Multicurrency Amount TTC print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; @@ -2288,13 +2316,13 @@ else print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).''; print ''; - + /* * List of payments */ - + $totalpaye = 0; - + $sign = 1; if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $sign = - 1; @@ -2387,9 +2415,9 @@ else { print ''.$langs->trans('AlreadyPaid').' :'.price($totalpaye).''; print ''.$langs->trans("Billed").' :'.price($object->total_ttc).''; - + $resteapayer = $object->total_ttc - $totalpaye; - + print ''.$langs->trans('RemainderToPay').' :'; print ''.price($resteapayer).''; } @@ -2402,7 +2430,7 @@ else dol_print_error($db); } - if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE) + if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE) { // Total already paid print ''; @@ -2453,7 +2481,7 @@ else dol_print_error($db); } */ - + // Paye partiellement 'escompte' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'discount_vat') { print ''; @@ -2502,7 +2530,7 @@ else print ' :'; print '' . price($resteapayeraffiche) . ''; print ' '; - } + } else // Credit note { // Total already paid back @@ -2534,9 +2562,9 @@ else print '
    '; print '
    '; print '
    '; - + print '

    '; - + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $blocname = 'contacts'; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index fee2d3b4a1c..26729ecf866 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -579,7 +579,7 @@ if (empty($reshook)) { $productsupplier = new ProductFournisseur($db); - if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED)) + if (empty($conf->global->SUPPLIER_PROPOSAL_WITH_NOPRICEDEFINED)) // TODO this test seems useless { $idprod=0; if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) @@ -594,8 +594,9 @@ if (empty($reshook)) } elseif (GETPOST('idprodfournprice') > 0) { - //$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. - $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), -1); // We force qty to -1 to be sure to find if a supplier price exist + //$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat. + $qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist + $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch); $res=$productsupplier->fetch($idprod); } @@ -605,7 +606,7 @@ if (empty($reshook)) $price_base_type = $productsupplier->fourn_price_base_type; $type = $productsupplier->type; $label = $productsupplier->label; - $desc = $productsupplier->description; + $desc = $productsupplier->description; if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); From 4c243d3b9e16062866079144d9674ccc49310797 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Aug 2017 15:18:54 +0200 Subject: [PATCH 08/11] Fix index declaration must be moved into the .key.sql files. --- .../install/mysql/migration/6.0.0-7.0.0.sql | 6 ++++++ .../mysql/tables/llx_holiday_config.key.sql | 20 +++++++++++++++++++ .../mysql/tables/llx_holiday_config.sql | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 htdocs/install/mysql/tables/llx_holiday_config.key.sql diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index b027f560aa0..5759423abbb 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -190,3 +190,9 @@ ALTER TABLE llx_extrafields ADD COLUMN fk_user_author integer; ALTER TABLE llx_extrafields ADD COLUMN fk_user_modif integer; ALTER TABLE llx_extrafields ADD COLUMN datec datetime; ALTER TABLE llx_extrafields ADD COLUMN tms timestamp; + +ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128); +ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name); + + + diff --git a/htdocs/install/mysql/tables/llx_holiday_config.key.sql b/htdocs/install/mysql/tables/llx_holiday_config.key.sql new file mode 100644 index 00000000000..cda95c87f39 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_holiday_config.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2012 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_holiday_config ADD UNIQUE INDEX idx_holiday_config (name); + diff --git a/htdocs/install/mysql/tables/llx_holiday_config.sql b/htdocs/install/mysql/tables/llx_holiday_config.sql index 2f08bf5aa41..4ef6f15c7df 100644 --- a/htdocs/install/mysql/tables/llx_holiday_config.sql +++ b/htdocs/install/mysql/tables/llx_holiday_config.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_holiday_config ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, -name VARCHAR( 255 ) NOT NULL UNIQUE, +name VARCHAR(128) NOT NULL, value TEXT NULL ) ENGINE=innodb; \ No newline at end of file From 52a8692a8508fcef88fe4b36067af3bfdc84030a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Aug 2017 16:07:11 +0200 Subject: [PATCH 09/11] FIX #7226 --- .../class/fournisseur.commande.class.php | 22 ++- htdocs/fourn/commande/dispatch.php | 144 +++++++++++++----- 2 files changed, 123 insertions(+), 43 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 1d099ee9265..d7d1e542b3a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2832,8 +2832,9 @@ class CommandeFournisseur extends CommonOrder $supplierorderdispatch = new CommandeFournisseurDispatch($this->db); $filter=array('t.fk_commande'=>$this->id); if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) { - $filter['t.status']=1; + $filter['t.status']=1; // Restrict to lines with status validated } + $ret=$supplierorderdispatch->fetchAll('','',0,0,$filter); if ($ret<0) { @@ -2844,20 +2845,27 @@ class CommandeFournisseur extends CommonOrder { if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines)>0) { - //Build array with quantity deliverd by product + $date_liv = dol_now(); + + // Build array with quantity deliverd by product foreach($supplierorderdispatch->lines as $line) { $qtydelivered[$line->fk_product]+=$line->qty; } foreach($this->lines as $line) { $qtywished[$line->fk_product]+=$line->qty; } - - $date_liv = dol_now(); - //Compare array - $diff_array=array_diff_assoc($qtydelivered,$qtywished); + $diff_array=array_diff_assoc($qtydelivered,$qtywished); // Warning: $diff_array is done only on common keys. + $keysinwishednotindelivered=array_diff(array_keys($qtywished),array_keys($qtydelivered)); // To check we also have same number of keys + $keysindeliverednotinwished=array_diff(array_keys($qtydelivered),array_keys($qtywished)); // To check we also have same number of keys + /*var_dump(array_keys($qtydelivered)); + var_dump(array_keys($qtywished)); + var_dump($diff_array); + var_dump($keysinwishednotindelivered); + var_dump($keysindeliverednotinwished); + exit;*/ - if (count($diff_array)==0) //No diff => mean everythings is received + if (count($diff_array)==0 && count($keysinwishednotindelivered)==0 && count($keysindeliverednotinwished)==0) //No diff => mean everythings is received { if ($closeopenorder) { diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index c87b3a62bed..c6a6034c684 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -28,6 +28,7 @@ * \ingroup commande * \brief Page to dispatch receiving */ + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_order/modules_commandefournisseur.php'; require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; @@ -84,17 +85,33 @@ if ($id > 0 || ! empty($ref)) { * Actions */ -if ($action == 'checkdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) { +if ($action == 'checkdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) +{ + $error=0; $supplierorderdispatch = new CommandeFournisseurDispatch($db); + + $db->begin(); + $result = $supplierorderdispatch->fetch($lineid); if (! $result) - dol_print_error($db); - $result = $supplierorderdispatch->setStatut(1); - if ($result < 0) { + { + $error++; setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); - $error ++; $action = ''; - } else { + } + + if (! $error) + { + $result = $supplierorderdispatch->setStatut(1); + if ($result < 0) { + setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); + $error++; + $action = ''; + } + } + + if (! $error) + { $result = $object->calcAndSetStatusDispatch($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -102,19 +119,42 @@ if ($action == 'checkdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED $action = ''; } } + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } } -if ($action == 'uncheckdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) { +if ($action == 'uncheckdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) +{ + $error=0; $supplierorderdispatch = new CommandeFournisseurDispatch($db); + + $db->begin(); + $result = $supplierorderdispatch->fetch($lineid); if (! $result) - dol_print_error($db); - $result = $supplierorderdispatch->setStatut(0); - if ($result < 0) { + { + $error++; setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); - $error ++; $action = ''; - } else { + } + + if (! $error) + { + $result = $supplierorderdispatch->setStatut(0); + if ($result < 0) { + setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); + $error ++; + $action = ''; + } + } + if (! $error) + { $result = $object->calcAndSetStatusDispatch($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -122,19 +162,42 @@ if ($action == 'uncheckdispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANC $action = ''; } } + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } } -if ($action == 'denydispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) { +if ($action == 'denydispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))) +{ + $error=0; $supplierorderdispatch = new CommandeFournisseurDispatch($db); + + $db->begin(); + $result = $supplierorderdispatch->fetch($lineid); if (! $result) - dol_print_error($db); - $result = $supplierorderdispatch->setStatut(2); - if ($result < 0) { + { + $error++; setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); - $error ++; $action = ''; - } else { + } + + if (! $error) + { + $result = $supplierorderdispatch->setStatut(2); + if ($result < 0) { + setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); + $error ++; + $action = ''; + } + } + if (! $error) + { $result = $object->calcAndSetStatusDispatch($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -142,6 +205,14 @@ if ($action == 'denydispatchline' && ! ((empty($conf->global->MAIN_USE_ADVANCED_ $action = ''; } } + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } } if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) { @@ -150,10 +221,10 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) $db->begin(); $pos = 0; - foreach ($_POST as $key => $value) + foreach ($_POST as $key => $value) { // without batch module enabled - if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) + if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $pos ++; @@ -184,7 +255,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) } } // with batch module enabled - if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) + if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $pos ++; @@ -286,11 +357,11 @@ if ($id > 0 || ! empty($ref)) { $title = $langs->trans("SupplierOrder"); dol_fiche_head($head, 'dispatch', $title, 0, 'order'); - + // Supplier order card $linkback = ''.$langs->trans("BackToList").''; - + $morehtmlref='
    '; // Ref supplier $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); @@ -331,14 +402,14 @@ if ($id > 0 || ! empty($ref)) { } } $morehtmlref.='
    '; - - - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + print '
    '; print '
    '; - + print ''; // Date @@ -362,7 +433,7 @@ if ($id > 0 || ! empty($ref)) { print "
    "; print '
    '; - + // if ($mesg) print $mesg; print '
    '; @@ -382,7 +453,7 @@ if ($id > 0 || ! empty($ref)) { print '
    '; print ''; print ''; - + print '
    '; print ''; @@ -585,10 +656,10 @@ if ($id > 0 || ! empty($ref)) { print ''; print "
    \n"; - if ($nbproduct) + if ($nbproduct) { $checkboxlabel=$langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv($object->statuts[5])); - + print '
    '; print $langs->trans("Comment") . ' : '; print '
    '; print ' '.$checkboxlabel; - + print '
    0 || ! empty($ref)) { if (! $nbproduct) { if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) print '
    '.$langs->trans("NoPredefinedProductToDispatch").'
    '; // No predefined line at all - else + else print '
    '.$langs->trans("NoMorePredefinedProductToDispatch").'
    '; // No predefined line that remain to be dispatched. } @@ -618,7 +689,7 @@ if ($id > 0 || ! empty($ref)) { dol_fiche_end(); - + // List of lines already dispatched $sql = "SELECT p.ref, p.label,"; $sql .= " e.rowid as warehouse_id, e.label as entrepot,"; @@ -699,7 +770,8 @@ if ($id > 0 || ! empty($ref)) { // Add button to check/uncheck disaptching print '
    '; - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))) { + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))) + { if (empty($objp->status)) { print '' . $langs->trans("Approve") . ''; print '' . $langs->trans("Deny") . ''; From d90a23efb69efc9f6aeec5c93a10ae2f042de8f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Aug 2017 17:00:50 +0200 Subject: [PATCH 10/11] Fix for old php --- htdocs/admin/dolistore/class/dolistore.class.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index acf86766e25..482bd124a40 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -56,13 +56,11 @@ class Dolistore extends DolistoreModel $this->end = $this->per_page; } - $lang = explode('_', $langs->defaultlang); - $lang = $lang[0]; - $lang_array = ['fr', 'en', 'es', 'it', 'de']; - if (!in_array($lang, $lang_array)) { - $lang = 'en'; - } - $this->lang = array_search($lang, $lang_array) + 1; // 1=fr 2=en ... + $langtmp = explode('_', $langs->defaultlang); + $lang = $langtmp[0]; + $lang_array = array('fr'=>1, 'en'=>2, 'es'=>3, 'it'=>4, 'de'=>5); + if (! in_array($lang, array_keys($lang_array))) $lang = 'en'; + $this->lang = $lang_array[$lang]; // 1=fr 2=en ... try { $this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, From 9f5718f00a5842008b923298d82cdef24ac54f6b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 Aug 2017 19:38:06 +0200 Subject: [PATCH 11/11] Fix php unit --- htdocs/admin/dolistore/class/dolistore.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 482bd124a40..5e0aa546cc0 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -306,11 +306,11 @@ class DolistoreModel function get_previous_link($text = '<<') { - return "$text"; + return ''.$text.''; } function get_next_link($text = '>>') { - return "$text"; + return ''.$text.''; } }