From 7c2b5b614f63611e8cfc28cbdfb7977f3054ef2e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 25 Oct 2020 19:13:09 +0100 Subject: [PATCH 01/77] NEW: preload product description on selection for customer propal/order/invoice --- htdocs/comm/propal/card.php | 7 +++- htdocs/commande/card.php | 5 +++ htdocs/compta/facture/card.php | 5 +++ htdocs/contrat/card.php | 6 ++++ htdocs/core/tpl/objectline_create.tpl.php | 40 ++++++++++++++++------- htdocs/fourn/facture/card.php | 5 +++ htdocs/product/ajax/products.php | 35 ++++++++++++++++++-- 7 files changed, 87 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 4a4cf3c37dd..3a9fc38fbaf 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -995,11 +995,16 @@ if (empty($reshook)) $outputlangs->setDefaultLang($newlang); } - $desc = (!empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; + $desc = (!empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description; } else { $desc = $prod->description; } + //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time + if ($product_desc==$desc) { + $product_desc=''; + } + if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc = $product_desc; else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 596fe4e94bc..585b85def0b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -854,6 +854,11 @@ if (empty($reshook)) $desc = $prod->description; } + //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time + if ($product_desc==$desc) { + $product_desc=''; + } + if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc = $product_desc; else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 94f817114aa..6b56d39ba3f 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2068,6 +2068,11 @@ if (empty($reshook)) $desc = $prod->description; } + //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time + if ($product_desc==$desc) { + $product_desc=''; + } + if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc = $product_desc; else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 64b3275379a..f3dc0355331 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -499,6 +499,12 @@ if (empty($reshook)) } $desc = $prod->description; + + //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time + if ($product_desc==$desc) { + $product_desc=''; + } + if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc = $product_desc; else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index d177ce7637c..ec73bf9725b 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -514,13 +514,13 @@ if (!empty($usemargins) && $user->rights->margins->creer) global->DISPLAY_MARGIN_RATES)) { ?> $("input[name='np_marginRate']:first").blur(function(e) { - return checkFreeLine(e, "np_marginRate"); + return checkFreeLine(e, "np_marginRate"); }); global->DISPLAY_MARK_RATES)) { ?> $("input[name='np_markRate']:first").blur(function(e) { - return checkFreeLine(e, "np_markRate"); + return checkFreeLine(e, "np_markRate"); }); rights->margins->creer) var rate = $("input[name='"+npRate+"']:first"); if (rate.val() == '') - return true; + return true; if (! $.isNumeric(rate.val().replace(',','.'))) { - alert('trans("rateMustBeNumeric")); ?>'); - e.stopPropagation(); - setTimeout(function () { rate.focus() }, 50); - return false; + alert('trans("rateMustBeNumeric")); ?>'); + e.stopPropagation(); + setTimeout(function () { rate.focus() }, 50); + return false; } if (npRate == "np_markRate" && rate.val() >= 100) { - alert('trans("markRateShouldBeLesserThan100")); ?>'); - e.stopPropagation(); - setTimeout(function () { rate.focus() }, 50); - return false; + alert('trans("markRateShouldBeLesserThan100")); ?>'); + e.stopPropagation(); + setTimeout(function () { rate.focus() }, 50); + return false; } var price = 0; @@ -659,7 +659,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) ?> var pbq = parseInt($('option:selected', this).attr('data-pbq')); /* If product was selected with a HTML select */ if (isNaN(pbq)) { pbq = jQuery('#idprod').attr('data-pbq'); } /* If product was selected with a HTML input with autocomplete */ - //console.log(pbq); if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0) { @@ -675,6 +674,23 @@ if (!empty($usemargins) && $user->rights->margins->creer) function(data) { console.log("Load unit price end, we got value "+data.price_ht); jQuery("#price_ht").val(data.price_ht); + global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { ?> + var proddesc = data.desc_trans; + + var proddesc = data.desc; + + console.log("Load desciption into text area : "+proddesc); + global->FCKEDITOR_ENABLE_DETAILS)) { ?> + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") + { + var editor = CKEDITOR.instances['dp_desc']; + if (editor) { + editor.setData(proddesc); + } + } + + jQuery('#dp_desc').text(proddesc); + }, 'json' ); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 542a4a09274..45fb10b525a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1294,6 +1294,11 @@ if (empty($reshook)) $desc = $productsupplier->desc_supplier; } else $desc = $productsupplier->description; + //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time + if ($product_desc==$desc) { + $product_desc=''; + } + if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); $type = $productsupplier->type; diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 7441d88abc0..273eef35300 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -71,7 +71,9 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) { $outref = $object->ref; $outlabel = $object->label; + $outlabel_trans =''; $outdesc = $object->description; + $outdesc_trans =''; $outtype = $object->type; $outqty = 1; $outdiscount = 0; @@ -79,10 +81,25 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) $found = false; $price_level = 1; - if ($socid > 0 && !empty($conf->global->PRODUIT_MULTIPRICES)) { + + if ($socid > 0) { $thirdpartytemp = new Societe($db); $thirdpartytemp->fetch($socid); - $price_level = $thirdpartytemp->price_level; + //Load translation description and label + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $newlang = $thirdpartytemp->default_lang; + + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outdesc_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["description"])) ? $object->multilangs[$outputlangs->defaultlang]["description"] : $object->description; + $outlabel_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["label"])) ? $object->multilangs[$outputlangs->defaultlang]["label"] : $object->label; + } + } + + if (!empty($conf->global->PRODUIT_MULTIPRICES)) { + $price_level = $thirdpartytemp->price_level; + } } // Price by qty @@ -158,7 +175,19 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) $outtva_tx = $object->tva_tx; } - $outjson = array('ref' => $outref, 'label' => $outlabel, 'desc' => $outdesc, 'type' => $outtype, 'price_ht' => $outprice_ht, 'price_ttc' => $outprice_ttc, 'pricebasetype' => $outpricebasetype, 'tva_tx' => $outtva_tx, 'qty' => $outqty, 'discount' => $outdiscount); + $outjson = array( + 'ref' => $outref, + 'label' => $outlabel, + 'label_trans' => $outlabel_trans, + 'desc' => $outdesc, + 'desc_trans' => $outdesc_trans, + 'type' => $outtype, + 'price_ht' => $outprice_ht, + 'price_ttc' => $outprice_ttc, + 'pricebasetype' => $outpricebasetype, + 'tva_tx' => $outtva_tx, + 'qty' => $outqty, + 'discount' => $outdiscount); } echo json_encode($outjson); From 925dfd36b5d4559a9075c218d40250fde8ff39ea Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sun, 25 Oct 2020 19:15:10 +0100 Subject: [PATCH 02/77] syntax --- htdocs/fourn/facture/card.php | 5 ----- htdocs/product/ajax/products.php | 9 +++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 45fb10b525a..542a4a09274 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1294,11 +1294,6 @@ if (empty($reshook)) $desc = $productsupplier->desc_supplier; } else $desc = $productsupplier->description; - //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time - if ($product_desc==$desc) { - $product_desc=''; - } - if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); $type = $productsupplier->type; diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 273eef35300..c2b698c8e04 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -85,6 +85,11 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) if ($socid > 0) { $thirdpartytemp = new Societe($db); $thirdpartytemp->fetch($socid); + + if (!empty($conf->global->PRODUIT_MULTIPRICES)) { + $price_level = $thirdpartytemp->price_level; + } + //Load translation description and label if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $newlang = $thirdpartytemp->default_lang; @@ -96,10 +101,6 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) $outlabel_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["label"])) ? $object->multilangs[$outputlangs->defaultlang]["label"] : $object->label; } } - - if (!empty($conf->global->PRODUIT_MULTIPRICES)) { - $price_level = $thirdpartytemp->price_level; - } } // Price by qty From 76824c868bdadc3268cfab95a4b49820bfaa224d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 26 Oct 2020 16:31:07 +0100 Subject: [PATCH 03/77] clean get price for fourn and labal for supplier coducment --- htdocs/core/class/html.form.class.php | 30 +++++++- htdocs/core/lib/ajax.lib.php | 40 ++++++++--- htdocs/core/tpl/objectline_create.tpl.php | 83 +++++++++++++++++------ htdocs/fourn/commande/card.php | 4 +- htdocs/fourn/facture/card.php | 2 +- htdocs/product/fournisseurs.php | 2 +- 6 files changed, 127 insertions(+), 34 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bf52ff5871a..397d1a008cf 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2737,6 +2737,12 @@ class Form $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,"; $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,"; $sql .= " pfp.supplier_reputation"; + // if we use supplier description of the products + if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) { + $sql .= " ,pfp.desc_fourn as description"; + } else { + $sql .= " ,p.description"; + } // Units if ($conf->global->PRODUCT_USE_UNITS) { $sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units"; @@ -2766,7 +2772,11 @@ class Form foreach ($scrit as $crit) { if ($i > 0) $sql .= " AND "; - $sql .= "(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%')"; + $sql .= "(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'"; + if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) { + $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'"; + } + $sql .= ")"; $i++; } if (count($scrit) > 1) $sql .= ")"; @@ -2956,8 +2966,9 @@ class Form if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) $opt .= ' disabled'; if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { - $opt .= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqup="'.$objp->unitprice.'" data-pbqpercent="'.$objp->remise_percent.'"'; + $opt .= ' data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'"'; } + $opt .= ' data-description="'.dol_escape_htmltag($objp->description).'"'; $opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"'; $opt .= '>'; @@ -2971,7 +2982,20 @@ class Form // "key" value of json key array is used by jQuery automatically as selected value // "label" value of json key array is used by jQuery automatically as text for combo box $out .= $opt; - array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'up'=>$objp->unitprice, 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false))); + array_push($outarray, + array('key'=>$outkey, + 'value'=>$outref, + 'label'=>$outval, + 'qty'=>$outqty, + 'up'=>$objp->unitprice, + 'discount'=>$outdiscount, + 'type'=>$outtype, + 'duration_value'=>$outdurationvalue, + 'duration_unit'=>$outdurationunit, + 'disabled'=>(empty($objp->idprodfournprice) ?true:false), + 'description'=>$objp->description + ) + ); // Exemple of var_dump $outarray // array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp" // ["label"]=>string(76) "ppp (fff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)" diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 10fa477600a..9b225967eb1 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -134,7 +134,11 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen } return { label: label, value: item.value, id: item.key, disabled: item.disabled, update: update, textarea: textarea, - pbq: item.pbq, type: item.type, qty: item.qty, discount: item.discount, pricebasetype: item.pricebasetype, price_ht: item.price_ht, price_ttc: item.price_ttc } + pbq: item.pbq, + type: item.type, qty: item.qty, discount: item.discount, + pricebasetype: item.pricebasetype, price_ht: item.price_ht, + price_ttc: item.price_ttc, + up: item.up, description : item.description} })); } else console.error("Error: Ajax url '.$url.($urloption ? '?'.$urloption : '').' has returned an empty page. Should be an empty json array."); @@ -146,14 +150,34 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen console.log("Call change on input '.$htmlname.' because of select definition of autocomplete select call on input#search_'.$htmlname.'"); console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective"); - //console.log(ui.item); - $("#'.$htmlname.'").attr("data-pbq", ui.item.pbq); - $("#'.$htmlname.'").attr("data-pbqup", ui.item.price_ht); - $("#'.$htmlname.'").attr("data-pbqbase", ui.item.pricebasetype); - $("#'.$htmlname.'").attr("data-pbqqty", ui.item.qty); - $("#'.$htmlname.'").attr("data-pbqpercent", ui.item.discount); + console.log(ui.item); + //For supplier price + $("#'.$htmlname.'").attr("data-up", ui.item.up); + $("#'.$htmlname.'").attr("data-discount", ui.item.discount); + $("#'.$htmlname.'").attr("data-qty", ui.item.qty); + $("#'.$htmlname.'").attr("data-description", ui.item.description); - $("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value + //For customer price + '; + + if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { + $script .= ' + $("#' . $htmlname . '").attr("data-pbq", ui.item.pbq); + $("#' . $htmlname . '").attr("data-pbqup", ui.item.price_ht); + $("#' . $htmlname . '").attr("data-pbqbase", ui.item.pricebasetype); + $("#' . $htmlname . '").attr("data-pbqqty", ui.item.qty); + $("#' . $htmlname . '").attr("data-pbqpercent", ui.item.discount); + '; + } else { + $script .= ' + $("#' . $htmlname . '").attr("data-up", ui.item.price_ht); + $("#' . $htmlname . '").attr("data-base", ui.item.pricebasetype); + $("#' . $htmlname . '").attr("data-qty", ui.item.qty); + $("#' . $htmlname . '").attr("data-discount", ui.item.discount); + '; + } + $script .= ' + $("#'.$htmlname.'").val(ui.item.id).trigger("change"); // Select new value // Disable an element if (options.option_disabled) { console.log("Make action option_disabled on #"+options.option_disabled+" with disabled="+ui.item.disabled) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index ec73bf9725b..ba6b4e1bb1b 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -602,39 +602,39 @@ if (!empty($usemargins) && $user->rights->margins->creer) }); $("#prod_entry_mode_free").on( "click", function() { - setforfree(); + setforfree(); }); $("#select_type").change(function() { - setforfree(); + setforfree(); if (jQuery('#select_type').val() >= 0) { /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ - jQuery('#dp_desc').focus(); - /* focus if CKEDITOR */ - if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") - { - var editor = CKEDITOR.instances['dp_desc']; - if (editor) { editor.focus(); } - } + jQuery('#dp_desc').focus(); + /* focus if CKEDITOR */ + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") + { + var editor = CKEDITOR.instances['dp_desc']; + if (editor) { editor.focus(); } + } } console.log("Hide/show date according to product type"); if (jQuery('#select_type').val() == '0') { - jQuery('#trlinefordates').hide(); - jQuery('.divlinefordates').hide(); + jQuery('#trlinefordates').hide(); + jQuery('.divlinefordates').hide(); } else { - jQuery('#trlinefordates').show(); - jQuery('.divlinefordates').show(); + jQuery('#trlinefordates').show(); + jQuery('.divlinefordates').show(); } }); $("#prod_entry_mode_predef").on( "click", function() { - console.log("click prod_entry_mode_predef"); - setforpredef(); - jQuery('#trlinefordates').show(); + console.log("click prod_entry_mode_predef"); + setforpredef(); + jQuery('#trlinefordates').show(); }); rights->margins->creer) 'json' ); } - rights->margins->creer) @@ -804,7 +804,10 @@ if (!empty($usemargins) && $user->rights->margins->creer) } ?> - /* To process customer price per quantity (CUSTOMER_PRICE_PER_QTY works only if combo product is not an ajax after x key pressed) */ + global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) + {?> + /* To process customer price per quantity (PRODUIT_CUSTOMER_PRICES_BY_QTY works only if combo product is not an ajax after x key pressed) */ var pbq = parseInt($('option:selected', this).attr('data-pbq')); // When select is done from HTML select if (isNaN(pbq)) { pbq = jQuery('#idprod').attr('data-pbq'); } // When select is done from HTML input with autocomplete var pbqup = parseFloat($('option:selected', this).attr('data-pbqup')); @@ -816,7 +819,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent')); if (isNaN(pbqpercent)) { pbqpercent = jQuery('#idprod').attr('data-pbqpercent'); } - if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0) + if ((jQuery('#idprod').val() > 0) && ! isNaN(pbq) && pbq > 0) { var pbqupht = pbqup; /* TODO support of price per qty TTC not yet available */ @@ -832,6 +835,48 @@ if (!empty($usemargins) && $user->rights->margins->creer) jQuery("#remise_percent").val(pbqpercent); } } + + //Deal with supplier + if (jQuery('#idprodfournprice').val() >0) + { + var up = parseFloat($('option:selected', this).attr('data-up')); // When select is done from HTML select + if (isNaN(up)) { up = parseFloat(jQuery('#idprodfournprice').attr('data-up'));} // When select is done from HTML input with autocomplete + + var qty = parseFloat($('option:selected', this).attr('data-qty')); + if (isNaN(qty)) { qty = parseFloat(jQuery('#idprodfournprice').attr('data-qty'));} + + var discount = parseFloat($('option:selected', this).attr('data-discount')); + if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));} + + var description = $('option:selected', this).attr('data-description'); + if (typeof description == 'undefined') { description = jQuery('#idprodfournprice').attr('data-description'); } + console.log("We find supplier price :"+up+" qty: "+qty+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val()); + + jQuery("#price_ht").val(up); + if (jQuery("#qty").val() < qty) + { + jQuery("#qty").val(qty); + } + if (jQuery("#remise_percent").val() < discount) + { + jQuery("#remise_percent").val(discount); + } + + console.log("Load desciption into text area : "+description); + global->FCKEDITOR_ENABLE_DETAILS)) { ?> + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") + { + var editor = CKEDITOR.instances['dp_desc']; + if (editor) { + editor.setData(description); + } + } + + jQuery('#dp_desc').text(description); + + } else { jQuery("#pbq").val(''); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index e202b3e8efd..e5ddc3b1b75 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -356,7 +356,7 @@ if (empty($reshook)) // Set if we used free entry or predefined product $predef = ''; - $product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : ''); + $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); $prod_entry_mode = GETPOST('prod_entry_mode'); @@ -475,7 +475,7 @@ if (empty($reshook)) $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $desc = (!empty($productsupplier->multilangs [$outputlangs->defaultlang] ["description"])) ? $productsupplier->multilangs [$outputlangs->defaultlang] ["description"] : $productsupplier->description; + $desc = (!empty($productsupplier->multilangs[$outputlangs->defaultlang]["description"])) ? $productsupplier->multilangs[$outputlangs->defaultlang]["description"] : $productsupplier->description; } else { $desc = $productsupplier->description; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c304a4edce7..3f9ea28c420 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1180,7 +1180,7 @@ if (empty($reshook)) // Set if we used free entry or predefined product $predef = ''; - $product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : ''); + $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index b9a8d6c3b68..41c38c82ba7 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -166,7 +166,7 @@ if (empty($reshook)) $price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode $delivery_time_days = GETPOST('delivery_time_days', 'int') ? GETPOST('delivery_time_days', 'int') : ''; $supplier_reputation = GETPOST('supplier_reputation'); - $supplier_description = GETPOST('supplier_description', 'alpha'); + $supplier_description = GETPOST('supplier_description', 'restricthtml'); $barcode = GETPOST('barcode', 'alpha'); $fk_barcode_type = GETPOST('fk_barcode_type', 'int'); $packaging = price2num(GETPOST("packaging", 'alphanohtml'), 'MS'); From a53e9077069e4ab467ac94f90a527b8991d3204b Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 26 Oct 2020 15:32:00 +0000 Subject: [PATCH 04/77] Fixing style errors. --- htdocs/core/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index ba6b4e1bb1b..c69b57a90d0 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -695,7 +695,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) 'json' ); } - rights->margins->creer) @@ -835,7 +835,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) jQuery("#remise_percent").val(pbqpercent); } } - //Deal with supplier From 9aa3368627a052592a342cdeb41dc22d279444fd Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 26 Oct 2020 16:33:13 +0100 Subject: [PATCH 05/77] syntax --- htdocs/core/lib/ajax.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 9b225967eb1..f8ec1d5ead1 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -150,7 +150,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen console.log("Call change on input '.$htmlname.' because of select definition of autocomplete select call on input#search_'.$htmlname.'"); console.log("Selected id = "+ui.item.id+" - If this value is null, it means you select a record with key that is null so selection is not effective"); - console.log(ui.item); + //console.log(ui.item); //For supplier price $("#'.$htmlname.'").attr("data-up", ui.item.up); $("#'.$htmlname.'").attr("data-discount", ui.item.discount); From 2c772cd8bb2b046e5490d3f0f73db6bd9dc2876b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 27 Oct 2020 09:52:04 +0100 Subject: [PATCH 06/77] try to make it work for experimental PRODUIT_CUSTOMER_PRICES_BY_QTY option --- htdocs/core/class/html.form.class.php | 45 +++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 397d1a008cf..ff83173be5e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2150,7 +2150,9 @@ class Form if (!empty($conf->global->MAIN_MULTILANGS)) { $sql .= ", pl.label as label_translated"; + $sql .= ", pl.description as description_translated"; $selectFields .= ", label_translated"; + $selectFields .= ", description_translated"; } // Price by quantity if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) @@ -2190,7 +2192,18 @@ class Form // Multilang : we add translation if (!empty($conf->global->MAIN_MULTILANGS)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang='".$this->db->escape($langs->getDefaultLang())."'"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid "; + if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && !empty($socid)) { + $soc = new Societe($db); + $result = $soc->fetch($socid); + if ($result > 0 && !empty($soc->default_lang)) { + $sql .= " AND pl.lang='" . $this->db->escape($soc->default_lang) . "'"; + } else { + $sql .= " AND pl.lang='".$this->db->escape($langs->getDefaultLang())."'"; + } + } else { + $sql .= " AND pl.lang='".$this->db->escape($langs->getDefaultLang())."'"; + } } if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { @@ -2403,7 +2416,9 @@ class Form $outval = ''; $outref = ''; $outlabel = ''; + $outlabel_translated = ''; $outdesc = ''; + $outdesc_translated = ''; $outbarcode = ''; $outorigin = ''; $outtype = ''; @@ -2424,6 +2439,11 @@ class Form $outref = $objp->ref; $outlabel = $objp->label; $outdesc = $objp->description; + if (!empty($conf->global->MAIN_MULTILANGS)) + { + $outlabel_translated = $objp->label_translated; + $outdesc_translated = $objp->description_translated; + } $outbarcode = $objp->barcode; $outorigin = $objp->fk_country; $outpbq = empty($objp->price_by_qty_rowid) ? '' : $objp->price_by_qty_rowid; @@ -2485,6 +2505,10 @@ class Form elseif ($objp->stock <= 0) $opt .= ' class="product_line_stock_too_low"'; } } + if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $opt .= ' data-labeltrans="'.$outlabel_translated.'"'; + $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"'; + } $opt .= '>'; $opt .= $objp->ref; if ($outbarcode) $opt .= ' ('.$outbarcode.')'; @@ -2655,7 +2679,24 @@ class Form } $opt .= "\n"; - $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'pbq'=>$outpbq); + $optJson = array( + 'key'=>$outkey, + 'value'=>$outref, + 'label'=>$outval, + 'label2'=>$outlabel, + 'desc'=>$outdesc, + 'type'=>$outtype, + 'price_ht'=>price2num($outprice_ht), + 'price_ttc'=>price2num($outprice_ttc), + 'pricebasetype'=>$outpricebasetype, + 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, + 'discount'=>$outdiscount, + 'duration_value'=>$outdurationvalue, + 'duration_unit'=>$outdurationunit, + 'pbq'=>$outpbq, + 'labeltrans'=>$outlabel_translated, + 'desctrans'=>$outdesc_translated + ); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From d77a0b40a8923049710455d633911416cd66ada8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 28 Oct 2020 16:37:41 +0100 Subject: [PATCH 07/77] tested and approuve feaure #15036 --- htdocs/comm/propal/card.php | 4 +- htdocs/commande/card.php | 4 +- htdocs/compta/facture/card.php | 4 +- htdocs/contrat/card.php | 4 +- htdocs/core/tpl/objectline_create.tpl.php | 65 +++++++++++++++++------ htdocs/fourn/commande/card.php | 8 ++- htdocs/fourn/facture/card.php | 7 ++- htdocs/langs/en_US/admin.lang | 4 +- htdocs/product/admin/product.php | 23 ++++++++ htdocs/product/ajax/products.php | 3 ++ 10 files changed, 98 insertions(+), 28 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f03986d471c..47dd722b5b1 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -793,7 +793,7 @@ if (empty($reshook)) } elseif ($action == 'addline' && $usercancreate) { // Add line // Set if we used free entry or predefined product $predef = ''; - $product_desc = (GETPOSTISSET('dp_desc') ?GETPOST('dp_desc', 'restricthtml') : ''); + $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $price_ht = price2num(GETPOST('price_ht')); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht')); $prod_entry_mode = GETPOST('prod_entry_mode'); @@ -1001,7 +1001,7 @@ if (empty($reshook)) } //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time - if ($product_desc==$desc) { + if ($product_desc==$desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { $product_desc=''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 6572a383532..1bdce17f564 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -640,7 +640,7 @@ if (empty($reshook)) // Set if we used free entry or predefined product $predef = ''; - $product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : ''); + $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $price_ht = GETPOST('price_ht'); $price_ht_devise = GETPOST('multicurrency_price_ht'); $prod_entry_mode = GETPOST('prod_entry_mode'); @@ -855,7 +855,7 @@ if (empty($reshook)) } //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time - if ($product_desc==$desc) { + if ($product_desc==$desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { $product_desc=''; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 80e60dd8784..4602e968220 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1902,7 +1902,7 @@ if (empty($reshook)) // Set if we used free entry or predefined product $predef = ''; - $product_desc = (GETPOST('dp_desc', 'none') ?GETPOST('dp_desc', 'restricthtml') : ''); + $product_desc =(GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $price_ht = price2num(GETPOST('price_ht')); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht')); $prod_entry_mode = GETPOST('prod_entry_mode', 'alpha'); @@ -2073,7 +2073,7 @@ if (empty($reshook)) } //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time - if ($product_desc==$desc) { + if ($product_desc==$desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { $product_desc=''; } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 034709ef110..3265e2f5866 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -383,7 +383,7 @@ if (empty($reshook)) { // Set if we used free entry or predefined product $predef = ''; - $product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : ''); + $product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : ''); $price_ht = price2num(GETPOST('price_ht')); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht')); if (GETPOST('prod_entry_mode', 'alpha') == 'free') @@ -501,7 +501,7 @@ if (empty($reshook)) $desc = $prod->description; //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time - if ($product_desc==$desc) { + if ($product_desc==$desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { $product_desc=''; } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index c69b57a90d0..f1faf50e991 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -674,13 +674,18 @@ if (!empty($usemargins) && $user->rights->margins->creer) function(data) { console.log("Load unit price end, we got value "+data.price_ht); jQuery("#price_ht").val(data.price_ht); - global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { ?> + global->PRODUIT_AUTOFILL_DESC)) { + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { ?> var proddesc = data.desc_trans; - + var proddesc = data.desc; - + console.log("Load desciption into text area : "+proddesc); - global->FCKEDITOR_ENABLE_DETAILS)) { ?> + global->FCKEDITOR_ENABLE_DETAILS)) { ?> if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { var editor = CKEDITOR.instances['dp_desc']; @@ -688,9 +693,13 @@ if (!empty($usemargins) && $user->rights->margins->creer) editor.setData(proddesc); } } - + jQuery('#dp_desc').text(proddesc); - + + }, 'json' ); @@ -834,7 +843,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { jQuery("#remise_percent").val(pbqpercent); } - } + } else { jQuery("#pbq").val(''); } @@ -850,8 +859,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) var discount = parseFloat($('option:selected', this).attr('data-discount')); if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));} - var description = $('option:selected', this).attr('data-description'); - if (typeof description == 'undefined') { description = jQuery('#idprodfournprice').attr('data-description'); } console.log("We find supplier price :"+up+" qty: "+qty+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val()); jQuery("#price_ht").val(up); @@ -864,24 +871,48 @@ if (!empty($usemargins) && $user->rights->margins->creer) jQuery("#remise_percent").val(discount); } + global->PRODUIT_AUTOFILL_DESC)) { + ?> + var description = $('option:selected', this).attr('data-description'); + if (typeof description == 'undefined') { description = jQuery('#idprodfournprice').attr('data-description'); } + console.log("Load desciption into text area : "+description); - global->FCKEDITOR_ENABLE_DETAILS)) { ?> + global->FCKEDITOR_ENABLE_DETAILS)) { ?> if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { var editor = CKEDITOR.instances['dp_desc']; if (editor) { - editor.setData(description); + editor.setData(description); } } - + jQuery('#dp_desc').text(description); - - } - else - { - jQuery("#pbq").val(''); + + } else if (jQuery('#idprodfournprice').length > 0) { + global->PRODUIT_AUTOFILL_DESC)) { + if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?> + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") + { + var editor = CKEDITOR.instances['dp_desc']; + if (editor) { + editor.setData(''); + } + } + + jQuery('#dp_desc').text(''); + } + /* To set focus */ if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 42817e2ea28..f7c963f5e29 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -484,7 +484,13 @@ if (empty($reshook)) $desc = $productsupplier->desc_supplier; } - if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); + //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time + if ($product_desc==$desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { + $product_desc=''; + } + + if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc = $product_desc; + if (!empty($product_desc) && trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); $type = $productsupplier->type; if ($price_ht != '' || $price_ht_devise != '') { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 9849e3b6223..a6bc58879c1 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1294,7 +1294,12 @@ if (empty($reshook)) $desc = $productsupplier->desc_supplier; } else $desc = $productsupplier->description; - if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); + //If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time + if ($product_desc==$desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { + $product_desc=''; + } + if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) $desc = $product_desc; + if (!empty($product_desc) && trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); $type = $productsupplier->type; if ($price_ht != '' || $price_ht_devise != '') { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e47390b9ce0..c2bcdef711f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1587,6 +1587,8 @@ ServiceSetup=Services module setup ProductServiceSetup=Products and Services modules setup NumberOfProductShowInSelect=Maximum number of products to show in combo select lists (0=no limit) ViewProductDescInFormAbility=Display product descriptions in forms (otherwise shown in a tooltip popup) +DoNotAddProductDescAtAddLines=Do not add product description (from product card) on submit add lines on forms +OnProductSelectAddProductDesc=On product selection in forms get the production description into description line MergePropalProductCard=Activate in product/service Attached Files tab an option to merge product PDF document to proposal PDF azur if product/service is in the proposal ViewProductDescInThirdpartyLanguageAbility=Display products descriptions in the language of the third party UseSearchToSelectProductTooltip=Also if you have a large number of products (> 100 000), you can increase speed by setting constant PRODUCT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. @@ -2067,4 +2069,4 @@ TemplateDeleted=Template deleted MailToSendEventPush=Event reminder email SwitchThisForABetterSecurity=Switching this value to %s is recommended for more security DictionaryProductNature= Nature of product -CountryIfSpecificToOneCountry=Country (if specific to a given country) \ No newline at end of file +CountryIfSpecificToOneCountry=Country (if specific to a given country) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 313a27884ff..e7003c6ee47 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -145,6 +145,12 @@ if ($action == 'other') $value = GETPOST('activate_useProdFournDesc', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_FOURN_TEXTS", $value, 'chaine', 0, '', $conf->entity); + $value = GETPOST('activate_FillProductDescAuto', 'alpha'); + $res = dolibarr_set_const($db, "PRODUIT_AUTOFILL_DESC", $value, 'chaine', 0, '', $conf->entity); + + $value = GETPOST('activate_DoNotAddStdProductDescOnAddLine', 'alpha'); + $res = dolibarr_set_const($db, "MAIN_NO_CONCAT_DESCRIPTION", $value, 'chaine', 0, '', $conf->entity); + if ($value) { $sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1"; $resql = $db->query($sql_test); @@ -630,6 +636,23 @@ print $form->selectyesno("activate_viewProdDescInForm", $conf->global->PRODUIT_D print ''; print ''; +// Do Not Add Product description on add lines +print ''; +print ''.$langs->trans("DoNotAddProductDescAtAddLines").''; +print ''; +print $form->selectyesno("activate_DoNotAddStdProductDescOnAddLine", $conf->global->MAIN_NO_CONCAT_DESCRIPTION, 1); +print ''; +print ''; + +// Do Not Add Product description on add lines +print ''; +print ''.$langs->trans("OnProductSelectAddProductDesc").''; +print ''; +print $form->selectyesno("activate_FillProductDescAuto", $conf->global->PRODUIT_AUTOFILL_DESC, 1); +print ''; +print ''; + + // Activate propal merge produt card /* Kept as hidden feature only. PRODUIT_PDF_MERGE_PROPAL can be added manually. Still did not understand how this feature works. diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index c2b698c8e04..40249e4041e 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -99,6 +99,9 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) $outputlangs->setDefaultLang($newlang); $outdesc_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["description"])) ? $object->multilangs[$outputlangs->defaultlang]["description"] : $object->description; $outlabel_trans = (!empty($object->multilangs[$outputlangs->defaultlang]["label"])) ? $object->multilangs[$outputlangs->defaultlang]["label"] : $object->label; + } else { + $outdesc_trans = $object->description; + $outlabel_trans = $object->label; } } } From 88b570926f7ab66c829d979545a8b700445128bd Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 28 Oct 2020 15:38:31 +0000 Subject: [PATCH 08/77] Fixing style errors. --- htdocs/core/tpl/objectline_create.tpl.php | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index f1faf50e991..bc04e7b6614 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -678,13 +678,13 @@ if (!empty($usemargins) && $user->rights->margins->creer) if (!empty($conf->global->PRODUIT_AUTOFILL_DESC)) { if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { ?> var proddesc = data.desc_trans; - var proddesc = data.desc; - console.log("Load desciption into text area : "+proddesc); - global->FCKEDITOR_ENABLE_DETAILS)) { ?> if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { @@ -693,12 +693,12 @@ if (!empty($usemargins) && $user->rights->margins->creer) editor.setData(proddesc); } } - jQuery('#dp_desc').text(proddesc); - - }, 'json' @@ -873,12 +873,12 @@ if (!empty($usemargins) && $user->rights->margins->creer) global->PRODUIT_AUTOFILL_DESC)) { - ?> + ?> var description = $('option:selected', this).attr('data-description'); if (typeof description == 'undefined') { description = jQuery('#idprodfournprice').attr('data-description'); } console.log("Load desciption into text area : "+description); - global->FCKEDITOR_ENABLE_DETAILS)) { ?> if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") { @@ -887,10 +887,10 @@ if (!empty($usemargins) && $user->rights->margins->creer) editor.setData(description); } } - jQuery('#dp_desc').text(description); - } else if (jQuery('#idprodfournprice').length > 0) { @@ -904,10 +904,10 @@ if (!empty($usemargins) && $user->rights->margins->creer) editor.setData(''); } } - + jQuery('#dp_desc').text(''); - } From 11099132da9783cc3b4b0f7eacec8ee1e9d7f086 Mon Sep 17 00:00:00 2001 From: bahfir abbes Date: Fri, 6 Nov 2020 00:45:30 +0100 Subject: [PATCH 09/77] New: add notification on ACTION_CREATE event --- htdocs/core/class/notify.class.php | 27 ++++++++++++++----- ..._50_modNotification_Notification.class.php | 3 ++- .../mysql/data/llx_c_action_trigger.sql | 2 +- htdocs/langs/en_US/other.lang | 2 ++ htdocs/langs/fr_FR/other.lang | 2 ++ 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 6547b98471a..fb0ce5a91f5 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -81,7 +81,8 @@ class Notify 'EXPENSE_REPORT_VALIDATE', 'EXPENSE_REPORT_APPROVE', 'HOLIDAY_VALIDATE', - 'HOLIDAY_APPROVE' + 'HOLIDAY_APPROVE', + 'ACTION_CREATE' ); @@ -502,12 +503,18 @@ class Notify $object_type = 'holiday'; $mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayValidated", $link); break; - case 'HOLIDAY_APPROVE': - $link = ''.$newref.''; - $dir_output = $conf->holiday->dir_output; - $object_type = 'holiday'; - $mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved", $link); - break; + case 'HOLIDAY_APPROVE': + $link = ''.$newref.''; + $dir_output = $conf->holiday->dir_output; + $object_type = 'holiday'; + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved", $link); + break; + case 'ACTION_CREATE': + $link = ''.$newref.''; + $dir_output = $conf->agenda->dir_output; + $object_type = 'action'; + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextActionAdded", $link); + break; } $ref = dol_sanitizeFileName($newref); $pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; @@ -718,6 +725,12 @@ class Notify $object_type = 'holiday'; $mesg = $langs->transnoentitiesnoconv("EMailTextHolidayApproved", $link); break; + case 'ACTION_CREATE': + $link = ''.$newref.''; + $dir_output = $conf->agenda->dir_output; + $object_type = 'action'; + $mesg = $langs->transnoentitiesnoconv("EMailTextActionAdded", $link); + break; } $ref = dol_sanitizeFileName($newref); $pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index c5a4f450e42..a6078796478 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -46,7 +46,8 @@ class InterfaceNotification extends DolibarrTriggers 'EXPENSE_REPORT_VALIDATE', 'EXPENSE_REPORT_APPROVE', 'HOLIDAY_VALIDATE', - 'HOLIDAY_APPROVE' + 'HOLIDAY_APPROVE', + 'ACTION_CREATE' ); /** diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index eeca137dbc0..c72a8ab7f40 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -145,4 +145,4 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',150); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',151); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_DELETE','Task deleted','Executed when a project task is deleted','project',152); - +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ACTION_CREATE','Action added','Executed when an action is added to the agenda','agenda',700); diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 7495291cf3f..40f4f019793 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -78,6 +78,7 @@ Notify_EXPENSE_REPORT_VALIDATE=Expense report validated (approval required) Notify_EXPENSE_REPORT_APPROVE=Expense report approved Notify_HOLIDAY_VALIDATE=Leave request validated (approval required) Notify_HOLIDAY_APPROVE=Leave request approved +Notify_ACTION_CREATE=Added action to Agenda SeeModuleSetup=See setup of module %s NbOfAttachedFiles=Number of attached files/documents TotalSizeOfAttachedFiles=Total size of attached files/documents @@ -215,6 +216,7 @@ EMailTextExpenseReportValidated=Expense report %s has been validated. EMailTextExpenseReportApproved=Expense report %s has been approved. EMailTextHolidayValidated=Leave request %s has been validated. EMailTextHolidayApproved=Leave request %s has been approved. +EMailTextActionAdded=The action %s has been added to the Agenda. ImportedWithSet=Importation data set DolibarrNotification=Automatic notification ResizeDesc=Enter new width OR new height. Ratio will be kept during resizing... diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index 0a5abbfbf3a..5120fd52e67 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -78,6 +78,7 @@ Notify_EXPENSE_REPORT_VALIDATE=Note de frais validée (approbation requise) Notify_EXPENSE_REPORT_APPROVE=Note de frais approuvé Notify_HOLIDAY_VALIDATE=Demande de congé validée (approbation requise) Notify_HOLIDAY_APPROVE=Demande de congé approuvée +Notify_ACTION_CREATE=Ajout d'action à l'agenda SeeModuleSetup=Voir la configuration du module %s NbOfAttachedFiles=Nombre de fichiers/documents liés TotalSizeOfAttachedFiles=Taille totale fichiers/documents liés @@ -218,6 +219,7 @@ EMailTextExpenseReportValidated=La note de frais %s a été validée. EMailTextExpenseReportApproved=La note de frais %s a été approuvée. EMailTextHolidayValidated=La demande de congé %s a été validée. EMailTextHolidayApproved=La demande de congé %s a été approuvée. +EMailTextActionAdded=L'action %s a été ajoutée à l'Agenda. ImportedWithSet=Lot d'importation (Import key) DolibarrNotification=Notification automatique ResizeDesc=Entrer la nouvelle largeur OU la nouvelle hauteur. Le ratio d'aspect est conservé lors du redimensionnement… From f4566fe0f1fa8dace06466e45e65ccc690bb1ffd Mon Sep 17 00:00:00 2001 From: Bahfir Abbes Date: Mon, 9 Nov 2020 22:20:20 +0100 Subject: [PATCH 10/77] fix:link name --- htdocs/core/class/notify.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index fb0ce5a91f5..75d6a33c43b 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -510,7 +510,7 @@ class Notify $mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved", $link); break; case 'ACTION_CREATE': - $link = ''.$newref.''; + $link = ''.$newref.''; $dir_output = $conf->agenda->dir_output; $object_type = 'action'; $mesg = $outputlangs->transnoentitiesnoconv("EMailTextActionAdded", $link); @@ -726,7 +726,7 @@ class Notify $mesg = $langs->transnoentitiesnoconv("EMailTextHolidayApproved", $link); break; case 'ACTION_CREATE': - $link = ''.$newref.''; + $link = ''.$newref.''; $dir_output = $conf->agenda->dir_output; $object_type = 'action'; $mesg = $langs->transnoentitiesnoconv("EMailTextActionAdded", $link); From 6e0832fb3893aa5874951ea744dcc4f9f2d62f9e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Dec 2020 15:59:39 +0100 Subject: [PATCH 11/77] FIX WIP avoid warning with php 8.0 --- htdocs/core/boxes/box_commandes.php | 4 ++-- htdocs/core/boxes/box_contracts.php | 2 +- htdocs/core/boxes/box_factures.php | 4 ++-- htdocs/core/boxes/box_factures_fourn.php | 4 ++-- htdocs/core/boxes/box_graph_invoices_permonth.php | 8 ++++---- .../boxes/box_graph_invoices_supplier_permonth.php | 9 +++++---- htdocs/core/boxes/box_graph_orders_permonth.php | 8 ++++---- .../boxes/box_graph_orders_supplier_permonth.php | 8 ++++---- .../core/boxes/box_graph_product_distribution.php | 10 +++++----- htdocs/core/boxes/box_graph_propales_permonth.php | 14 ++++++++------ htdocs/core/boxes/box_produits_alerte_stock.php | 2 +- htdocs/core/boxes/box_propales.php | 4 ++-- htdocs/core/boxes/box_supplier_orders.php | 4 ++-- htdocs/core/class/dolgraph.class.php | 8 ++++---- htdocs/core/menus/standard/eldy.lib.php | 8 +++----- htdocs/index.php | 10 +++++----- 16 files changed, 54 insertions(+), 53 deletions(-) diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 3f7875ce7d4..9b020a05711 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -83,7 +83,7 @@ class box_commandes extends ModeleBoxes $societestatic = new Societe($this->db); $userstatic = new User($this->db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."CustomerOrders", $max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."CustomerOrders", $max)); if ($user->rights->commande->lire) { @@ -108,7 +108,7 @@ class box_commandes extends ModeleBoxes if (!empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql .= " AND c.fk_statut = 1"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC "; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC "; else $sql .= " ORDER BY c.tms DESC, c.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 9350bae2da9..0fa10b43fd8 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -92,7 +92,7 @@ class box_contracts extends ModeleBoxes $sql .= " AND c.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_contrat DESC, c.ref DESC "; + if (! empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_contrat DESC, c.ref DESC "; else $sql .= " ORDER BY c.tms DESC, c.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 011342d8a30..20e83fb442c 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -81,7 +81,7 @@ class box_factures extends ModeleBoxes $langs->load("bills"); - $text = $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."CustomerBills", $max); + $text = $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."CustomerBills", $max); $this->info_box_head = array( 'text' => $text, 'limit'=> dol_strlen($text) @@ -106,7 +106,7 @@ class box_factures extends ModeleBoxes $sql .= " AND f.entity IN (".getEntity('invoice').")"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY f.datef DESC, f.ref DESC "; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY f.datef DESC, f.ref DESC "; else $sql .= " ORDER BY f.tms DESC, f.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index d3c1ccd9017..0be9d7bbd6f 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -81,7 +81,7 @@ class box_factures_fourn extends ModeleBoxes $thirdpartystatic = new Fournisseur($this->db); $this->info_box_head = array( - 'text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."SupplierBills", $max) + 'text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."SupplierBills", $max) ); if ($user->rights->fournisseur->facture->lire) @@ -104,7 +104,7 @@ class box_factures_fourn extends ModeleBoxes $sql .= " AND f.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY f.datef DESC, f.ref DESC "; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY f.datef DESC, f.ref DESC "; else $sql .= " ORDER BY f.tms DESC, f.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 983bb75cbc3..4ef11019cd3 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -112,10 +112,10 @@ class box_graph_invoices_permonth extends ModeleBoxes $shownb = GETPOST($param_shownb, 'alpha'); $showtot = GETPOST($param_showtot, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $endyear = $tmparray['year']; - $shownb = $tmparray['shownb']; - $showtot = $tmparray['showtot']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $endyear = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : ''); + $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 1490f5ea6e9..d346bae36d9 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -109,13 +109,14 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $shownb = GETPOST($param_shownb, 'alpha'); $showtot = GETPOST($param_showtot, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $endyear = $tmparray['year']; - $shownb = $tmparray['shownb']; - $showtot = $tmparray['showtot']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $endyear = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : ''); + $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); + if (empty($year)) $year = $nowarray['year']; if (empty($endyear)) $endyear = $nowarray['year']; $startyear = $endyear - 1; $mode = 'supplier'; diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index d9c26620553..b1059dc02ff 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -112,10 +112,10 @@ class box_graph_orders_permonth extends ModeleBoxes $shownb = GETPOST($param_shownb, 'alpha'); $showtot = GETPOST($param_showtot, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $endyear = $tmparray['year']; - $shownb = $tmparray['shownb']; - $showtot = $tmparray['showtot']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $endyear = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : ''); + $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 765c6324516..354aa071946 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -111,10 +111,10 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $shownb = GETPOST($param_shownb, 'alpha'); $showtot = GETPOST($param_showtot, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $endyear = $tmparray['year']; - $shownb = $tmparray['shownb']; - $showtot = $tmparray['showtot']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $endyear = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : ''); + $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 407c66177b5..8c6049c720b 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -95,11 +95,11 @@ class box_graph_product_distribution extends ModeleBoxes $showpropalnb = GETPOST($param_showpropalnb, 'alpha'); $showordernb = GETPOST($param_showordernb, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $year = $tmparray['year']; - $showinvoicenb = $tmparray['showinvoicenb']; - $showpropalnb = $tmparray['showpropalnb']; - $showordernb = $tmparray['showordernb']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $year = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $showinvoicenb = (!empty($tmparray['showinvoicenb']) ? $tmparray['showinvoicenb'] : ''); + $showpropalnb = (!empty($tmparray['showpropalnb']) ? $tmparray['showpropalnb'] : ''); + $showordernb = (!empty($tmparray['showordernb']) ? $tmparray['showordernb'] : ''); } if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb = 1; $showinvoicenb = 1; $showordernb = 1; } if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb = 0; diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index de1a1f8de83..5014c4b3817 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -112,10 +112,10 @@ class box_graph_propales_permonth extends ModeleBoxes $shownb = GETPOST($param_shownb, 'alpha'); $showtot = GETPOST($param_showtot, 'alpha'); } else { - $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); - $endyear = $tmparray['year']; - $shownb = $tmparray['shownb']; - $showtot = $tmparray['showtot']; + $tmparray = (!empty($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode]) ? json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true) : array()); + $endyear = (!empty($tmparray['year']) ? $tmparray['year'] : ''); + $shownb = (!empty($tmparray['shownb']) ? $tmparray['shownb'] : ''); + $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); @@ -176,8 +176,10 @@ class box_graph_propales_permonth extends ModeleBoxes //$datatype2 = array('lines','bars'); $filenamenb = $dir."/".$prefix."propalsamountinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsamountinyear-'.$endyear.'.png'; - if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsamountinyear-'.$endyear.'.png'; + if (!empty($mode)) { + if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsamountinyear-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstatssupplier&file=propalsamountinyear-'.$endyear.'.png'; + } $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 893bb2273ab..5d1e944d805 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -64,7 +64,7 @@ class box_produits_alerte_stock extends ModeleBoxes $this->db = $db; $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); - $tmpentry = array('enabled'=>((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && !empty($conf->stock->enabled)), 'perms'=>($user->rights->stock->lire), 'module'=>'product|service|stock'); + $tmpentry = array('enabled'=>((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && !empty($conf->stock->enabled)), 'perms'=>!empty($user->rights->stock->lire), 'module'=>'product|service|stock'); $showmode = isVisibleToUserType(($user->socid > 0 ? 1 : 0), $tmpentry, $listofmodulesforexternal); $this->hidden = ($showmode != 1); } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index f98e0f1e347..6efd56c01db 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -81,7 +81,7 @@ class box_propales extends ModeleBoxes $propalstatic = new Propal($this->db); $societestatic = new Societe($this->db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."Propals", $max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."Propals", $max)); if ($user->rights->propale->lire) { @@ -96,7 +96,7 @@ class box_propales extends ModeleBoxes $sql .= " AND p.entity IN (".getEntity('propal').")"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY p.datep DESC, p.ref DESC "; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY p.datep DESC, p.ref DESC "; else $sql .= " ORDER BY p.tms DESC, p.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 151c1df6bcb..5074d403231 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -79,7 +79,7 @@ class box_supplier_orders extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; $thirdpartystatic = new Fournisseur($this->db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."SupplierOrders", $max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."SupplierOrders", $max)); if ($user->rights->fournisseur->commande->lire) { @@ -98,7 +98,7 @@ class box_supplier_orders extends ModeleBoxes $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC "; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC "; else $sql .= " ORDER BY c.tms DESC, c.ref DESC "; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 5fcc7b00c91..e880e186e5b 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -964,7 +964,7 @@ class DolGraph $array_of_ykeys = array_keys($valarray); $alabelexists = 1; $tmpykey = explode('_', ($array_of_ykeys[$i + ($alabelexists ? 1 : 0)]), 3); - if (!empty($tmpykey[2]) || $tmpykey[2] == '0') { // This is a 'Group by' array + if (isset($tmpykey[2]) && (!empty($tmpykey[2]) || $tmpykey[2] == '0')) { // This is a 'Group by' array $tmpvalue = (array_key_exists('y_' . $tmpykey[1] . '_' . $tmpykey[2], $valarray) ? $valarray['y_' . $tmpykey[1] . '_' . $tmpykey[2]] : $valarray[$i + 1]); $values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null); $arrayofgroupslegend[$i] = array( @@ -1203,7 +1203,7 @@ class DolGraph $foundnegativecolor = 0; $usecolorvariantforgroupby = 0; // We used a 'group by' and we have too many colors so we generated color variants per - if (is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by. + if (!empty($arrayofgroupslegend) && is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by. $nbofcolorneeds = count($arrayofgroupslegend); $nbofcolorsavailable = count($theme_datacolor); if ($nbofcolorneeds > $nbofcolorsavailable) { @@ -1278,7 +1278,7 @@ class DolGraph $this->stringtoshow .= '{'; $this->stringtoshow .= 'dolibarrinfo: \'y_' . $i . '\', '; $this->stringtoshow .= 'label: \'' . dol_escape_js(dol_string_nohtmltag($textoflegend)) . '\', '; - $this->stringtoshow .= 'pointStyle: \'' . ($this->type[$i] == 'linesnopoint' ? 'line' : 'circle') . '\', '; + $this->stringtoshow .= 'pointStyle: \'' . ((!empty($this->type[$i]) && $this->type[$i] == 'linesnopoint') ? 'line' : 'circle') . '\', '; $this->stringtoshow .= 'fill: ' . ($type == 'bar' ? 'true' : 'false') . ', '; if ($isfunnel) { $this->stringtoshow .= 'borderWidth: \'2\', '; @@ -1287,7 +1287,7 @@ class DolGraph } $this->stringtoshow .= 'borderColor: \'' . $bordercolor . '\', '; $this->stringtoshow .= 'backgroundColor: \'' . $color . '\', '; - if ($arrayofgroupslegend[$i]) $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', '; + if (!empty($arrayofgroupslegend) && !empty($arrayofgroupslegend[$i])) $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', '; $this->stringtoshow .='data: ['; if ($isfunnel) { $this->stringtoshow .= '['.-$serie[$i].','.$serie[$i].']'; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 85b63a6f4e3..810f2087430 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -206,9 +206,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $menu_arr[] = array( 'name' => 'Projet', 'link' => '/projet/index.php?mainmenu=project&leftmenu=', - 'title' => (empty($conf->global->PROJECT_USE_OPPORTUNITIES) || $conf->global->PROJECT_USE_OPPORTUNITIES == 2) - ? (($conf->global->PROJECT_USE_OPPORTUNITIES == 2) ? "Leads" : "Projects") - : "Projects", + 'title' => (! empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $conf->global->PROJECT_USE_OPPORTUNITIES == 2 ? "Leads" : "Projects"), 'level' => 0, 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, @@ -743,11 +741,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"), 1); $warnpicto = ''; - if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { + if (!empty($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { $langs->load("errors"); $warnpicto = img_warning($langs->trans("WarningPHPMailD")); } - if (in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) { + if (!empty($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmail')) && empty($conf->global->MAIN_MAIL_SMTP_SERVER)) { $langs->load("errors"); $warnpicto = img_warning($langs->trans("ErrorSetupOfEmailsNotComplete")); } diff --git a/htdocs/index.php b/htdocs/index.php index a4060278c50..399c9cfa035 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -312,7 +312,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) $boxstatItem .= ''; $boxstatItem .= '
'; $boxstatItem .= ''.$text.'
'; - $boxstatItem .= ''.img_object("", $board->picto, 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).''; + $boxstatItem .= ''.img_object("", $board->picto, 'class="inline-block"').' '.(!empty($board->nb[$val]) ? $board->nb[$val] : 0).''; $boxstatItem .= '
'; $boxstatItem .= '
'; @@ -675,7 +675,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { // get key index of stats used in $includes, $classes, $keys, $icons, $titres, $links $keyIndex = array_search($globalStatsKey, $keys); - $classe = $classes[$keyIndex]; + $classe = (!empty($classes[$keyIndex]) ? $classes[$keyIndex] : ''); if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe])) { $groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey] ? $boardloaded[$classe]->nb[$globalStatsKey] : 0; @@ -762,7 +762,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } if ($showweather && !empty($isIntopOpenedDashBoard)) { - $appendClass = $conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : ''; + $appendClass = (!empty($conf->global->MAIN_DISABLE_METEO) && $conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : ''); $weather = getWeatherStatus($totallate); $text = ''; @@ -889,7 +889,7 @@ print '
'; * Show widgets (boxes) */ -$boxlist .= '
'; +$boxlist = '
'; $boxlist .= '
'; if (!empty($nbworkboardcount)) @@ -914,7 +914,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) } if (!empty($boxstatFromHook) || !empty($boxstatItems)) { - $boxstat .= ''."\n"; + $boxstat = ''."\n"; $boxstat .= '
'; $boxstat .= ''; $boxstat .= ''; From 20cd9cbbc7ca4dcd52dc5f001a0409a6bb650b0b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Dec 2020 16:25:29 +0100 Subject: [PATCH 12/77] FIX avoid warning php 8.0 --- htdocs/admin/company.php | 26 +++++++++++------------ htdocs/core/class/translate.class.php | 2 +- htdocs/core/modules/modStock.class.php | 2 +- htdocs/core/tpl/passwordforgotten.tpl.php | 8 +++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index b82f0fcd765..cac436955f5 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -393,18 +393,18 @@ print ''."\n"; +print 'global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'>'."\n"; // Address print ''."\n"; +print ''."\n"; // Zip print ''."\n"; +print ''."\n"; print ''."\n"; +print ''."\n"; // Country print ''."\n"; // Phone print ''; +print ''; print ''."\n"; // Fax print ''; +print ''; print ''."\n"; // Email print ''; +print ''; print ''."\n"; // Web print ''; +print ''; print ''."\n"; // Barcode @@ -457,7 +457,7 @@ if (!empty($conf->barcode->enabled)) { print ''; + print ''; print ''; } @@ -534,7 +534,7 @@ print ''; // Note print ''; +print ''; print ''; print '
'.$langs->trans( // Name print '
'; -print 'global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'>
'; -print '
'; -print '
'; -print '
'; @@ -431,25 +431,25 @@ print '
'; print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); -print '
'; print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); -print '
'; print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); -print '
'; print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright'); -print '
'; print ''; print ''; - print '
'; -print '
'; @@ -549,17 +549,17 @@ $langs->load("companies"); // Managing Director(s) print ''; -print ''; +print ''; // GDPR contact print ''; print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc")); print ''; -print ''; +print ''; // Capital print ''; -print ''; +print ''; // Juridical Status print ''; diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 11e67104f9a..ac9285363d7 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -731,7 +731,7 @@ class Translate */ public function transcountry($str, $countrycode) { - if ($this->tab_translate["$str$countrycode"]) return $this->trans("$str$countrycode"); + if (!empty($this->tab_translate["$str$countrycode"])) return $this->trans("$str$countrycode"); else return $this->trans($str); } diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index c15f041d21d..1e36bcb66ff 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -254,7 +254,7 @@ class modStock extends DolibarrModules $this->export_sql_end[$r] .= ' AND e.entity IN ('.getEntity('stock').')'; // Export stock including batch number - if ($conf->productbatch->enabled) + if (!empty($conf->productbatch->enabled)) { $langs->load("productbatch"); diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 937ee63a68c..44d3c0199ac 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -81,9 +81,9 @@ $(document).ready(function () { @@ -113,7 +113,7 @@ if ($disablenofollow) echo '';
- + From 325c2b03f839044b27fd185193e481b9ce5b0329 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Dec 2020 16:43:41 +0100 Subject: [PATCH 13/77] FIX step by step --- htdocs/admin/accountant.php | 24 ++++++++--------- htdocs/admin/company_socialnetworks.php | 6 ++--- htdocs/admin/modules.php | 26 ++++++++++++++----- htdocs/admin/openinghours.php | 14 +++++----- htdocs/core/modules/DolibarrModules.class.php | 1 + htdocs/core/modules/modStock.class.php | 2 +- htdocs/includes/parsedown/Parsedown.php | 2 +- 7 files changed, 45 insertions(+), 30 deletions(-) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index 7a1d5b66ece..c8fccb6073d 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -114,57 +114,57 @@ print ''.$langs->trans( // Name print ''; -print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; +print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; // Address print ''; -print ''."\n"; +print ''."\n"; print ''; -print ''."\n"; +print ''."\n"; print ''; -print ''."\n"; +print ''."\n"; // Country print ''; print img_picto('', 'globe-americas', 'class="paddingrightonly"'); -print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id'); +print $form->select_country((!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : GETPOST('country_id', 'int')), 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''."\n"; print ''; -$formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id'); +$formcompany->select_departement((!empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE) ? $conf->global->MAIN_INFO_ACCOUNTANT_STATE : GETPOST('state_id', 'alpha')), (!empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY) ? $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY : GETPOST('country_id', 'int')), 'state_id'); print ''."\n"; print ''; print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; print ''; print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; print ''; print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; // Web print ''; print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; // Code print ''; -print ''."\n"; +print ''."\n"; // Note print ''; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/admin/company_socialnetworks.php b/htdocs/admin/company_socialnetworks.php index 5cbdb948b4a..93c6739d37d 100644 --- a/htdocs/admin/company_socialnetworks.php +++ b/htdocs/admin/company_socialnetworks.php @@ -117,11 +117,11 @@ foreach ($listofnetworks as $key => $value) { $networkconstname = 'MAIN_INFO_SOCIETE_'.strtoupper($key).'_URL'; $networkconstid = 'MAIN_INFO_SOCIETE_'.strtoupper($key); print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''.dol_print_socialnetworks($conf->global->$networkconstid, 0, 0, $key, $listofnetworks).''; + print ''.dol_print_socialnetworks((!empty($conf->global->$networkconstid) ? dol_escape_htmltag($conf->global->$networkconstid) : ''), 0, 0, $key, $listofnetworks).''; print ''."\n"; } } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index e9984316394..4fc07fa1172 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -497,13 +497,19 @@ if ($mode == 'common' || $mode == 'commonkanban') { dol_set_focus('#search_keyword'); print '
'; - if ($optioncss != '') { + print ''; + if (isset($optioncss) && $optioncss != '') { print ''; } - print ''; - print ''; - print ''; - print ''; + if (isset($sortfield) && $sortfield != '') { + print ''; + } + if (isset($sortorder) && $sortorder != '') { + print ''; + } + if (isset($page) && $page != '') { + print ''; + } print ''; print dol_get_fiche_head($head, 'modules', '', -1); @@ -1001,7 +1007,7 @@ if ($mode == 'marketplace') {
- get_products($categorie); ?> + get_products(!empty($categorie) ? $categorie: ''); ?>
@@ -1082,28 +1088,36 @@ if ($mode == 'deploy') { $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb $maxphp = @ini_get('upload_max_filesize'); // In unknown if (preg_match('/k$/i', $maxphp)) { + $maxphp = preg_replace('/k$/i', '', $maxphp); $maxphp = $maxphp * 1; } if (preg_match('/m$/i', $maxphp)) { + $maxphp = preg_replace('/m$/i', '', $maxphp); $maxphp = $maxphp * 1024; } if (preg_match('/g$/i', $maxphp)) { + $maxphp = preg_replace('/g$/i', '', $maxphp); $maxphp = $maxphp * 1024 * 1024; } if (preg_match('/t$/i', $maxphp)) { + $maxphp = preg_replace('/t$/i', '', $maxphp); $maxphp = $maxphp * 1024 * 1024 * 1024; } $maxphp2 = @ini_get('post_max_size'); // In unknown if (preg_match('/k$/i', $maxphp2)) { + $maxphp2 = preg_replace('/k$/i', '', $maxphp2); $maxphp2 = $maxphp2 * 1; } if (preg_match('/m$/i', $maxphp2)) { + $maxphp2 = preg_replace('/m$/i', '', $maxphp2); $maxphp2 = $maxphp2 * 1024; } if (preg_match('/g$/i', $maxphp2)) { + $maxphp2 = preg_replace('/g$/i', '', $maxphp2); $maxphp2 = $maxphp2 * 1024 * 1024; } if (preg_match('/t$/i', $maxphp2)) { + $maxphp2 = preg_replace('/t$/i', '', $maxphp2); $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; } // Now $max and $maxphp and $maxphp2 are in Kb diff --git a/htdocs/admin/openinghours.php b/htdocs/admin/openinghours.php index c3cbcb3d0ae..d50be27e97b 100644 --- a/htdocs/admin/openinghours.php +++ b/htdocs/admin/openinghours.php @@ -95,37 +95,37 @@ if (empty($action) || $action == 'edit' || $action == 'updateedit') print ''; print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; + print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>'."\n"; print ''; print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; print $form->textwithpicto($langs->trans("Wednesday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; print $form->textwithpicto($langs->trans("Thursday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; print $form->textwithpicto($langs->trans("Friday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; print $form->textwithpicto($langs->trans("Saturday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; print $form->textwithpicto($langs->trans("Sunday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print ''."\n"; + print ''."\n"; print ''; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 510ec8ef55a..cfcb85054d2 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -622,6 +622,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + $content=''; $pathoffile = $this->getDescLongReadmeFound(); if ($pathoffile) // Mostly for external modules diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 1e36bcb66ff..5ae6688a31f 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -327,7 +327,7 @@ class modStock extends DolibarrModules 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product", 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", 'p.datec'=>'product', 'p.tms'=>'product' ); // We define here only fields that use another icon that the one defined into export_icon - if ($conf->productbatch->enabled) + if (!empty($conf->productbatch->enabled)) { $this->export_fields_array[$r]['sm.batch'] = 'Batch'; $this->export_TypeFields_array[$r]['sm.batch'] = 'Text'; diff --git a/htdocs/includes/parsedown/Parsedown.php b/htdocs/includes/parsedown/Parsedown.php index df718bce111..cc110c318c8 100644 --- a/htdocs/includes/parsedown/Parsedown.php +++ b/htdocs/includes/parsedown/Parsedown.php @@ -1182,7 +1182,7 @@ class Parsedown 'src' => $Link['element']['attributes']['href'], 'alt' => $Link['element']['text'], // @CHANGE LDR - 'class' => $Link['element']['attributes']['class'] + 'class' => (!empty($Link['element']['attributes']['class']) ? $Link['element']['attributes']['class'] : '') ), ), ); From aec01a95fc328610d118cd092f90b2be346d24fd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Dec 2020 17:48:52 +0100 Subject: [PATCH 14/77] FIX again and again --- htdocs/admin/system/phpinfo.php | 40 +++++++++++++++---- htdocs/comm/card.php | 2 +- htdocs/core/class/commonobject.class.php | 8 ++-- htdocs/core/class/extrafields.class.php | 9 ++++- htdocs/core/class/html.formactions.class.php | 4 +- htdocs/core/class/html.formfile.class.php | 40 +++++++++++++++---- htdocs/core/lib/company.lib.php | 15 ++++--- .../tpl/extrafields_list_search_input.tpl.php | 2 +- .../tpl/extrafields_list_search_title.tpl.php | 2 +- htdocs/core/tpl/extrafields_view.tpl.php | 4 +- htdocs/societe/consumption.php | 7 ++-- htdocs/societe/paymentmodes.php | 4 +- 12 files changed, 97 insertions(+), 40 deletions(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index cf38687f66f..388b61c75cf 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -51,15 +51,39 @@ if (isset($title)) // Check PHP setup is OK $maxphp = @ini_get('upload_max_filesize'); // In unknown -if (preg_match('/k$/i', $maxphp)) $maxphp = $maxphp * 1; -if (preg_match('/m$/i', $maxphp)) $maxphp = $maxphp * 1024; -if (preg_match('/g$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024; -if (preg_match('/t$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024 * 1024; +if (preg_match('/k$/i', $maxphp)) { + $maxphp = preg_replace('/k$/i', '', $maxphp); + $maxphp = $maxphp * 1; +} +if (preg_match('/m$/i', $maxphp)) { + $maxphp = preg_replace('/m$/i', '', $maxphp); + $maxphp = $maxphp * 1024; +} +if (preg_match('/g$/i', $maxphp)) { + $maxphp = preg_replace('/g$/i', '', $maxphp); + $maxphp = $maxphp * 1024 * 1024; +} +if (preg_match('/t$/i', $maxphp)) { + $maxphp = preg_replace('/t$/i', '', $maxphp); + $maxphp = $maxphp * 1024 * 1024 * 1024; +} $maxphp2 = @ini_get('post_max_size'); // In unknown -if (preg_match('/k$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1; -if (preg_match('/m$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024; -if (preg_match('/g$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024; -if (preg_match('/t$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; +if (preg_match('/k$/i', $maxphp2)) { + $maxphp2 = preg_replace('/k$/i', '', $maxphp2); + $maxphp2 = $maxphp2 * 1; +} +if (preg_match('/m$/i', $maxphp2)) { + $maxphp2 = preg_replace('/m$/i', '', $maxphp2); + $maxphp2 = $maxphp2 * 1024; +} +if (preg_match('/g$/i', $maxphp2)) { + $maxphp2 = preg_replace('/g$/i', '', $maxphp2); + $maxphp2 = $maxphp2 * 1024 * 1024; +} +if (preg_match('/t$/i', $maxphp2)) { + $maxphp2 = preg_replace('/t$/i', '', $maxphp2); + $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; +} if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2) { $langs->load("errors"); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 93316384c2a..53e498fe303 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -87,7 +87,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); $hookmanager->initHooks(array('thirdpartycomm', 'globalcard')); // Security check -$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); +$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0); if ($object->id > 0) { if (!($object->client > 0) || empty($user->rights->societe->lire)) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index de4f2bc367c..3336dbda078 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -601,7 +601,7 @@ abstract class CommonObject if (empty($lastname)) $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company : ''))))); $ret = ''; - if ($option && $this->civility_code) + if (!empty($option) && !empty($this->civility_code)) { if ($langs->transnoentitiesnoconv("Civility".$this->civility_code) != "Civility".$this->civility_code) $ret .= $langs->transnoentitiesnoconv("Civility".$this->civility_code).' '; else $ret .= $this->civility_code.' '; @@ -720,7 +720,7 @@ abstract class CommonObject $out = ''; $outdone = 0; - $coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT); + $coords = $this->getFullAddress(1, ', ', (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) ? $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT : 0)); if ($coords) { if (!empty($conf->use_javascript_ajax)) @@ -1407,7 +1407,7 @@ abstract class CommonObject } elseif (strpos($obj->element, 'supplier') !== false && $obj->element != 'supplier_proposal') { $modulename = 'fournisseur'; } - if ($conf->{$modulename}->enabled) { + if (!empty($conf->{$modulename}->enabled)) { $libelle_element = $langs->trans('ContactDefault_'.$obj->element); $transkey = "TypeContact_".$obj->element."_".$source."_".$obj->code; $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle); @@ -6846,7 +6846,7 @@ abstract class CommonObject $value = $getposttemp; } } else { - $value = $this->array_options["options_".$key]; // No GET, no POST, no default value, so we take value of object. + $value = (!empty($this->array_options["options_".$key]) ? $this->array_options["options_".$key] : ''); // No GET, no POST, no default value, so we take value of object. } //var_dump($keyprefix.' - '.$key.' - '.$keysuffix.' - '.$keyprefix.'options_'.$key.$keysuffix.' - '.$this->array_options["options_".$key.$keysuffix].' - '.$getposttemp.' - '.$value); break; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 2daf4c835e9..cf499bbde5d 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1097,7 +1097,12 @@ class ExtraFields foreach ($param['options'] as $key => $val) { if ((string) $key == '') continue; - list($val, $parent) = explode('|', $val); + $valarray = explode('|', $val); + $val = $valarray[0]; + $parent = ''; + if (!empty($valarray[1])) { + $parent = $valarray[1]; + } $out .= '
'; diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index f182fb39cbd..8945daa23f8 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -290,6 +290,11 @@ if ($action == 'create') { // Id $parent_rowid = GETPOST('menuId', 'int'); + $parent_mainmenu = ''; + $parent_leftmenu = ''; + $parent_langs = ''; + $parent_level = ''; + if (GETPOST('menuId', 'int')) { $sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int'); $res = $db->query($sql); @@ -328,8 +333,8 @@ if ($action == 'create') { } else { print ''; } print ''.$langs->trans('DetailType').''; @@ -370,8 +375,8 @@ if ($action == 'create') { // Target print ''.$langs->trans('Target').''.$langs->trans('DetailTarget').''; // Enabled diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index a1ebb21838b..045332bb2d9 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -367,7 +367,7 @@ if ($conf->use_javascript_ajax) $remainingdata = array(); foreach ($data as $datar) { - if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue; + if (empty($datar['rowid']) || !empty($tree_recur_alreadyadded[$datar['rowid']])) continue; $remainingdata[] = $datar; } diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 16a1c42ddaa..008e5277bc3 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -161,7 +161,7 @@ print '
'; print ''; print ''; -$selected = $conf->global->MAIN_PDF_FORMAT; +$selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : ''); if (empty($selected)) $selected = dol_getDefaultFormat(); // Show pdf format @@ -320,13 +320,13 @@ print ''; print ''; print ''."\n"; } - $perm_libelle = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->label)); + $perm_libelle = (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->label)); print ''; diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 0349f8a3435..9290a0459d0 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -155,7 +155,7 @@ print ''; print ''; print ''; print ''; @@ -164,7 +164,7 @@ print ''; print ''; print ''; print ''; @@ -173,7 +173,7 @@ print ''; print ''; print ''; print ''; @@ -182,7 +182,7 @@ print ''; print ''; print ''; print ''; @@ -191,7 +191,7 @@ print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 30085d3f1f1..86db4fab6e2 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -241,8 +241,8 @@ print ''; foreach ($arrayhandler as $key => $module) { // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + if (!empty($module->version) && $module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if (!empty($module->version) && $module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if ($module->isEnabled()) { diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index ea5ea2983fd..d51ff3ae558 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -116,7 +116,7 @@ print ''; print ''; print ''; print ''; // Action column print ''; print ''; diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 80fdbc2f4a2..22f669966f3 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -99,7 +99,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC"; + if (!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE)) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC"; else $sql .= " ORDER BY c.date_livraison ASC, c.fk_statut ASC"; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 0710416f1fe..f523e2a40a2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1073,8 +1073,8 @@ class FormFile if (empty($relativepath)) { $relativepath = (!empty($object->ref) ?dol_sanitizeFileName($object->ref) : '').'/'; - if ($object->element == 'invoice_supplier') $relativepath = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath - if ($object->element == 'project_task') $relativepath = 'Call_not_supported_._Call_function_using_a_defined_relative_path_.'; + if (!empty($object->element) && $object->element == 'invoice_supplier') $relativepath = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath + if (!empty($object->element) && $object->element == 'project_task') $relativepath = 'Call_not_supported_._Call_function_using_a_defined_relative_path_.'; } // For backward compatiblity, we detect file stored into an old path if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && $filearray[0]['level1name'] == 'photos') diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index a4cb7a603dd..91691cbec54 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -106,7 +106,8 @@ class InfoBox if (is_object($user)) $sql .= " AND b.fk_user IN (0,".$user->id.")"; else $sql .= " AND b.fk_user = 0"; $sql .= " ORDER BY b.box_order"; - } else // available + } + else // available { $sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms"; $sql .= " FROM ".MAIN_DB_PREFIX."boxes_def as d"; @@ -150,7 +151,7 @@ class InfoBox // box properties $box->rowid = (empty($obj->rowid) ? '' : $obj->rowid); $box->id = (empty($obj->box_id) ? '' : $obj->box_id); - $box->position = ($obj->position == '' ? '' : $obj->position); // '0' must stay '0' + $box->position = ((isset($obj->position) && $obj->position == '') ? '' : (isset($obj->position) ? $obj->position : '')); // '0' must stay '0' $box->box_order = (empty($obj->box_order) ? '' : $obj->box_order); $box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user); $box->sourcefile = $relsourcefile; diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index e4de8b0c833..9df0f8d9ddf 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -163,7 +163,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset print ''; $ulprinted++; } - print "\n".'
  • '; + print "\n".'
  • '; if ($showfk) { print '
  • '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("ShowDetailsInPDFPageFoot").''; -print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS); +print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)); print '
    '.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").''; //if (! empty($conf->global->MAIN_MULTILANGS)) //{ -print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : $conf->global->PDF_USE_ALSO_LANGUAGE_CODE, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1); +print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0), 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1); //} else { // print ''.$langs->trans("MultiLangNotEnabled").''; //} diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 4905f4f2497..3d37b2a7c8a 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -166,7 +166,7 @@ if ($result) if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) { // TODO Define familyposition - $family = $modules[$obj->module]->family_position; + $family = (!empty($modules[$obj->module]->family_position) ? $modules[$obj->module]->family_position : ''); $familyposition = 0; $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".$modules[$obj->module]->module_position.","; $sqlupdate .= " family_position = ".$familyposition; @@ -214,7 +214,7 @@ if ($result) print '
    '.$langs->trans("MAIN_PROXY_USE").''; print ''; -print $form->selectyesno('MAIN_PROXY_USE', $conf->global->MAIN_PROXY_USE, 1); +print $form->selectyesno('MAIN_PROXY_USE', (!empty($conf->global->MAIN_PROXY_USE) ? $conf->global->MAIN_PROXY_USE : 0), 1); print '
    '.$langs->trans("MAIN_PROXY_HOST").''; print ''; -print ''; +print ''; print '
    '.$langs->trans("MAIN_PROXY_PORT").''; print ''; -print ''; +print ''; print '
    '.$langs->trans("MAIN_PROXY_USER").''; print ''; -print ''; +print ''; print '
    '.$langs->trans("MAIN_PROXY_PASS").''; print ''; -print ''; +print ''; print '
    '.$langs->trans("MaxSizeForUploadedFiles").'.'; $max = @ini_get('upload_max_filesize'); -if ($max) print ' '.$langs->trans("MustBeLowerThanPHPLimit", $max * 1024, $langs->trans("Kb")).'.'; +if (isset($max)) print ' '.$langs->trans("MustBeLowerThanPHPLimit", ((int) $max) * 1024, $langs->trans("Kb")).'.'; else print ' '.$langs->trans("NoMaxSizeByPHPLimit").'.'; print ''; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index c31f1c07093..dfaa8e576de 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -40,9 +40,9 @@ $transkey = GETPOST('transkey', 'alphanohtml'); $transvalue = GETPOST('transvalue', 'restricthtml'); -$mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'searchkey'; +$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'searchkey'; -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -62,9 +62,9 @@ $hookmanager->initHooks(array('admintranslation', 'globaladmin')); */ if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } -if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } +if (!GETPOST('confirmmassaction', 'alpha') && !empty($massaction) && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } -$parameters = array('socid'=>$socid); +$parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -217,14 +217,14 @@ print '
    '; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); -if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); +if (isset($optioncss) && $optioncss != '') $param .= '&optioncss='.urlencode($optioncss); if ($langcode) $param .= '&langcode='.urlencode($langcode); if ($transkey) $param .= '&transkey='.urlencode($transkey); if ($transvalue) $param .= '&transvalue='.urlencode($transvalue); -print 'entity) && $debug) ? '?debug=1' : '').'" method="POST">'; -if ($optioncss != '') print ''; +print 'entity) && !empty($debug)) ? '?debug=1' : '').'" method="POST">'; +if (isset($optioncss) && $optioncss != '') print ''; print ''; print ''; print ''; @@ -472,7 +472,7 @@ if ($mode == 'searchkey') print '
    '; - $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); + $searchpicto = $form->showFilterAndCheckAddButtons(!empty($massactionbutton) ? 1 : 0, 'checkforselect', 1); print $searchpicto; print '
    '; // Note print ''; +print ''; print ''; print '
    '; @@ -194,7 +194,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset print ''; $ulprinted++; } - print "\n".'
  • '; + print "\n".'
  • '; if ($showfk) { print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; +print ''; print ''; print '
    '; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 913112e04e6..0cf23e0593f 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -498,7 +498,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; //var_dump($conf->global->THEME_ELDY_BACKBODY); if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKBODY) ? $conf->global->THEME_ELDY_BACKBODY : ''), array()), ''), 'THEME_ELDY_BACKBODY', '', 1, '', '', 'colorbackbody').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''); if ($color) print ''; @@ -539,7 +539,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("TopMenuBackgroundColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $conf->global->THEME_ELDY_TOPMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_TOPMENU_BACK1', '', 1, '', '', 'colorbackhmenu1').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''); if ($color) print ''; @@ -580,7 +580,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("LeftMenuBackgroundColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_VERMENU_BACK1) ? $conf->global->THEME_ELDY_VERMENU_BACK1 : ''), array()), ''), 'THEME_ELDY_VERMENU_BACK1', '', 1, '', '', 'colorbackvmenu1').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''); if ($color) print ''; @@ -601,7 +601,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("TextTitleColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLENOTAB) ? $conf->global->THEME_ELDY_TEXTTITLENOTAB : ''), array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', '', 1, '', '', 'colortexttitlenotab').' '; } else { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); } @@ -621,7 +621,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("BackgroundTableTitleColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_BACKTITLE1) ? $conf->global->THEME_ELDY_BACKTITLE1 : ''), array()), ''), 'THEME_ELDY_BACKTITLE1', '', 1, '', '', 'colorbacktitle1').' '; } else { print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); } @@ -641,7 +641,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("BackgroundTableTitleTextColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE, array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLE) ? $conf->global->THEME_ELDY_TEXTTITLE : ''), array()), ''), 'THEME_ELDY_TEXTTITLE', '', 1, '', '', 'colortexttitle').' '; } else { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default")); } @@ -661,7 +661,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("BackgroundTableTitleTextlinkColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLELINK, array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTTITLELINK) ? $conf->global->THEME_ELDY_TEXTTITLELINK : ''), array()), ''), 'THEME_ELDY_TEXTTITLELINK', '', 1, '', '', 'colortexttitlelink').' '; } else { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default")); } @@ -682,7 +682,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("BackgroundTableLineOddColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklinepair2').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEIMPAIR1) ? $conf->global->THEME_ELDY_LINEIMPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEIMPAIR1', '', 1, '', '', 'colorbacklinepair2').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''); if ($color) print ''; @@ -703,7 +703,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("BackgroundTableLineEvenColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklineimpair2').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_LINEPAIR1) ? $conf->global->THEME_ELDY_LINEPAIR1 : ''), array()), ''), 'THEME_ELDY_LINEPAIR1', '', 1, '', '', 'colorbacklineimpair2').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''); if ($color) print ''; @@ -744,7 +744,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''.$langs->trans("LinkColor").''; if ($edit) { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' '; + print $formother->selectColor(colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_TEXTLINK) ? $conf->global->THEME_ELDY_TEXTLINK : ''), array()), ''), 'THEME_ELDY_TEXTLINK', '', 1, '', '', 'colortextlink').' '; } else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''); if ($color) print ''; @@ -781,12 +781,12 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) //print ''; //print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; if ($edit) { - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover)); - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); + if (!empty($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover)); + else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_HOVER) ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), ''); print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', '', 1, '', '', 'colorbacklinepairhover').' '; } else { if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover)); - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); + else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_HOVER) ? $conf->global->THEME_ELDY_USE_HOVER : ''), array()), ''); if ($color) { if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) print ''; else print $langs->trans("Default"); @@ -818,12 +818,12 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) //print ''; //print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; if ($edit) { - if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0'; - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), ''); + if (!empty($conf->global->THEME_ELDY_USE_CHECKED) && $conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0'; + else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_CHECKED) ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), ''); print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', '', 1, '', '', 'colorbacklinepairchecked').' '; } else { if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0'; - else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), ''); + else $color = colorArrayToHex(colorStringToArray((!empty($conf->global->THEME_ELDY_USE_CHECKED) ? $conf->global->THEME_ELDY_USE_CHECKED : ''), array()), ''); if ($color) { if ($color != 'e6edf0') print ''; else print $langs->trans("Default"); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 810f2087430..06320794a64 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -803,8 +803,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat'); } $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); - $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); - $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); } } } From 7832fa213f4da99a5c6bdae77809fd17a1009168 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 30 Dec 2020 11:34:59 +0100 Subject: [PATCH 16/77] FIX Stickler line exceeds 500 characters; contains 527 characters --- htdocs/core/class/html.formactions.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index fe70c482d21..cbd17b30568 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -202,7 +202,8 @@ class FormActions $newcardbutton = ''; if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create)) { - $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&origin='.urlencode($typeelement).'&originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage)); + $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.urlencode(dol_print_date(dol_now(), 'dayhourlog')).'&origin='.urlencode($typeelement).'&originid='.$object->id.((!empty($object->socid) && $object->socid > 0) ? '&socid='.$object->socid : ((!empty($socid) && $socid > 0) ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage); + $newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', $url); } From c647c78ee0d2366b14af8bea763c601c6a3ed7dd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 30 Dec 2020 14:02:53 +0100 Subject: [PATCH 17/77] FIX restore GETPOSTISSET --- htdocs/admin/accountant.php | 2 +- htdocs/admin/company.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index c8fccb6073d..3647c10f5ea 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -164,7 +164,7 @@ print ''; -print '
    '; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index cac436955f5..fd3f7505778 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -534,7 +534,7 @@ print '
  • '; -print '
    '; From d0d94276669bc0bbc04bd9db6e645917eee5e37f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 2 Jan 2021 17:23:25 +0100 Subject: [PATCH 18/77] FIX regression --- htdocs/admin/delais.php | 552 ++++++++++++++++++++-------------------- 1 file changed, 272 insertions(+), 280 deletions(-) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 62b0c6ec53d..0b8c639622f 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -35,127 +35,127 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action', 'aZ09'); $modules = array( - 'agenda' => array( - array( - 'code' => 'MAIN_DELAY_ACTIONS_TODO', - 'img' => 'action' - ) - ), - 'projet' => array( - array( - 'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE', - 'img' => 'project' - ), - array( - 'code' => 'MAIN_DELAY_TASKS_TODO', - 'img' => 'projecttask' - ) - ), - 'propal' => array( - array( - 'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE', - 'img' => 'propal' - ), - array( - 'code' => 'MAIN_DELAY_PROPALS_TO_BILL', - 'img' => 'propal' - ) - ), - 'commande' => array( - array( - 'code' => 'MAIN_DELAY_ORDERS_TO_PROCESS', - 'img' => 'order' - ) - ), - 'facture' => array( - array( - 'code' => 'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED', - 'img' => 'bill' - ) - ), - 'fournisseur' => array( - array( - 'code' => 'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS', - 'img' => 'order' - ), - array( - 'code' => 'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY', - 'img' => 'bill' - ) - ), - 'service' => array( - array( - 'code' => 'MAIN_DELAY_NOT_ACTIVATED_SERVICES', - 'img' => 'service' - ), - array( - 'code' => 'MAIN_DELAY_RUNNING_SERVICES', - 'img' => 'service' - ) - ), - 'banque' => array( - array( - 'code' => 'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE', - 'img' => 'account' - ), - array( - 'code' => 'MAIN_DELAY_CHEQUES_TO_DEPOSIT', - 'img' => 'account' - ) - ), - 'adherent' => array( - array( - 'code' => 'MAIN_DELAY_MEMBERS', - 'img' => 'user' - ) - ), - 'expensereport' => array( - array( - 'code' => 'MAIN_DELAY_EXPENSEREPORTS', - 'img' => 'trip' - ), - /* TODO Enable this - array( - 'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY', - 'img' => 'trip' - )*/ - ), - 'holiday' => array( - array( - 'code' => 'MAIN_DELAY_HOLIDAYS', - 'img' => 'holiday' - ), - ), + 'agenda' => array( + array( + 'code' => 'MAIN_DELAY_ACTIONS_TODO', + 'img' => 'action' + ) + ), + 'projet' => array( + array( + 'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE', + 'img' => 'project' + ), + array( + 'code' => 'MAIN_DELAY_TASKS_TODO', + 'img' => 'projecttask' + ) + ), + 'propal' => array( + array( + 'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE', + 'img' => 'propal' + ), + array( + 'code' => 'MAIN_DELAY_PROPALS_TO_BILL', + 'img' => 'propal' + ) + ), + 'commande' => array( + array( + 'code' => 'MAIN_DELAY_ORDERS_TO_PROCESS', + 'img' => 'order' + ) + ), + 'facture' => array( + array( + 'code' => 'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED', + 'img' => 'bill' + ) + ), + 'fournisseur' => array( + array( + 'code' => 'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS', + 'img' => 'order' + ), + array( + 'code' => 'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY', + 'img' => 'bill' + ) + ), + 'service' => array( + array( + 'code' => 'MAIN_DELAY_NOT_ACTIVATED_SERVICES', + 'img' => 'service' + ), + array( + 'code' => 'MAIN_DELAY_RUNNING_SERVICES', + 'img' => 'service' + ) + ), + 'banque' => array( + array( + 'code' => 'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE', + 'img' => 'account' + ), + array( + 'code' => 'MAIN_DELAY_CHEQUES_TO_DEPOSIT', + 'img' => 'account' + ) + ), + 'adherent' => array( + array( + 'code' => 'MAIN_DELAY_MEMBERS', + 'img' => 'user' + ) + ), + 'expensereport' => array( + array( + 'code' => 'MAIN_DELAY_EXPENSEREPORTS', + 'img' => 'trip' + ), + /* TODO Enable this + array( + 'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY', + 'img' => 'trip' + )*/ + ), + 'holiday' => array( + array( + 'code' => 'MAIN_DELAY_HOLIDAYS', + 'img' => 'holiday' + ), + ), ); $labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly")); if (!isset($conf->global->MAIN_DELAY_PROJECT_TO_CLOSE)) { - $conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7; // Must be same value than into conf.class.php + $conf->global->MAIN_DELAY_PROJECT_TO_CLOSE = 7; // Must be same value than into conf.class.php } if (!isset($conf->global->MAIN_DELAY_TASKS_TODO)) { - $conf->global->MAIN_DELAY_TASKS_TODO = 7; // Must be same value than into conf.class.php + $conf->global->MAIN_DELAY_TASKS_TODO = 7; // Must be same value than into conf.class.php } if (!isset($conf->global->MAIN_DELAY_MEMBERS)) { - $conf->global->MAIN_DELAY_MEMBERS = 0; // Must be same value than into conf.class.php + $conf->global->MAIN_DELAY_MEMBERS = 0; // Must be same value than into conf.class.php } if (!isset($conf->global->MAIN_DELAY_ACTIONS_TODO)) { - $conf->global->MAIN_DELAY_ACTIONS_TODO = 7; // Must be same value than into conf.class.php + $conf->global->MAIN_DELAY_ACTIONS_TODO = 7; // Must be same value than into conf.class.php } if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { - $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; + $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; } if (!isset($conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)) { - $conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7; + $conf->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS = 7; } if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { - $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; + $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; } if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { - $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; + $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; } if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { - $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; + $conf->global->MAIN_DELAY_ORDERS_TO_PROCESS = 2; } @@ -166,30 +166,30 @@ if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) { if ($action == 'update') { - foreach ($modules as $module => $delays) - { - if (!empty($conf->$module->enabled)) - { - foreach ($delays as $delay) - { - if (GETPOST($delay['code']) != '') - { - dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity); - } - } - } - } - - dolibarr_set_const($db, "MAIN_DISABLE_METEO", $_POST["MAIN_DISABLE_METEO"], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE", GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"), 'chaine', 0, '', $conf->entity); - - // For update value with percentage - $plus = ''; - if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE'; - // Update values - for ($i = 0; $i < 4; $i++) { - if (GETPOSTISSET('MAIN_METEO'.$plus.'_LEVEL'.$i)) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity); - } + foreach ($modules as $module => $delays) + { + if (!empty($conf->$module->enabled)) + { + foreach ($delays as $delay) + { + if (GETPOST($delay['code']) != '') + { + dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity); + } + } + } + } + + dolibarr_set_const($db, "MAIN_DISABLE_METEO", $_POST["MAIN_DISABLE_METEO"], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE", GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"), 'chaine', 0, '', $conf->entity); + + // For update value with percentage + $plus = ''; + if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE'; + // Update values + for ($i = 0; $i < 4; $i++) { + if (GETPOSTISSET('MAIN_METEO'.$plus.'_LEVEL'.$i)) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity); + } } @@ -209,164 +209,156 @@ print "
    \n"; if ($action == 'edit') { - print ''; - print ''; - print ''; - - print ''; - print ''; - - foreach ($modules as $module => $delays) - { - if (!empty($conf->$module->enabled)) - { - foreach ($delays as $delay) - { - $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); - print ''; - print ''; - print ''; - } - } - } - - print '
    '.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
    '.img_object('', $delay['img']).''.$langs->trans('Delays_'.$delay['code']).''; - print ' '.$langs->trans("days").'
    '; - - print '
    '; - - // Show if meteo is enabled - print ''; - print ''; - - print ''; - print ''; - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("MAIN_DISABLE_METEO").''; - print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO)); - print '
    '; + print ''; + print ''; + print ''; + + print ''; + print ''; + + foreach ($modules as $module => $delays) + { + if (!empty($conf->$module->enabled)) + { + foreach ($delays as $delay) + { + $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); + print ''; + print ''; + print ''; + } + } + } + + print '
    '.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
    '.img_object('', $delay['img']).''.$langs->trans('Delays_'.$delay['code']).''; + print ' '.$langs->trans("days").'
    '; + + print '
    '; + + // Show if meteo is enabled + print ''; + print ''; + + print ''; + print ''; + + print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("MAIN_DISABLE_METEO").''; + print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO)); + print '
    '; } else { - /* + /* * Show parameters */ - - print ''; - print ''; - - foreach ($modules as $module => $delays) - { - if (!empty($conf->$module->enabled)) - { - foreach ($delays as $delay) - { - $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); - print ''; - print ''; - print ''; - print ''; - } - } - } - - print '
    '.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
    '.img_object('', $delay['img']).''.$langs->trans('Delays_'.$delay['code']).''.$value.' '.$langs->trans("days").'
    '; - - print '
    '; - - // Show if meteo is enabled - print ''; - print ''; - - print ''; - print ''; - - print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("MAIN_DISABLE_METEO").''; - if (!isset($conf->global->MAIN_DISABLE_METEO)) $conf->global->MAIN_DISABLE_METEO = 0; - print $labelmeteo[$conf->global->MAIN_DISABLE_METEO]; - print '
    '; + + print ''; + print ''; + + foreach ($modules as $module => $delays) + { + if (!empty($conf->$module->enabled)) + { + foreach ($delays as $delay) + { + $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); + print ''; + print ''; + print ''; + print ''; + } + } + } + + print '
    '.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
    '.img_object('', $delay['img']).''.$langs->trans('Delays_'.$delay['code']).''.$value.' '.$langs->trans("days").'
    '; + + print '
    '; + + // Show if meteo is enabled + print ''; + print ''; + + print ''; + print ''; + + print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '.$langs->trans("MAIN_DISABLE_METEO").''; + print $labelmeteo[$conf->global->MAIN_DISABLE_METEO]; + print '
    '; } print '
    '; -if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO != 1) { - // Show logo for weather - print ''.$langs->trans("DescWeather").' '; - - if ($action == 'edit') { - $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod')); - $str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod')); - if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std; - else $str_mode_enabled = $str_mode_percentage; - print ''.$str_mode_enabled.''; - print ''; - - print '

    '; - } else { - if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled'); - else print $langs->trans('MeteoPercentageModEnabled'); - print '

    '; - } - - $offset = 0; - $cursor = 10; // By default - //if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET; - //if (! empty($conf->global->MAIN_METEO_GAP)) $cursor=$conf->global->MAIN_METEO_GAP; - $level0 = $offset; if (!empty($conf->global->MAIN_METEO_LEVEL0)) $level0 = $conf->global->MAIN_METEO_LEVEL0; - $level1 = $offset + 1 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL1)) $level1 = $conf->global->MAIN_METEO_LEVEL1; - $level2 = $offset + 2 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL2)) $level2 = $conf->global->MAIN_METEO_LEVEL2; - $level3 = $offset + 3 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL3)) $level3 = $conf->global->MAIN_METEO_LEVEL3; - $level4 = $offset + 4 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL4)) $level4 = $conf->global->MAIN_METEO_LEVEL4; - $text = ''; $options = 'class="valignmiddle" height="60px"'; - - - if ($action == 'edit') { - print '
    global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>'; - - print '
    '; - print '
    '; - print img_weather($text, 0, $options); - print ' <= '; - print '
    '; - print img_weather($text, 1, $options); - print ' <= '; - print '
    '; - print img_weather($text, 2, $options); - print ' <= '; - print '
    '; - print img_weather($text, 3, $options); - print ' <= '; - print '
    '; - print img_weather($text, 4, $options); - print ' <= '; - print '
    '; - print '
    '; - - print '
    '; - - print '
    global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>'; - - print '
    '; - print '
    '; - print img_weather($text, 0, $options); - print ' <=  %'; - print '
    '; - print img_weather($text, 1, $options); - print ' <=  %'; - print '
    '; - print img_weather($text, 2, $options); - print ' <=  %'; - print '
    '; - print img_weather($text, 3, $options); - print ' <=  %'; - print '
    '; - print img_weather($text, 4, $options); - print ' <=  %'; - print '
    '; - print '
    '; - - print '
    '; - - ?> +if ($conf->global->MAIN_DISABLE_METEO != 1) { + // Show logo for weather + print ''.$langs->trans("DescWeather").' '; + + if ($action == 'edit') { + $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod')); + $str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod')); + if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std; + else $str_mode_enabled = $str_mode_percentage; + print ''.$str_mode_enabled.''; + print ''; + + print '

    '; + } else { + if (empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled'); + else print $langs->trans('MeteoPercentageModEnabled'); + print '

    '; + } + + $offset = 0; + $cursor = 10; // By default + //if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET; + //if (! empty($conf->global->MAIN_METEO_GAP)) $cursor=$conf->global->MAIN_METEO_GAP; + $level0 = $offset; if (!empty($conf->global->MAIN_METEO_LEVEL0)) $level0 = $conf->global->MAIN_METEO_LEVEL0; + $level1 = $offset + 1 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL1)) $level1 = $conf->global->MAIN_METEO_LEVEL1; + $level2 = $offset + 2 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL2)) $level2 = $conf->global->MAIN_METEO_LEVEL2; + $level3 = $offset + 3 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL3)) $level3 = $conf->global->MAIN_METEO_LEVEL3; + $text = ''; $options = 'class="valignmiddle" height="60px"'; + + + if ($action == 'edit') { + print '
    global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>'; + + print '
    '; + print '
    '; + print img_weather($text, 0, $options); + print ' <= '; + print '
    '; + print img_weather($text, 1, $options); + print ' <= '; + print '
    '; + print img_weather($text, 2, $options); + print ' <= '; + print '
    '; + print img_weather($text, 3, $options); + print ' <= '; + print '
    '; + print '
    '; + + print '
    '; + + print '
    global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>'; + + print '
    '; + print '
    '; + print img_weather($text, 0, $options); + print ' <=  %'; + print '
    '; + print img_weather($text, 1, $options); + print ' <=  %'; + print '
    '; + print img_weather($text, 2, $options); + print ' <=  %'; + print '
    '; + print img_weather($text, 3, $options); + print ' <=  %'; + print '
    '; + print '
    '; + + print '
    '; + + ?>