From 1ecc24216fece3ed11e319389fe30b6f64dd0384 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Thu, 13 Jun 2013 15:07:50 +0200 Subject: [PATCH 01/27] =?UTF-8?q?Fix=20[=20bug=20#934=20]=20Impossible=20d?= =?UTF-8?q?e=20cr=C3=A9er=20une=20facture=20pr=C3=A9d=C3=A9finie=20(pgsql)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/facture/class/facture-rec.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 1651407d746..565e63fd749 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -125,8 +125,8 @@ class FactureRec extends Facture $sql.= ", '".$facsrc->socid."'"; $sql.= ", ".$conf->entity; $sql.= ", ".$this->db->idate($now); - $sql.= ", '".$facsrc->amount."'"; - $sql.= ", '".$facsrc->remise."'"; + $sql.= ", ".(!empty($facsrc->amount)?$facsrc->amount:'0'); + $sql.= ", ".(!empty($facsrc->remise)?$this->remise:'0'); $sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL"); $sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL"); $sql.= ", '".$user->id."'"; From eb298e055760710207fb015b9fe842de423358bf Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Thu, 13 Jun 2013 15:24:09 +0200 Subject: [PATCH 02/27] Merge file from Jean Heimberger --- htdocs/product/class/product.class.php | 1 + htdocs/product/price.php | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6888c144a7c..5a9d075b4ff 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -57,6 +57,7 @@ class Product extends CommonObject //! Base price ('TTC' for price including tax or 'HT' for net price) var $price_base_type; //! Arrays for multiprices + var $pricelevel; var $multiprices=array(); var $multiprices_ttc=array(); var $multiprices_base_type=array(); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 2d0a1816982..6b8f6b90ae3 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -88,6 +88,16 @@ if ($action == 'update_price' && ! $_POST["cancel"] && ($user->rights->produit-> $newpsq = empty($newpsq) ? 0 : $newpsq; } + //save level and multiprices for trigger + $object->pricelevel = $level; + if ($level) + { + $object->multiprices[$level]=$newprice; + $object->multiprices_base_type[$level]=$newpricebase; + $object->multiprices_tva_tx[$level]=$newvat; + $object->multiprices_min[$level]=$newprice_min; + } + if ($object->updatePrice($object->id, $newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) { $action = ''; From d9f5151c39cbb6b016a5582642bc40d00e90190f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 Jun 2013 15:53:17 +0200 Subject: [PATCH 03/27] Fix: Bad default value for finished property --- htdocs/product/class/product.class.php | 6 ++---- htdocs/product/fiche.php | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6888c144a7c..2bdf4d3368b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -225,7 +225,6 @@ class Product extends CommonObject if (empty($this->status)) $this->status = 0; if (empty($this->status_buy)) $this->status_buy = 0; - if (empty($this->finished)) $this->finished = 0; $price_ht=0; $price_ttc=0; @@ -315,7 +314,7 @@ class Product extends CommonObject $sql.= ", ".$this->status; $sql.= ", ".$this->status_buy; $sql.= ", '".$this->canvas."'"; - $sql.= ", ".$this->finished; + $sql.= ", ".((! isset($this->finished) || $this->finished < 0)?'null':$this->finished); $sql.= ")"; dol_syslog(get_class($this)."::Create sql=".$sql); @@ -446,7 +445,6 @@ class Product extends CommonObject if (empty($this->localtax1_tx)) $this->localtax1_tx = 0; if (empty($this->localtax2_tx)) $this->localtax2_tx = 0; - if (empty($this->finished)) $this->finished = 0; if (empty($this->country_id)) $this->country_id = 0; $this->accountancy_code_buy = trim($this->accountancy_code_buy); @@ -464,7 +462,7 @@ class Product extends CommonObject $sql.= ",tosell = " . $this->status; $sql.= ",tobuy = " . $this->status_buy; - $sql.= ",finished = " . ($this->finished<0 ? "null" : $this->finished); + $sql.= ",finished = " . ((! isset($this->finished) || $this->finished < 0) ? "null" : $this->finished); $sql.= ",weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null'); $sql.= ",weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null'); $sql.= ",length = " . ($this->length!='' ? "'".$this->length."'" : 'null'); diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 8971b93a3df..315ea66b184 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -312,7 +312,6 @@ if (empty($reshook)) $object->ref = GETPOST('clone_ref'); $object->status = 0; $object->status_buy = 0; - $object->finished = 1; $object->id = null; if ($object->check()) From 2704ba5f36692d39d2088c7c0f2f1a6ed1845f55 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Thu, 13 Jun 2013 18:11:23 +0200 Subject: [PATCH 04/27] Fix bug on attach element in element.php (simply not work before...) --- htdocs/projet/class/project.class.php | 27 +++++++++++++++++++-------- htdocs/projet/element.php | 15 +++++++++++---- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index dc438d2b929..bb37d9eeeb8 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1286,7 +1286,6 @@ class Project extends CommonObject */ function select_element($Tablename) { - global $db; $projectkey="fk_projet"; switch ($Tablename) @@ -1316,25 +1315,27 @@ class Project extends CommonObject } $sql.= " ORDER BY ref DESC"; - dol_syslog("Project.Lib::select_element sql=".$sql); + dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG); - $resql=$db->query($sql); + $resql=$this->db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); $i = 0; if ($num > 0) { $sellist = ''; } return $sellist ; + + $this->db->free($resql); } } @@ -1347,8 +1348,8 @@ class Project extends CommonObject */ function update_element($TableName, $ElementSelectId) { - global $db; - $sql="update ".MAIN_DB_PREFIX.$TableName; + $sql="UPDATE ".MAIN_DB_PREFIX.$TableName; + if ($TableName=="actioncomm") { $sql.= " SET fk_project=".$this->id; @@ -1359,7 +1360,17 @@ class Project extends CommonObject $sql.= " SET fk_projet=".$this->id; $sql.= " WHERE rowid=".$ElementSelectId; } - $resql=$db->query($sql); + + dol_syslog(get_class($this)."::update_element sql=" . $sql, LOG_DEBUG); + $resql=$this->db->query($sql); + if (!$resql) { + $this->error=$this->db->lasterror(); + dol_syslog(get_class($this)."::update_element error : " . $this->error, LOG_ERR); + return -1; + }else { + return 1; + } + } } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index e47c36fa191..3f686bdecaf 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -46,8 +46,10 @@ if (! empty($conf->commande->enabled)) $langs->load("orders"); if (! empty($conf->propal->enabled)) $langs->load("propal"); if (! empty($conf->ficheinter->enabled)) $langs->load("interventions"); -$projectid=GETPOST('id'); -$ref=GETPOST('ref'); +$projectid=GETPOST('id','int'); +$ref=GETPOST('ref','alpha'); +$action=GETPOST('action','alpha'); + if ($projectid == '' && $ref == '') { dol_print_error('','Bad parameter'); @@ -62,6 +64,8 @@ if ($ref) { $project->fetch(0,$ref); $projectid=$project->id; +}else { + $project->fetch($projectid); } // Security check @@ -82,7 +86,7 @@ $form = new Form($db); $userstatic=new User($db); $project = new Project($db); -$project->fetch($_GET["id"],$_GET["ref"]); +$project->fetch($projectid,$ref); $project->societe->fetch($project->societe->id); // To verify role of users @@ -191,7 +195,10 @@ if ($action=="addelement") { $tablename = GETPOST("tablename"); $elementselectid = GETPOST("elementselect"); - $project->update_element($tablename, $elementselectid); + $result=$project->update_element($tablename, $elementselectid); + if ($result<0) { + setEventMessage($mailchimp->error,'errors'); + } } foreach ($listofreferent as $key => $value) From 8757fc1dba582b84100a2439261dcb465d3b6156 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 Jun 2013 21:43:19 +0200 Subject: [PATCH 05/27] Fix: css pb with jmobile --- htdocs/theme/auguria/style.css.php | 65 ++++++++++++++++++----- htdocs/theme/bureau2crea/style.css.php | 59 ++++++++++++++------- htdocs/theme/cameleo/style.css.php | 72 ++++++++++++++++++-------- htdocs/theme/eldy/style.css.php | 2 +- 4 files changed, 144 insertions(+), 54 deletions(-) diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 41bdadf037c..dfe178dc0a8 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -2235,25 +2235,65 @@ div.ecmjqft { /* JMobile */ /* ============================================================================== */ +li.ui-li-divider .ui-link { + color: #FFF !important; +} +a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-inner:hover { + text-decoration: none !important; +} + +.ui-btn-inner { + padding-left: 10px; + padding-right: 10px; + /* white-space: normal; */ /* Warning, enable this break the truncate feature */ +} +.ui-select .ui-btn-icon-right .ui-btn-inner { + padding-right: 36px; +} +.fiche .ui-controlgroup { + margin: 0px; + padding-bottom: 0px; +} +div.ui-controlgroup-controls div.tabsElem +{ + margin-top: 2px; +} +div.ui-controlgroup-controls div.tabsElem a +{ + -moz-box-shadow: 0 -3px 6px rgba(0,0,0,.2); + -webkit-box-shadow: 0 -3px 6px rgba(0,0,0,.2); + box-shadow: 0 -3px 6px rgba(0,0,0,.2); + border: none; +} +a.tab span.ui-btn-inner +{ + border: none; + padding: 0; +} + .ui-body-c { border: none; text-shadow: none; } - -div.tabsElem a.ui-btn-corner-all { - -webkit-border-bottom-left-radius: 0px; - -moz-border-radius-bottomleft: 0px; - border-bottom-left-radius: 0px; - -webkit-border-bottom-right-radius: 0px; - -moz-border-radius-bottomright: 0px; - border-bottom-right-radius: 0px; +.ui-link { + color: rgb() !important; } -.ui-btn-icon-left .ui-icon { - left: 8px; +a.ui-link { + word-wrap: break-word; } -.ui-btn-icon-right .ui-icon { - right: 8px; + +/* force wrap possible onto field overflow does not works */ +.formdoc .ui-btn-inner +{ + white-space: normal; + overflow: hidden; + text-overflow: hidden; +} + +/* Warning: setting this may make screen not beeing refreshed after a combo selection */ +.ui-body-c { + background: #fff; } div.ui-radio @@ -2267,6 +2307,7 @@ div.ui-radio position: static; } + close(); ?> diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 30f1b354068..9115d071d33 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -2427,44 +2427,65 @@ div.ecmjqft { /* JMobile */ /* ============================================================================== */ +li.ui-li-divider .ui-link { + color: #FFF !important; +} +a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-inner:hover { + text-decoration: none !important; +} + .ui-btn-inner { padding-left: 10px; padding-right: 10px; - white-space: normal; + /* white-space: normal; */ /* Warning, enable this break the truncate feature */ } - -div.ui-controlgroup +.ui-select .ui-btn-icon-right .ui-btn-inner { + padding-right: 36px; +} +.fiche .ui-controlgroup { + margin: 0px; + padding-bottom: 0px; +} +div.ui-controlgroup-controls div.tabsElem { - height: auto; - background-image: none; + margin-top: 2px; } - -div.ui-controlgroup-controls div.tabsElem, div.ui-controlgroup-controls div.tabsElem a.tab +div.ui-controlgroup-controls div.tabsElem a { - height: auto; + -moz-box-shadow: 0 -3px 6px rgba(0,0,0,.2); + -webkit-box-shadow: 0 -3px 6px rgba(0,0,0,.2); + box-shadow: 0 -3px 6px rgba(0,0,0,.2); + border: none; } - a.tab span.ui-btn-inner { border: none; padding: 0; } -div.tabs a.tab#active span.ui-btn-inner, div.tabs a.tab#active span.ui-btn-text, div.tabs a.tab span.ui-btn-inner, div.tabs a.tab span.ui-btn-text { - background-image: none; - color: #D45416; - height: auto; -} .ui-body-c { border: none; text-shadow: none; } - -.ui-btn-icon-left .ui-icon { - left: 8px; +.ui-link { + color: rgb() !important; } -.ui-btn-icon-right .ui-icon { - right: 8px; + +a.ui-link { + word-wrap: break-word; +} + +/* force wrap possible onto field overflow does not works */ +.formdoc .ui-btn-inner +{ + white-space: normal; + overflow: hidden; + text-overflow: hidden; +} + +/* Warning: setting this may make screen not beeing refreshed after a combo selection */ +.ui-body-c { + background: #fff; } div.ui-radio diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index be7c6532f44..2cf66caa7fe 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -2277,38 +2277,65 @@ div.ecmjqft { /* JMobile */ /* ============================================================================== */ -.ui-body-c { +li.ui-li-divider .ui-link { + color: #FFF !important; +} +a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-inner:hover { + text-decoration: none !important; +} + +.ui-btn-inner { + padding-left: 10px; + padding-right: 10px; + /* white-space: normal; */ /* Warning, enable this break the truncate feature */ +} +.ui-select .ui-btn-icon-right .ui-btn-inner { + padding-right: 36px; +} +.fiche .ui-controlgroup { + margin: 0px; + padding-bottom: 0px; +} +div.ui-controlgroup-controls div.tabsElem +{ + margin-top: 2px; +} +div.ui-controlgroup-controls div.tabsElem a +{ + -moz-box-shadow: 0 -3px 6px rgba(0,0,0,.2); + -webkit-box-shadow: 0 -3px 6px rgba(0,0,0,.2); + box-shadow: 0 -3px 6px rgba(0,0,0,.2); border: none; - text-shadow: none; } - -div.ui-controlgroup -{ - height: auto; - background-image: none; -} - -div.ui-controlgroup-controls div.tabsElem, div.ui-controlgroup-controls div.tabsElem a.tab -{ - height: auto; -} - a.tab span.ui-btn-inner { border: none; padding: 0; } -div.tabs a.tab#active span.ui-btn-inner, div.tabs a.tab#active span.ui-btn-text, div.tabs a.tab span.ui-btn-inner, div.tabs a.tab span.ui-btn-text { - background-image: none; - color: #D45416; - height: auto; + +.ui-body-c { + border: none; + text-shadow: none; +} +.ui-link { + color: rgb() !important; } -.ui-btn-icon-left .ui-icon { - left: 8px; +a.ui-link { + word-wrap: break-word; } -.ui-btn-icon-right .ui-icon { - right: 8px; + +/* force wrap possible onto field overflow does not works */ +.formdoc .ui-btn-inner +{ + white-space: normal; + overflow: hidden; + text-overflow: hidden; +} + +/* Warning: setting this may make screen not beeing refreshed after a combo selection */ +.ui-body-c { + background: #fff; } div.ui-radio @@ -2322,6 +2349,7 @@ div.ui-radio position: static; } + close(); ?> diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index a311080a73d..8d136c10055 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -903,7 +903,7 @@ font.vsmenudisabled { font-size:px; font-family: ; } font.vsmenudisabledmargin { margin: 1px 1px 1px 8px; } -a.help:link, a.help:visited, a.help:hover, a.help:active { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #666666; } +a.help:link, a.help:visited, a.help:hover, a.help:active { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #666666; text-decoration: none; } div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks From 12c3fe25584e33ab28e0eaea3bc317d53f9e34bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 Jun 2013 23:24:58 +0200 Subject: [PATCH 06/27] Fix: Missing price level for triggers --- htdocs/product/class/product.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 08413318b06..33c4402ef7f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1061,7 +1061,9 @@ class Product extends CommonObject // Price by quantity $this->price_by_qty = $newpsq; - $this->_log_price($user,$level); + $this->_log_price($user,$level); // Save price for level into table product_price + + $this->level = $level; // Store level of price edited for trigger // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); From d3a500d6c48d26b6b24957411c231eec3d2899a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 Jun 2013 23:24:58 +0200 Subject: [PATCH 07/27] Fix: Missing price level for triggers --- htdocs/product/class/product.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2bdf4d3368b..f009b0df269 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1067,7 +1067,9 @@ class Product extends CommonObject // Price by quantity $this->price_by_qty = $newpsq; - $this->_log_price($user,$level); + $this->_log_price($user,$level); // Save price for level into table product_price + + $this->level = $level; // Store level of price edited for trigger // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); From bd8f1f2d2f7573143373d02f10042152254fca14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 00:11:15 +0200 Subject: [PATCH 08/27] Fix: Multiprices were not update by mass vat update tool --- htdocs/product/admin/product_tools.php | 42 +++++++++++++++++++++++--- htdocs/product/class/product.class.php | 6 ++-- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 3c17429e9c9..5cb378241dc 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -98,12 +98,46 @@ if ($action == 'convert') $newnpr=$objectstatic->recuperableonly; $newlevel=0; - $ret=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); - if ($ret < 0) $error++; - else $nbrecordsmodified++; + $ret=0; $retm=0; - // FIXME Now update all price levels. Call $objectstatic->updatePrice( as many times than exisitng price_level + // Update single price + if (! empty($price_base_type)) + { + print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $ret=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + } + // Update multiprice + foreach ($objectstatic->multiprices as $level => $multiprices) + { + $price_base_type = $objectstatic->multiprices_base_type[$level]; // Get price_base_type of product/service to keep the same for update + if (empty($price_base_type)) continue; // Discard not defined price levels + if ($price_base_type == 'TTC') + { + $newprice=price2num($objectstatic->multiprices_ttc[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->multiprices_min_ttc[$level]; + } + else + { + $newprice=price2num($objectstatic->multiprices[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->multiprices_min[$level]; + } + if ($newminprice > $newprice) $newminprice=$newprice; + $newvat=str_replace('*','',$newvatrate); + $newnpr=$objectstatic->multiprices_recuperableonly[$level]; + $newlevel=$level; + + print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $retm=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + if ($retm < 0) + { + $error++; + break; + } + } + + if ($ret < 0 || $retm < 0) $error++; + else $nbrecordsmodified++; } $i++; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 33c4402ef7f..0768a5a6066 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -63,6 +63,7 @@ class Product extends CommonObject var $multiprices_ttc=array(); var $multiprices_base_type=array(); var $multiprices_tva_tx=array(); + var $multiprices_recuperableonly=array(); //! Price by quantity arrays var $price_by_qty; var $prices_by_qty=array(); @@ -1197,7 +1198,7 @@ class Product extends CommonObject for ($i=1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; - $sql.= " price_base_type, tva_tx, tosell, price_by_qty, rowid"; + $sql.= " price_base_type, tva_tx, tosell, price_by_qty, rowid, recuperableonly"; $sql.= " FROM ".MAIN_DB_PREFIX."product_price"; $sql.= " WHERE price_level=".$i; $sql.= " AND fk_product = '".$this->id."'"; @@ -1213,7 +1214,8 @@ class Product extends CommonObject $this->multiprices_min[$i]=$result["price_min"]; $this->multiprices_min_ttc[$i]=$result["price_min_ttc"]; $this->multiprices_base_type[$i]=$result["price_base_type"]; - $this->multiprices_tva_tx[$i]=$result["tva_tx"]; + $this->multiprices_tva_tx[$i]=$result["tva_tx"]; + $this->multiprices_recuperableonly[$i]=$result["recuperableonly"]; // Price by quantity $this->prices_by_qty[$i]=$result["price_by_qty"]; From 5f60a7c88ca988db1cbe1184d231569adc3d6496 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 00:11:15 +0200 Subject: [PATCH 09/27] Fix: Multiprices were not update by mass vat update tool --- htdocs/product/admin/product_tools.php | 42 +++++++++++++++++++++++--- htdocs/product/class/product.class.php | 6 ++-- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 3c17429e9c9..5cb378241dc 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -98,12 +98,46 @@ if ($action == 'convert') $newnpr=$objectstatic->recuperableonly; $newlevel=0; - $ret=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); - if ($ret < 0) $error++; - else $nbrecordsmodified++; + $ret=0; $retm=0; - // FIXME Now update all price levels. Call $objectstatic->updatePrice( as many times than exisitng price_level + // Update single price + if (! empty($price_base_type)) + { + print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $ret=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + } + // Update multiprice + foreach ($objectstatic->multiprices as $level => $multiprices) + { + $price_base_type = $objectstatic->multiprices_base_type[$level]; // Get price_base_type of product/service to keep the same for update + if (empty($price_base_type)) continue; // Discard not defined price levels + if ($price_base_type == 'TTC') + { + $newprice=price2num($objectstatic->multiprices_ttc[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->multiprices_min_ttc[$level]; + } + else + { + $newprice=price2num($objectstatic->multiprices[$level],'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->multiprices_min[$level]; + } + if ($newminprice > $newprice) $newminprice=$newprice; + $newvat=str_replace('*','',$newvatrate); + $newnpr=$objectstatic->multiprices_recuperableonly[$level]; + $newlevel=$level; + + print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $retm=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + if ($retm < 0) + { + $error++; + break; + } + } + + if ($ret < 0 || $retm < 0) $error++; + else $nbrecordsmodified++; } $i++; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f009b0df269..7973ab0db57 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -61,6 +61,7 @@ class Product extends CommonObject var $multiprices_ttc=array(); var $multiprices_base_type=array(); var $multiprices_tva_tx=array(); + var $multiprices_recuperableonly=array(); //! Price by quantity arrays var $price_by_qty; var $prices_by_qty=array(); @@ -1203,7 +1204,7 @@ class Product extends CommonObject for ($i=1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; - $sql.= " price_base_type, tva_tx, tosell, price_by_qty, rowid"; + $sql.= " price_base_type, tva_tx, tosell, price_by_qty, rowid, recuperableonly"; $sql.= " FROM ".MAIN_DB_PREFIX."product_price"; $sql.= " WHERE price_level=".$i; $sql.= " AND fk_product = '".$this->id."'"; @@ -1219,7 +1220,8 @@ class Product extends CommonObject $this->multiprices_min[$i]=$result["price_min"]; $this->multiprices_min_ttc[$i]=$result["price_min_ttc"]; $this->multiprices_base_type[$i]=$result["price_base_type"]; - $this->multiprices_tva_tx[$i]=$result["tva_tx"]; + $this->multiprices_tva_tx[$i]=$result["tva_tx"]; + $this->multiprices_recuperableonly[$i]=$result["recuperableonly"]; // Price by quantity $this->prices_by_qty[$i]=$result["price_by_qty"]; From 6750987dcb748f7ca6a15ca3c72c70a9b1346ef9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 00:21:17 +0200 Subject: [PATCH 10/27] Qual: id of an instance should not be provided into method of instance --- htdocs/product/admin/product_tools.php | 4 +-- htdocs/product/price.php | 49 ++++++++++++++------------ 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 5cb378241dc..de1ae7cdd7c 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -104,7 +104,7 @@ if ($action == 'convert') if (! empty($price_base_type)) { print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $ret=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + $ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); } // Update multiprice foreach ($objectstatic->multiprices as $level => $multiprices) @@ -128,7 +128,7 @@ if ($action == 'convert') $newlevel=$level; print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $retm=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + $retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); if ($retm < 0) { $error++; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 2d0a1816982..240844b9f4d 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -51,7 +51,7 @@ $object = new Product($db); if ($action == 'update_price' && ! $_POST["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { $result = $object->fetch($id); - + // MultiPrix if (! empty($conf->global->PRODUIT_MULTIPRICES)) { @@ -88,7 +88,7 @@ if ($action == 'update_price' && ! $_POST["cancel"] && ($user->rights->produit-> $newpsq = empty($newpsq) ? 0 : $newpsq; } - if ($object->updatePrice($object->id, $newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) + if ($object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) { $action = ''; $mesg = '
'.$langs->trans("RecordSaved").'
'; @@ -112,8 +112,8 @@ $error=0; if ($action == 'activate_price_by_qty') { // Activating product price by quantity add a new price, specified as by quantity $result = $object->fetch($id); $level=GETPOST('level'); - - $object->updatePrice($object->id, 0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1); + + $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1); } if ($action == 'edit_price_by_qty') { // Edition d'un prix par quantité @@ -131,7 +131,7 @@ if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par qu $quantity=GETPOST('quantity'); $remise_percent=price2num(GETPOST('remise_percent')); $remise=0; // TODO : allow dicsount by amount when available on documents - + if (empty($quantity)) { $error++; @@ -148,10 +148,10 @@ if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par qu { $price = price2num($newprice) / (1 + ($object->tva_tx / 100)); } - + $price = price2num($newprice,'MU'); $unitPrice = price2num($price/$quantity,'MU'); - + // Ajout / mise à jour if($rowid > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."product_price_by_qty SET"; @@ -161,12 +161,12 @@ if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par qu $sql.= " remise_percent=".$remise_percent.","; $sql.= " remise=".$remise; $sql.= " WHERE rowid = ".GETPOST('rowid'); - + $result = $db->query($sql); } else { $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price_by_qty (fk_product_price,price,unitprice,quantity,remise_percent,remise) values ("; $sql.= $priceid.','.$price.','.$unitPrice.','.$quantity.','.$remise_percent.','.$remise.')'; - + $result = $db->query($sql); } } @@ -174,19 +174,19 @@ if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par qu if ($action == 'delete_price_by_qty') { $rowid = GETPOST('rowid'); - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty"; $sql.= " WHERE rowid = ".GETPOST('rowid'); - + $result = $db->query($sql); } if ($action == 'delete_all_price_by_qty') { $priceid=GETPOST('priceid'); - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty"; $sql.= " WHERE fk_product_price = ".$priceid; - + $result = $db->query($sql); } @@ -325,10 +325,10 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) if($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) { print ''.$langs->trans("PriceByQuantity").' '.$i; print ''; - + if($object->prices_by_qty[$i] == 1) { print ''; - + print ''; print ''; print ''; @@ -383,7 +383,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) print ''; print ''; } - + print '
'.$langs->trans("PriceByQuantityRange").' '.$i.''.$langs->trans("HT").'
'; } else { print $langs->trans("No"); @@ -422,16 +422,18 @@ else print price($object->price_min).' '.$langs->trans($object->price_base_type); } print ''; - + // Price by quantity - if($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) { + if($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) + { print ''.$langs->trans("PriceByQuantity"); if($object->prices_by_qty[0] == 0) { print ' '.$langs->trans("Activate"); } print ''; - - if($object->prices_by_qty[0] == 1) { + + if ($object->prices_by_qty[0] == 1) + { print ''; print ''; print ''; @@ -440,7 +442,8 @@ else print ''; print ''; print ''; - foreach ($object->prices_by_qty_list[0] as $ii=> $prices) { + foreach ($object->prices_by_qty_list[0] as $ii=> $prices) + { if($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) { print ''; print ''; @@ -667,8 +670,8 @@ $sql.= " WHERE fk_product = ".$object->id; $sql.= " AND p.fk_user_author = u.rowid"; if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql.= " AND p.price_level = ".$soc->price_level; $sql.= " ORDER BY p.date_price DESC, p.price_level ASC"; -//$sql .= $db->plimit(); +dol_syslog("sql=".$sql); $result = $db->query($sql); if ($result) { @@ -680,7 +683,7 @@ if ($result) // Il doit au moins y avoir la ligne de prix initial. // On l'ajoute donc pour remettre a niveau (pb vieilles versions) - $object->updatePrice($object->id, $object->price, $object->price_base_type, $user, $newprice_min); + $object->updatePrice($object->price, $object->price_base_type, $user, $newprice_min); $result = $db->query($sql); $num = $db->num_rows($result); From 980901b557eef5591214a5a637f57e218b77bd5a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 00:23:38 +0200 Subject: [PATCH 11/27] Qual: id of an instance should not be provided into method of instance --- htdocs/product/class/product.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0768a5a6066..642c2b6376a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -959,7 +959,6 @@ class Product extends CommonObject /** * Modify price of a product/Service * - * @param int $id Id of product/service to change * @param double $newprice New price * @param string $newpricebase HT or TTC * @param User $user Object user that make change @@ -970,10 +969,12 @@ class Product extends CommonObject * @param int $newpsq 1 if it has price by quantity * @return int <0 if KO, >0 if OK */ - function updatePrice($id, $newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0, $newpsq=0) + function updatePrice($newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0, $newpsq=0) { global $conf,$langs; + $id=$this->id; + dol_syslog(get_class($this)."update_price id=".$id." newprice=".$newprice." newpricebase=".$newpricebase." newminprice=".$newminprice." level=".$level." npr=".$newnpr); // Clean parameters From 184f1a4b159495a657981c4e3f9362796424b7cc Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Fri, 14 Jun 2013 00:44:58 +0200 Subject: [PATCH 12/27] revert Jean modif --- htdocs/product/class/product.class.php | 1 - htdocs/product/price.php | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5a9d075b4ff..6888c144a7c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -57,7 +57,6 @@ class Product extends CommonObject //! Base price ('TTC' for price including tax or 'HT' for net price) var $price_base_type; //! Arrays for multiprices - var $pricelevel; var $multiprices=array(); var $multiprices_ttc=array(); var $multiprices_base_type=array(); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 6b8f6b90ae3..2d0a1816982 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -88,16 +88,6 @@ if ($action == 'update_price' && ! $_POST["cancel"] && ($user->rights->produit-> $newpsq = empty($newpsq) ? 0 : $newpsq; } - //save level and multiprices for trigger - $object->pricelevel = $level; - if ($level) - { - $object->multiprices[$level]=$newprice; - $object->multiprices_base_type[$level]=$newpricebase; - $object->multiprices_tva_tx[$level]=$newvat; - $object->multiprices_min[$level]=$newprice_min; - } - if ($object->updatePrice($object->id, $newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) { $action = ''; From 9ff6b4c23e6a1ee32522d85decbe41479f0a5723 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 00:46:02 +0200 Subject: [PATCH 13/27] Fix: Too large top --- htdocs/theme/auguria/style.css.php | 2 +- htdocs/theme/bureau2crea/style.css.php | 2 +- htdocs/theme/cameleo/style.css.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index ea1c3b04c00..2fecd817b5e 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -469,7 +469,7 @@ foreach($mainmenuusedarray as $val) /* Login */ form#login { - margin-top: 70px; + margin-top: px; margin-bottom: 30px; font-size: 13px; } diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 132b1c3e12b..00181336286 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -508,7 +508,7 @@ li.tmenu a.tmenudisabled { /* Login */ form#login { - margin-top: 70px; + margin-top: px; margin-bottom: 30px; font-size: 13px; } diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index 86bd7d8cdda..ec01aef6882 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -579,7 +579,7 @@ foreach($mainmenuusedarray as $val) /* Login */ form#login { - margin-top: 70px; + margin-top: px; margin-bottom: 30px; font-size: 13px; } From 99cbee64862b9bd6c26c158fe0880334437cff5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 01:22:38 +0200 Subject: [PATCH 14/27] Fix: Do not update twice level 1 --- htdocs/product/admin/product_tools.php | 53 ++++++++++++++------------ 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index de1ae7cdd7c..6e7e0513576 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -82,32 +82,11 @@ if ($action == 'convert') $ret=$objectstatic->fetch($obj->rowid); if ($ret > 0) { - $price_base_type = $objectstatic->price_base_type; // Get price_base_type of product/service to keep the same for update - if ($price_base_type == 'TTC') - { - $newprice=price2num($objectstatic->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->price_min_ttc; - } - else - { - $newprice=price2num($objectstatic->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->price_min; - } - if ($newminprice > $newprice) $newminprice=$newprice; - $newvat=str_replace('*','',$newvatrate); - $newnpr=$objectstatic->recuperableonly; - $newlevel=0; + $ret=0; $retm=0; $updatelevel1=false; - $ret=0; $retm=0; - - // Update single price - if (! empty($price_base_type)) - { - print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); - } // Update multiprice - foreach ($objectstatic->multiprices as $level => $multiprices) + $listofmulti=array_reverse($objectstatic->multiprices, true); // To finish with level 1 + foreach ($listofmulti as $level => $multiprices) { $price_base_type = $objectstatic->multiprices_base_type[$level]; // Get price_base_type of product/service to keep the same for update if (empty($price_base_type)) continue; // Discard not defined price levels @@ -127,15 +106,39 @@ if ($action == 'convert') $newnpr=$objectstatic->multiprices_recuperableonly[$level]; $newlevel=$level; - print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; $retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); if ($retm < 0) { $error++; break; } + + if ($newlevel == 1) $updatelevel1=true; } + // Update single price + $price_base_type = $objectstatic->price_base_type; // Get price_base_type of product/service to keep the same for update + if ($price_base_type == 'TTC') + { + $newprice=price2num($objectstatic->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->price_min_ttc; + } + else + { + $newprice=price2num($objectstatic->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->price_min; + } + if ($newminprice > $newprice) $newminprice=$newprice; + $newvat=str_replace('*','',$newvatrate); + $newnpr=$objectstatic->recuperableonly; + $newlevel=0; + if (! empty($price_base_type) && ! $updatelevel1) + { + //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + } + if ($ret < 0 || $retm < 0) $error++; else $nbrecordsmodified++; } From 396cbcec62988360bd04469376a99422329c0867 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 01:23:54 +0200 Subject: [PATCH 15/27] Fix: Do not update twice level 1 Conflicts: htdocs/product/admin/product_tools.php --- htdocs/product/admin/product_tools.php | 55 ++++++++++++++------------ 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 5cb378241dc..6e7e0513576 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -82,32 +82,11 @@ if ($action == 'convert') $ret=$objectstatic->fetch($obj->rowid); if ($ret > 0) { - $price_base_type = $objectstatic->price_base_type; // Get price_base_type of product/service to keep the same for update - if ($price_base_type == 'TTC') - { - $newprice=price2num($objectstatic->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->price_min_ttc; - } - else - { - $newprice=price2num($objectstatic->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) - $newminprice=$objectstatic->price_min; - } - if ($newminprice > $newprice) $newminprice=$newprice; - $newvat=str_replace('*','',$newvatrate); - $newnpr=$objectstatic->recuperableonly; - $newlevel=0; + $ret=0; $retm=0; $updatelevel1=false; - $ret=0; $retm=0; - - // Update single price - if (! empty($price_base_type)) - { - print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $ret=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); - } // Update multiprice - foreach ($objectstatic->multiprices as $level => $multiprices) + $listofmulti=array_reverse($objectstatic->multiprices, true); // To finish with level 1 + foreach ($listofmulti as $level => $multiprices) { $price_base_type = $objectstatic->multiprices_base_type[$level]; // Get price_base_type of product/service to keep the same for update if (empty($price_base_type)) continue; // Discard not defined price levels @@ -127,15 +106,39 @@ if ($action == 'convert') $newnpr=$objectstatic->multiprices_recuperableonly[$level]; $newlevel=$level; - print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; - $retm=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); if ($retm < 0) { $error++; break; } + + if ($newlevel == 1) $updatelevel1=true; } + // Update single price + $price_base_type = $objectstatic->price_base_type; // Get price_base_type of product/service to keep the same for update + if ($price_base_type == 'TTC') + { + $newprice=price2num($objectstatic->price_ttc,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->price_min_ttc; + } + else + { + $newprice=price2num($objectstatic->price,'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) + $newminprice=$objectstatic->price_min; + } + if ($newminprice > $newprice) $newminprice=$newprice; + $newvat=str_replace('*','',$newvatrate); + $newnpr=$objectstatic->recuperableonly; + $newlevel=0; + if (! empty($price_base_type) && ! $updatelevel1) + { + //print "$objectstatic->id $newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr
\n"; + $ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); + } + if ($ret < 0 || $retm < 0) $error++; else $nbrecordsmodified++; } From c1b21d14803732266446641b5aaae47fd04e0aaf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 01:29:05 +0200 Subject: [PATCH 16/27] Fix: Option not working --- htdocs/adherents/admin/adherent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 2bed305783a..cfb7372308a 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -138,7 +138,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) print ''; print ''; print '
\n"; From 02f1271fc4619cd6a07b0e7bfce410fc579c272a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 01:30:43 +0200 Subject: [PATCH 17/27] New: Add option ADHERENT_LOGIN_NOT_REQUIRED --- ChangeLog | 1 + htdocs/adherents/admin/adherent.php | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16b77f8cc6d..19859731a6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ For users: - New: [ task #926 ] Add extrafield feature on order lines - New: [ task #927 ] Add extrafield feature on Proposal lines - New: [ task #928 ] Add extrafield feature on invoice lines +- New: Add option ADHERENT_LOGIN_NOT_REQUIRED For translators: - Normalized sort order of all languages files with english ref file. diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index cfb7372308a..87412802de0 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -130,20 +130,17 @@ $var=true; $form = new Form($db); // Login/Pass required for members -if ($conf->global->MAIN_FEATURES_LEVEL > 0) -{ - $var=!$var; - print ''; - print ''; - print ''; - print ''; - print '\n"; - print ''; -} +$var=!$var; +print ''; +print ''; +print ''; +print ''; +print '\n"; +print ''; // Mail required for members $var=!$var; From b3ca9de39947ecdc77dcc35142174db7797963ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 02:09:34 +0200 Subject: [PATCH 18/27] Fix: Update select with list --- htdocs/core/modules/modSociete.class.php | 54 +++++++++---------- .../core/tpl/admin_extrafields_edit.tpl.php | 14 ++--- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 93700ec55b2..0f2e7ed5bb6 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -258,33 +258,33 @@ class modSociete extends DolibarrModules $resql=$this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { - while ($obj=$this->db->fetch_object($resql)) - { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) - { - case 'int': - case 'double': - case 'price': - $typeFilter="Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter="Date"; - break; - case 'boolean': - $typeFilter="Boolean"; - break; - case 'sellist': - $typeFilter="List:".$obj->param; - break; - } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='company'; - } + while ($obj=$this->db->fetch_object($resql)) + { + $fieldname='extra.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $typeFilter="Text"; + switch($obj->type) + { + case 'int': + case 'double': + case 'price': + $typeFilter="Numeric"; + break; + case 'date': + case 'datetime': + $typeFilter="Date"; + break; + case 'boolean': + $typeFilter="Boolean"; + break; + case 'sellist': + $typeFilter="List:".$obj->param; + break; + } + $this->export_fields_array[$r][$fieldname]=$fieldlabel; + $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; + $this->export_entities_array[$r][$fieldname]='company'; + } } // End add axtra fields $this->export_sql_start[$r]='SELECT DISTINCT '; diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 25c8ede2227..3d1bdc4a9be 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -61,12 +61,14 @@ if((($type == 'select') || ($type == 'checkbox') ||(($type == 'radio'))) && is_a $param_chain = ''; foreach ($param['options'] as $key => $value) { - if(strlen($key)) + if(strlen($key)) { - $param_chain .= $key.', '.$value."\n"; + $param_chain .= $key.','.$value."\n"; } } -}elseif ($type== 'sellist') { +} +elseif ($type== 'sellist') +{ $paramlist=array_keys($param['options']); $param_chain = $paramlist[0]; } @@ -83,8 +85,8 @@ if((($type == 'select') || ($type == 'checkbox') ||(($type == 'radio'))) && is_a - @@ -99,7 +101,7 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') ||(($typ
'.$langs->trans("PriceByQuantityRange").''.$langs->trans("Discount").' 
'.$langs->trans("AdherentLoginRequired").''; - print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?$conf->global->ADHERENT_LOGIN_NOT_REQUIRED:1),1); + print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?0:1),1); print ''; print ''; print "
'.$langs->trans("AdherentLoginRequired").''; - print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?0:1),1); - print ''; - print ''; - print "
'.$langs->trans("AdherentLoginRequired").''; +print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?0:1),1); +print ''; +print ''; +print "
- From 8ed5dfededf4ac88ca57fc44f94b9d492b93fb60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 02:15:43 +0200 Subject: [PATCH 19/27] Fix: Bad styles of html elements --- htdocs/core/class/extrafields.class.php | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 146237122ca..206856c3530 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -559,7 +559,7 @@ class ExtraFields $this->attribute_pos[$tab->name]=$tab->pos; } } - + return $array_name_label; } else @@ -626,11 +626,11 @@ class ExtraFields { $tmp=explode(',',$size); $newsize=$tmp[0]; - $out=''; + $out=''; } elseif ($type == 'varchar') { - $out=''; + $out=''; } elseif ($type == 'text') { @@ -646,27 +646,27 @@ class ExtraFields } else { $checked=' value="1" '; } - $out=''; + $out=''; } elseif ($type == 'mail') { - $out=''; + $out=''; } elseif ($type == 'phone') { - $out=''; + $out=''; } elseif ($type == 'price') { - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } elseif ($type == 'double') { - $out=' '; + $out=' '; } elseif ($type == 'select') { - $out=''; foreach ($param['options'] as $key=>$val ) { $out.='
'.img_left().''; + print ''.img_left('default', 0, 'style="max-width: 20px"').''; print ''; //print $text.'-'.$htmltext."
"; print $form->textwithpicto($text,$htmltext); @@ -573,7 +573,7 @@ if ($step == 2 && $datatoexport) print $form->textwithpicto($text,$htmltext); //print ' ('.$code.')'; print ''; - print ''.img_right().''; + print ''.img_right('default', 0, 'style="max-width: 20px"').''; print ' '; } From bc5fa5972ab27d0c58033228e4294e4198cfff8a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 02:26:24 +0200 Subject: [PATCH 21/27] Drop deprecated tables --- htdocs/install/mysql/migration/3.4.0-3.5.0.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index 01b9ac4af29..b7a12f34262 100755 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -63,3 +63,7 @@ create table llx_propaldet_extrafields ALTER TABLE llx_propaldet_extrafields ADD INDEX idx_propaldet_extrafields (fk_object); +DROP table llx_adherent_options; +DROP table llx_adherent_options_label; + + From 13b3a3c850b818230a0789db58ed58efcd34a81c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 02:35:30 +0200 Subject: [PATCH 22/27] Fix: Export of extra field for members --- htdocs/core/modules/modAdherent.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 74fd21da47f..fd4a4d38857 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -43,7 +43,7 @@ class modAdherent extends DolibarrModules function __construct($db) { global $conf; - + $this->db = $db; $this->numero = 310; @@ -179,7 +179,7 @@ class modAdherent extends DolibarrModules $this->export_TypeFields_array[$r]=array('a.civilite'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",'a.zip'=>"Text",'a.town'=>"Text",'a.country'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:fk_adherent_type:libelle','ta.libelle'=>'Text','c.dateadh'=>'Date','c.cotisation'=>'Number'); $this->export_entities_array[$r]=array('a.rowid'=>'member','a.civilite'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'a.country'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.cotisation'=>'subscription'); // Add extra fields - $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'member' AND entity = ".$conf->entity; + $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity = ".$conf->entity; $resql=$this->db->query($sql); while ($obj=$this->db->fetch_object($resql)) { From 3b88142ba87ec0508a6020a8c6c93157e4e90380 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 02:41:08 +0200 Subject: [PATCH 23/27] Fix: Import of extra field for members --- htdocs/core/modules/modAdherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index fd4a4d38857..8cd63fb37c7 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -212,7 +212,7 @@ class modAdherent extends DolibarrModules $this->import_tables_creator_array[$r]=array('a'=>'fk_user_author'); // Fields to store import user id $this->import_fields_array[$r]=array('a.civilite'=>"UserTitle",'a.lastname'=>"Lastname*",'a.firstname'=>"Firstname",'a.login'=>"Login*","a.pass"=>"Password","a.fk_adherent_type"=>"MemberType*",'a.morphy'=>'Nature*','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'a.country'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status*",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datefin'=>'DateEndSubscription'); // Add extra fields - $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'member' AND entity = ".$conf->entity; + $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity = ".$conf->entity; $resql=$this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { From 684c086ad01a36529bf4f616fb0ed2ff22a89ed7 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 14 Jun 2013 15:37:28 +0200 Subject: [PATCH 24/27] Fix: param must be a string --- htdocs/compta/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index ae3a8b08a72..4d6d3140047 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1836,7 +1836,7 @@ else if ($action == 'print_file' AND $user->rights->printipp->read) { require_once DOL_DOCUMENT_ROOT.'/core/class/dolprintipp.class.php'; $printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD); - $printer->print_file(GETPOST('file',alpha),GETPOST('printer',alpha)); + $printer->print_file(GETPOST('file','alpha'),GETPOST('printer','alpha')); setEventMessage($langs->trans("FileWasSentToPrinter", GETPOST('file'))); $action=''; } From 2f386b1b367f09c81a7af2c54339faedfc10f1a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 19:43:45 +0200 Subject: [PATCH 25/27] Fix: Bad closing of div --- htdocs/core/menus/standard/eldy.lib.php | 9 +++++---- htdocs/main.inc.php | 6 ++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index bf03e27dfaa..9f3637477bc 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1228,7 +1228,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Show menu if (empty($noout)) { - $alt=0; + $alt=0; $blockvmenuopened=false; $num=count($menu_array); for ($i = 0; $i < $num; $i++) { @@ -1238,6 +1238,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $alt++; if (empty($menu_array[$i]['level']) && $showmenu) { + $blockvmenuopened=true; if (($alt%2==0)) { print '
'."\n"; @@ -1264,7 +1265,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $url=preg_replace('/__LOGIN__/',$user->login,$url); $url=preg_replace('/__USERID__/',$user->id,$url); - print ''."\n"; + print ''."\n"; // Menu niveau 0 if ($menu_array[$i]['level'] == 0) @@ -1299,12 +1300,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } } - // If next is a new block or end + // If next is a new block or if there is nothing after if (empty($menu_array[$i+1]['level'])) { if ($showmenu) print ''."\n"; - print "
\n"; + if ($blockvmenuopened) { print "\n"; $blockvmenuopened=false; } } } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 86419f2bdaf..74633bce37e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1449,9 +1449,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "\n"; - print "\n"; + print "\n\n"; - //XXX if (empty($conf->use_javascript_ajax) || empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print ''; if (empty($conf->dol_hide_leftmenu) && (empty($conf->use_javascript_ajax) || empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT))) print '
'; } @@ -1483,7 +1482,6 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me if (empty($conf->dol_hide_leftmenu)) { if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "\n".'
'."\n"; - //XXX else print '
'; else print '
'; print "\n"; @@ -1542,7 +1540,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me // Left column print ''."\n"; - print '
'."\n"; + print '
'."\n\n"; $menumanager->menu_array = $menu_array_before; $menumanager->menu_array_after = $menu_array_after; From af8c4cd0d39ddeb5f85d837df8fa00602868fd47 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 19:43:45 +0200 Subject: [PATCH 26/27] Fix: Bad closing of div --- htdocs/core/menus/standard/eldy.lib.php | 9 +++++---- htdocs/main.inc.php | 6 ++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a241f735c24..8c3c1952cc0 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1269,7 +1269,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Show menu if (empty($noout)) { - $alt=0; + $alt=0; $blockvmenuopened=false; $num=count($menu_array); for ($i = 0; $i < $num; $i++) { @@ -1279,6 +1279,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $alt++; if (empty($menu_array[$i]['level']) && $showmenu) { + $blockvmenuopened=true; if (($alt%2==0)) { print '
'."\n"; @@ -1305,7 +1306,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $url=preg_replace('/__LOGIN__/',$user->login,$url); $url=preg_replace('/__USERID__/',$user->id,$url); - print ''."\n"; + print ''."\n"; // Menu niveau 0 if ($menu_array[$i]['level'] == 0) @@ -1340,12 +1341,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } } - // If next is a new block or end + // If next is a new block or if there is nothing after if (empty($menu_array[$i+1]['level'])) { if ($showmenu) print ''."\n"; - print "
\n"; + if ($blockvmenuopened) { print "
\n"; $blockvmenuopened=false; } } } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 128fa747571..941db5e5f13 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1452,9 +1452,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "
\n"; - print "\n"; + print "\n\n"; - //XXX if (empty($conf->use_javascript_ajax) || empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print ''; if (empty($conf->dol_hide_leftmenu) && (empty($conf->use_javascript_ajax) || empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT))) print '
'; } @@ -1486,7 +1485,6 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me if (empty($conf->dol_hide_leftmenu)) { if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "\n".'
'."\n"; - //XXX else print '
'; else print '
'; print "\n"; @@ -1545,7 +1543,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me // Left column print ''."\n"; - print '
'."\n"; + print '
'."\n\n"; $menumanager->menu_array = $menu_array_before; $menumanager->menu_array_after = $menu_array_after; From 0a9cf26a3207be419471bd8ac16210b09dcf85cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 19:51:53 +0200 Subject: [PATCH 27/27] Fix: Bad closing of div --- htdocs/core/menus/standard/auguria.lib.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 316c4d5b607..1c14f3de824 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -301,7 +301,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM // Show menu if (empty($noout)) { - $alt=0; + $alt=0; $blockvmenuopened=false; $num=count($menu_array); for ($i = 0; $i < $num; $i++) { @@ -311,6 +311,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM $alt++; if (empty($menu_array[$i]['level']) && $showmenu) { + $blockvmenuopened=true; if (($alt%2==0)) { print '
'."\n"; @@ -344,8 +345,8 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM $url.='mainmenu='.$mainmenu; } - print ''."\n"; - + print ''."\n"; + // Menu niveau 0 if ($menu_array[$i]['level'] == 0) { @@ -379,12 +380,12 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM } } - // If next is a new block or end + // If next is a new block or if there is nothing after if (empty($menu_array[$i+1]['level'])) { if ($showmenu) print ''."\n"; - print "
\n"; + if ($blockvmenuopened) { print "
\n"; $blockvmenuopened=false; } } } }