From 1ecc24216fece3ed11e319389fe30b6f64dd0384 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Thu, 13 Jun 2013 15:07:50 +0200 Subject: [PATCH 01/10] =?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/10] 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/10] 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/10] 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/10] 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 d3a500d6c48d26b6b24957411c231eec3d2899a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 Jun 2013 23:24:58 +0200 Subject: [PATCH 06/10] 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 5f60a7c88ca988db1cbe1184d231569adc3d6496 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 00:11:15 +0200 Subject: [PATCH 07/10] 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 184f1a4b159495a657981c4e3f9362796424b7cc Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Fri, 14 Jun 2013 00:44:58 +0200 Subject: [PATCH 08/10] 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 396cbcec62988360bd04469376a99422329c0867 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Jun 2013 01:23:54 +0200 Subject: [PATCH 09/10] 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 10/10] 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 ''.$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 "\n";