From 640730539ed832dc948feb69188d6bff0f7677bb Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Sat, 2 May 2020 08:50:22 +0200 Subject: [PATCH 001/319] NEW: Add option to include products without alert in replenish --- htdocs/langs/en_US/stocks.lang | 1 + htdocs/product/stock/replenish.php | 158 ++++++++++++++++++----------- 2 files changed, 100 insertions(+), 59 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 9856649b834..e5fd3db9260 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -119,6 +119,7 @@ CurentlyUsingPhysicalStock=Physical stock RuleForStockReplenishment=Rule for stocks replenishment SelectProductWithNotNullQty=Select at least one product with a qty not null and a vendor AlertOnly= Alerts only +IncludeProductWithUndefinedAlerts = Include products with no defined alerts WarehouseForStockDecrease=The warehouse %s will be used for stock decrease WarehouseForStockIncrease=The warehouse %s will be used for stock increase ForThisWarehouse=For this warehouse diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 97d3871c027..d00fdaabb5e 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -55,6 +55,7 @@ $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', $type = GETPOST('type', 'int'); $tobuy = GETPOST('tobuy', 'int'); $salert = GETPOST('salert', 'alpha'); +$allalert = GETPOST('allalert', 'alpha'); $mode = GETPOST('mode', 'alpha'); $draftorder = GETPOST('draftorder', 'alpha'); @@ -108,6 +109,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $snom = ''; $sal = ''; $salert = ''; + $allalert = ''; $draftorder = ''; } if ($draftorder == 'on') $draftchecked = "checked"; @@ -430,34 +432,65 @@ if ($usevirtualstock) $sql .= ' ('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; $sql .= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.') + ('.$sqlProductionToProduce.' - '.$sqlProductionToConsume.')))'; $sql .= ' OR '; - $sql .= ' ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + if ($allalert == 'on') { + $sql .= ' (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + } else { + $sql .= ' ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + } $sql .= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.') + ('.$sqlProductionToProduce.' - '.$sqlProductionToConsume.')))'; $sql .= ')'; if ($salert == 'on') // Option to see when stock is lower than alert { - $sql .= ' AND ('; - $sql .= $sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + $sql .= ' AND (('; + if ($allalert == 'on') { + $sql .= $sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + } else { + $sql .= $sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + } $sql .= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.') + ('.$sqlProductionToProduce.' - '.$sqlProductionToConsume.'))'; $sql .= ')'; $alertchecked = 'checked'; } } else { $sql .= ' HAVING (('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; - $sql .= ' OR ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; + if ($allalert == 'on') { + $sql .= ' OR (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; + } else { + $sql .= ' OR ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; + } if ($salert == 'on') // Option to see when stock is lower than alert { - $sql .= ' AND ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + if ($allalert == 'on') { + $sql .= ' AND (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + } else { + $sql .= ' AND ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + } $alertchecked = 'checked'; } } +$allalertchecked = ''; +if ($allalert == 'on') { + $allalertchecked = 'checked'; +} + // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + if (($page * $limit) > $nbtotalofrecords) { + $page = 0; + $offset = 0; + } +} + $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($limit + 1, $offset); @@ -510,6 +543,7 @@ print ''; print ''; print ''; print ''; +print ''; print ''; print ''; if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) @@ -532,72 +566,78 @@ print ''; print ''; -if ($sref || $snom || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) { - $filters = '&sref='.$sref.'&snom='.$snom; - $filters .= '&sall='.$sall; - $filters .= '&salert='.$salert; - $filters .= '&draftorder='.$draftorder; - $filters .= '&mode='.$mode; - $filters .= '&fk_supplier='.$fk_supplier; - $filters .= '&fk_entrepot='.$fk_entrepot; - print_barre_liste( - $texte, - $page, - 'replenish.php', - $filters, - $sortfield, - $sortorder, - '', - $num - ); -} else { - $filters = '&sref='.$sref.'&snom='.$snom; - $filters .= '&fourn_id='.$fourn_id; - $filters .= (isset($type) ? '&type='.$type : ''); - $filters .= '&='.$salert; - $filters .= '&draftorder='.$draftorder; - $filters .= '&mode='.$mode; - $filters .= '&fk_supplier='.$fk_supplier; - $filters .= '&fk_entrepot='.$fk_entrepot; - print_barre_liste( - $texte, - $page, - 'replenish.php', - $filters, - $sortfield, - $sortorder, - '', - $num - ); -} +print '
'. + ''. + ''. + ''. + ''. + ''. + ''. + ''. + ''. + ''; -print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table -print ''; +$filters = '&sref='.$sref.'&snom='.$snom; +$filters .= '&fourn_id='.$fourn_id; +$filters .= (isset($type) ? '&type='.$type : ''); +$filters .= '&sall='.$sall; +$filters .= '&salert='.$salert; +$filters .= '&allalert='.$allalert; +$filters .= '&draftorder='.$draftorder; +$filters .= '&mode='.$mode; +$filters .= '&fk_supplier='.$fk_supplier; +$filters .= '&fk_entrepot='.$fk_entrepot; $param = (isset($type) ? '&type='.$type : ''); -$param .= '&fourn_id='.$fourn_id.'&snom='.$snom.'&salert='.$salert.'&draftorder='.$draftorder; +$param .= '&fourn_id='.$fourn_id.'&snom='.$snom.'&allalert='.$allalert.'&salert='.$salert.'&draftorder='.$draftorder; $param .= '&sref='.$sref; $param .= '&mode='.$mode; $param .= '&fk_supplier='.$fk_supplier; $param .= '&fk_entrepot='.$fk_entrepot; - $stocklabel = $langs->trans('Stock'); if ($usevirtualstock == 1) $stocklabel = $langs->trans('VirtualStock'); if ($usevirtualstock == 0) $stocklabel = $langs->trans('PhysicalStock'); if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) { - $stocklabel .= ' ('.$langs->trans("AllWarehouses").')'; + $stocklabel .= ' ('.$langs->trans("AllWarehouses").')'; } -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +$texte = $langs->trans('Replenishment'); + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + +if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) { + print_barre_liste( + $texte, + $page, + 'replenish.php', + $filters, + $sortfield, + $sortorder, + '', + $num, + $nbtotalofrecords, + 'object_stock.png', + 0, + '', + '', + $limit + ); +} else { + print_barre_liste( + $texte, + $page, + 'replenish.php', + $filters, + $sortfield, + $sortorder, + '', + $num, + $nbtotalofrecords, + 'object_stock.png' + ); +} + +print '
'; // Fields title search print ''; @@ -606,7 +646,7 @@ print ''; if (!empty($conf->service->enabled) && $type == 1) print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; From a03739962b78de98ba3da8f5b33bc92f523858db Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Sat, 2 May 2020 09:21:51 +0200 Subject: [PATCH 002/319] Propagate the value of limit --- htdocs/product/stock/replenish.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index d00fdaabb5e..f6af90d09a1 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -546,6 +546,9 @@ print ''; print ''; print ''; print ''; +if ($limit > 0 && $limit != $conf->liste_limit) { + print ''; +} if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { print '
'; @@ -587,6 +590,9 @@ $filters .= '&draftorder='.$draftorder; $filters .= '&mode='.$mode; $filters .= '&fk_supplier='.$fk_supplier; $filters .= '&fk_entrepot='.$fk_entrepot; +if ($limit > 0 && $limit != $conf->liste_limit) { + $filters .= '&limit=' . urlencode($limit); +} $param = (isset($type) ? '&type='.$type : ''); $param .= '&fourn_id='.$fourn_id.'&snom='.$snom.'&allalert='.$allalert.'&salert='.$salert.'&draftorder='.$draftorder; @@ -594,6 +600,7 @@ $param .= '&sref='.$sref; $param .= '&mode='.$mode; $param .= '&fk_supplier='.$fk_supplier; $param .= '&fk_entrepot='.$fk_entrepot; + $stocklabel = $langs->trans('Stock'); if ($usevirtualstock == 1) $stocklabel = $langs->trans('VirtualStock'); if ($usevirtualstock == 0) $stocklabel = $langs->trans('PhysicalStock'); From 1e3f31041d7a2b2f96a3df0e6f3c131e9b3fb909 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 2 May 2020 07:23:06 +0000 Subject: [PATCH 003/319] Fixing style errors. --- htdocs/product/stock/replenish.php | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index f6af90d09a1..2423a95e49e 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -432,41 +432,41 @@ if ($usevirtualstock) $sql .= ' ('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; $sql .= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.') + ('.$sqlProductionToProduce.' - '.$sqlProductionToConsume.')))'; $sql .= ' OR '; - if ($allalert == 'on') { - $sql .= ' (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; - } else { - $sql .= ' ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; - } + if ($allalert == 'on') { + $sql .= ' (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + } else { + $sql .= ' ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + } $sql .= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.') + ('.$sqlProductionToProduce.' - '.$sqlProductionToConsume.')))'; $sql .= ')'; if ($salert == 'on') // Option to see when stock is lower than alert { $sql .= ' AND (('; - if ($allalert == 'on') { - $sql .= $sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; - } else { - $sql .= $sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; - } + if ($allalert == 'on') { + $sql .= $sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + } else { + $sql .= $sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')'; + } $sql .= ' - ('.$sqlCommandesCli.' - '.$sqlExpeditionsCli.') + ('.$sqlCommandesFourn.' - '.$sqlReceptionFourn.') + ('.$sqlProductionToProduce.' - '.$sqlProductionToConsume.'))'; $sql .= ')'; $alertchecked = 'checked'; } } else { $sql .= ' HAVING (('.$sqldesiredtock.' >= 0 AND ('.$sqldesiredtock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; - if ($allalert == 'on') { - $sql .= ' OR (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; - } else { - $sql .= ' OR ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; - } + if ($allalert == 'on') { + $sql .= ' OR (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; + } else { + $sql .= ' OR ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").'))))'; + } if ($salert == 'on') // Option to see when stock is lower than alert { - if ($allalert == 'on') { - $sql .= ' AND (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; - } else { - $sql .= ' AND ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; - } + if ($allalert == 'on') { + $sql .= ' AND (('.$sqlalertstock.' >= 0 OR '.$sqlalertstock.' IS NULL) AND ('.$db->ifsql("$sqlalertstock IS NULL", "0", $sqlalertstock).' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + } else { + $sql .= ' AND ('.$sqlalertstock.' >= 0 AND ('.$sqlalertstock.' > SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").')))'; + } $alertchecked = 'checked'; } } From b65a4649e7032a69e4bd0b0c2e31070cd196cfdb Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Sat, 2 May 2020 09:26:58 +0200 Subject: [PATCH 004/319] Correct lint errors --- htdocs/product/stock/replenish.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index f6af90d09a1..a00c3a49481 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -569,16 +569,16 @@ print '
'; print ''; -print '
'. - ''. - ''. - ''. - ''. - ''. - ''. - ''. - ''. - ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; $filters = '&sref='.$sref.'&snom='.$snom; $filters .= '&fourn_id='.$fourn_id; From 69db790cf5fdd5fa96f9f524eb88a50d9af900fc Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 8 Jun 2020 14:43:14 +0200 Subject: [PATCH 005/319] NEW multiselect type and date to date filter --- htdocs/core/class/html.form.class.php | 19 +++ htdocs/core/lib/company.lib.php | 161 ++++++++++++++++++-------- 2 files changed, 132 insertions(+), 48 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 289b92f84ae..f3560be0545 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5241,6 +5241,25 @@ class Form print $retstring; return; } + /** + * Show 2 HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. + * Fields are preselected with : + * - set_time date (must be a local PHP server timestamp or string date with format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM') + * - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location) + * - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1) + * + * @param integer $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2). + * @param integer $set_time_end Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2). + * @param string $prefix Prefix for fields name + * @return string Html for selectDate + * @see form_date(), select_month(), select_year(), select_dayofweek() + */ + public function selectDateToDate($set_time = '', $set_time_end = '', $prefix = 're', $empty = 0) { + $ret = $this->selectDate($set_time, $prefix.'_start',0 ,0, $empty); + $ret .='
'; + $ret .=$this->selectDate($set_time_end, $prefix.'_end', 0 ,0, $empty); + return $ret; + } /** * Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 3f6e8563a50..6e1f87bc962 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1273,7 +1273,27 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin global $form; global $param, $massactionbutton; - + $start_year = GETPOST('dateevent_startyear'); + $start_month = GETPOST('dateevent_startmonth'); + $start_day = GETPOST('dateevent_startday'); + $end_year = GETPOST('dateevent_endyear'); + $end_month = GETPOST('dateevent_endmonth'); + $end_day = GETPOST('dateevent_endday'); + if(!empty($start_year) && !empty($start_month) && !empty($start_day)) { + $search_start = $start_year.'-'.$start_month.'-'.$start_day; + $tms_start = strtotime($search_start); + } + if(!empty($end_year) && !empty($end_month) && !empty($end_day)) { + $search_end = $end_year.'-'.$end_month.'-'.$end_day.' 23:59:59'; + $tms_end = strtotime($search_end); + } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers + { + $search_start = ''; + $tms_start = ''; + $search_end = ''; + $tms_end = ''; + } dol_include_once('/comm/action/class/actioncomm.class.php'); // Check parameters @@ -1379,54 +1399,47 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin } } - // Condition on actioncode - if (!empty($actioncode)) - { - if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) - { - if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'"; - elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND c.type = 'systemauto'"; - else { - if ($actioncode == 'AC_OTH') $sql .= " AND c.type != 'systemauto'"; - elseif ($actioncode == 'AC_OTH_AUTO') $sql .= " AND c.type = 'systemauto'"; + if(! empty($search_start) && ! empty($search_end)) { + $sql .= " AND ((a.datep BETWEEN '$search_start' AND '$search_end') OR (a.datep2 BETWEEN '$search_start' AND '$search_end'))"; + } + else if(empty($search_start) && ! empty($search_end)) { + $sql .= " AND ((a.datep <= '$search_end') OR (a.datep2 <= '$search_end'))"; + } + else if(! empty($search_start) && empty($search_end)) { + $sql .= " AND ((a.datep >= '$search_start') OR (a.datep2 >= '$search_start'))"; + } + + if(is_array($actioncode) && ! empty($actioncode)) { + $sql .= ' AND ('; + foreach($actioncode as $key => $code) { + if($key != 0) $sql .= "OR ("; + if(! empty($code)) addEventTypeSQL($sql, $code, $donetodo, $now, $filters, ""); + if($key != 0) $sql .= ")"; + } + $sql .= ')'; + } + else if(! empty($actioncode)) addEventTypeSQL($sql, $actioncode, $donetodo, $now, $filters); + + if(is_array($actioncode)) { + + foreach($actioncode as $code) { + $sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj); + if(! empty($sql2)) { + if(! empty($sql)) $sql = $sql." UNION ".$sql2; + else if(empty($sql)) $sql = $sql2; + break; } - } else { - if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'"; - elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND c.type = 'systemauto'"; - else $sql .= " AND c.code = '".$db->escape($actioncode)."'"; } } - if ($donetodo == 'todo') $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; - elseif ($donetodo == 'done') $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; - if (is_array($filters) && $filters['search_agenda_label']) $sql .= natural_search('a.label', $filters['search_agenda_label']); - } - - // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. - if (!empty($conf->mailing->enabled) && !empty($objcon->email) - && (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) - { - $langs->load("mails"); - - $sql2 = "SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type"; - $sql2 .= ", '' as fk_element, '' as elementtype, '' as contact_id"; - $sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto"; - $sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action - if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql2 .= ", '' as lastname, '' as firstname"; - elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql2 .= ", '' as lastname, '' as firstname"; - elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql2 .= ", '' as ref"; - elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql2 .= ", '' as ref"; - elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql2 .= ", '' as ref"; - $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u"; - $sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email. - $sql2 .= " AND mc.statut = 1"; - $sql2 .= " AND u.rowid = m.fk_user_valid"; - $sql2 .= " AND mc.fk_mailing=m.rowid"; - } - - if (!empty($sql) && !empty($sql2)) { - $sql = $sql." UNION ".$sql2; - } elseif (empty($sql) && !empty($sql2)) { - $sql = $sql2; + else { + $sql2 = addMailingEventTypeSQL($actioncode, $objcon, $filterobj); + if(! empty($sql) && ! empty($sql2)) { + $sql = $sql." UNION ".$sql2; + } + else if(empty($sql) && ! empty($sql2)) { + $sql = $sql2; + } + } } //TODO Add limit in nb of results @@ -1550,10 +1563,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $out .= '
'; $out .= ''; $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= ''; @@ -1830,3 +1843,55 @@ function show_subsidiaries($conf, $langs, $db, $object) return $i; } + +function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDOR = "AND") { + global $conf, $db; + // Condition on actioncode + + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) + { + if ($actioncode == 'AC_NON_AUTO') $sql .= " $sqlANDOR c.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; + else + { + if ($actioncode == 'AC_OTH') $sql .= " $sqlANDOR c.type != 'systemauto'"; + elseif ($actioncode == 'AC_OTH_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; + } + } + else + { + if ($actioncode == 'AC_NON_AUTO') $sql .= " $sqlANDOR c.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; + else $sql .= " $sqlANDOR c.code = '".$db->escape($actioncode)."'"; + } + + if ($donetodo == 'todo') $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; + elseif ($donetodo == 'done') $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; + if (is_array($filters) && $filters['search_agenda_label']) $sql .= natural_search('a.label', $filters['search_agenda_label']); +} + +function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) { + global $conf, $langs, $db; + // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. + if (!empty($conf->mailing->enabled) && !empty($objcon->email) + && (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) { + $langs->load("mails"); + + $sql2 = "SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type"; + $sql2 .= ", '' as fk_element, '' as elementtype, '' as contact_id"; + $sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto"; + $sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action + if(is_object($filterobj) && get_class($filterobj) == 'Societe') $sql2 .= ", '' as lastname, '' as firstname"; + else if(is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql2 .= ", '' as lastname, '' as firstname"; + else if(is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql2 .= ", '' as ref"; + else if(is_object($filterobj) && get_class($filterobj) == 'Product') $sql2 .= ", '' as ref"; + else if(is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql2 .= ", '' as ref"; + $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u"; + $sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email. + $sql2 .= " AND mc.statut = 1"; + $sql2 .= " AND u.rowid = m.fk_user_valid"; + $sql2 .= " AND mc.fk_mailing=m.rowid"; + return $sql2; + } + +} From 3dd7c81f54b8b17d4f9c606b161dc81162871c9b Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 8 Jun 2020 15:58:20 +0200 Subject: [PATCH 006/319] FIX stickler --- htdocs/core/class/html.form.class.php | 10 ++++--- htdocs/core/lib/company.lib.php | 43 +++++++++++++++++++-------- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f3560be0545..76a203ad8df 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5251,13 +5251,15 @@ class Form * @param integer $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2). * @param integer $set_time_end Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2). * @param string $prefix Prefix for fields name + * @param string $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only * @return string Html for selectDate * @see form_date(), select_month(), select_year(), select_dayofweek() */ - public function selectDateToDate($set_time = '', $set_time_end = '', $prefix = 're', $empty = 0) { - $ret = $this->selectDate($set_time, $prefix.'_start',0 ,0, $empty); - $ret .='
'; - $ret .=$this->selectDate($set_time_end, $prefix.'_end', 0 ,0, $empty); + public function selectDateToDate($set_time = '', $set_time_end = '', $prefix = 're', $empty = 0) + { + $ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty); + $ret .= '
'; + $ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty); return $ret; } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 6e1f87bc962..5f7d9f8fccf 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1279,11 +1279,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $end_year = GETPOST('dateevent_endyear'); $end_month = GETPOST('dateevent_endmonth'); $end_day = GETPOST('dateevent_endday'); - if(!empty($start_year) && !empty($start_month) && !empty($start_day)) { + if (!empty($start_year) && !empty($start_month) && !empty($start_day)) { $search_start = $start_year.'-'.$start_month.'-'.$start_day; $tms_start = strtotime($search_start); } - if(!empty($end_year) && !empty($end_month) && !empty($end_day)) { + if (!empty($end_year) && !empty($end_month) && !empty($end_day)) { $search_end = $end_year.'-'.$end_month.'-'.$end_day.' 23:59:59'; $tms_end = strtotime($search_end); } @@ -1399,13 +1399,13 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin } } - if(! empty($search_start) && ! empty($search_end)) { + if(! empty($search_start) && ! empty($search_end)) { $sql .= " AND ((a.datep BETWEEN '$search_start' AND '$search_end') OR (a.datep2 BETWEEN '$search_start' AND '$search_end'))"; } - else if(empty($search_start) && ! empty($search_end)) { + elseif (empty($search_start) && ! empty($search_end)) { $sql .= " AND ((a.datep <= '$search_end') OR (a.datep2 <= '$search_end'))"; } - else if(! empty($search_start) && empty($search_end)) { + elseif (! empty($search_start) && empty($search_end)) { $sql .= " AND ((a.datep >= '$search_start') OR (a.datep2 >= '$search_start'))"; } @@ -1418,25 +1418,25 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin } $sql .= ')'; } - else if(! empty($actioncode)) addEventTypeSQL($sql, $actioncode, $donetodo, $now, $filters); + elseif (! empty($actioncode)) addEventTypeSQL($sql, $actioncode, $donetodo, $now, $filters); if(is_array($actioncode)) { foreach($actioncode as $code) { $sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj); - if(! empty($sql2)) { - if(! empty($sql)) $sql = $sql." UNION ".$sql2; - else if(empty($sql)) $sql = $sql2; + if (! empty($sql2)) { + if (! empty($sql)) $sql = $sql." UNION ".$sql2; + elseif (empty($sql)) $sql = $sql2; break; } } } else { $sql2 = addMailingEventTypeSQL($actioncode, $objcon, $filterobj); - if(! empty($sql) && ! empty($sql2)) { + if (! empty($sql) && ! empty($sql2)) { $sql = $sql." UNION ".$sql2; } - else if(empty($sql) && ! empty($sql2)) { + elseif (empty($sql) && ! empty($sql2)) { $sql = $sql2; } } @@ -1843,7 +1843,18 @@ function show_subsidiaries($conf, $langs, $db, $object) return $i; } - +/** + * Add Event Type SQL + * + * @param string $sql $sql modified + * @param string $actioncode Action code + * @param string $donetodo donetodo + * @param string $now now + * @param string $filters array + * @param string $donetodo donetodo + * @param string $sqlANDOR "AND", "OR" or "" + * @return void + */ function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDOR = "AND") { global $conf, $db; // Condition on actioncode @@ -1870,6 +1881,14 @@ function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDO if (is_array($filters) && $filters['search_agenda_label']) $sql .= natural_search('a.label', $filters['search_agenda_label']); } +/** + * Add Mailing Event Type SQL + * + * @param string $actioncode Action code + * @param string $objcon objcon + * @param Object $filterobj + * @return string + */ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) { global $conf, $langs, $db; // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. From b4dd11ec98af2a07b62802128133f2228e0affc3 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 8 Jun 2020 14:00:57 +0000 Subject: [PATCH 007/319] Fixing style errors. --- htdocs/core/lib/company.lib.php | 62 ++++++++++++++++----------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 5f7d9f8fccf..b98a61b451d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1399,7 +1399,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin } } - if(! empty($search_start) && ! empty($search_end)) { + if (! empty($search_start) && ! empty($search_end)) { $sql .= " AND ((a.datep BETWEEN '$search_start' AND '$search_end') OR (a.datep2 BETWEEN '$search_start' AND '$search_end'))"; } elseif (empty($search_start) && ! empty($search_end)) { @@ -1409,20 +1409,19 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $sql .= " AND ((a.datep >= '$search_start') OR (a.datep2 >= '$search_start'))"; } - if(is_array($actioncode) && ! empty($actioncode)) { + if (is_array($actioncode) && ! empty($actioncode)) { $sql .= ' AND ('; - foreach($actioncode as $key => $code) { - if($key != 0) $sql .= "OR ("; - if(! empty($code)) addEventTypeSQL($sql, $code, $donetodo, $now, $filters, ""); - if($key != 0) $sql .= ")"; + foreach ($actioncode as $key => $code) { + if ($key != 0) $sql .= "OR ("; + if (! empty($code)) addEventTypeSQL($sql, $code, $donetodo, $now, $filters, ""); + if ($key != 0) $sql .= ")"; } $sql .= ')'; } elseif (! empty($actioncode)) addEventTypeSQL($sql, $actioncode, $donetodo, $now, $filters); - if(is_array($actioncode)) { - - foreach($actioncode as $code) { + if (is_array($actioncode)) { + foreach ($actioncode as $code) { $sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj); if (! empty($sql2)) { if (! empty($sql)) $sql = $sql." UNION ".$sql2; @@ -1855,26 +1854,25 @@ function show_subsidiaries($conf, $langs, $db, $object) * @param string $sqlANDOR "AND", "OR" or "" * @return void */ -function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDOR = "AND") { +function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDOR = "AND") +{ global $conf, $db; // Condition on actioncode - if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) + if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - if ($actioncode == 'AC_NON_AUTO') $sql .= " $sqlANDOR c.type != 'systemauto'"; - elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; - else - { - if ($actioncode == 'AC_OTH') $sql .= " $sqlANDOR c.type != 'systemauto'"; - elseif ($actioncode == 'AC_OTH_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; - } - } - else - { - if ($actioncode == 'AC_NON_AUTO') $sql .= " $sqlANDOR c.type != 'systemauto'"; - elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; - else $sql .= " $sqlANDOR c.code = '".$db->escape($actioncode)."'"; - } + if ($actioncode == 'AC_NON_AUTO') $sql .= " $sqlANDOR c.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; + else { + if ($actioncode == 'AC_OTH') $sql .= " $sqlANDOR c.type != 'systemauto'"; + elseif ($actioncode == 'AC_OTH_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; + } + } + else { + if ($actioncode == 'AC_NON_AUTO') $sql .= " $sqlANDOR c.type != 'systemauto'"; + elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " $sqlANDOR c.type = 'systemauto'"; + else $sql .= " $sqlANDOR c.code = '".$db->escape($actioncode)."'"; + } if ($donetodo == 'todo') $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; elseif ($donetodo == 'done') $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; @@ -1889,7 +1887,8 @@ function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDO * @param Object $filterobj * @return string */ -function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) { +function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) +{ global $conf, $langs, $db; // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. if (!empty($conf->mailing->enabled) && !empty($objcon->email) @@ -1900,11 +1899,11 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) { $sql2 .= ", '' as fk_element, '' as elementtype, '' as contact_id"; $sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto"; $sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action - if(is_object($filterobj) && get_class($filterobj) == 'Societe') $sql2 .= ", '' as lastname, '' as firstname"; - else if(is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql2 .= ", '' as lastname, '' as firstname"; - else if(is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql2 .= ", '' as ref"; - else if(is_object($filterobj) && get_class($filterobj) == 'Product') $sql2 .= ", '' as ref"; - else if(is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql2 .= ", '' as ref"; + if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql2 .= ", '' as lastname, '' as firstname"; + elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql2 .= ", '' as lastname, '' as firstname"; + elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql2 .= ", '' as ref"; + elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql2 .= ", '' as ref"; + elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql2 .= ", '' as ref"; $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u"; $sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email. $sql2 .= " AND mc.statut = 1"; @@ -1912,5 +1911,4 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) { $sql2 .= " AND mc.fk_mailing=m.rowid"; return $sql2; } - } From 012574b487042cfa7ca878f0edc98c408b670b8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Jun 2020 00:51:19 +0200 Subject: [PATCH 008/319] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 76a203ad8df..d8d43931083 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5241,6 +5241,7 @@ class Form print $retstring; return; } + /** * Show 2 HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. * Fields are preselected with : From f86f4c1e1d6635aea23d6b20560efb9ffade9e1f Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Sun, 21 Jun 2020 19:02:20 +0200 Subject: [PATCH 009/319] Change label of checkbox to be more explicit --- htdocs/langs/en_US/stocks.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index e5fd3db9260..413eebd4d86 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -119,7 +119,7 @@ CurentlyUsingPhysicalStock=Physical stock RuleForStockReplenishment=Rule for stocks replenishment SelectProductWithNotNullQty=Select at least one product with a qty not null and a vendor AlertOnly= Alerts only -IncludeProductWithUndefinedAlerts = Include products with no defined alerts +IncludeProductWithUndefinedAlerts = Include also negative stock for products with no desired quantity defined, to restore them to 0 WarehouseForStockDecrease=The warehouse %s will be used for stock decrease WarehouseForStockIncrease=The warehouse %s will be used for stock increase ForThisWarehouse=For this warehouse From bf338b4d4f2566e58b11d4229a5665d89dcce882 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Mon, 22 Jun 2020 08:57:52 +0200 Subject: [PATCH 010/319] NEW show links for select and multi-select in category extra field --- htdocs/core/class/extrafields.class.php | 136 ++++++++++++++++-------- 1 file changed, 89 insertions(+), 47 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4de540c9009..dc576e26823 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1621,6 +1621,13 @@ class ExtraFields $keyList .= implode(', ', $fields_label); } + $filter_categorie = false; + if (count($InfoFieldList) > 5) { + if ($InfoFieldList[0] == 'categorie') { + $filter_categorie = true; + } + } + $sql = 'SELECT '.$keyList; $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; if (strpos($InfoFieldList[4], 'extra') !== false) @@ -1641,37 +1648,49 @@ class ExtraFields $resql = $this->db->query($sql); if ($resql) { - $value = ''; // value was used, so now we reste it to use it to build final output + if ($filter_categorie === false) { + $value = ''; // value was used, so now we reste it to use it to build final output - $obj = $this->db->fetch_object($resql); + $obj = $this->db->fetch_object($resql); - // Several field into label (eq table:code|libelle:rowid) - $fields_label = explode('|', $InfoFieldList[1]); + // Several field into label (eq table:code|libelle:rowid) + $fields_label = explode('|', $InfoFieldList[1]); - if (is_array($fields_label) && count($fields_label) > 1) - { - foreach ($fields_label as $field_toshow) - { - $translabel = ''; - if (!empty($obj->$field_toshow)) { - $translabel = $langs->trans($obj->$field_toshow); + if (is_array($fields_label) && count($fields_label) > 1) { + foreach ($fields_label as $field_toshow) { + $translabel = ''; + if (!empty($obj->$field_toshow)) { + $translabel = $langs->trans($obj->$field_toshow); + } + if ($translabel != $field_toshow) { + $value .= dol_trunc($translabel, 18) . ' '; + } else { + $value .= $obj->$field_toshow . ' '; + } } - if ($translabel != $field_toshow) { - $value .= dol_trunc($translabel, 18).' '; + } else { + $translabel = ''; + if (!empty($obj->{$InfoFieldList[1]})) { + $translabel = $langs->trans($obj->{$InfoFieldList[1]}); + } + if ($translabel != $obj->{$InfoFieldList[1]}) { + $value = dol_trunc($translabel, 18); } else { - $value .= $obj->$field_toshow.' '; + $value = $obj->{$InfoFieldList[1]}; } } } else { - $translabel = ''; - if (!empty($obj->{$InfoFieldList[1]})) { - $translabel = $langs->trans($obj->{$InfoFieldList[1]}); - } - if ($translabel != $obj->{$InfoFieldList[1]}) { - $value = dol_trunc($translabel, 18); - } else { - $value = $obj->{$InfoFieldList[1]}; + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + + $toprint = array(); + $obj = $this->db->fetch_object($resql); + $c = new Categorie($this->db); + $c->fetch($obj->rowid); + $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text + foreach ($ways as $way) { + $toprint[] = '
  • color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '
  • '; } + $value = '
      '.implode(' ', $toprint).'
    '; } } else dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING); } elseif ($type == 'radio') @@ -1710,6 +1729,13 @@ class ExtraFields $keyList .= implode(', ', $fields_label); } + $filter_categorie = false; + if (count($InfoFieldList) > 5) { + if ($InfoFieldList[0] == 'categorie') { + $filter_categorie = true; + } + } + $sql = 'SELECT '.$keyList; $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; if (strpos($InfoFieldList[4], 'extra') !== false) { @@ -1721,33 +1747,49 @@ class ExtraFields dol_syslog(get_class($this).':showOutputField:$type=chkbxlst', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $value = ''; // value was used, so now we reste it to use it to build final output - $toprint = array(); - while ($obj = $this->db->fetch_object($resql)) { - // Several field into label (eq table:code|libelle:rowid) - $fields_label = explode('|', $InfoFieldList[1]); - if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) { - if (is_array($fields_label) && count($fields_label) > 1) { - foreach ($fields_label as $field_toshow) { - $translabel = ''; - if (!empty($obj->$field_toshow)) { - $translabel = $langs->trans($obj->$field_toshow); + if ($filter_categorie === false) { + $value = ''; // value was used, so now we reste it to use it to build final output + $toprint = array(); + while ($obj = $this->db->fetch_object($resql)) { + // Several field into label (eq table:code|libelle:rowid) + $fields_label = explode('|', $InfoFieldList[1]); + if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) { + if (is_array($fields_label) && count($fields_label) > 1) { + foreach ($fields_label as $field_toshow) { + $translabel = ''; + if (!empty($obj->$field_toshow)) { + $translabel = $langs->trans($obj->$field_toshow); + } + if ($translabel != $field_toshow) { + $toprint[] = '
  • ' . dol_trunc($translabel, 18) . '
  • '; + } else { + $toprint[] = '
  • ' . $obj->$field_toshow . '
  • '; + } } - if ($translabel != $field_toshow) { - $toprint[] = '
  • '.dol_trunc($translabel, 18).'
  • '; - } else { - $toprint[] = '
  • '.$obj->$field_toshow.'
  • '; - } - } - } else { - $translabel = ''; - if (!empty($obj->{$InfoFieldList[1]})) { - $translabel = $langs->trans($obj->{$InfoFieldList[1]}); - } - if ($translabel != $obj->{$InfoFieldList[1]}) { - $toprint[] = '
  • '.dol_trunc($translabel, 18).'
  • '; } else { - $toprint[] = '
  • '.$obj->{$InfoFieldList[1]}.'
  • '; + $translabel = ''; + if (!empty($obj->{$InfoFieldList[1]})) { + $translabel = $langs->trans($obj->{$InfoFieldList[1]}); + } + if ($translabel != $obj->{$InfoFieldList[1]}) { + $toprint[] = '
  • ' . dol_trunc($translabel, 18) . '
  • '; + } else { + $toprint[] = '
  • ' . $obj->{$InfoFieldList[1]} . '
  • '; + } + } + } + } + } else { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + + $toprint = array(); + while ($obj = $this->db->fetch_object($resql)) { + if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) { + $c = new Categorie($this->db); + $c->fetch($obj->rowid); + $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text + foreach ($ways as $way) { + $toprint[] = '
  • color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '
  • '; } } } From 8c1af0fdb8c9216ff2dbb873830dc500a801d815 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 24 Jun 2020 12:24:47 +0200 Subject: [PATCH 011/319] fix enbtoty on supplier order --- 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 538af54fe23..4b42665199f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -273,7 +273,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; - $sql.= " WHERE c.entity = ".$conf->entity; + $sql.= " WHERE c.entity IN (".getEntity('order_invoice').")"; if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'"; else $sql.= " AND c.rowid=".$id; From 77868ad2a366b2d46cb01ab372e89ac02df788d1 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 24 Jun 2020 12:42:41 +0200 Subject: [PATCH 012/319] fix entity on supplier order --- htdocs/fourn/class/fournisseur.commande.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2ad30a60b80..cc394804823 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -273,7 +273,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; - $sql.= " WHERE c.entity IN (".getEntity('order_invoice').")"; + $sql.= " WHERE c.entity IN (".getEntity('supplier_order').")"; if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'"; else $sql.= " AND c.rowid=".$id; @@ -528,6 +528,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; $sql.= " AND fk_statut = ".self::STATUS_DRAFT; + $sql.= " AND entity IN (".getEntity('supplier_order').")"; $resql=$this->db->query($sql); if (! $resql) @@ -844,6 +845,7 @@ class CommandeFournisseur extends CommonOrder $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; + $sql .= " AND entity IN (".getEntity('supplier_order').")"; if ($this->db->query($sql)) { if (! $error) From 731978fda6a35393f11e304d94fcc21926302092 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sun, 28 Jun 2020 16:33:44 +0200 Subject: [PATCH 013/319] FIX html lost on html extrafield --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index e1a834a42ca..ae5d41dba48 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2086,7 +2086,7 @@ class ExtraFields $value_key = ''; } } - elseif (in_array($key_type, array('price', 'double'))) + elseif (in_array($key_type, array('price', 'double', 'html'))) { $value_arr = GETPOST("options_".$key, 'alpha'); $value_key = price2num($value_arr); From 245ba93895f54047c5836cc278648fea3a7a4979 Mon Sep 17 00:00:00 2001 From: Je2fb <46494485+Je2fb@users.noreply.github.com> Date: Sun, 28 Jun 2020 17:53:48 +0200 Subject: [PATCH 014/319] fix #14143 --- htdocs/core/class/evalmath.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index a520ebb3a21..dd665713679 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -194,7 +194,7 @@ class EvalMath * * @return string Output */ - private function vars() + public function vars() { $output = $this->v; unset($output['pi']); From dfb7c3e194092f493d0b47d9debad29ffbfa5549 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Jun 2020 21:14:49 +0200 Subject: [PATCH 015/319] Update fournisseur.commande.class.php --- htdocs/fourn/class/fournisseur.commande.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index cc394804823..dd8cb1fe722 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -528,7 +528,6 @@ class CommandeFournisseur extends CommonOrder $sql.= " fk_user_valid = ".$user->id; $sql.= " WHERE rowid = ".$this->id; $sql.= " AND fk_statut = ".self::STATUS_DRAFT; - $sql.= " AND entity IN (".getEntity('supplier_order').")"; $resql=$this->db->query($sql); if (! $resql) From 960512acd9176be205b18dd0cbda9bd92f4caf5c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Jun 2020 21:21:35 +0200 Subject: [PATCH 016/319] Update fournisseur.commande.class.php Action with filter on rowid does not need to have test on entity --- 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 dd8cb1fe722..ef8d4b4d93f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -844,7 +844,7 @@ class CommandeFournisseur extends CommonOrder $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; - $sql .= " AND entity IN (".getEntity('supplier_order').")"; + if ($this->db->query($sql)) { if (! $error) From 5d65b5f66025473cfca99bb6bd48f0c5f7fbfc71 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 29 Jun 2020 09:07:54 +0200 Subject: [PATCH 017/319] fix html should not do price2num --- htdocs/core/class/extrafields.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ae5d41dba48..caf43f94342 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2086,11 +2086,15 @@ class ExtraFields $value_key = ''; } } - elseif (in_array($key_type, array('price', 'double', 'html'))) + elseif (in_array($key_type, array('price', 'double'))) { $value_arr = GETPOST("options_".$key, 'alpha'); $value_key = price2num($value_arr); } + elseif (in_array($key_type, array('html'))) + { + $value_key = GETPOST("options_".$key, 'alpha'); + } else { $value_key = GETPOST("options_".$key); From eb22947c07165dec6c56a942c9804012a4570398 Mon Sep 17 00:00:00 2001 From: oscim Date: Mon, 29 Jun 2020 14:01:48 +0200 Subject: [PATCH 018/319] Update project.class.php Fix order of delete extra prev table of project --- htdocs/projet/class/project.class.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 72f83317fb3..5d2eb217031 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -721,7 +721,18 @@ class Project extends CommonObject } } + if (!$error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_extrafields"; + $sql .= " WHERE fk_object=".$this->id; + $resql = $this->db->query($sql); + if (!$resql) + { + $this->errors[] = $this->db->lasterror(); + $error++; + } + } // Delete project if (!$error) @@ -737,18 +748,7 @@ class Project extends CommonObject } } - if (!$error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_extrafields"; - $sql .= " WHERE fk_object=".$this->id; - $resql = $this->db->query($sql); - if (!$resql) - { - $this->errors[] = $this->db->lasterror(); - $error++; - } - } if (empty($error)) { // We remove directory From f34a3785f07c17e4b9f8ad5c06a6367cae841253 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 16:02:08 +0200 Subject: [PATCH 019/319] FIX CSS --- htdocs/theme/eldy/global.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 06feb97c2dd..ef6dd9a2b68 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -614,10 +614,10 @@ textarea.centpercent { padding-: 2px; } .paddingtop { - padding-bottom: 4px; + padding-top: 4px; } .paddingtop2 { - padding-bottom: 2px; + padding-top: 2px; } .paddingbottom { padding-bottom: 4px; From 9bb0ef04f54a240b7ebf0f98f0bc3a394cd63959 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 18:07:51 +0200 Subject: [PATCH 020/319] Fix upload of file in import module --- htdocs/core/lib/security.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 3ee5739bc6d..72713393025 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -289,6 +289,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if (!$user->rights->banque->modifier) { $createok = 0; $nbko++; } } elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; } + } elseif ($feature == 'import') { + if (!$user->rights->import->run) { $createok = 0; $nbko++; } } elseif ($feature == 'ecm') { if (!$user->rights->ecm->upload) { $createok = 0; $nbko++; } } From 6553c40bea8f467b58d79945e0b1b3bde74181d3 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 30 Jun 2020 11:23:55 +0200 Subject: [PATCH 021/319] FIX : create a deposit with amount using comma didn't work --- htdocs/compta/facture/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ff7a1714757..a65d7f6ed81 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1255,7 +1255,8 @@ if (empty($reshook)) if ($_POST['type'] == Facture::TYPE_DEPOSIT) { $typeamount = GETPOST('typedeposit', 'alpha'); - $valuedeposit = GETPOST('valuedeposit', 'int'); + $valuedeposit = GETPOST('valuedeposit'); + $valuedeposit = price2num($valuedeposit, 'MU'); $amountdeposit = array(); if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)) From 4f1ac84a199059a63e373ad7416ce6ebc37383d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jun 2020 12:07:24 +0200 Subject: [PATCH 022/319] Fix can't find link to edit table plan --- htdocs/langs/en_US/cashdesk.lang | 3 ++- htdocs/takepos/admin/bar.php | 23 ++++++++++++++++++++--- htdocs/takepos/admin/setup.php | 1 + htdocs/takepos/index.php | 2 +- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 71a2a992e19..4494e10545d 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -111,4 +111,5 @@ AutoOrder=Order by the customer himself RestaurantMenu=Menu CustomerMenu=Customer menu ScanToMenu=Scan QR code to see the menu -ScanToOrder=Scan QR code to order \ No newline at end of file +ScanToOrder=Scan QR code to order +DefineTablePlan=Define table plan \ No newline at end of file diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 97f651efdb2..3d4bd490dde 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -66,12 +66,14 @@ if (GETPOST('action', 'alpha') == 'set') $form = new Form($db); $formproduct = new FormProduct($db); -llxHeader('', $langs->trans("CashDeskSetup")); +$arrayofcss = array("/takepos/css/colorbox.css"); + +llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, $arrayofjs, $arrayofcss); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); $head = takepos_prepare_head(); -dol_fiche_head($head, 'bar', 'TakePOS', -1); +dol_fiche_head($head, 'bar', 'TakePOS', -1, 'cash-register'); print '
    '; @@ -80,6 +82,20 @@ print ''; print ''; print ''; +?> + + + + '.$langs->trans("DefineTablePlan").'
    '; +print '

    '; + print '
    '; print '
       '.$langs->trans('IncludeProductWithUndefinedAlerts').' '.$langs->trans('AlertOnly').' '.$langs->trans('IncludeAlsoDraftOrders').'  '; - $out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, 0, 1); + $out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, !empty($conf->global->AGENDA_USE_MULTISELECT_TYPE) ? 1 : -1, 1); $out .= ''.$form->selectDateToDate($tms_start, $tms_end, 'dateevent', 1).'
    '; print ''; @@ -138,9 +154,9 @@ print ''; - print '
    '; print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0); print '
    '; + if ($conf->global->TAKEPOS_AUTO_ORDER) { print '
    '; @@ -168,6 +184,7 @@ if ($conf->global->TAKEPOS_AUTO_ORDER) print ''; } + if ($conf->global->TAKEPOS_QR_MENU) { $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 03607409ea7..a6f8b4968cc 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -121,6 +121,7 @@ if ($action != '') { } } + /* * View */ diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index f4b83138416..63bbc5d1808 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -433,7 +433,7 @@ function CloseBill() { } function Floors() { - console.log("Open box to select floor"); + console.log("Open box to select floor place="+place); $.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"trans("Floors"); ?>"}); } From 5afd518718ab4a58308333c451fa42f2c94b5fe1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jun 2020 13:06:44 +0200 Subject: [PATCH 023/319] Update vat rate for Congo --- htdocs/install/mysql/data/llx_c_tva.sql | 4 ++++ htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 2 ++ 2 files changed, 6 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 0888c68783c..afd3a762ccc 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -86,6 +86,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 9 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 93, 9, '3','0','VAT super reduced rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 94, 9, '17','0','VAT standard rate',1); +-- CONGO = REPUBLIQUE DU CONGO (id country=72) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (721, 72, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1); + -- CYPRUS (id country=78) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (781, 78, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (782, 78, '9','0','VAT Rate 9',1); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 2a7fc17e77e..1d543fad548 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -322,3 +322,5 @@ UPDATE llx_prelevement_facture_demande SET entity = 1 WHERE entity IS NULL; ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture); ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (721, 72, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1); From b8ea58f18c15a2cf31807f76473fa8cb7583c221 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jun 2020 16:15:10 +0200 Subject: [PATCH 024/319] Fix phpcs --- htdocs/core/class/ldap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 9d613455cfe..06c3106a5dc 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -474,7 +474,7 @@ class Ldap //print_r($info); - // For better compatibility with Samba4 AD + // For better compatibility with Samba4 AD if ($this->serverType == "activedirectory") { unset($info['cn']); // For avoid error : Operation not allowed on RDN (Code 67) } From 918e669c98755e896326380e3cfc5a3e45dbf03d Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 30 Jun 2020 16:33:18 +0200 Subject: [PATCH 025/319] FIX change selected fields on company card --- htdocs/societe/card.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d277632c348..d2f27419e76 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -846,6 +846,11 @@ if (empty($reshook)) $id=$socid; $object->fetch($socid); + // Selection of new fields + if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD) && (empty($conf->global->SOCIETE_DISABLE_CONTACTS) || !empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))) { + include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; + } + // Actions to send emails $trigger_name='COMPANY_SENTBYMAIL'; $paramname='socid'; From caa3661eeb509479dcb7e29cafcab0e3b6a3f718 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 1 Jul 2020 09:16:44 +0200 Subject: [PATCH 026/319] NEW add order by lastname and firstname by default in get sales representatives --- htdocs/societe/class/societe.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a74c0de7c52..935b44ab16d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2070,11 +2070,13 @@ class Societe extends CommonObject /** * Return array of sales representatives * - * @param User $user Object user - * @param int $mode 0=Array with properties, 1=Array of id. - * @return array Array of sales representatives of third party + * @param User $user Object user + * @param int $mode 0=Array with properties, 1=Array of id. + * @param string $sortfield List of sort fields, separated by comma. Example: 't1.fielda,t2.fieldb' + * @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC'; + * @return array Array of sales representatives of third party */ - public function getSalesRepresentatives(User $user, $mode = 0) + public function getSalesRepresentatives(User $user, $mode = 0, $sortfield = null, $sortorder = null) { global $conf; @@ -2091,6 +2093,11 @@ class Societe extends CommonObject } else $sql .= " WHERE entity in (0, ".$conf->entity.")"; $sql .= " AND u.rowid = sc.fk_user AND sc.fk_soc = ".$this->id; + if (empty($sortfield) && empty($sortorder)) { + $sortfield = 'u.lastname,u.firstname'; + $sortorder = 'ASC,ASC'; + } + $sql .= $this->db->order($sortfield, $sortorder); $resql = $this->db->query($sql); if ($resql) From a34c6ec7b08da4628c1d42dcd1c6d07661a363d4 Mon Sep 17 00:00:00 2001 From: laurantines Date: Wed, 1 Jul 2020 13:12:52 +0200 Subject: [PATCH 027/319] Update list.php in Adherents Add Address in search --- htdocs/adherents/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index bf8353da5c9..4dcb34610cf 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -298,6 +298,7 @@ if ($search_gender != '' && $search_gender != '-1') $sql .= " AND d.gender = '". if ($search_login) $sql .= natural_search("d.login", $search_login); if ($search_company) $sql .= natural_search("s.nom", $search_company); if ($search_email) $sql .= natural_search("d.email", $search_email); +if ($search_address) $sql .= natural_search("d.address", $search_address); if ($search_town) $sql .= natural_search("d.town", $search_town); if ($search_zip) $sql .= natural_search("d.zip", $search_zip); if ($search_state) $sql .= natural_search("state.nom", $search_state); From 5f37f54675ff7637c88136a04672552f2d437820 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 13:16:06 +0200 Subject: [PATCH 028/319] Fix warning --- htdocs/master.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 4005e6a2ed5..0db06b121fd 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -49,7 +49,7 @@ $conf->db->host = $dolibarr_main_db_host; $conf->db->port = $dolibarr_main_db_port; $conf->db->name = $dolibarr_main_db_name; $conf->db->user = $dolibarr_main_db_user; -$conf->db->pass = $dolibarr_main_db_pass; +$conf->db->pass = empty($dolibarr_main_db_pass)?'':$dolibarr_main_db_pass; $conf->db->type = $dolibarr_main_db_type; $conf->db->prefix = $dolibarr_main_db_prefix; $conf->db->character_set = $dolibarr_main_db_character_set; From 5f2486049eefff6ab31501bb6e3b6bb2b14813f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 13:22:15 +0200 Subject: [PATCH 029/319] Fix trans --- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/langs/en_US/banks.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index f6e5c2c83d6..0bfa4cfd2db 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1491,7 +1491,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Direct debit order if (!empty($conf->prelevement->enabled)) { - $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("StandingOrders"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw'); + $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw'); if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer); diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 7a36346733f..75f9549dca5 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -37,6 +37,7 @@ IbanValid=BAN valid IbanNotValid=BAN not valid StandingOrders=Direct debit orders StandingOrder=Direct debit order +PaymentByDirectDebit=Payment by direct debit PaymentByBankTransfers=Payments by credit transfer PaymentByBankTransfer=Payment by credit transfer AccountStatement=Account statement From 39651953b3c6048c40ab60adc548d723c9b0b964 Mon Sep 17 00:00:00 2001 From: quentin Date: Wed, 1 Jul 2020 14:04:41 +0200 Subject: [PATCH 030/319] FIX refacto --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/company.lib.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ece403b3c51..762a22cc37a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5241,7 +5241,7 @@ class Form print $retstring; return; } - + /** * Show 2 HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. * Fields are preselected with : diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index b98a61b451d..2d58e545b41 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1850,9 +1850,8 @@ function show_subsidiaries($conf, $langs, $db, $object) * @param string $donetodo donetodo * @param string $now now * @param string $filters array - * @param string $donetodo donetodo - * @param string $sqlANDOR "AND", "OR" or "" - * @return void + * @param string $sqlANDOR "AND", "OR" or "" sql condition + * @return string sql request */ function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDOR = "AND") { @@ -1877,6 +1876,8 @@ function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDO if ($donetodo == 'todo') $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; elseif ($donetodo == 'done') $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; if (is_array($filters) && $filters['search_agenda_label']) $sql .= natural_search('a.label', $filters['search_agenda_label']); + + return $sql; } /** @@ -1884,7 +1885,7 @@ function addEventTypeSQL(&$sql, $actioncode, $donetodo, $now, $filters, $sqlANDO * * @param string $actioncode Action code * @param string $objcon objcon - * @param Object $filterobj + * @param Object $filterobj filterobj * @return string */ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) From d2a364eea85d49c357024ca34b73fc10ceac6970 Mon Sep 17 00:00:00 2001 From: quentin Date: Wed, 1 Jul 2020 14:10:43 +0200 Subject: [PATCH 031/319] NEW get all child recursively --- htdocs/core/class/commonobject.class.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5f9582a475f..03b220f314a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2525,10 +2525,11 @@ abstract class CommonObject /** * Get children of line * - * @param int $id Id of parent line - * @return array Array with list of children lines id + * @param int $id Id of parent line + * @param int $includealltree 0 = 1st level child, 1 = All level child + * @return array Array with list of children lines id */ - public function getChildrenOfLine($id) + public function getChildrenOfLine($id, $includealltree = 0) { $rows = array(); @@ -2541,16 +2542,14 @@ abstract class CommonObject $resql = $this->db->query($sql); if ($resql) { - $i = 0; - $num = $this->db->num_rows($resql); - while ($i < $num) - { - $row = $this->db->fetch_row($resql); - $rows[$i] = $row[0]; - $i++; + if($this->db->num_rows($resql) > 0) { + while($row = $this->db->fetch_row($resql)) { + + $rows[] = $row[0]; + if (!empty($includealltree)) $rows = array_merge($rows, $this->getChildrenOfLine($row[0]), $includealltree); + } } } - return $rows; } From e2a9743dd403e9274b82959b9cb375872ebe5e97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 14:19:47 +0200 Subject: [PATCH 032/319] Debug module credit transfer --- htdocs/compta/facture/prelevement.php | 76 +++++++++++++------ htdocs/compta/paymentbybanktransfer/index.php | 11 +-- .../class/bonprelevement.class.php | 21 +++-- htdocs/compta/prelevement/create.php | 7 +- htdocs/compta/prelevement/index.php | 7 +- htdocs/core/lib/fourn.lib.php | 4 +- 6 files changed, 83 insertions(+), 43 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index dd9c1394563..b24723330a0 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -48,13 +48,12 @@ $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'alpha'); $type = GETPOST('type', 'aZ09'); -$mode = GETPOST('mode', 'aZ09'); $fieldid = (!empty($ref) ? 'ref' : 'rowid'); if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); -if ($mode == 'bank-transfer') { +if ($type == 'bank-transfer') { $object = new FactureFournisseur($db); } else { $object = new Facture($db); @@ -94,6 +93,7 @@ if (empty($reshook)) $sourcetype = 'facture'; if ($type == 'bank-transfer') { $sourcetype = 'supplier_invoice'; + $newtype = 'bank-transfer'; } $result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype); @@ -119,7 +119,7 @@ if (empty($reshook)) $result = $object->demande_prelevement_delete($user, GETPOST('did', 'int')); if ($result == 0) { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.'&mode='.$mode); + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.'&type='.$type); exit; } } @@ -135,7 +135,7 @@ $form = new Form($db); $now = dol_now(); -if ($mode == 'bank-transfer') { +if ($type == 'bank-transfer') { $title = $langs->trans('InvoiceSupplier')." - ".$langs->trans('CreditTransfer'); $helpurl = ""; } else { @@ -170,7 +170,7 @@ if ($object->id > 0) if ($object->paye) $resteapayer = 0; $resteapayeraffiche = $resteapayer; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice @@ -204,7 +204,7 @@ if ($object->id > 0) $author->fetch($object->user_author); } - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $head = facturefourn_prepare_head($object); } else { $head = facture_prepare_head($object); @@ -213,7 +213,7 @@ if ($object->id > 0) dol_fiche_head($head, 'standingorders', $title, -1, 'bill'); // Invoice content - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $linkback = ''.$langs->trans("BackToList").''; } else { $linkback = ''.$langs->trans("BackToList").''; @@ -221,7 +221,7 @@ if ($object->id > 0) $morehtmlref = '
    '; // Ref customer - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); } else { @@ -230,7 +230,7 @@ if ($object->id > 0) } // Thirdparty $morehtmlref .= '
    '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } else { if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; @@ -290,7 +290,7 @@ if ($object->id > 0) } if ($object->type == $object::TYPE_REPLACEMENT) { - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $facreplaced = new FactureFournisseur($db); } else { $facreplaced = new Facture($db); @@ -300,7 +300,7 @@ if ($object->id > 0) } if ($object->type == $object::TYPE_CREDIT_NOTE) { - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $facusing = new FactureFournisseur($db); } else { $facusing = new Facture($db); @@ -318,7 +318,7 @@ if ($object->id > 0) { if ($i == 0) print ' '; else print ','; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $facavoir = new FactureFournisseur($db); } else { $facavoir = new Facture($db); @@ -341,7 +341,7 @@ if ($object->id > 0) // Discounts print ''.$langs->trans('Discounts').''; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { //$societe = new Fournisseur($db); //$result = $societe->fetch($object->socid); $thirdparty = $object->thirdparty; @@ -357,7 +357,7 @@ if ($object->id > 0) print ''; // Label - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { print ''; print ''.$form->editfieldkey("Label", 'label', $object->label, $object, 0).''; print ''.$form->editfieldval("Label", 'label', $object->label, $object, 0).''; @@ -427,7 +427,7 @@ if ($object->id > 0) if ($object->type != $object::TYPE_CREDIT_NOTE) { $duedate = $object->date_lim_reglement; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $duedate = $object->date_echeance; } @@ -488,7 +488,7 @@ if ($object->id > 0) print ''; $title = 'CustomerIBAN'; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $title = 'SupplierIBAN'; } print ''.$langs->trans($title).''; @@ -649,7 +649,7 @@ if ($object->id > 0) print "\n
    \n"; $buttonlabel = $langs->trans("MakeWithdrawRequest"); - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $buttonlabel = $langs->trans("MakeBankTransferOrder"); } @@ -665,6 +665,7 @@ if ($object->id > 0) print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -694,7 +695,7 @@ if ($object->id > 0) print "

    \n"; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { print '
    '.$langs->trans("DoCreditTransferBeforePayments").'

    '; } else { print '
    '.$langs->trans("DoStandingOrdersBeforePayments").'

    '; @@ -711,7 +712,7 @@ if ($object->id > 0) print ''.$langs->trans("DateRequest").''; print ''.$langs->trans("User").''; print ''.$langs->trans("Amount").''; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { print ''.$langs->trans("BankTransferReceipt").''; } else { print ''.$langs->trans("WithdrawalReceipt").''; @@ -723,7 +724,7 @@ if ($object->id > 0) $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,"; $sql .= " pfd.date_traite as date_traite, pfd.amount,"; - $sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login"; + $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; @@ -743,14 +744,29 @@ if ($object->id > 0) { $i = 0; + $tmpuser = new User($db); + $num = $db->num_rows($result); while ($i < $num) { $obj = $db->fetch_object($result_sql); + $tmpuser->id = $obj->user_id; + $tmpuser->login = $obj->login; + $tmpuser->ref = $obj->login; + $tmpuser->email = $obj->email; + $tmpuser->lastname = $obj->lastname; + $tmpuser->firstname = $obj->firstname; + $tmpuser->statut = $obj->user_status; + print ''; + print ''.dol_print_date($db->jdate($obj->date_demande), 'dayhour')."\n"; - print ''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.''; + + print ''; + print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login'); + print ''; + print ''.price($obj->amount).''; print '-'; print ' '; @@ -758,7 +774,7 @@ if ($object->id > 0) print ''.$langs->trans("OrderWaiting").''; print ''; - print ''; + print ''; print img_delete(); print ''; @@ -778,7 +794,7 @@ if ($object->id > 0) $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,"; $sql .= " pb.ref,"; - $sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login"; + $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; @@ -798,15 +814,27 @@ if ($object->id > 0) $numclosed = $num; $i = 0; + $tmpuser = new User($db); + while ($i < $num) { $obj = $db->fetch_object($result); + $tmpuser->id = $obj->user_id; + $tmpuser->login = $obj->login; + $tmpuser->ref = $obj->login; + $tmpuser->email = $obj->email; + $tmpuser->lastname = $obj->lastname; + $tmpuser->firstname = $obj->firstname; + $tmpuser->statut = $obj->user_status; + print ''; print ''.dol_print_date($db->jdate($obj->date_demande), 'day')."\n"; - print ''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.''; + print ''; + print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login'); + print ''; print ''.price($obj->amount).''; diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 6172b3f1284..792507c56fd 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -94,11 +94,11 @@ print '

    '; */ $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; $sql .= " pfd.date_demande, pfd.amount,"; -$sql .= " s.nom as name, s.rowid as socid"; -$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; +$sql .= " s.nom as name, s.email, s.rowid as socid"; +$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; +$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " WHERE s.rowid = f.fk_soc"; $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; $sql .= " AND f.total_ttc > 0"; @@ -133,14 +133,15 @@ if ($resql) $invoicestatic->type = $obj->type; $alreadypayed = $invoicestatic->getSommePaiement(); + $thirdpartystatic->id = $obj->socid; + $thirdpartystatic->name = $obj->name; + $thirdpartystatic->email = $obj->email; print ''; print $invoicestatic->getNomUrl(1, 'withdraw'); print ''; print ''; - $thirdpartystatic->id = $obj->socid; - $thirdpartystatic->name = $obj->name; print $thirdpartystatic->getNomUrl(1, 'customer'); print ''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 1a13eb2edb9..193d352ae35 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -703,9 +703,16 @@ class BonPrelevement extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; } $sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; - $sql .= " WHERE f.fk_statut = 1"; - $sql .= " AND f.entity IN (".getEntity('invoice').")"; - $sql .= " AND f.rowid = pfd.fk_facture"; + $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; + if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) + { + $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; + } + if ($mode != 'bank-transfer') { + $sql .= " AND f.rowid = pfd.fk_facture"; + } else { + $sql .= " AND f.rowid = pfd.fk_facture_fourn"; + } $sql .= " AND f.paye = 0"; $sql .= " AND pfd.traite = 0"; $sql .= " AND f.total_ttc > 0"; @@ -744,16 +751,16 @@ class BonPrelevement extends CommonObject /** * Get number of invoices to withdrawal * - * @param string $mode 'direct-debit' or 'bank-transfer' + * @param string $type 'direct-debit' or 'bank-transfer' * @return int '; print ''; - print ''.$langs->trans("Invoice").''; + print ''.$langs->trans($tradinvoice).''; print ''.$langs->trans("ThirdParty").''; print ''.$langs->trans("RIB").''; print ''.$langs->trans("RUM").''; diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index eaec6d92f16..72c318a1024 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -94,7 +94,7 @@ print '

    '; */ $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; $sql .= " pfd.date_demande, pfd.amount,"; -$sql .= " s.nom as name, s.rowid as socid"; +$sql .= " s.nom as name, s.email, s.rowid as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -133,14 +133,15 @@ if ($resql) $invoicestatic->type = $obj->type; $alreadypayed = $invoicestatic->getSommePaiement(); + $thirdpartystatic->id = $obj->socid; + $thirdpartystatic->name = $obj->name; + $thirdpartystatic->email = $obj->email; print ''; print $invoicestatic->getNomUrl(1, 'withdraw'); print ''; print ''; - $thirdpartystatic->id = $obj->socid; - $thirdpartystatic->name = $obj->name; print $thirdpartystatic->getNomUrl(1, 'customer'); print ''; diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 8d0e767c943..201d74a9ff9 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -68,7 +68,7 @@ function facturefourn_prepare_head($object) if ($obj) $nbStandingOrders = $obj->nb; } else dol_print_error($db); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'&mode=bank-transfer'; + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'&type=bank-transfer'; $head[$h][1] = $langs->trans('BankTransfer'); if ($nbStandingOrders > 0) $head[$h][1] .= ''.$nbStandingOrders.''; $head[$h][2] = 'standingorders'; @@ -233,8 +233,6 @@ function supplierorder_admin_prepare_head() $head[$h][2] = 'supplierorderdet'; $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices"); $head[$h][2] = 'supplierinvoice'; From 5e259d26ab3cbe4b0eebfa010107f695dc93d466 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 1 Jul 2020 15:20:42 +0200 Subject: [PATCH 033/319] FIX takepos hook can add more than 1 button within 1 module --- htdocs/takepos/index.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 63bbc5d1808..51358e24080 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -932,8 +932,14 @@ if ($resql) $hookmanager->initHooks(array('takeposfrontend')); $reshook = $hookmanager->executeHooks('ActionButtons'); if (!empty($reshook)) { +if (is_array($reshook) && !isset($reshook['title'])) { + foreach ($reshook as $reshook) { +$menus[$r++] = $reshook; + } +} else { $menus[$r++] = $reshook; } +} if ($r % 3 == 2) $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;'); From 92f4744d11c49d2ec6a5dede2c75920a54f9a0fa Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 1 Jul 2020 13:22:43 +0000 Subject: [PATCH 034/319] Fixing style errors. --- htdocs/takepos/index.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 51358e24080..af9c3062ba3 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -932,13 +932,13 @@ if ($resql) $hookmanager->initHooks(array('takeposfrontend')); $reshook = $hookmanager->executeHooks('ActionButtons'); if (!empty($reshook)) { -if (is_array($reshook) && !isset($reshook['title'])) { - foreach ($reshook as $reshook) { -$menus[$r++] = $reshook; - } -} else { - $menus[$r++] = $reshook; -} + if (is_array($reshook) && !isset($reshook['title'])) { + foreach ($reshook as $reshook) { + $menus[$r++] = $reshook; + } + } else { + $menus[$r++] = $reshook; + } } if ($r % 3 == 2) $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;'); From cc132775f3a896a63e0746bf3a4c966b79a048aa Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 1 Jul 2020 16:18:19 +0200 Subject: [PATCH 035/319] FIX non numeric value on comm/car.php --- htdocs/comm/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 4a97dc0f98c..9b385ea7ead 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -943,7 +943,7 @@ if ($object->id > 0) $late = ''; foreach ($contrat->lines as $line) { if ($contrat->statut == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) { - if (($line->date_fin_validite + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late")); + if (((!empty($line->date_fin_validite)?$line->date_fin_validite:0) + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late")); } } From 2a9311b2d8393071d5b17b6eb32650b0b90451e0 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 1 Jul 2020 16:55:23 +0200 Subject: [PATCH 036/319] Fix email spoofing - with hidden conf --- htdocs/core/class/CMailFile.class.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 853f2f98b05..e31053d1bf7 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -396,7 +396,23 @@ class CMailFile //$this->message->setFrom(array('john@doe.com' => 'John Doe')); if (! empty($from)) { try { - $result = $this->message->setFrom($this->getArrayAddress($from)); + + // Prevent email spoofing for smtp server with a strict configuration + $regexp = '/([a-z0-9_\.\-\+])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,4})+/i'; // This regular expression extracts all emails from a string + $emailMatchs = preg_match_all($regexp, $from, $adressEmailFrom); + $adressEmailFrom = reset($adressEmailFrom); + if($emailMatchs !== false + && $conf->global->MAIN_FORCE_DISABLE_MAIL_SPOOFING + && filter_var($conf->global->MAIN_MAIL_SMTPS_ID, FILTER_VALIDATE_EMAIL) + && $conf->global->MAIN_MAIL_SMTPS_ID !== $adressEmailFrom) + { + $result = $this->message->setFrom($conf->global->MAIN_MAIL_SMTPS_ID); + } + else + { + $result = $this->message->setFrom($this->getArrayAddress($from)); + } + } catch (Exception $e) { $this->errors[] = $e->getMessage(); } From 226c907e35653f324f923d96d2ac7282c5111fe7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 17:00:52 +0200 Subject: [PATCH 037/319] FIX Use of office365 TLS with SMTPs method. --- htdocs/core/class/smtps.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 0a0a39cc7cb..87ce3c22e80 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -424,7 +424,7 @@ class SMTPs $host = preg_replace('@ssl://@i', '', $host); // Remove prefix $host = preg_replace('@tls://@i', '', $host); // Remove prefix - if ($usetls) $host = 'tls://'.$host; + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; $hosth = $host; @@ -558,6 +558,8 @@ class SMTPs $host = preg_replace('@ssl://@i', '', $host); // Remove prefix $host = preg_replace('@tls://@i', '', $host); // Remove prefix + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; + $hosth = $host; if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) From 92a36dbeee93b6387bd32394b83e10e08f22e5df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 17:00:52 +0200 Subject: [PATCH 038/319] FIX Use of office365 TLS with SMTPs method. --- htdocs/core/class/smtps.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 51e375c5279..09a1f7f2949 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -428,7 +428,7 @@ class SMTPs $host = preg_replace('@ssl://@i', '', $host); // Remove prefix $host = preg_replace('@tls://@i', '', $host); // Remove prefix - if ($usetls) $host = 'tls://'.$host; + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; $hosth = $host; @@ -565,6 +565,8 @@ class SMTPs $host = preg_replace('@ssl://@i', '', $host); // Remove prefix $host = preg_replace('@tls://@i', '', $host); // Remove prefix + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; + $hosth = $host; if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) From 324c8e9b54930f2a0fc95e0cc8659a59f5fe2620 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 17:00:52 +0200 Subject: [PATCH 039/319] FIX Use of office365 TLS with SMTPs method. Conflicts: htdocs/core/class/smtps.class.php --- htdocs/core/class/smtps.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index df7647b330c..9c071a36f23 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -428,7 +428,7 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix - if ($usetls) $host='tls://'.$host; + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; $hosth = $host; @@ -568,6 +568,8 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; + $hosth = $host; if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) From d3c23428d5cf773172ebeb573c234c1f10a12cc1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 17:00:52 +0200 Subject: [PATCH 040/319] FIX Use of office365 TLS with SMTPs method. Conflicts: htdocs/core/class/smtps.class.php --- htdocs/core/class/smtps.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index f978fd47fba..bce175b3872 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -428,7 +428,7 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix - if ($usetls) $host='tls://'.$host; + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; $hosth = $host; @@ -555,6 +555,8 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; + $hosth = $host; if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) From ae0c73898098ab949fb1a9eb80358fcfb941f07c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 19:42:28 +0200 Subject: [PATCH 041/319] FIX Entry from stripe intent were reported into SEPA payments FIX Label of popup on thirdparty FIX Missing the tooltip when creating bank account --- htdocs/compta/paymentbybanktransfer/index.php | 9 +- .../class/bonprelevement.class.php | 156 +++++++++++------- htdocs/compta/prelevement/create.php | 20 ++- htdocs/compta/prelevement/index.php | 14 +- htdocs/societe/class/societe.class.php | 20 +-- htdocs/societe/paymentmodes.php | 17 +- 6 files changed, 155 insertions(+), 81 deletions(-) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 792507c56fd..1fc6c53cf99 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -106,7 +106,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".FactureFournisseur::STATUS_VALIDATED; } -$sql .= " AND pfd.traite = 0 AND pfd.fk_facture_fourn = f.rowid"; +$sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.ext_payment_id IS NULL"; +$sql .= " AND pfd.fk_facture_fourn = f.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql .= " AND f.fk_soc = ".$socid; @@ -195,7 +197,8 @@ if ($result) print"\n\n"; print '
    '; print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -222,7 +225,7 @@ if ($result) $i++; } } else { - print ''; + print ''; } print "
    '.$langs->trans("LatestBankTransferReceipts", $limit).'
    '.$langs->trans("LatestBankTransferReceipts", $limit).''.$langs->trans("Date").''.$langs->trans("Amount").''.$langs->trans("Status").'
    '.$langs->trans("None").'
    '.$langs->trans("None").'

    "; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 193d352ae35..5db9ccde671 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.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/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; @@ -118,7 +119,7 @@ class BonPrelevement extends CommonObject /** * Add invoice to withdrawal * - * @param int $facture_id id invoice to add + * @param int $invoice_id id invoice to add * @param int $client_id id invoice customer * @param string $client_nom customer name * @param int $amount amount of invoice @@ -126,14 +127,16 @@ class BonPrelevement extends CommonObject * @param string $code_guichet code of bank's office * @param string $number bank account number * @param string $number_key number key of account number + * @param string $type 'debit-order' or 'bank-transfer' * @return int >0 if OK, <0 if KO */ - public function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) + public function AddFacture($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order') { // phpcs:enable $result = 0; $line_id = 0; + // Add lines $result = $this->addline($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key); if ($result == 0) @@ -141,10 +144,14 @@ class BonPrelevement extends CommonObject if ($line_id > 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture ("; - $sql .= "fk_facture"; + if ($type != 'bank-transfer') { + $sql .= "fk_facture"; + } else { + $sql .= "fk_facture_fourn"; + } $sql .= ",fk_prelevement_lignes"; $sql .= ") VALUES ("; - $sql .= $facture_id; + $sql .= $invoice_id; $sql .= ", ".$line_id; $sql .= ")"; @@ -155,19 +162,19 @@ class BonPrelevement extends CommonObject else { $result = -1; - dol_syslog(get_class($this)."::AddFacture Erreur $result"); + dol_syslog(get_class($this)."::AddFacture Error $result"); } } else { $result = -2; - dol_syslog(get_class($this)."::AddFacture Erreur $result"); + dol_syslog(get_class($this)."::AddFacture Error $result"); } } else { $result = -3; - dol_syslog(get_class($this)."::AddFacture Erreur $result"); + dol_syslog(get_class($this)."::AddFacture Error $result"); } return $result; @@ -686,7 +693,7 @@ class BonPrelevement extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Returns amount of withdrawal + * Returns amount waiting for direct debit payment or credit transfer payment * * @param string $mode 'direct-debit' or 'bank-transfer' * @return double db->query($sql); @@ -749,7 +757,7 @@ class BonPrelevement extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Get number of invoices to withdrawal + * Get number of invoices to pay * * @param string $type 'direct-debit' or 'bank-transfer' * @return int global->PRELEVEMENT_CODE_BANQUE."'"; //if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; @@ -874,6 +893,12 @@ class BonPrelevement extends CommonObject { $row = $this->db->fetch_row($resql); $factures[$i] = $row; // All fields + if ($row[7] == 0) { + $error++; + dol_syslog(__METHOD__."::Read invoices error Found a null invoice", LOG_ERR); + $this->invoice_in_error[$row[0]] = "Error for invoice id ".$row[0].", found a null amount"; + break; + } $i++; } $this->db->free($resql); @@ -891,15 +916,19 @@ class BonPrelevement extends CommonObject require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; $soc = new Societe($this->db); - // Check RIB + // Check BAN $i = 0; - dol_syslog(__METHOD__."::Check RIB", LOG_DEBUG); + dol_syslog(__METHOD__."::Check BAN", LOG_DEBUG); if (count($factures) > 0) { foreach ($factures as $key => $fac) { - $fact = new Facture($this->db); + if ($type != 'bank-transfer') { + $fact = new Facture($this->db); + } else { + $fact = new FactureFournisseur($this->db); + } $resfetch = $fact->fetch($fac[0]); if ($resfetch >= 0) // Field 0 of $fac is rowid of invoice { @@ -908,13 +937,15 @@ class BonPrelevement extends CommonObject $bac = new CompanyBankAccount($this->db); $bac->fetch(0, $soc->id); - if ($format == 'FRST' && $bac->frstrecur != 'FRST') - { - continue; - } - if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR')) - { - continue; + if ($type != 'bank-transfer') { + if ($format == 'FRST' && $bac->frstrecur != 'FRST') + { + continue; + } + if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR')) + { + continue; + } } if ($bac->verif() >= 1) @@ -927,32 +958,32 @@ class BonPrelevement extends CommonObject } else { - dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING); $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); } } else { - dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN Failed to read company", LOG_WARNING); } } else { - dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN Failed to read invoice", LOG_WARNING); } } } else { - dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN No invoice to process", LOG_WARNING); } } $ok = 0; // Withdraw invoices in factures_prev array - $out = count($factures_prev)." invoices will be withdrawn."; + $out = count($factures_prev)." invoices will be included."; //print $out."\n"; dol_syslog($out); @@ -982,14 +1013,14 @@ class BonPrelevement extends CommonObject { /* * We are in real mode. - * We create withdraw receipt and build withdraw into disk + * We create order and build file into disk */ $this->db->begin(); $now = dol_now(); /* - * Traitements + * Process order generation */ if (!$error) { @@ -1001,7 +1032,7 @@ class BonPrelevement extends CommonObject $sql .= " AND entity = ".$conf->entity; $sql .= " ORDER BY ref DESC LIMIT 1"; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1009,18 +1040,23 @@ class BonPrelevement extends CommonObject $row = $this->db->fetch_row($resql); $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0]) + 1, 0, 2), 2, "0", STR_PAD_LEFT); - $dir = $conf->prelevement->dir_output.'/receipts'; + if ($type != 'bank-transfer') { + $dir = $conf->prelevement->dir_output.'/receipts'; + } else { + $dir = $conf->paymentbybanktransfer->dir_output.'/receipts'; + } if (!is_dir($dir)) dol_mkdir($dir); $this->filename = $dir.'/'.$ref.'.xml'; // Create withdraw receipt in database $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; - $sql .= " ref, entity, datec"; + $sql .= " ref, entity, datec, type"; $sql .= ") VALUES ("; $sql .= "'".$this->db->escape($ref)."'"; $sql .= ", ".$conf->entity; $sql .= ", '".$this->db->idate($now)."'"; + $sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'"; $sql .= ")"; $resql = $this->db->query($sql); @@ -1058,7 +1094,9 @@ class BonPrelevement extends CommonObject /* * Add standing order * - * + * $fac[0] : invoice_id + * $fac[1] : ??? + * $fac[2] : third party id * $fac[3] : banque * $fac[4] : guichet * $fac[5] : number @@ -1067,7 +1105,8 @@ class BonPrelevement extends CommonObject * $fac[8] : client nom * $fac[2] : client id */ - $ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6]); + + $ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6], $type); if ($ri <> 0) { $error++; @@ -1080,13 +1119,12 @@ class BonPrelevement extends CommonObject $sql .= ", fk_prelevement_bons = ".$this->id; $sql .= " WHERE rowid = ".$fac[1]; - dol_syslog(__METHOD__."::Update Orders::Sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error++; - dol_syslog(__METHOD__."::Update Orders::Error=".$this->db->error(), LOG_ERR); + dol_syslog(__METHOD__."::Update Error=".$this->db->error(), LOG_ERR); } } } @@ -1095,11 +1133,10 @@ class BonPrelevement extends CommonObject if (!$error) { /* - * Create direct debit order in a XML file + * Create file of direct debit order or credit transfer into a XML file */ - dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG); - + dol_syslog(__METHOD__."::Init direct debit file for ".count($factures_prev)." invoices", LOG_DEBUG); if (count($factures_prev) > 0) { @@ -1126,7 +1163,7 @@ class BonPrelevement extends CommonObject $this->context['factures_prev'] = $factures_prev; // Generation of SEPA file $this->filename - $this->generate($format, $executiondate); + $result = $this->generate($format, $executiondate); } dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG); } @@ -1149,8 +1186,13 @@ class BonPrelevement extends CommonObject if (!$error && !$notrigger) { + $triggername = 'DIRECT_DEBIT_ORDER_CREATE'; + if ($type != 'bank-transfer') { + $triggername = 'CREDIT_TRANSFER_ORDER_CREATE'; + } + // Call trigger - $result = $this->call_trigger('DIRECT_DEBIT_ORDER_CREATE', $user); + $result = $this->call_trigger($triggername, $user); if ($result < 0) $error++; // End call triggers } @@ -1419,9 +1461,9 @@ class BonPrelevement extends CommonObject * - Others countries: Warning message * File is generated with name this->filename * - * @param string $format FRST, RCUR or ALL - * @param string $executiondate Date to execute transfer - * @return int 0 if OK, <0 if KO + * @param string $format FRST, RCUR or ALL + * @param string $executiondate Date to execute transfer + * @return int >=0 if OK, <0 if KO */ public function generate($format = 'ALL', $executiondate = '') { @@ -1468,7 +1510,7 @@ class BonPrelevement extends CommonObject $this->total = 0; /* - * section Debiteur (sepa Debiteurs bloc lines) + * Section Debitor (sepa Debiteurs bloc lines) */ $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; @@ -1593,13 +1635,15 @@ class BonPrelevement extends CommonObject $langs->load('withdrawals'); // TODO Add here code to generate a generic file - fputs($this->file, $langs->trans('WithdrawalFileNotCapable', $mysoc->country_code)); + fputs($this->file, $langs->transnoentitiesnoconv('WithdrawalFileNotCapable', $mysoc->country_code)); } fclose($this->file); - if (!empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) { @chmod($this->file, octdec($conf->global->MAIN_UMASK)); - return $result; + } + + return $result; } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index f05e4f422d4..a6bc41734d4 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -5,7 +5,7 @@ * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Frédéric France - * Copyright (C) 2019 Markus Welters + * Copyright (C) 2019 Markus Welters * * 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 @@ -24,7 +24,7 @@ /** * \file htdocs/compta/prelevement/create.php * \ingroup prelevement - * \brief Prelevement creation page + * \brief Page to create a direct debit order or a credit transfer order */ require '../../main.inc.php'; @@ -77,11 +77,17 @@ if (empty($reshook)) } if ($action == 'create') { - // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty + $delayindays = 0; + if ($type != 'bank-transfer') { + $conf->global->PRELEVEMENT_ADDDAYS; + } else { + $conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS; + } $bprev = new BonPrelevement($db); - $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday') + $conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear')); + $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), (GETPOST('reday', 'int') + $delayindays), GETPOST('reyear', 'int')); - $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate); + // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore) + $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type); if ($result < 0) { setEventMessages($bprev->error, $bprev->errors, 'errors'); @@ -257,8 +263,10 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; } -$sql .= " AND f.total_ttc > 0"; +//$sql .= " AND pfd.amount > 0"; +$sql .= " AND f.total_ttc > 0"; // Avoid credit notes $sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.ext_payment_id IS NULL"; if ($type == 'bank-transfer') { $sql .= " AND pfd.fk_facture_fourn = f.rowid"; } else { diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 72c318a1024..ef451146f55 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -22,7 +22,7 @@ /** * \file htdocs/compta/prelevement/index.php * \ingroup prelevement - * \brief Prelevement index page + * \brief Home page for direct debit orders */ @@ -106,7 +106,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; } -$sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid"; +$sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.ext_payment_id IS NULL"; +$sql .= " AND pfd.fk_facture = f.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql .= " AND f.fk_soc = ".$socid; @@ -176,8 +178,9 @@ print '
    '; /* - * Withdraw receipts + * Direct debit orders */ + $limit = 5; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; @@ -194,7 +197,8 @@ if ($result) print"\n\n"; print '
    '; print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -222,7 +226,7 @@ if ($result) $i++; } } else { - print ''; + print ''; } print "
    '.$langs->trans("LastWithdrawalReceipt", $limit).'
    '.$langs->trans("LastWithdrawalReceipt", $limit).''.$langs->trans("Date").''.$langs->trans("Amount").''.$langs->trans("Status").'
    '.$langs->trans("None").'
    '.$langs->trans("None").'

    "; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e80d433e7e0..730e66eaab8 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2388,44 +2388,44 @@ class Societe extends CommonObject $label .= '
    '; - if ($option == 'customer' || $option == 'compta' || $option == 'category' || $option == 'category_supplier') + if ($option == 'customer' || $option == 'compta' || $option == 'category') { - $label .= ''.$langs->trans("ShowCustomer").''; + $label .= ''.$langs->trans("Customer").''; $linkstart = ''; + $label .= ''.$langs->trans("Prospect").''; $linkstart = ''; + $label .= ''.$langs->trans("Supplier").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = 'LT12 1000 0111 0100 1000
    FR14 2004 1010 0505 0001 3M02 606
    LU28 0019 4006 4475 0000
    DE89 3704 0044 0532 0130 00'; } elseif ($val == 'BIC') { $name = 'bic'; $size = 12; + $content = $companybankaccount->bic; if ($companybankaccount->needIBAN()) $require = true; + $tooltip = $langs->trans("Example").': LIABLT2XXXX'; } - print ''.$langs->trans($val).''; + print ''; + if ($tooltip) { + print $form->textwithpicto($langs->trans($val), $tooltip, 4, 'help', '', 0, 3, $name); + } else { + print $langs->trans($val); + } + print ''; print ''; print ''; } From 22448b19f4868e14af7017edbff6320a1c1b9452 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Wed, 1 Jul 2020 22:19:10 +0200 Subject: [PATCH 042/319] FIX : Correct ModuleBuilder left menu --- htdocs/modulebuilder/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index bbc4e08df23..7f544a7e7d5 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2848,7 +2848,7 @@ elseif (!empty($module)) print ''; print ''; - print $menu['left']; + print $menu['leftmenu']; print ''; print ''; From 76f3724191ac2f4b42e7b7136a28593df3b1c8cb Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Wed, 1 Jul 2020 22:34:35 +0200 Subject: [PATCH 043/319] NEW: Appearance tab in TakePOS with more visual parameters --- htdocs/core/lib/takepos.lib.php | 5 ++ htdocs/langs/en_US/cashdesk.lang | 6 +- htdocs/takepos/admin/appearance.php | 130 ++++++++++++++++++++++++++++ htdocs/takepos/admin/setup.php | 9 -- htdocs/takepos/css/pos.css.php | 2 +- htdocs/takepos/index.php | 4 +- 6 files changed, 143 insertions(+), 13 deletions(-) create mode 100644 htdocs/takepos/admin/appearance.php diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index d04fa5f77ef..1a8ace36d0b 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -37,6 +37,11 @@ function takepos_prepare_head() $head[$h][1] = $langs->trans("Parameters"); $head[$h][2] = 'setup'; $h++; + + $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/appearance.php'; + $head[$h][1] = $langs->trans("Appearance"); + $head[$h][2] = 'appearance'; + $h++; $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/receipt.php'; $head[$h][1] = $langs->trans("Receipt"); diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 71a2a992e19..55044a00cec 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -111,4 +111,8 @@ AutoOrder=Order by the customer himself RestaurantMenu=Menu CustomerMenu=Customer menu ScanToMenu=Scan QR code to see the menu -ScanToOrder=Scan QR code to order \ No newline at end of file +ScanToOrder=Scan QR code to order +Appearance=Appearance +HideCategoryImages=Hide Category Images +HideProductImages=Hide Product Images +NumberOfLinesToShow=Number of lines to show in image box \ No newline at end of file diff --git a/htdocs/takepos/admin/appearance.php b/htdocs/takepos/admin/appearance.php new file mode 100644 index 00000000000..1c395fdbb29 --- /dev/null +++ b/htdocs/takepos/admin/appearance.php @@ -0,0 +1,130 @@ + + * Copyright (C) 2011-2017 Juanjo Menent + * Copyright (C) 2019 Andreu Bisquerra Gaya + * + * 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/takepos/admin/terminal.php + * \ingroup takepos + * \brief Setup page for TakePos module + */ + +require '../../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT."/core/lib/takepos.lib.php"; + +// Security check +if (!$user->admin) accessforbidden(); + +$langs->loadLangs(array("admin", "cashdesk", "commercial")); + +/* + * Actions + */ + +if (GETPOST('action', 'alpha') == 'set') +{ + $db->begin(); + + $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_LINES_TO_SHOW", GETPOST('TAKEPOS_LINES_TO_SHOW', 'alpha'), 'chaine', 0, '', $conf->entity); + + dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); + + if (!$res > 0) $error++; + + if (!$error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} elseif (GETPOST('action', 'alpha') == 'setmethod') +{ + dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity); +} + + +/* + * View + */ + +$form = new Form($db); +$formproduct = new FormProduct($db); + +llxHeader('', $langs->trans("CashDeskSetup")); + +$linkback = '
    '.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); +$head = takepos_prepare_head(); +dol_fiche_head($head, 'appearance', 'TakePOS', -1, 'cash-register'); + +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print "\n"; + +// Color theme +print '\n"; + +// Hide category images to speed up +print '\n"; + +// Hide category images to speed up +print '\n"; + +// Terminals +print '\n"; + +print '
    '.$langs->trans("Parameters").''.$langs->trans("Value").'
    '; +print $langs->trans("ColorTheme"); +print ''; +$array = array(0=>"Eldy", 1=>$langs->trans("Colorful")); +print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (empty($conf->global->TAKEPOS_COLOR_THEME) ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0); +print "
    '; +print $langs->trans('HideCategoryImages'); +print ''; +print ajax_constantonoff("TAKEPOS_HIDE_CATEGORY_IMAGES", array(), $conf->entity, 0, 0, 1, 0); +print "
    '; +print $langs->trans('HideProductImages'); +print ''; +print ajax_constantonoff("TAKEPOS_HIDE_PRODUCT_IMAGES", array(), $conf->entity, 0, 0, 1, 0); +print "
    '; +print $langs->trans("NumberOfLinesToShow"); +print ''; +$array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6"); +print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, (empty($conf->global->TAKEPOS_LINES_TO_SHOW) ? '2' : $conf->global->TAKEPOS_LINES_TO_SHOW), 0); +print "
    '; + +print '
    '; + +print '
    '; + +print "\n"; + +print '
    '; + +llxFooter(); +$db->close(); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 541c34e4e12..79f3b729bc4 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -75,7 +75,6 @@ if ($action == 'set') $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ADDON", GETPOST('TAKEPOS_ADDON', 'alpha'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -303,14 +302,6 @@ $htmltext = ''.$langs->trans("AvailableVariables").':
    '; foreach ($substitutionarray as $key => $val) $htmltext .= $key.'
    '; $htmltext .= '
    '; -// Color theme -print ''; -print $langs->trans("ColorTheme"); -print ''; -$array = array(0=>"Eldy", 1=>$langs->trans("Colorful")); -print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (empty($conf->global->TAKEPOS_COLOR_THEME) ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0); -print "\n"; - // Payment numpad print ''; print $langs->trans("Paymentnumpad"); diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index 4c92fe888d2..80271e8bdb3 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -429,7 +429,7 @@ p.description_content{ div.description_content { display: -webkit-box; -webkit-box-orient: vertical; - -webkit-line-clamp: 2; + -webkit-line-clamp: global->TAKEPOS_LINES_TO_SHOW;?>; overflow: hidden; padding-left: 2px; padding-right: 2px; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 135723de966..0b81aa51391 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -982,7 +982,7 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { //echo ''; echo ''; } else { - echo ''; + if (!$conf->global->TAKEPOS_HIDE_CATEGORY_IMAGES) echo ''; } ?> @@ -1015,7 +1015,7 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { print ''; } else { print '
    '; - print ''; + if (!$conf->global->TAKEPOS_HIDE_PRODUCT_IMAGES) print ''; } ?> From d2a78b8aa49fb4b1fe1ce1a0d48aed2e99a07823 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 1 Jul 2020 22:44:18 +0200 Subject: [PATCH 044/319] Update appearance.php --- htdocs/takepos/admin/appearance.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/admin/appearance.php b/htdocs/takepos/admin/appearance.php index 1c395fdbb29..5d3e401d751 100644 --- a/htdocs/takepos/admin/appearance.php +++ b/htdocs/takepos/admin/appearance.php @@ -1,7 +1,7 @@ * Copyright (C) 2011-2017 Juanjo Menent - * Copyright (C) 2019 Andreu Bisquerra Gaya + * Copyright (C) 2019-2020 Andreu Bisquerra Gaya * * 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 +18,7 @@ */ /** - * \file htdocs/takepos/admin/terminal.php + * \file htdocs/takepos/admin/appearance.php * \ingroup takepos * \brief Setup page for TakePos module */ From 9e4d7627f3a4aef826191fb4b4f2aa821bad198c Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 1 Jul 2020 22:55:00 +0200 Subject: [PATCH 045/319] Fix travis --- htdocs/core/lib/takepos.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index 1a8ace36d0b..083e54c66c0 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -37,7 +37,7 @@ function takepos_prepare_head() $head[$h][1] = $langs->trans("Parameters"); $head[$h][2] = 'setup'; $h++; - + $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/appearance.php'; $head[$h][1] = $langs->trans("Appearance"); $head[$h][2] = 'appearance'; From d6ded950ac9d0f6eca6ef3996d57c2524f5a392b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 00:07:18 +0200 Subject: [PATCH 046/319] Update doc --- ChangeLog | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a39c27e119f..edb66756ff2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -104,8 +104,8 @@ NEW: class tool for converting units NEW: Close #13011 Add button create thirdparty when creating intervention NEW: Colorful theme for TakePOS NEW: columns units in product list -NEW: compatibility of translabel with more dict -NEW: Confirm file delete on fracture card +NEW: compatibility of translabel with more dictionaries +NEW: Confirm file delete on invoice card NEW: "contact_civility" for ODT templates NEW: CUPS printing compatibility for TakePOS NEW: Customer command list - Add date start & date end @@ -113,16 +113,11 @@ NEW: display weight in shipment list NEW: Documentation about PHP support in Dolibarr NEW: Donation - Update FR CERFA to 11580*04 NEW: Easier way to setup the different types of tax. Better visibility. -NEW: enable put for agendaevents api NEW: Expedition list - Add date start & date end NEW: Experiment supplier packaging with option PRODUCT_USE_SUPPLIER_PACKAGING: Using price according to the minimum quantity NEW: Export module, add extrafields for Contract and Contract line NEW: Extend retained warranty to be available for all invoices -NEW: filter by product on supplier order API NEW: French new regions -NEW: get documents for categories with RESP API -NEW: get proposal by ref with API -NEW: Hidden option MAIN_TEMP_DIR NEW: hook and data id NEW: hook on ics generation to add more events in eventarray NEW: hook on product load stats @@ -209,6 +204,11 @@ NEW: Bookkeeping by account - Add selectfields & hook NEW: Can force position of legend of graph on right (instead of top) NEW: Can change destination of "Back to list" using a "backtolist" parameter NEW: add more category types from hook +NEW: enable put for agendaevents api +NEW: filter by product on supplier order API +NEW: get documents for categories with RESP API +NEW: get proposal by ref with API +NEW: Hidden option MAIN_TEMP_DIR WARNING: From d76ca6f569588de73f7156040b8838921e5d82ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 00:09:52 +0200 Subject: [PATCH 047/319] Update doc --- ChangeLog | 1 - 1 file changed, 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index edb66756ff2..19c77c702fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -190,7 +190,6 @@ NEW: API filter bankaccounts by category NEW: API filter contacts by category NEW: API filter members by category NEW: API filter projects by category -NEW: API filter thirdpartie by category NEW: API filter thirdparty by category NEW: API filter user by category NEW: API filter warehouses by categorie From 452cca503ae11647a56b8e7c86c4d8200db5a9b6 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Thu, 2 Jul 2020 00:11:17 +0200 Subject: [PATCH 048/319] Fixes --- htdocs/takepos/admin/appearance.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/admin/appearance.php b/htdocs/takepos/admin/appearance.php index 5d3e401d751..f085067197e 100644 --- a/htdocs/takepos/admin/appearance.php +++ b/htdocs/takepos/admin/appearance.php @@ -108,7 +108,7 @@ print ''; print ajax_constantonoff("TAKEPOS_HIDE_PRODUCT_IMAGES", array(), $conf->entity, 0, 0, 1, 0); print "\n"; -// Terminals +// Lines to show print ''; print $langs->trans("NumberOfLinesToShow"); print ''; From 26c6e2d92e4b04164f8df5c6977b34c918173639 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 03:34:28 +0200 Subject: [PATCH 049/319] Clean code --- htdocs/admin/system/constall.php | 2 -- htdocs/admin/system/dolibarr.php | 1 - htdocs/install/step1.php | 5 +---- htdocs/main.inc.php | 27 +-------------------------- 4 files changed, 2 insertions(+), 33 deletions(-) diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 31c5b887122..b3be7fcf267 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -84,7 +84,6 @@ $configfileparameters = array( '?dolibarr_js_CKEDITOR', '?dolibarr_js_JQUERY', '?dolibarr_js_JQUERY_UI', - '?dolibarr_js_JQUERY_FLOT', '?dolibarr_font_DOL_DEFAULT_TTF', '?dolibarr_font_DOL_DEFAULT_TTF_BOLD', 'separator', @@ -132,7 +131,6 @@ $configfilelib = array( 'dolibarr_js_CKEDITOR', 'dolibarr_js_JQUERY', 'dolibarr_js_JQUERY_UI', - 'dolibarr_js_JQUERY_FLOT', 'dolibarr_font_DOL_DEFAULT_TTF', 'dolibarr_font_DOL_DEFAULT_TTF_BOLD', 'separator', diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 6c2d4f6cfef..fdf0f5aed1f 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -317,7 +317,6 @@ $configfileparameters = array( '?dolibarr_js_CKEDITOR' => 'dolibarr_js_CKEDITOR', '?dolibarr_js_JQUERY' => 'dolibarr_js_JQUERY', '?dolibarr_js_JQUERY_UI' => 'dolibarr_js_JQUERY_UI', - '?dolibarr_js_JQUERY_FLOT' => 'dolibarr_js_JQUERY_FLOT', '?dolibarr_font_DOL_DEFAULT_TTF' => 'dolibarr_font_DOL_DEFAULT_TTF', '?dolibarr_font_DOL_DEFAULT_TTF_BOLD' => 'dolibarr_font_DOL_DEFAULT_TTF_BOLD', 'separator4' => '', diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 62a10a0b7b3..87a4d53c03b 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -839,7 +839,7 @@ function write_conf_file($conffile) global $force_dolibarr_lib_TCPDF_PATH, $force_dolibarr_lib_FPDI_PATH; global $force_dolibarr_lib_PHPEXCEL_PATH, $force_dolibarr_lib_GEOIP_PATH; global $force_dolibarr_lib_ODTPHP_PATH, $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP; - global $force_dolibarr_js_CKEDITOR, $force_dolibarr_js_JQUERY, $force_dolibarr_js_JQUERY_UI, $force_dolibarr_js_JQUERY_FLOT; + global $force_dolibarr_js_CKEDITOR, $force_dolibarr_js_JQUERY, $force_dolibarr_js_JQUERY_UI; global $force_dolibarr_font_DOL_DEFAULT_TTF, $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD; $error = 0; @@ -972,9 +972,6 @@ function write_conf_file($conffile) if (empty($force_dolibarr_js_JQUERY_UI)) { fputs($fp, '//'); $force_dolibarr_js_JQUERY_UI = ''; } fputs($fp, '$dolibarr_js_JQUERY_UI=\''.$force_dolibarr_js_JQUERY_UI.'\';'); fputs($fp, "\n"); - if (empty($force_dolibarr_js_JQUERY_FLOT)) { fputs($fp, '//'); $force_dolibarr_js_JQUERY_FLOT = ''; } - fputs($fp, '$dolibarr_js_JQUERY_FLOT=\''.$force_dolibarr_js_JQUERY_FLOT.'\';'); - fputs($fp, "\n"); // Write params to overwrites default font path fputs($fp, "\n"); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 646a8adc770..2f62237bce9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1333,33 +1333,8 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) { print ''."\n"; } - // Flot - if (empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH == 'jflot') { - if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && !defined('DISABLE_JQUERY_FLOT')) { - if (constant('JS_JQUERY_FLOT')) { - print ''."\n"; - print ''."\n"; - print ''."\n"; - } else { - print ''."\n"; - print ''."\n"; - print ''."\n"; - /* Test for jflot 4.2 -> not better than current - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - */ - } - } - } // Chart - if ($conf->global->MAIN_JS_GRAPH == 'chart') { + if (empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH == 'chart') { print ''."\n"; } From ca769a3c6298c0e6338220dcd874c40d785dea00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 03:37:01 +0200 Subject: [PATCH 050/319] Fix scrutinizer errors --- htdocs/core/class/dolreceiptprinter.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 8d9c449b972..352a660d72a 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -552,7 +552,7 @@ class dolReceiptPrinter extends Printer // tags a remplacer par leur valeur avant de parser (dol_value_xxx) $this->template = str_replace('', $object->id, $this->template); $this->template = str_replace('', $object->ref, $this->template); - $this->template = str_replace('', $object->points, $this->template); + //$this->template = str_replace('', $object->points, $this->template); $this->template = str_replace('', dol_print_date($object->date, 'day'), $this->template); $this->template = str_replace('', dol_print_date($object->date, 'dayhour'), $this->template); $this->template = str_replace('', dol_print_date($object->date, '%Y'), $this->template); @@ -563,7 +563,7 @@ class dolReceiptPrinter extends Printer $this->template = str_replace('', $object->thirdparty->firstname, $this->template); $this->template = str_replace('', $object->thirdparty->lastname, $this->template); - $this->template = str_replace('', $object->thirdparty->mail, $this->template); + $this->template = str_replace('', $object->thirdparty->email, $this->template); $this->template = str_replace('', $object->thirdparty->phone, $this->template); $this->template = str_replace('', $object->thirdparty->mobile, $this->template); $this->template = str_replace('', $object->thirdparty->vatintra, $this->template); From 6b16f649280fcb0f6e5fe0eb1a3317e0f04962e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 03:39:47 +0200 Subject: [PATCH 051/319] Fix properties used that does not exists --- htdocs/core/class/dolreceiptprinter.class.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 352a660d72a..f54b25731d8 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -197,17 +197,16 @@ class dolReceiptPrinter extends Printer 'dol_print_object_local_tax2' => 'TotalLT2', 'dol_print_object_total' => 'Total', 'dol_print_object_number' => 'DOL_PRINT_OBJECT_NUMBER', - 'dol_value_object_points' => 'DOL_VALUE_OBJECT_POINTS', + //'dol_value_object_points' => 'DOL_VALUE_OBJECT_POINTS', 'dol_print_order_lines' => 'DOL_PRINT_ORDER_LINES', 'dol_value_customer_firstname' => 'DOL_VALUE_CUSTOMER_FIRSTNAME', 'dol_value_customer_lastname' => 'DOL_VALUE_CUSTOMER_LASTNAME', 'dol_value_customer_mail' => 'DOL_VALUE_CUSTOMER_MAIL', 'dol_value_customer_phone' => 'DOL_VALUE_CUSTOMER_PHONE', - 'dol_value_customer_mobile' => 'DOL_VALUE_CUSTOMER_MOBILE', 'dol_value_customer_skype' => 'DOL_VALUE_CUSTOMER_SKYPE', 'dol_value_customer_tax_number' => 'DOL_VALUE_CUSTOMER_TAX_NUMBER', - 'dol_value_customer_account_balance' => 'DOL_VALUE_CUSTOMER_ACCOUNT_BALANCE', - 'dol_value_customer_points' => 'DOL_VALUE_CUSTOMER_POINTS', + //'dol_value_customer_account_balance' => 'DOL_VALUE_CUSTOMER_ACCOUNT_BALANCE', + //'dol_value_customer_points' => 'DOL_VALUE_CUSTOMER_POINTS', 'dol_value_mysoc_name' => 'DOL_VALUE_MYSOC_NAME', 'dol_value_mysoc_address' => 'Address', 'dol_value_mysoc_zip' => 'Zip', @@ -565,10 +564,10 @@ class dolReceiptPrinter extends Printer $this->template = str_replace('', $object->thirdparty->lastname, $this->template); $this->template = str_replace('', $object->thirdparty->email, $this->template); $this->template = str_replace('', $object->thirdparty->phone, $this->template); - $this->template = str_replace('', $object->thirdparty->mobile, $this->template); - $this->template = str_replace('', $object->thirdparty->vatintra, $this->template); - $this->template = str_replace('', $object->customer_account_balance, $this->template); - $this->template = str_replace('', $object->customer_points, $this->template); + //$this->template = str_replace('', $object->thirdparty->mobile, $this->template); + $this->template = str_replace('', $object->thirdparty->tva_intra, $this->template); + //$this->template = str_replace('', $object->customer_account_balance, $this->template); + //$this->template = str_replace('', $object->customer_points, $this->template); $this->template = str_replace('', $mysoc->name, $this->template); $this->template = str_replace('', $mysoc->address, $this->template); From cfcb40dd2ad9e2f5b3c605140d38dd3c3163e3ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 03:48:32 +0200 Subject: [PATCH 052/319] Fix scrutinizer errors --- htdocs/website/index.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 6605923b254..d59b15e15fe 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1178,7 +1178,7 @@ if (GETPOSTISSET('pageid') && $action == 'delete' && $permissiontodelete) { $res = $object->fetch(0, $websitekey); $website = $object; - $res = $objectpage->fetch($pageid, $object->fk_website); + $res = $objectpage->fetch($pageid, $object->id); if ($res > 0) { @@ -3484,8 +3484,10 @@ if ($action == 'editmeta' || $action == 'createcontainer') $c = new Categorie($db); $cats = $c->containing($objectpage->id, Categorie::TYPE_WEBSITE_PAGE); $arrayselected = array(); - foreach ($cats as $cat) { - $arrayselected[] = $cat->id; + if (is_array($cats)) { + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } } $cate_arbo = $form->select_all_categories(Categorie::TYPE_WEBSITE_PAGE, '', 'parent', null, null, 1); From a5431a40daf64c1e7025ba3e838cee2cea2fb7a0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 2 Jul 2020 10:16:20 +0200 Subject: [PATCH 053/319] FIX missing possibility to change entity when propal cloning --- htdocs/comm/propal/card.php | 15 +++++++-------- htdocs/comm/propal/class/propal.class.php | 4 +++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 28fdc7845d2..996ad2e31af 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -194,7 +194,7 @@ if (empty($reshook)) } } - $result = $object->createFromClone($user, $socid); + $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null)); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit(); @@ -1832,10 +1832,9 @@ if ($action == 'create') print ''; print ''.$langs->trans("CreateEmptyPropal").''; + print ''; } - if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) print ''; - dol_fiche_end(); $langs->load("bills"); @@ -1878,11 +1877,11 @@ if ($action == 'create') if ($action == 'clone') { // Create an array for form $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => - // 1), - array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))); + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')) + ); if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) { $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0101805cd88..3fd122c0103 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1324,9 +1324,10 @@ class Propal extends CommonObject * * @param User $user User making the clone * @param int $socid Id of thirdparty + * @param int $forceentity Entity id to force * @return int New id of clone */ - public function createFromClone(User $user, $socid = 0) + public function createFromClone(User $user, $socid = 0, $forceentity = null) { global $conf, $hookmanager; @@ -1382,6 +1383,7 @@ class Propal extends CommonObject $object->id = 0; $object->ref = ''; + $object->entity = (! empty($forceentity) ? $forceentity : $object->entity); $object->statut = self::STATUS_DRAFT; // Clear fields From 642e75c3dd29b03d7eaf71f21678f05d2f5521d1 Mon Sep 17 00:00:00 2001 From: quentin Date: Thu, 2 Jul 2020 11:34:59 +0200 Subject: [PATCH 054/319] FIX wrong origin --- htdocs/commande/class/commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 54506a4a816..c92de067c8e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1014,7 +1014,7 @@ class Commande extends CommonOrder // Complete vat rate with code $vatrate = $line->tva_tx; if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')'; - + $origin = !empty($line->origin) ? $line->origin : $this->element; $result = $this->addline( $line->desc, $line->subprice, @@ -1039,7 +1039,7 @@ class Commande extends CommonOrder $line->label, $line->array_options, $line->fk_unit, - $this->element, + $origin, $line->id ); if ($result < 0) From b3396a6454e52b2853142f3dbd1e574e00b7813d Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Thu, 2 Jul 2020 14:40:56 +0200 Subject: [PATCH 055/319] better look & feel icon on dropdown --- htdocs/main.inc.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2f62237bce9..1084c07f755 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1884,7 +1884,7 @@ function top_menu_quickadd() @@ -1897,7 +1897,7 @@ function top_menu_quickadd() @@ -1910,7 +1910,7 @@ function top_menu_quickadd() @@ -1923,7 +1923,7 @@ function top_menu_quickadd() @@ -1936,7 +1936,7 @@ function top_menu_quickadd() @@ -1949,7 +1949,7 @@ function top_menu_quickadd() @@ -1962,7 +1962,7 @@ function top_menu_quickadd() @@ -1975,7 +1975,7 @@ function top_menu_quickadd() @@ -1988,7 +1988,7 @@ function top_menu_quickadd() @@ -2001,7 +2001,7 @@ function top_menu_quickadd() @@ -2014,7 +2014,7 @@ function top_menu_quickadd() @@ -2040,7 +2040,7 @@ function top_menu_quickadd() $html.= ' '; @@ -137,14 +147,13 @@ if ($prev_id > 0 || $ref) } else { - $langs->load("errors"); - print $langs->trans("Error"); + dol_print_error($db); } /* * Stats */ - $ligne = new LignePrelevement($db); + $line = new LignePrelevement($db); $sql = "SELECT sum(pl.amount), pl.statut"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl"; @@ -170,7 +179,7 @@ if ($prev_id > 0 || $ref) print ''; - print $ligne->LibStatut($row[1], 1); + print $line->LibStatut($row[1], 1); print ''; print price($row[0]); diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index a404e19184e..8008c9fd51f 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -39,8 +39,13 @@ function prelevement_prepare_head(BonPrelevement $object) $h = 0; $head = array(); + $titleoftab = "WithdrawalsReceipts"; + if ($object->type == 'bank-transfer') { + $titleoftab = "BankTransferReceipts"; + } + $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("WithdrawalsReceipts"); + $head[$h][1] = $langs->trans($titleoftab); $head[$h][2] = 'prelevement'; $h++; diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 841a9c2d480..662c587108a 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -77,12 +77,12 @@ StatusMotif8=Other reason CreateForSepaFRST=Create direct debit file (SEPA FRST) CreateForSepaRCUR=Create direct debit file (SEPA RCUR) CreateAll=Create direct debit file (all) -CreateFileForPaymentByBankTransfer=Create credit transfer (all) +CreateFileForPaymentByBankTransfer=Create file for credit transfer (all) CreateSepaFileForPaymentByBankTransfer=Create credit transfer file (SEPA) CreateGuichet=Only office CreateBanque=Only bank OrderWaiting=Waiting for treatment -NotifyTransmision=Withdrawal Transmission +NotifyTransmision=File transmission NotifyCredit=Withdrawal Credit NumeroNationalEmetter=National Transmitter Number WithBankUsingRIB=For bank accounts using RIB @@ -95,7 +95,8 @@ ShowWithdraw=Show Direct Debit Order IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one direct debit payment order not yet processed, it won't be set as paid to allow prior withdrawal management. DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Payment by direct debit to generate and manage the direct debit order. When direct debit order is closed, payment on invoices will be automatically recorded, and invoices closed if remainder to pay is null. DoCreditTransferBeforePayments=This tab allows you to request a credit transfer order. Once done, go into menu Bank->Payment by credit transfer to generate and manage the credit transfer order. When credit transfer order is closed, payment on invoices will be automatically recorded, and invoices closed if remainder to pay is null. -WithdrawalFile=Withdrawal file +WithdrawalFile=Debit order file +CreditTransferFile=Credit transfer file SetToStatusSent=Set to status "File Sent" ThisWillAlsoAddPaymentOnInvoice=This will also record payments on invoices and will classify them as "Paid" if remain to pay is null StatisticsByLineStatus=Statistics by status of lines @@ -121,6 +122,7 @@ SEPAFrstOrRecur=Type of payment ModeRECUR=Recurring payment ModeFRST=One-off payment PleaseCheckOne=Please check one only +CreditTransferOrderCreated=Credit transfer order %s created DirectDebitOrderCreated=Direct debit order %s created AmountRequested=Amount requested SEPARCUR=SEPA CUR From 8c425ae7967dd63597088d983e2f5a2c425bca04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jul 2020 02:47:46 +0200 Subject: [PATCH 314/319] FIX Bad param --- htdocs/modulebuilder/template/admin/myobject_extrafields.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/admin/myobject_extrafields.php b/htdocs/modulebuilder/template/admin/myobject_extrafields.php index 13a6e7b54c5..065feb6cebe 100644 --- a/htdocs/modulebuilder/template/admin/myobject_extrafields.php +++ b/htdocs/modulebuilder/template/admin/myobject_extrafields.php @@ -68,7 +68,7 @@ $linkback = 'trans("MyObjectExtraFields"), -1, 'account'); From fef180cf86cab3b43deeac0dbda12c116c9b602b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jul 2020 02:54:37 +0200 Subject: [PATCH 315/319] Fix scrutinizer errors --- htdocs/admin/bom_extrafields.php | 2 +- htdocs/admin/mrp_extrafields.php | 2 +- .../template/class/myobject.class.php | 15 +- htdocs/recruitment/COPYING | 621 ------------------ .../class/recruitmentjobposition.class.php | 22 +- .../phpunit/RecruitmentFunctionalTest.php | 304 --------- 6 files changed, 17 insertions(+), 949 deletions(-) delete mode 100644 htdocs/recruitment/COPYING delete mode 100644 htdocs/recruitment/test/phpunit/RecruitmentFunctionalTest.php diff --git a/htdocs/admin/bom_extrafields.php b/htdocs/admin/bom_extrafields.php index 70d7720e994..70303f1dcda 100644 --- a/htdocs/admin/bom_extrafields.php +++ b/htdocs/admin/bom_extrafields.php @@ -68,7 +68,7 @@ $linkback = 'trans("ExtraFields"), -1, 'account'); diff --git a/htdocs/admin/mrp_extrafields.php b/htdocs/admin/mrp_extrafields.php index 55df2a065d0..cab7232f569 100644 --- a/htdocs/admin/mrp_extrafields.php +++ b/htdocs/admin/mrp_extrafields.php @@ -68,7 +68,7 @@ $linkback = 'trans("ExtraFields"), -1, 'account'); diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 9c3bbe0bec0..455f0a3e3d1 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -1060,11 +1060,24 @@ class MyObject extends CommonObject } } + +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; + /** * Class MyObjectLine. You can also remove this and generate a CRUD class for lines objects. */ -class MyObjectLine +class MyObjectLine extends CommonObjectLine { // To complete with content of an object MyObjectLine // We should have a field rowid, fk_myobject and position + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + $this->db = $db; + } } diff --git a/htdocs/recruitment/COPYING b/htdocs/recruitment/COPYING deleted file mode 100644 index 94a04532226..00000000000 --- a/htdocs/recruitment/COPYING +++ /dev/null @@ -1,621 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index adc33ab638d..6d38f47211c 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -884,18 +884,7 @@ class RecruitmentJobPosition extends CommonObject { $this->lines = array(); - $objectline = new RecruitmentJobPositionLine($this->db); - $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_recruitmentjobposition = '.$this->id)); - - if (is_numeric($result)) - { - $this->error = $this->error; - $this->errors = $this->errors; - return $result; - } else { - $this->lines = $result; - return $this->lines; - } + return $this->lines; } /** @@ -1026,12 +1015,3 @@ class RecruitmentJobPosition extends CommonObject return $error; } } - -/** - * Class RecruitmentJobPositionLine. You can also remove this and generate a CRUD class for lines objects. - */ -class RecruitmentJobPositionLine -{ - // To complete with content of an object RecruitmentJobPositionLine - // We should have a field rowid, fk_recruitmentjobposition and position -} diff --git a/htdocs/recruitment/test/phpunit/RecruitmentFunctionalTest.php b/htdocs/recruitment/test/phpunit/RecruitmentFunctionalTest.php deleted file mode 100644 index 0d4de50fe68..00000000000 --- a/htdocs/recruitment/test/phpunit/RecruitmentFunctionalTest.php +++ /dev/null @@ -1,304 +0,0 @@ - - * Copyright (C) 2020 Adminson Alicealalalamdskfldmjgdfgdfhfghgfh - * - * 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 test/phpunit/RecruitmentFunctionalTest.php - * \ingroup recruitment - * \brief Example Selenium test. - * - * Put detailed description here. - */ - -namespace test\functional; - -use PHPUnit_Extensions_Selenium2TestCase_WebDriverException; - -/** - * Class RecruitmentFunctionalTest - * - * Requires chromedriver for Google Chrome - * Requires geckodriver for Mozilla Firefox - * - * @fixme Firefox (Geckodriver/Marionette) support - * @todo Opera linux support - * @todo Windows support (IE, Google Chrome, Mozilla Firefox, Safari) - * @todo OSX support (Safari, Google Chrome, Mozilla Firefox) - * - * @package Testrecruitment - */ -class RecruitmentFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase -{ - // TODO: move to a global configuration file? - /** @var string Base URL of the webserver under test */ - protected static $base_url = 'http://dev.zenfusion.fr'; - /** - * @var string Dolibarr admin username - * @see authenticate - */ - protected static $dol_admin_user = 'admin'; - /** - * @var string Dolibarr admin password - * @see authenticate - */ - protected static $dol_admin_pass = 'admin'; - /** @var int Dolibarr module ID */ - private static $module_id = 500000; // TODO: autodetect? - - /** @var array Browsers to test with */ - public static $browsers = array( - array( - 'browser' => 'Google Chrome on Linux', - 'browserName' => 'chrome', - 'sessionStrategy' => 'shared', - 'desiredCapabilities' => array() - ), - // Geckodriver does not keep the session at the moment?! - // XPath selectors also don't seem to work - //array( - // 'browser' => 'Mozilla Firefox on Linux', - // 'browserName' => 'firefox', - // 'sessionStrategy' => 'shared', - // 'desiredCapabilities' => array( - // 'marionette' => true, - // ), - //) - ); - - /** - * Helper function to select links by href - * - * @param string $value Href - * @return mixed Helper string - */ - protected function byHref($value) - { - $anchor = null; - $anchors = $this->elements($this->using('tag name')->value('a')); - foreach ($anchors as $anchor) { - if (strstr($anchor->attribute('href'), $value)) { - break; - } - } - return $anchor; - } - - /** - * Global test setup - * @return void - */ - public static function setUpBeforeClass() - { - } - - /** - * Unit test setup - * @return void - */ - public function setUp() - { - $this->setSeleniumServerRequestsTimeout(3600); - $this->setBrowserUrl(self::$base_url); - } - - /** - * Verify pre conditions - * @return void - */ - protected function assertPreConditions() - { - } - - /** - * Handle Dolibarr authentication - * @return void - */ - private function authenticate() - { - try { - if ($this->byId('login')) { - $login = $this->byId('username'); - $login->clear(); - $login->value('admin'); - $password = $this->byId('password'); - $password->clear(); - $password->value('admin'); - $this->byId('login')->submit(); - } - } catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { - // Login does not exist. Assume we are already authenticated - } - } - - /** - * Test enabling developer mode - * @return bool - */ - public function testEnableDeveloperMode() - { - $this->url('/admin/const.php'); - $this->authenticate(); - $main_features_level_path = '//input[@value="MAIN_FEATURES_LEVEL"]/following::input[@type="text"]'; - $main_features_level = $this->byXPath($main_features_level_path); - $main_features_level->clear(); - $main_features_level->value('2'); - $this->byName('update')->click(); - // Page reloaded, we need a new XPath - $main_features_level = $this->byXPath($main_features_level_path); - return $this->assertEquals('2', $main_features_level->value(), "MAIN_FEATURES_LEVEL value is 2"); - } - - /** - * Test enabling the module - * - * @depends testEnableDeveloperMode - * @return bool - */ - public function testModuleEnabled() - { - $this->url('/admin/modules.php'); - $this->authenticate(); - $module_status_image_path = '//a[contains(@href, "'.self::$module_id.'")]/img'; - $module_status_image = $this->byXPath($module_status_image_path); - if (strstr($module_status_image->attribute('src'), 'switch_off.png')) { - // Enable the module - $this->byHref('modRecruitment')->click(); - } else { - // Disable the module - $this->byHref('modRecruitment')->click(); - // Reenable the module - $this->byHref('modRecruitment')->click(); - } - // Page reloaded, we need a new Xpath - $module_status_image = $this->byXPath($module_status_image_path); - return $this->assertContains('switch_on.png', $module_status_image->attribute('src'), "Module enabled"); - } - - /** - * Test access to the configuration page - * - * @depends testModuleEnabled - * @return bool - */ - public function testConfigurationPage() - { - $this->url('/custom/recruitment/admin/setup.php'); - $this->authenticate(); - return $this->assertContains('recruitment/admin/setup.php', $this->url(), 'Configuration page'); - } - - /** - * Test access to the about page - * - * @depends testConfigurationPage - * @return bool - */ - public function testAboutPage() - { - $this->url('/custom/recruitment/admin/about.php'); - $this->authenticate(); - return $this->assertContains('recruitment/admin/about.php', $this->url(), 'About page'); - } - - /** - * Test about page is rendering Markdown - * - * @depends testAboutPage - * @return bool - */ - public function testAboutPageRendersMarkdownReadme() - { - $this->url('/custom/recruitment/admin/about.php'); - $this->authenticate(); - return $this->assertEquals( - 'Dolibarr Module Template (aka My Module)', - $this->byTag('h1')->text(), - "Readme title" - ); - } - - /** - * Test box is properly declared - * - * @depends testModuleEnabled - * @return bool - */ - public function testBoxDeclared() - { - $this->url('/admin/boxes.php'); - $this->authenticate(); - return $this->assertContains('recruitmentwidget1', $this->source(), "Box enabled"); - } - - /** - * Test trigger is properly enabled - * - * @depends testModuleEnabled - * @return bool - */ - public function testTriggerDeclared() - { - $this->url('/admin/triggers.php'); - $this->authenticate(); - return $this->assertContains( - 'interface_99_modRecruitment_RecruitmentTriggers.class.php', - $this->byTag('body')->text(), - "Trigger declared" - ); - } - - /** - * Test trigger is properly declared - * - * @depends testTriggerDeclared - * @return bool - */ - public function testTriggerEnabled() - { - $this->url('/admin/triggers.php'); - $this->authenticate(); - return $this->assertContains( - 'tick.png', - $this->byXPath('//td[text()="interface_99_modRecruitment_MyTrigger.class.php"]/following::img')->attribute('src'), - "Trigger enabled" - ); - } - - /** - * Verify post conditions - * @return void - */ - protected function assertPostConditions() - { - } - - /** - * Unit test teardown - * @return void - */ - public function tearDown() - { - } - - /** - * Global test teardown - * @return void - */ - public static function tearDownAfterClass() - { - } -} From 98064f73298fe6e33b7bfcbca8abe7f9526c81e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jul 2020 02:47:46 +0200 Subject: [PATCH 316/319] FIX Bad param --- htdocs/modulebuilder/template/admin/myobject_extrafields.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/admin/myobject_extrafields.php b/htdocs/modulebuilder/template/admin/myobject_extrafields.php index 13a6e7b54c5..065feb6cebe 100644 --- a/htdocs/modulebuilder/template/admin/myobject_extrafields.php +++ b/htdocs/modulebuilder/template/admin/myobject_extrafields.php @@ -68,7 +68,7 @@ $linkback = 'trans("MyObjectExtraFields"), -1, 'account'); From 4e4f0a4575cbff32534b77a7af37174533030dab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jul 2020 09:44:48 +0200 Subject: [PATCH 317/319] Use same case for all sql files --- htdocs/admin/system/database-tables.php | 2 +- htdocs/install/mysql/tables/llx_c_format_cards.sql | 2 +- htdocs/install/mysql/tables/llx_establishment.sql | 2 +- htdocs/install/mysql/tables/llx_expeditiondet_batch.sql | 2 +- htdocs/install/mysql/tables/llx_expensereport_rules.sql | 2 +- htdocs/install/mysql/tables/llx_inventory.sql | 2 +- htdocs/install/mysql/tables/llx_inventorydet.sql | 2 +- htdocs/install/mysql/tables/llx_oauth_state.sql | 2 +- htdocs/install/mysql/tables/llx_oauth_token.sql | 2 +- htdocs/install/mysql/tables/llx_opensurvey_comments.sql | 2 +- htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql | 2 +- htdocs/install/mysql/tables/llx_opensurvey_sondage.sql | 2 +- htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql | 2 +- htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql | 2 +- htdocs/install/mysql/tables/llx_product_batch.sql | 2 +- htdocs/install/mysql/tables/llx_product_lot.sql | 2 +- htdocs/install/mysql/tables/llx_propal_merge_pdf_product.sql | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index 323d9b4c115..97b8237c6f2 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -119,7 +119,7 @@ else print ''.$obj->Engine.''; if (isset($obj->Engine) && $obj->Engine == "MyISAM") { - print ''.$langs->trans("Convert").' InnoDB'; + print ''.$langs->trans("Convert").' InnoDb'; } else { diff --git a/htdocs/install/mysql/tables/llx_c_format_cards.sql b/htdocs/install/mysql/tables/llx_c_format_cards.sql index b69b9eb19d1..d3885b5d256 100644 --- a/htdocs/install/mysql/tables/llx_c_format_cards.sql +++ b/htdocs/install/mysql/tables/llx_c_format_cards.sql @@ -36,4 +36,4 @@ CREATE TABLE llx_c_format_cards custom_x double(24,8) NOT NULL, custom_y double(24,8) NOT NULL, active integer NOT NULL -) ENGINE=InnoDB; +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_establishment.sql b/htdocs/install/mysql/tables/llx_establishment.sql index 89fec8f54e2..83cfadb7307 100644 --- a/htdocs/install/mysql/tables/llx_establishment.sql +++ b/htdocs/install/mysql/tables/llx_establishment.sql @@ -37,5 +37,5 @@ CREATE TABLE llx_establishment ( datec datetime NOT NULL, tms timestamp NOT NULL, status tinyint DEFAULT 1 -) ENGINE=InnoDB; +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql index 7a6a3bfd777..43b64451364 100644 --- a/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql +++ b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql @@ -23,5 +23,5 @@ CREATE TABLE llx_expeditiondet_batch ( batch varchar(128) DEFAULT NULL, qty double NOT NULL DEFAULT '0', fk_origin_stock integer NOT NULL -) ENGINE=InnoDB; +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_expensereport_rules.sql b/htdocs/install/mysql/tables/llx_expensereport_rules.sql index aa6d7553639..2a10cc24a7d 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_rules.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_rules.sql @@ -31,4 +31,4 @@ CREATE TABLE llx_expensereport_rules ( code_expense_rules_type varchar(50) NOT NULL, is_for_all tinyint DEFAULT 0, entity integer DEFAULT 1 -) ENGINE=InnoDB; +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_inventory.sql b/htdocs/install/mysql/tables/llx_inventory.sql index 70e409193aa..4ccb234e26e 100644 --- a/htdocs/install/mysql/tables/llx_inventory.sql +++ b/htdocs/install/mysql/tables/llx_inventory.sql @@ -35,4 +35,4 @@ CREATE TABLE llx_inventory date_validation datetime DEFAULT NULL, import_key varchar(14) -- import key ) -ENGINE=InnoDB; +ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_inventorydet.sql b/htdocs/install/mysql/tables/llx_inventorydet.sql index b4df529433e..161e34183a0 100644 --- a/htdocs/install/mysql/tables/llx_inventorydet.sql +++ b/htdocs/install/mysql/tables/llx_inventorydet.sql @@ -30,4 +30,4 @@ qty_stock double DEFAULT NULL, -- The targeted value. can be filled during dra qty_view double DEFAULT NULL, -- must be filled once regulation is done qty_regulated double DEFAULT NULL -- must be filled once regulation is done ) -ENGINE=InnoDB; +ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_oauth_state.sql b/htdocs/install/mysql/tables/llx_oauth_state.sql index 39ade6bc529..77093f6d1b4 100644 --- a/htdocs/install/mysql/tables/llx_oauth_state.sql +++ b/htdocs/install/mysql/tables/llx_oauth_state.sql @@ -22,4 +22,4 @@ CREATE TABLE llx_oauth_state ( fk_user integer, fk_adherent integer, entity integer DEFAULT 1 -)ENGINE=InnoDB; +)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_oauth_token.sql b/htdocs/install/mysql/tables/llx_oauth_token.sql index bbc236be6c1..145e646230d 100644 --- a/htdocs/install/mysql/tables/llx_oauth_token.sql +++ b/htdocs/install/mysql/tables/llx_oauth_token.sql @@ -24,4 +24,4 @@ CREATE TABLE llx_oauth_token ( fk_user integer, fk_adherent integer, entity integer DEFAULT 1 -)ENGINE=InnoDB; +)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_opensurvey_comments.sql b/htdocs/install/mysql/tables/llx_opensurvey_comments.sql index 74a9d9ec3cb..3fcc5a0abf9 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_comments.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_comments.sql @@ -21,5 +21,5 @@ CREATE TABLE llx_opensurvey_comments ( comment text NOT NULL, tms timestamp, usercomment text -) ENGINE=InnoDB; +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql b/htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql index 044fabc5029..8a15936c86f 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql @@ -20,5 +20,5 @@ CREATE TABLE llx_opensurvey_formquestions ( id_sondage VARCHAR(16), question TEXT, available_answers TEXT -- List of available answers -) ENGINE=InnoDB; +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql index c3f1cdbfee1..0521f533fdd 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql @@ -31,4 +31,4 @@ CREATE TABLE llx_opensurvey_sondage ( allow_spy tinyint NOT NULL DEFAULT 1, tms TIMESTAMP, sujet TEXT -- Not filled if format = 'F'. Question are into table llx_opensurvey_formquestions -) ENGINE=InnoDB; +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql index bd55d256a06..957818db4a1 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql @@ -19,4 +19,4 @@ CREATE TABLE llx_opensurvey_user_formanswers ( fk_user_survey INTEGER NOT NULL, fk_question INTEGER NOT NULL, reponses TEXT -) ENGINE=InnoDB; +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql index 16ef0b2cf7e..a2ddafa1b54 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql @@ -21,4 +21,4 @@ CREATE TABLE llx_opensurvey_user_studs ( id_sondage VARCHAR(16) NOT NULL, reponses VARCHAR(100) NOT NULL, -- Not used for 'F' surveys tms timestamp -) ENGINE=InnoDB; +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_batch.sql b/htdocs/install/mysql/tables/llx_product_batch.sql index 7b09d6a0024..9b736278e3a 100644 --- a/htdocs/install/mysql/tables/llx_product_batch.sql +++ b/htdocs/install/mysql/tables/llx_product_batch.sql @@ -27,5 +27,5 @@ CREATE TABLE llx_product_batch ( batch varchar(128) NOT NULL, qty double NOT NULL DEFAULT 0, import_key varchar(14) DEFAULT NULL -) ENGINE=InnoDB; +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_lot.sql b/htdocs/install/mysql/tables/llx_product_lot.sql index 885f699d800..4d59a46c153 100644 --- a/htdocs/install/mysql/tables/llx_product_lot.sql +++ b/htdocs/install/mysql/tables/llx_product_lot.sql @@ -29,4 +29,4 @@ CREATE TABLE llx_product_lot ( fk_user_creat integer, fk_user_modif integer, import_key integer -) ENGINE=InnoDB; +) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_propal_merge_pdf_product.sql b/htdocs/install/mysql/tables/llx_propal_merge_pdf_product.sql index e081b97969f..0c636b2507c 100644 --- a/htdocs/install/mysql/tables/llx_propal_merge_pdf_product.sql +++ b/htdocs/install/mysql/tables/llx_propal_merge_pdf_product.sql @@ -24,5 +24,5 @@ CREATE TABLE llx_propal_merge_pdf_product ( datec datetime NOT NULL, tms timestamp NOT NULL, import_key varchar(14) DEFAULT NULL -) ENGINE=InnoDB; +) ENGINE=innodb; From 364fb05ed378a004d43cc34ba96f114400c79660 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jul 2020 09:46:31 +0200 Subject: [PATCH 318/319] Fix phpcs --- htdocs/compta/prelevement/class/bonprelevement.class.php | 4 +--- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 8399485b29b..1ac0926792e 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1485,9 +1485,7 @@ class BonPrelevement extends CommonObject $i++; } $nbtotalDrctDbtTxInf = $i; - } - else - { + } else { fputs($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers $result = -2; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e7803ea4d0f..c7440c03500 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1246,7 +1246,7 @@ class CommandeFournisseur extends CommonOrder // $date_commande is deprecated $date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set - if(empty($date)) $date = $now; + if (empty($date)) $date = $now; // Clean parameters if (empty($this->source)) $this->source = 0; From d46d34915eebd58a0a81768b65c857ffff54f560 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Jul 2020 10:23:09 +0200 Subject: [PATCH 319/319] FIX Checkbox "drop table" was not checked when using php method for dump --- htdocs/admin/tools/dolibarr_export.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 6bbaeb7c6c8..e168f5fbdc0 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -302,7 +302,7 @@ if (in_array($type, array('mysql', 'mysqli'))) { print '
    '; print '
    '.$langs->trans('ExportStructure').''; - print ''; + print ''; print ''; print '
    '; print '
    ';