From be8a95a22b6ad7bb9bd4e64f19ff14235aaa75a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Mon, 25 Mar 2013 13:03:37 +0400 Subject: [PATCH 01/28] =?UTF-8?q?Mise=20=C3=A0=20jour=20des=20tables=20fac?= =?UTF-8?q?ture=5Ffourn=5Fdet=20et=20product=5Ffournisseur=5Fprice.=20Ajou?= =?UTF-8?q?t=20d'un=20champ=20pour=20la=20gestion=20de=20la=20TVA=20NPR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/install/mysql/tables/llx_facture_fourn_det.sql | 1 + htdocs/install/mysql/tables/llx_product_fournisseur_price.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql index 325950a4e46..f0452c9b40e 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql @@ -43,6 +43,7 @@ create table llx_facture_fourn_det product_type integer DEFAULT 0, date_start datetime DEFAULT NULL, -- date debut si service date_end datetime DEFAULT NULL, -- date fin si service + info_bits integer DEFAULT 0, -- TVA NPR ou non fk_code_ventilation integer DEFAULT 0 NOT NULL, import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql index c368691e5ac..01789ff8edd 100644 --- a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql @@ -37,6 +37,7 @@ create table llx_product_fournisseur_price charges double(24,8) DEFAULT 0, unitcharges double(24,8) DEFAULT 0, tva_tx double(6,3) NOT NULL, + recuperableonly integer NOT NULL DEFAULT 0, fk_user integer, import_key varchar(14) -- Import key )ENGINE=innodb; From 6cfedfff9fb205dd5ec78f4e5a54d1532862a5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Mon, 25 Mar 2013 17:18:10 +0400 Subject: [PATCH 02/28] TVA NPR : add info_bits property in class FactureFournisseur --- htdocs/fourn/class/fournisseur.facture.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 60bdf26a8ab..525e8fb832b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -389,7 +389,7 @@ class FactureFournisseur extends CommonInvoice { $sql = 'SELECT f.rowid, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva'; $sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; - $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type'; + $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits'; $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; @@ -430,6 +430,7 @@ class FactureFournisseur extends CommonInvoice $this->lines[$i]->total_ttc = $obj->total_ttc; $this->lines[$i]->fk_product = $obj->fk_product; $this->lines[$i]->product_type = $obj->product_type; + $this->lines[$i]->info_bits = $obj->info_bits; $i++; } @@ -1104,6 +1105,7 @@ class FactureFournisseur extends CommonInvoice $pu_ttc = $tabprice[5]; $total_localtax1 = $tabprice[9]; $total_localtax2 = $tabprice[10]; + $info_bits = empty($info_bits) ? 0 : $info_bits; if ($idproduct) { @@ -1133,6 +1135,7 @@ class FactureFournisseur extends CommonInvoice if ($idproduct) $sql.= ", fk_product = ".$idproduct; else $sql.= ", fk_product = null"; $sql.= ", product_type = ".$product_type; + $sql.= ", infos_bits = ".$infos_bits; $sql.= " WHERE rowid = ".$id; dol_syslog(get_class($this)."::updateline sql=".$sql); From b2b0d1616defca62e833381cbcbe95ec15991f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Mon, 25 Mar 2013 17:32:22 +0400 Subject: [PATCH 03/28] TVA NPR : add fourn_tva_npr property in class ProductFournisseur --- htdocs/fourn/class/fournisseur.product.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 7399c454cee..40e19664681 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -48,6 +48,7 @@ class ProductFournisseur extends Product var $product_fourn_id; // supplier id var $fk_availability; // availability delay var $fourn_unitprice; + var $fourn_tva_npr; /** @@ -147,7 +148,7 @@ class ProductFournisseur extends Product * @param float $remise Discount regarding qty (amount) * @return int <0 if KO, >=0 if OK */ - function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0) + function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0) { global $conf,$mysoc; @@ -188,6 +189,7 @@ class ProductFournisseur extends Product $sql.= " tva_tx = ".$tva_tx.","; $sql.= " fk_availability = ".$availability.","; $sql.= " entity = ".$conf->entity.","; + $sql.= " recuperableonly = ".$newnpr.","; $sql.= " charges = ".$charges; $sql.= " WHERE rowid = ".$this->product_fourn_price_id; // TODO Add price_base_type and price_ttc @@ -218,7 +220,7 @@ class ProductFournisseur extends Product { // Add price for this quantity to supplier $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price("; - $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, entity)"; + $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, entity, recuperableonly)"; $sql.= " values('".$this->db->idate($now)."',"; $sql.= " ".$this->id.","; $sql.= " ".$fourn->id.","; @@ -233,6 +235,7 @@ class ProductFournisseur extends Product $sql.= " ".$charges.","; $sql.= " ".$unitCharges.","; $sql.= " ".$availability.","; + $sql.= " ".$newnpr.","; $sql.= $conf->entity; $sql.=")"; @@ -316,6 +319,7 @@ class ProductFournisseur extends Product $this->product_id = $obj->fk_product; // deprecated $this->fk_product = $obj->fk_product; $this->fk_availability = $obj->fk_availability; + $this->fourn_tva_npr = $obj->recuperableonly; return 1; } else @@ -346,7 +350,7 @@ class ProductFournisseur extends Product $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; $sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.fk_product as product_fourn_id,"; - $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges"; + $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.recuperableonly"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE pfp.entity IN (".getEntity('product', 1).")"; @@ -381,6 +385,7 @@ class ProductFournisseur extends Product $prodfourn->fourn_name = $record["supplier_name"]; $prodfourn->fk_availability = $record["fk_availability"]; $prodfourn->id = $prodid; + $prodfourn->fourn_tva_npr = $record["recuperableonly"]; if (!isset($prodfourn->fourn_unitprice)) { @@ -501,4 +506,4 @@ class ProductFournisseur extends Product } -?> \ No newline at end of file +?> From aaaa5242d6a2b05102b8d6ca7475c487c428df7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Mon, 25 Mar 2013 17:42:48 +0400 Subject: [PATCH 04/28] TVA NP : update price calculation --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c92b94b0b6e..a8803d6e5e8 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1002,7 +1002,7 @@ class Product extends CommonObject else { $price = price2num($newprice,'MU'); - $price_ttc = price2num($newprice) * (1 + ($newvat / 100)); + $price_ttc = ( $newnpr != 1 ) ? price2num($newprice) * (1 + ($newvat / 100)) : $price; $price_ttc = price2num($price_ttc,'MU'); if ($newminprice!='' || $newminprice==0) From bbbc4ad8c44af76b01a622e0a8a032b7cb557e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Tue, 26 Mar 2013 07:57:19 +0400 Subject: [PATCH 05/28] TVA NPR: add parameter in function call. Accept * tva --- htdocs/fourn/facture/fiche.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index b726d39231a..62cb5334b93 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -502,13 +502,14 @@ elseif ($action == 'addline') $label.= $_POST['np_desc']; $tvatx=get_default_tva($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']); + $npr = get_default_npr($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']); $localtax1tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); $localtax2tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); $remise_percent=GETPOST('remise_percent'); $type = $product->type; - $result=$object->addline($label, $product->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $_POST['qty'], $idprod, $remise_percent); + $result=$object->addline($label, $product->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $_POST['qty'], $idprod, $remise_percent, '', '', 0, $npr); } if ($idprod == -1) @@ -520,7 +521,9 @@ elseif ($action == 'addline') } else { - $tauxtva = price2num($_POST['tauxtva']); + $npr = preg_match('/\*/', $_POST['tauxtva']) ? 1 : 0 ; + $tauxtva = str_replace('*','',$_POST["tauxtva"]); + $tauxtva = price2num($tauxtva); $localtax1tx= get_localtax($tauxtva, 1, $mysoc,$object->thirdparty); $localtax2tx= get_localtax($tauxtva, 2, $mysoc,$object->thirdparty); $remise_percent=GETPOST('remise_percent'); @@ -538,14 +541,14 @@ elseif ($action == 'addline') $price_base_type = 'HT'; //$desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0) - $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva, $localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, 0, $price_base_type, $type); + $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva, $localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } else { $ttc = price2num($_POST['amountttc']); $ht = $ttc / (1 + ($tauxtva / 100)); $price_base_type = 'HT'; - $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva,$localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, 0, $price_base_type, $type); + $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva,$localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } } } @@ -1739,7 +1742,7 @@ else print ''; // VAT - print ''.vatrate($object->lines[$i]->tva_tx).'%'; + print ''.vatrate($object->lines[$i]->tva_tx, true, $object->lines[$i]->info_bits).'%'; // Unit price print ''.price($object->lines[$i]->pu_ht,'MU').''; From 148ad65150ca44f2a4a9c8d930a1ad0ed42665da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Tue, 26 Mar 2013 08:11:06 +0400 Subject: [PATCH 06/28] TVA NPR : deduplicate line. Remove tva npr from journal lines --- htdocs/compta/journal/purchasesjournal.php | 9 +++++---- htdocs/compta/journal/sellsjournal.php | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index f1977f9f01a..96d5fd8bf86 100755 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -97,9 +97,9 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.libelle,"; $sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,"; $sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,"; -$sql.= " ct.accountancy_code_buy as account_tva"; +$sql.= " ct.accountancy_code_buy as account_tva, ct.recuperableonly"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; $sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn f ON f.rowid = fd.fk_facture_fourn"; $sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ; @@ -142,7 +142,8 @@ if ($result) $tabfac[$obj->rowid]["lib"] = $obj->libelle; $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc; $tabht[$obj->rowid][$compta_prod] += $obj->total_ht; - $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; + if($obj->recuperableonly != 1) + $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; $tabcompany[$obj->rowid]=array('id'=>$obj->socid,'name'=>$obj->name); $i++; @@ -238,4 +239,4 @@ print ""; llxFooter(); $db->close(); -?> \ No newline at end of file +?> diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index c3cb58526ad..1e35607b1bb 100755 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -99,12 +99,12 @@ $sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,"; $sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,"; $sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,"; -$sql.= " ct.accountancy_code_sell as account_tva"; +$sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly"; $sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product"; $sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture"; $sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'"; $sql.= " WHERE f.entity = ".$conf->entity; $sql.= " AND f.fk_statut > 0"; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)"; @@ -149,7 +149,8 @@ if ($result) if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva]=0; $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc; $tabht[$obj->rowid][$compta_prod] += $obj->total_ht; - $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; + if($obj->recuperableonly != 1) + $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; $tabcompany[$obj->rowid]=array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client); $i++; } From 28999af70b4986854a4fb524a556db981078f60e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Tue, 26 Mar 2013 08:47:17 +0400 Subject: [PATCH 07/28] TVA NPR : set function get_default_npr --- htdocs/core/lib/functions.lib.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 835e5a36ee1..6bb524d28e1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3047,8 +3047,32 @@ function get_default_tva($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idpr * @param int $idprod Id product * @return float 0 or 1 */ -function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod) +function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod+0, $idprodfournprice=0) { + global $db; + if($idprodfournprice>0) + { + $sql = "SELECT pfp.recuperableonly"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; + $sql.= " WHERE rowid = ".$idprodfournprice; + dol_syslog(get_class($this)."::get_default_npr sql=".$sql, LOG_DEBUG); + + $resql = $this->db->query($sql); + if ($resql) + { + $record = $this->db->fetch_array($resql); + if(isset($record['recuperableonly'])) + return $record['recuperableonly']; + } + + } + elseif( $idprod > 0 ) + { + $prod = new Product($db); + $prod->fetch($idprod); + return $prod->tva_npr; + } + return 0; } From eda61879821af0f2d4bd9f00ee47e88aa099e1c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Thu, 28 Mar 2013 09:30:42 +0400 Subject: [PATCH 08/28] TVA NPR : can use * in tva when set supplier price --- htdocs/product/fournisseurs.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 43929c96b0c..97011f44c30 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -95,7 +95,9 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn"); $quantity=GETPOST("qty"); $remise_percent=price2num(GETPOST('remise_percent','alpha')); - $tva_tx=price2num(GETPOST('tva_tx','alpha')); + $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0 ; + $tva_tx = str_replace('*','', GETPOST('tva_tx','alpha')); + $tva_tx = price2num($tva_tx); if (empty($quantity)) { @@ -156,7 +158,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) if (isset($_POST['ref_fourn_price_id'])) $product->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']); - $ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent); + $ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent, $npr); if ($ret < 0) { $error++; @@ -527,4 +529,4 @@ else // End of page llxFooter(); $db->close(); -?> \ No newline at end of file +?> From 5921033f9437e7ab7bb135c7fde734431ab9978d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20de=20Chateauvieux?= Date: Thu, 28 Mar 2013 09:51:49 +0400 Subject: [PATCH 09/28] TVA NPR : Change field name recuperableonly to info_bits --- htdocs/fourn/class/fournisseur.product.class.php | 8 ++++---- .../mysql/tables/llx_product_fournisseur_price.sql | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 40e19664681..6c0ee20b89b 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -189,7 +189,7 @@ class ProductFournisseur extends Product $sql.= " tva_tx = ".$tva_tx.","; $sql.= " fk_availability = ".$availability.","; $sql.= " entity = ".$conf->entity.","; - $sql.= " recuperableonly = ".$newnpr.","; + $sql.= " info_bits = ".$newnpr.","; $sql.= " charges = ".$charges; $sql.= " WHERE rowid = ".$this->product_fourn_price_id; // TODO Add price_base_type and price_ttc @@ -220,7 +220,7 @@ class ProductFournisseur extends Product { // Add price for this quantity to supplier $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price("; - $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, entity, recuperableonly)"; + $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, entity, info_bits)"; $sql.= " values('".$this->db->idate($now)."',"; $sql.= " ".$this->id.","; $sql.= " ".$fourn->id.","; @@ -350,7 +350,7 @@ class ProductFournisseur extends Product $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; $sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.fk_product as product_fourn_id,"; - $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.recuperableonly"; + $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.info_bits"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE pfp.entity IN (".getEntity('product', 1).")"; @@ -385,7 +385,7 @@ class ProductFournisseur extends Product $prodfourn->fourn_name = $record["supplier_name"]; $prodfourn->fk_availability = $record["fk_availability"]; $prodfourn->id = $prodid; - $prodfourn->fourn_tva_npr = $record["recuperableonly"]; + $prodfourn->fourn_tva_npr = $record["info_bits"]; if (!isset($prodfourn->fourn_unitprice)) { diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql index 01789ff8edd..2a26034c130 100644 --- a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql @@ -37,7 +37,7 @@ create table llx_product_fournisseur_price charges double(24,8) DEFAULT 0, unitcharges double(24,8) DEFAULT 0, tva_tx double(6,3) NOT NULL, - recuperableonly integer NOT NULL DEFAULT 0, + info_bits integer NOT NULL DEFAULT 0, fk_user integer, import_key varchar(14) -- Import key )ENGINE=innodb; From 9572eebae0538b923fe99b2a18cd9f4982814fc4 Mon Sep 17 00:00:00 2001 From: fhenry Date: Tue, 2 Apr 2013 22:22:57 +0200 Subject: [PATCH 10/28] Check style (http://www.dolibarr.fr/forum/3-installation/40712-sauvegarde) --- htdocs/core/lib/json.lib.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 606f6fc37bf..24464898a28 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -72,13 +72,15 @@ function dol_json_encode($elements) $output = '{'; $last = $num - 1; $i = 0; - foreach($elements as $key => $value) - { - $output .= '"'.$key.'":'; - if (is_array($value)) $output.= json_encode($value); - else $output .= _val($value); - if ($i !== $last) $output.= ','; - ++$i; + if (is_array($elements) && count($elements)>0) { + foreach($elements as $key => $value) + { + $output .= '"'.$key.'":'; + if (is_array($value)) $output.= json_encode($value); + else $output .= _val($value); + if ($i !== $last) $output.= ','; + ++$i; + } } $output.= '}'; } From be01297403aa96f94210928e73c78e9fa66cf7c5 Mon Sep 17 00:00:00 2001 From: fhenry Date: Wed, 3 Apr 2013 11:56:54 +0200 Subject: [PATCH 11/28] Fix Ducth (nl_NL) translation --- htdocs/langs/nl_NL/admin.lang | 10 ++++---- htdocs/langs/nl_NL/categories.lang | 6 ++--- htdocs/langs/nl_NL/companies.lang | 38 +++++++++++++++--------------- htdocs/langs/nl_NL/propal.lang | 2 +- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/htdocs/langs/nl_NL/admin.lang b/htdocs/langs/nl_NL/admin.lang index b6645c0783c..b3d80668ba2 100644 --- a/htdocs/langs/nl_NL/admin.lang +++ b/htdocs/langs/nl_NL/admin.lang @@ -259,8 +259,8 @@ LastStableVersion = Laatste stabiele versie GenericMaskCodes = U kunt elk gewenst maskernummer invoeren. In dit masker, kunnen de volgende tags worden gebruikt:
{000000} correspondeert met een nummer welke vermeerderd zal worden op elke %s. Voer zoveel nullen in als de gewenste lengte van de teller. De teller wordt aangevuld met nullen vanaf links zodat er zoveel nullen zijn als in het masker.
{000000+000} hetzelfde als voorgaand maar een offset corresponderend met het nummer aan de rechterkant van het + teken is toegevoegd startend op de eerste %s.
{000000@x} hetzelfde als voorgaande maar de teller wordt gereset naar nul, wanneer maand x is bereikt (x tussen 1 en 12). Als deze optie is gebruikt en x is 2 of hoger, dan is de volgorde {yy}{mm} of {yyyy}{mm} ook vereist.
{dd} dag (01 t/m 31).
{mm} maand (01 t/m 12).
{yy}, {yyyy} of {y} jaat over 2, 4 of 1 nummer(s).
GenericMaskCodes2 = {cccc} de afnermerscode
{cccc000} de afnermerscode en n karakters wordt opgevolgd door een afnermersreferentieteller zonder offset en gereset met de globale teller.
{tttt} De code van bedrijfstype op n karakters (Zie het menu 'constantent' voor de bedrijfstypes
GenericMaskCodes3 = Alle andere karakters in het masker zullen intact blijven.
Spaties zijn niet toegestaan.
-GenericMaskCodes4a = Voorbeeld van de 99e %s van de derde partij 'HetBedrijf' gedaan op 2007-01-31:
-GenericMaskCodes4b = Voorbeeld van een derde partij gecreëerd op 2007-03-01:
+GenericMaskCodes4a = Voorbeeld van de 99e %s van de Klant 'HetBedrijf' gedaan op 2007-01-31:
+GenericMaskCodes4b = Voorbeeld van een Klant gecreëerd op 2007-03-01:
GenericMaskCodes5 = ABC{jj}{mm}-{000000} zal ABC0701-000099 geven
{0000+100}-ZZZ/{dd}/XXX zal 0199-ZZZ/31/XXX geven GenericNumRefModelDesc = Geeft een aanpasbaar nummer volgens een gedefinieerd masker. ServerAvailableOnIPOrPort = Server is beschikbaar op het IP-adres %s met poort %s @@ -527,7 +527,7 @@ PermissionAdvanced253 = Creëer / wijzig de rechten van internet / externe gebru Permission254 = Verwijderen of uitschakelen van andere gebruikers Permission255 = Creëren / wijzigen eigen gebruikersgegevens Permission256 = Wijzigen eigen wachtwoord -Permission262 = Uitbreiden van de toegang tot iedereen die verbonden is aan de derde partij (niet alleen die welke verband houden met de gebruiker). Niet functioneel voor externe gebruikers (altijd beperkt tot zichzelf). +Permission262 = Uitbreiden van de toegang tot iedereen die verbonden is aan de Klant (niet alleen die welke verband houden met de gebruiker). Niet functioneel voor externe gebruikers (altijd beperkt tot zichzelf). Permission271 = Lees CA Permission272 = Facturen inzien Permission273 = Facturen uitgeven @@ -831,7 +831,7 @@ UserMailRequired = E-mail verplicht om een nieuwe gebruiker creëren CompanySetup = Derde partijenmoduleinstellingen CompanyCodeChecker = Module voor de generatie en toetsing van codes voor derde partijen (afnemer of leverancier) AccountCodeManager = Module voor de generatie van boekhoudkundige codes (afnemer of leverancier) -ModuleCompanyCodeAquarium = Geef een boekhoudkundige code terug opgebouwd uit "401", gevolgd door de de leverancierscode(Wanneer het een leverancier betreft) of een afnemerscode van de derde partij (Wanneer het een afnemer betreft). +ModuleCompanyCodeAquarium = Geef een boekhoudkundige code terug opgebouwd uit "401", gevolgd door de de leverancierscode(Wanneer het een leverancier betreft) of een afnemerscode van de Klant (Wanneer het een afnemer betreft). ModuleCompanyCodePanicum = Geef een lege boekhoudkundige code terug. ModuleCompanyCodeDigitaria = Boekhoudkundige-code is afhankelijk van derden code. De code bestaat uit het teken "C" in de eerste positie, gevolgd door de eerste 5 tekens van de derden code. UseNotifications = Gebruik kennisgevingen @@ -1195,7 +1195,7 @@ ClickToDialDesc = Deze module maakt het mogelijk om een icoontje te tonen achter ##### Point Of Sales (CashDesk) ##### = CashDesk = Verkooppunten CashDeskSetup = Verkooppuntenmoduleinstellingen -CashDeskThirdPartyForSell = Algemene derde partij te gebruiken bij verkopen +CashDeskThirdPartyForSell = Algemene Klant te gebruiken bij verkopen CashDeskBankAccountForSell = Te gebruiken rekening voor ontvangst van contacte betalingen CashDeskBankAccountForCheque = Te gebruiken rekening voor ontvangst van betalingen per cheque CashDeskBankAccountForCB = Te gebruiken rekening voor ontvangst van betalingen per CreditCard diff --git a/htdocs/langs/nl_NL/categories.lang b/htdocs/langs/nl_NL/categories.lang index 83c9a45296f..e1d2b67b6ac 100644 --- a/htdocs/langs/nl_NL/categories.lang +++ b/htdocs/langs/nl_NL/categories.lang @@ -46,9 +46,9 @@ WasAddedSuccessfully = %s is succesvol toegevoegd. ObjectAlreadyLinkedToCategory = Element is al gekoppeld aan deze categorie. CategorySuccessfullyCreated = De categorie %s is met succes toegevoegd. ProductIsInCategories = Product / dienst is eigenaar van de volgende categorieën -SupplierIsInCategories = Derde partij is eigenaar van de volgende leverancierscategorieën -CompanyIsInCustomersCategories = Deze derde partij is eigenaar van de volgende afnemers- / prospectencategorieën -CompanyIsInSuppliersCategories = Deze derde partij is eigenaar van de volgende leverancierscategorieën +SupplierIsInCategories = Klant is eigenaar van de volgende leverancierscategorieën +CompanyIsInCustomersCategories = Deze Klant is eigenaar van de volgende afnemers- / prospectencategorieën +CompanyIsInSuppliersCategories = Deze Klant is eigenaar van de volgende leverancierscategorieën MemberIsInCategories = Dit lid is eigenaar van de volgende ledencategorieën ProductHasNoCategory = Dit product / dienst behoort tot geen enkele categorie SupplierHasNoCategory = Deze leverancier behoort tot geen enkele categorie diff --git a/htdocs/langs/nl_NL/companies.lang b/htdocs/langs/nl_NL/companies.lang index d9ea4539cac..6b7c91d293c 100644 --- a/htdocs/langs/nl_NL/companies.lang +++ b/htdocs/langs/nl_NL/companies.lang @@ -3,11 +3,11 @@ CHARSET = UTF-8 ErrorCompanyNameAlreadyExists = De bedrijfsnaam %s bestaat al. kies een andere. ErrorPrefixAlreadyExists = De prefix %s bestaat al. kies een andere. ErrorSetACountryFirst = Stel eerst het land in -DeleteThirdParty = Verwijder een derde partij +DeleteThirdParty = Verwijder een Klant ConfirmDeleteCompany = Weet u zeker dat u dit bedrijf en alle geërfde gegevens wilt verwijderen? DeleteContact = Contactpersoon verwijderen ConfirmDeleteContact = Weet u zeker dat u deze contactpersoon en alle geërfde gegevens wilt verwijderen ? -MenuNewThirdParty = Nieuwe derde partij +MenuNewThirdParty = Nieuwe Klant MenuNewCompany = Nieuwe onderneming MenuNewCustomer = Nieuwe afnemer MenuNewProspect = Nieuw prospect @@ -15,33 +15,33 @@ MenuNewSupplier = Nieuwe leverancier MenuNewPrivateIndividual = Nieuwe particulier MenuSocGroup = Groepen NewCompany = Nieuwe bedrijf (prospect, afnemer, leverancier) -NewThirdParty = Nieuwe derde partij (prospect, afnemer, leverancier) +NewThirdParty = Nieuwe Klant (prospect, afnemer, leverancier) NewSocGroup = Nieuwe bedrijfsgroep NewPrivateIndividual = Nieuwe particulier (prospect, afnemer, leverancier) ProspectionArea = Prospectenoverzicht SocGroup = Bedrijfsgroep -IdThirdParty = ID derde partij +IdThirdParty = ID Klant IdCompany = ID bedrijf IdContact = ID contactpersoon Contacts = Contactpersonen ContactsAddresses = Contacpersonen / adressen -ThirdPartyContacts = Contacten van derde partij -ThirdPartyContact = Contactpersoon van derde partij +ThirdPartyContacts = Contacten van Klant +ThirdPartyContact = Contactpersoon van Klant StatusContactValidated = Status van contactpersoon CustomerContact = Afnemerscontactpersoon Company = Bedrijf CompanyName = Bedrijfsnaam Companies = Bedrijven CountryIsInEEC = Lidstaat van de Europese Unie -ThirdPartyName = Naam van derde partij -ThirdParty = Derde partij -ThirdParties = Derde partij -ThirdPartyAll = Derde partijen (alle) +ThirdPartyName = Naam van Klant +ThirdParty = Klant +ThirdParties = Klant +ThirdPartyAll = Klanten (alle) ThirdPartyProspects = Prospecten ThirdPartyCustomers = Afnemers ThirdPartyCustomersWithIdProf12 = Afnemers met %s of %s ThirdPartySuppliers = Leveranciers -ThirdPartyType = Type derde partij +ThirdPartyType = Type Klant Company/Fundation = Bedrijf / stichting Individual = Particulier ToCreateContactWithSameName = Maakt automatisch een contactpersoon met dezelfde informatie @@ -173,10 +173,10 @@ Supplier = Leverancier CompanyList = Bedrijvenoverzicht AddContact = Contactpersoon toevoegen Contact = Contactpersoon -NoContactDefined = Geen contactpersoon ingesteld voor deze derde partij +NoContactDefined = Geen contactpersoon ingesteld voor deze Klant DefaultContact = Standaard contactpersoon AddCompany = Bedrijf toevoegen -AddThirdParty = Derde partij toevoegen +AddThirdParty = Klant toevoegen DeleteACompany = Bedrijf verwijderen PersonalInformations = Persoonlijke gegevens AccountancyCode = Boekhoudkundige code @@ -186,8 +186,8 @@ CustomerAccount = Afnemersrekening SupplierAccount = Leveranciersrekening CustomerCodeDesc = Afnemerscode, uniek voor alle afnemers SupplierCodeDesc = Leverancierscode, uniek voor alle leveranciers -RequiredIfCustomer = Vereist als derde partij een afnemer of prospect is -RequiredIfSupplier = Vereist als derde partij een leverancier is +RequiredIfCustomer = Vereist als Klant een afnemer of prospect is +RequiredIfSupplier = Vereist als Klant een leverancier is ValidityControledByModule = Geldigheid gecontroleerd door module ThisIsModuleRules = Dit zijn de regels voor deze module LastProspect = Laatste prospect @@ -234,7 +234,7 @@ ProspectLevel = Prospectpotentieel ContactPrivate = Privé ContactPublic = Gedeeld ContactVisibility = Zichtbaarheid -OthersNotLinkedToThirdParty = Anderen, niet gebonden aan een derde partij +OthersNotLinkedToThirdParty = Anderen, niet gebonden aan een Klant ProspectStatus = Prospectstatus PL_NONE = Geen PL_UNKNOWN = Onbekend @@ -269,7 +269,7 @@ NoRIB = Geen bank ingesteld NoParentCompany = Geen ExportImport = Import - Export ExportCardToFormat = Export details naar formaat -ContactNotLinkedToCompany = Contact niet gekoppeld aan enige derde partij +ContactNotLinkedToCompany = Contact niet gekoppeld aan enige Klant DolibarrLogin = Dolibarr login NoDolibarrAccess = Geen Dolibarr toegang ExportDataset_company_1 = Bedrijven / instellingen en eigenschappen @@ -292,12 +292,12 @@ DeleteFile = Bestand verwijderen ConfirmDeleteFile = Weet u zeker dat u dit bestand wilt verwijderen? AllocateCommercial = Toewijzing SelectCountry = Selecteer een land -SelectCompany = Selecteer een derde partij +SelectCompany = Selecteer een Klant Organization = Organisatie AutomaticallyGenerated = Automatisch gegenereerd FiscalYearInformation = Informatie over het fiscale jaar FiscalMonthStart = Startmaand van het fiscale jaar -YouMustCreateContactFirst = U dient voor de derde partij eerst contactpersonen met een e-mailadres instellen, voordat u kennisgevingen per e-mail kunt sturen. +YouMustCreateContactFirst = U dient voor de Klant eerst contactpersonen met een e-mailadres instellen, voordat u kennisgevingen per e-mail kunt sturen. ListSuppliersShort = Leveranciersoverzicht ListProspectsShort = Prospectenoverzicht ListCustomersShort = Afnemersoverzicht diff --git a/htdocs/langs/nl_NL/propal.lang b/htdocs/langs/nl_NL/propal.lang index 932677dff5a..d1f0503145d 100644 --- a/htdocs/langs/nl_NL/propal.lang +++ b/htdocs/langs/nl_NL/propal.lang @@ -74,7 +74,7 @@ OtherPropals = Andere offertes CopyPropalFrom = Maak offerte door het kopiëren van een bestaande offerte CreateEmptyPropal = Creëer een lege offerte of uit de lijst van producten / diensten DefaultProposalDurationValidity = Standaardgeldigheid offerte (in dagen) -UseCustomerContactAsPropalRecipientIfExist = Gebruik, indien ingesteld, het afnemerscontactadres als offerteontvangstadres in plaats van het adres van de derde partij +UseCustomerContactAsPropalRecipientIfExist = Gebruik, indien ingesteld, het afnemerscontactadres als offerteontvangstadres in plaats van het adres van de Klant ClonePropal = Kloon offerte ConfirmClonePropal = Weet u zeker dat u deze offerte %s wilt klonen? ProposalsAndProposalsLines = Offertes en offerteregels From c109467d2071b8e8634f57f761d1fa2aa49088b9 Mon Sep 17 00:00:00 2001 From: fhenry Date: Thu, 4 Apr 2013 13:58:33 +0200 Subject: [PATCH 12/28] Qual : Review code after intalling PHPUnit, CodeSniffer on Eclipse... --- htdocs/admin/carrier.php | 41 +-- htdocs/comm/propal/class/propal.class.php | 1 - htdocs/commande/fiche.php | 2 +- htdocs/compta/facture/class/facture.class.php | 1 - htdocs/contrat/class/contrat.class.php | 4 + htdocs/core/boxes/box_comptes.php | 4 +- htdocs/core/boxes/box_members.php | 4 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/dolprintipp.class.php | 10 + htdocs/core/class/extrafields.class.php | 7 +- htdocs/core/class/html.formother.class.php | 7 +- htdocs/core/class/translate.class.php | 1 + htdocs/core/lib/ajax.lib.php | 7 +- htdocs/core/lib/pdf.lib.php | 255 +++++++++--------- htdocs/core/menus/standard/auguria_menu.php | 10 +- htdocs/core/modules/modPrintIPP.class.php | 50 ++-- htdocs/cron/card.php | 4 +- htdocs/cron/class/cronjob.class.php | 5 +- htdocs/expedition/class/expedition.class.php | 32 ++- .../install/mysql/migration/3.3.0-3.4.0.sql | 11 + .../install/mysql/tables/llx_printer_ipp.sql | 28 ++ htdocs/societe/consumption.php | 4 +- htdocs/user/class/user.class.php | 8 +- 23 files changed, 290 insertions(+), 208 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_printer_ipp.sql diff --git a/htdocs/admin/carrier.php b/htdocs/admin/carrier.php index 612c14d2248..ebc31c8b4cb 100644 --- a/htdocs/admin/carrier.php +++ b/htdocs/admin/carrier.php @@ -44,24 +44,24 @@ $object = new Expedition($db); * Actions */ //if ($action==setvalue AND $carrier) -if ($action==setvalue) +if ($action=='setvalue') { // need to add check on values - $object->update[code]=GETPOST('code','alpha'); - $object->update[libelle]=GETPOST('libelle','alpha'); - $object->update[description]=GETPOST('description','alpha'); - $object->update[tracking]=GETPOST('tracking','alpha'); + $object->update['code']=GETPOST('code','alpha'); + $object->update['libelle']=GETPOST('libelle','alpha'); + $object->update['description']=GETPOST('description','alpha'); + $object->update['tracking']=GETPOST('tracking','alpha'); $object->update_delivery_method($carrier); header("Location: carrier.php"); exit; } -if ($action==activate_carrier AND $carrier!='') +if ($action=='activate_carrier' && $carrier!='') { $object->activ_delivery_method($carrier); } -if ($action==disable_carrier AND $carrier!='') +if ($action=='disable_carrier' && $carrier!='') { $object->disable_delivery_method($carrier); } @@ -134,26 +134,26 @@ if ($action=='edit_carrier' || $action=='setvalue') $var=!$var; print ''; print $langs->trans("Code").''; - print ''; + print ''; print '   '.$langs->trans("Example").': CODE'; print ''; $var=!$var; print ''; print $langs->trans("Name").''; - print ''; + print ''; print ''; $var=!$var; print ''; print $langs->trans("Description").''; - print ''; + print ''; print ''; $var=!$var; print ''; print $langs->trans("Tracking").''; - print ''; + print ''; print '   '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}'; print ''; @@ -186,25 +186,26 @@ else print ''.$langs->trans("Status").''; print ''.$langs->trans("Edit").''; print "\n"; - for ($i=0; $ilistmeths); $i++) + $numlistmeths=count($object->listmeths); + for ($i=0; $i<$numlistmeths; $i++) { $var=!$var; print ""; - print ''.$object->listmeths[$i][code].''; - print ''.$object->listmeths[$i][libelle].''; - print ''.$object->listmeths[$i][description].''; - print ''.$object->listmeths[$i][tracking].''; + print ''.$object->listmeths[$i]['code'].''; + print ''.$object->listmeths[$i]['libelle'].''; + print ''.$object->listmeths[$i]['description'].''; + print ''.$object->listmeths[$i]['tracking'].''; print ''; - if($object->listmeths[$i][active] == 0) + if($object->listmeths[$i]['active'] == 0) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } print ''; - print ''.img_picto($langs->trans("Edit"),'edit').''; + print ''.img_picto($langs->trans("Edit"),'edit').''; print ''; print "\n"; } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0288fa4f31f..13d2e6e87a4 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1199,7 +1199,6 @@ class Propal extends CommonObject * Update value of extrafields on the proposal * * @param User $user Object user that modify - * @param double $remise Amount discount * @return int <0 if ko, >0 if ok */ function update_extrafields($user) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 22cfc938ba1..ff08d7c9686 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1107,7 +1107,7 @@ else if ($action == 'print_file' AND $user->rights->printipp->use) { 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')); } /* diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a24b21c51a8..6c19894e7f1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -559,7 +559,6 @@ class Facture extends CommonInvoice * Load an object from its id and create a new one in database * * @param int $socid Id of thirdparty - * @param HookManager $hookmanager Hook manager instance * @return int New id of clone */ function createFromClone($socid=0) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 398f30dd100..d85b8fb89b1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -894,6 +894,8 @@ class Contrat extends CommonObject * @param float $price_base_type HT or TTC * @param float $pu_ttc Prix unitaire TTC * @param int $info_bits Bits de type de lignes + * @param int $fk_fournprice Fourn price id + * @param int $pa_ht Buying price HT * @return int <0 si erreur, >0 si ok */ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0) @@ -1034,6 +1036,8 @@ class Contrat extends CommonObject * @param timestamp $date_fin_reel Date de fin reelle * @param float $price_base_type HT or TTC * @param int $info_bits Bits de type de lignes + * @param int $fk_fournprice Fourn price id + * @param int $pa_ht Buying price HT * @return int < 0 si erreur, > 0 si ok */ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0) diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 817fec968da..5fc8d2add91 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -45,7 +45,9 @@ class box_comptes extends ModeleBoxes /** - * Constructor + * Constructor + * + * @param DoliDB $db Database handler */ function __construct($db) { diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 7add5a76939..91d3cd918b9 100755 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -45,7 +45,9 @@ class box_members extends ModeleBoxes /** - * Constructor + * Constructor + * + * @param DoliDB $db Database handler */ function __construct($db) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 048d25e0549..e078639724c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2196,7 +2196,7 @@ abstract class CommonObject * @param object $extrafields extrafield Object * @param string $mode Show output (view) or input (edit) for extrafield * - * return string + * @return string */ function showOptionals($extrafields,$mode='view') { diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index 30ddbfe254a..e7a0d051cb3 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -42,6 +42,9 @@ class dolprintIPP * @param DoliDB $db database * @param string $host host of Cups * @param string $port port + * @param string $userid userid + * @param string $user user + * @param string $password password * @return printIPP */ function __construct($db,$host,$port,$userid,$user,$password) @@ -76,7 +79,11 @@ class dolprintIPP /** * Print selected file + * + * @param string $file file + * @param string $module module * + * @return void */ function print_file($file,$module) { @@ -112,6 +119,9 @@ class dolprintIPP /** * List jobs print * + * @param string $module module + * + * @return void */ function list_jobs($module) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d35fb8dd369..e6ef238d502 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -97,6 +97,7 @@ class ExtraFields * @param string $elementtype Element type ('member', 'product', 'company', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not + * @param string $default_value Defaulted value * @param array $param Params for field * @return int <=0 if KO, >0 if OK */ @@ -219,7 +220,7 @@ class ExtraFields * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) * @return int <=0 if KO, >0 if OK */ - private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0,$param) + private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='') { global $conf; @@ -356,7 +357,7 @@ class ExtraFields * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) * @return int >0 if OK, <=0 if KO */ - function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos,$param='') + function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='') { $table=$elementtype.'_extrafields'; // Special case for not normalized table names @@ -814,7 +815,7 @@ class ExtraFields * Fill array_options array for object by extrafields value (using for data send by forms) * * @param array $extralabels $array of extrafields - * @param object $object object + * @param object &$object object * @return int 1 if array_options set / 0 if no value */ function setOptionalsFromPost($extralabels,&$object) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 9fca74bc397..3de291bbe76 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -211,9 +211,10 @@ class FormOther /** * Return list of revenue stamp for country * - * @param string $selected Value of preselected revenue stamp - * @param string $htmlname Name of combo list - * @return string HTML select list + * @param string $selected Value of preselected revenue stamp + * @param string $htmlname Name of combo list + * @param string $country_code Country Code + * @return string HTML select list */ function select_revenue_stamp($selected='',$htmlname='revenuestamp',$country_code='') { diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index f863d1c925d..18f4195a166 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -694,6 +694,7 @@ class Translate /** * Return a currency code into its symbol * + * @param string $currency_code Currency Code * @param string $amount If not '', show currency + amount according to langs ($10, 10€). * @return string Amount + Currency symbol encoded into UTF8 */ diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 38ad5dee987..4ffb5ba3b00 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -299,9 +299,10 @@ function ajax_dialog($title,$message,$w=350,$h=150) /** * Convert a html select field into an ajax combobox * - * @param string $htmlname Name of html select field - * @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) - * @return string Return html string to convert a select field into a combo + * @param string $htmlname Name of html select field + * @param array $event Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete + * @return string Return html string to convert a select field into a combo */ function ajax_combobox($htmlname, $event=array(), $minLengthToAutocomplete=0) { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 65816d52309..34f1bd5878f 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1,38 +1,38 @@ * Copyright (C) 2006 Rodolphe Quiedeville - * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2010-2012 Regis Houssin - * Copyright (C) 2010 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * or see http://www.gnu.org/ - */ +* Copyright (C) 2007 Patrick Raguin +* Copyright (C) 2010-2012 Regis Houssin +* Copyright (C) 2010 Juanjo Menent +* Copyright (C) 2012 Christophe Battarel +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* or see http://www.gnu.org/ +*/ /** * \file htdocs/core/lib/pdf.lib.php - * \brief Set of functions used for PDF generation - * \ingroup core - */ +* \brief Set of functions used for PDF generation +* \ingroup core +*/ /** * Return array with format properties of default PDF format - * - * @return array Array('width'=>w,'height'=>h,'unit'=>u); - */ +* +* @return array Array('width'=>w,'height'=>h,'unit'=>u); +*/ function pdf_getFormat() { global $conf,$db; @@ -78,7 +78,7 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P') global $conf; if (! empty($conf->global->MAIN_USE_FPDF) && ! empty($conf->global->MAIN_DISABLE_FPDI)) - return "Error MAIN_USE_FPDF and MAIN_DISABLE_FPDI can't be set together"; + return "Error MAIN_USE_FPDF and MAIN_DISABLE_FPDI can't be set together"; // We use by default TCPDF else FPDF if (empty($conf->global->MAIN_USE_FPDF)) require_once TCPDF_PATH.'tcpdf.php'; @@ -96,15 +96,15 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P') { /* Permission supported by TCPDF - print : Print the document; - - modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble'; - - copy : Copy or otherwise extract text and graphics from the document; - - annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields); - - fill-forms : Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified; - - extract : Extract text and graphics (in support of accessibility to users with disabilities or for other purposes); - - assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set; - - print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality. - - owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions. - */ + - modify : Modify the contents of the document by operations other than those controlled by 'fill-forms', 'extract' and 'assemble'; + - copy : Copy or otherwise extract text and graphics from the document; + - annot-forms : Add or modify text annotations, fill in interactive form fields, and, if 'modify' is also set, create or modify interactive form fields (including signature fields); + - fill-forms : Fill in existing interactive form fields (including signature fields), even if 'annot-forms' is not specified; + - extract : Extract text and graphics (in support of accessibility to users with disabilities or for other purposes); + - assemble : Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if 'modify' is not set; + - print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality. + - owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions. + */ if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format); else $pdf = new TCPDF($pagetype,$metric,$format); // For TCPDF, we specify permission we want to block @@ -125,10 +125,10 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P') { // Declare here a class to overwrite FPDI to add method writeHTMLCell /** - * This class if a enhanced FPDI class that support method writeHTMLCell - */ + * This class if a enhanced FPDI class that support method writeHTMLCell + */ class FPDI_DolExtended extends FPDI - { + { /** * __call * @@ -230,16 +230,16 @@ function pdf_getPDFFontSize($outputlangs) */ function pdf_getHeightForLogo($logo) { - $height=22; $maxwidth=130; - include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - $tmp=dol_getImageSize($logo); - if ($tmp['height']) - { - $width=round($height*$tmp['width']/$tmp['height']); - if ($width > $maxwidth) $height=$height*$maxwidth/$width; - } - //print $tmp['width'].' '.$tmp['height'].' '.$width; exit; - return $height; + $height=22; $maxwidth=130; + include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; + $tmp=dol_getImageSize($logo); + if ($tmp['height']) + { + $width=round($height*$tmp['width']/$tmp['height']); + if ($width > $maxwidth) $height=$height*$maxwidth/$width; + } + //print $tmp['width'].' '.$tmp['height'].' '.$width; exit; + return $height; } @@ -275,15 +275,15 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS)) { - // Tel - if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel); - // Fax - if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax); - // EMail - if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email); - // Web - if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url); - } + // Tel + if ($sourcecompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($sourcecompany->tel); + // Fax + if ($sourcecompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($sourcecompany->fax); + // EMail + if ($sourcecompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($sourcecompany->email); + // Web + if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url); + } } if ($mode == 'target') @@ -307,16 +307,16 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS)) - { - // Tel - if ($targetcontact->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->tel); - // Fax - if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax); - // EMail - if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email); - // Web - if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url); - } + { + // Tel + if ($targetcontact->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcontact->tel); + // Fax + if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax); + // EMail + if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email); + // Web + if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url); + } } else { @@ -325,16 +325,16 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n"; if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS)) - { - // Tel - if ($targetcompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->tel); - // Fax - if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax); - // EMail - if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email); - // Web - if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url); - } + { + // Tel + if ($targetcompany->tel) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($targetcompany->tel); + // Fax + if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax); + // EMail + if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email); + // Web + if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url); + } } // Intra VAT @@ -575,7 +575,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $pdf->MultiCell(100, 3, $val, 0, 'L', 0); //$nboflines=dol_nboflines_bis($val,120); //$cury+=($nboflines*3)+2; - $tmpy=$pdf->getStringHeight (100, $val); + $tmpy=$pdf->getStringHeight(100, $val); $cury+=$tmpy; } else if (! $usedetailedbban) $cury+=1; @@ -626,11 +626,11 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass { // Make substitution $substitutionarray=array( - '__FROM_NAME__' => $fromcompany->nom, - '__FROM_EMAIL__' => $fromcompany->email, - '__TOTAL_TTC__' => $object->total_ttc, - '__TOTAL_HT__' => $object->total_ht, - '__TOTAL_VAT__' => $object->total_vat + '__FROM_NAME__' => $fromcompany->nom, + '__FROM_EMAIL__' => $fromcompany->email, + '__TOTAL_TTC__' => $object->total_ttc, + '__TOTAL_HT__' => $object->total_ht, + '__TOTAL_VAT__' => $object->total_vat ); complete_substitutions_array($substitutionarray,$outputlangs,$object); $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); @@ -937,11 +937,11 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl } elseif ($desc == '(DEPOSIT)' && $object->lines[$i]->fk_remise_except) { - $discount=new DiscountAbsolute($db); - $discount->fetch($object->lines[$i]->fk_remise_except); - $libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit",$discount->ref_facture_source); - // Add date of deposit - if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec,'day','',$outputlangs).')'; + $discount=new DiscountAbsolute($db); + $discount->fetch($object->lines[$i]->fk_remise_except); + $libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromDeposit",$discount->ref_facture_source); + // Add date of deposit + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec,'day','',$outputlangs).')'; } else { @@ -1024,7 +1024,6 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl * @param int $i Current line number * @param Translate $outputlangs Object langs for output * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) - * @param HookManager $hookmanager Hook manager instance * @return void */ function pdf_getlinenum($object,$i,$outputlangs,$hidedetails=0) @@ -1132,12 +1131,12 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0) */ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0) { - global $conf, $hookmanager; + global $conf, $hookmanager; - $sign=1; - if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; + $sign=1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; - if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) { $special_code = $object->lines[$i]->special_code; if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); @@ -1164,19 +1163,19 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0) { global $hookmanager; - if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) - { - $special_code = $object->lines[$i]->special_code; - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); - foreach($object->hooks as $modules) - { - if (method_exists($modules[$special_code],'pdf_getlineupwithtax')) return $modules[$special_code]->pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails); + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) + { + $special_code = $object->lines[$i]->special_code; + if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); + foreach($object->hooks as $modules) + { + if (method_exists($modules[$special_code],'pdf_getlineupwithtax')) return $modules[$special_code]->pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails); } - } - else - { - if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100); - } + } + else + { + if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100); + } } /** @@ -1342,10 +1341,10 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0) */ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0) { - global $conf, $hookmanager; + global $conf, $hookmanager; - $sign=1; - if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; + $sign=1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; if ($object->lines[$i]->special_code == 3) { @@ -1381,27 +1380,27 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0) { global $hookmanager; - if ($object->lines[$i]->special_code == 3) - { - return $outputlangs->transnoentities("Option"); - } - else - { - if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) - { - $special_code = $object->lines[$i]->special_code; - if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); - foreach($object->hooks as $modules) - { - if (method_exists($modules[$special_code],'pdf_getlinetotalwithtax')) return $modules[$special_code]->pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails); + if ($object->lines[$i]->special_code == 3) + { + return $outputlangs->transnoentities("Option"); + } + else + { + if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) + { + $special_code = $object->lines[$i]->special_code; + if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); + foreach($object->hooks as $modules) + { + if (method_exists($modules[$special_code],'pdf_getlinetotalwithtax')) return $modules[$special_code]->pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails); } - } - else - { - if (empty($hidedetails) || $hidedetails > 1) return - price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100); - } - } + } + else + { + if (empty($hidedetails) || $hidedetails > 1) return + price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100); + } + } } /** diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 44185cea085..d1a67514a2b 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -118,7 +118,7 @@ class MenuManager if ($leftmenu=="modulesadmintools" && $user->admin) { $langs->load("products"); - array_unshift($tabMenu,array( + $array_menu_product=array( 'url'=>"/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools", 'titre'=>$langs->trans("ProductVatMassChange"), 'enabled'=>($user->admin?true:false), @@ -130,10 +130,11 @@ class MenuManager 'leftmenu'=>'modulesadmintools_massvat', 'type'=>'left', 'position'=>20 - )); + ); + array_unshift($tabMenu,$array_menu_product); //$newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ProductVatMassChange"), 1, $user->admin); } - array_unshift($tabMenu,array( + $array_menu_product=array( 'url'=>"/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools", 'titre'=>$langs->trans("ModulesSystemTools"), 'enabled'=>($user->admin?true:false), @@ -144,7 +145,8 @@ class MenuManager 'leftmenu'=>'modulesadmintools', 'type'=>'left', 'position'=>20 - )); + ); + array_unshift($tabMenu,$array_menu_product); } } diff --git a/htdocs/core/modules/modPrintIPP.class.php b/htdocs/core/modules/modPrintIPP.class.php index 53cadf53699..35fd62af04e 100644 --- a/htdocs/core/modules/modPrintIPP.class.php +++ b/htdocs/core/modules/modPrintIPP.class.php @@ -35,10 +35,12 @@ include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php"); class modPrintIPP extends DolibarrModules { - /** - * \brief Constructeur. Definit les noms, constantes et boites - * \param DB handler d'acces base - */ + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ function __construct($db) { $this->db = $db ; @@ -120,25 +122,33 @@ class modPrintIPP extends DolibarrModules } /** - * \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module. - * Definit egalement les repertoires de donnees a creer pour ce module. - */ - function init() - { - $sql = array("CREATE TABLE IF NOT EXISTS llx_printer_ipp (rowid int(11) NOT NULL AUTO_INCREMENT,printer_name text NOT NULL, printer_location text NOT NULL,printer_uri varchar(256) NOT NULL,copy int(11) NOT NULL DEFAULT '1',module varchar(16) NOT NULL,login varchar(32) NOT NULL,PRIMARY KEY (rowid)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;"); - - return $this->_init($sql); - } - - /** - * \brief Fonction appelee lors de la desactivation d'un module. - * Supprime de la base les constantes, boites et permissions du module. - */ - function remove() + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + function init($options='') { $sql = array(); - return $this->_remove($sql); + return $this->_init($sql, $options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + function remove($options='') + { + $sql = array(); + + return $this->_remove($sql, $options); } } diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 3a3caa16626..4b36797347c 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -54,7 +54,7 @@ if(!empty($cancel)) { if (!empty($id)) { $action=''; }else { - Header ( "Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1'); + Header("Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1'); } } @@ -69,7 +69,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->del setEventMessage($object->error,'errors'); $action='edit'; }else { - Header ( "Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1'); + Header("Location: ".dol_buildpath('/cron/cron/list.php',1).'?status=1'); } } diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index b43f4ed9bd4..60514e73942 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -407,7 +407,7 @@ class Cronjob extends CommonObject $sql.= " ORDER BY $sortfield $sortorder "; if (!empty($limit) && !empty($offset)) { - $sql.= $this->db->plimit( $limit + 1 ,$offset); + $sql.= $this->db->plimit($limit + 1,$offset); } $sqlwhere = array(); @@ -1061,7 +1061,8 @@ class Cronjob extends CommonObject /** * Crob Job line class */ -class Cronjobline{ +class Cronjobline +{ var $id; var $ref; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 393a316df15..9896eb50486 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1195,14 +1195,14 @@ class Expedition extends CommonObject { while ($obj = $this->db->fetch_object($resql)) { - $this->listmeths[$i][rowid] = $obj->rowid; - $this->listmeths[$i][code] = $obj->code; + $this->listmeths[$i]['rowid'] = $obj->rowid; + $this->listmeths[$i]['code'] = $obj->code; $label=$langs->trans('SendingMethod'.$obj->code); - $this->listmeths[$i][libelle] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle); - $this->listmeths[$i][description] = $obj->description; + $this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code?$label:$obj->libelle); + $this->listmeths[$i]['description'] = $obj->description; if ($obj->tracking) { - $this->listmeths[$i][tracking] = $obj->tracking; + $this->listmeths[$i]['tracking'] = $obj->tracking; } else { @@ -1214,11 +1214,11 @@ class Expedition extends CommonObject { require_once DOL_DOCUMENT_ROOT."/core/modules/expedition/methode_expedition_".strtolower($obj->code).'.modules.php'; $shipmethod = new $classname(); - $this->listmeths[$i][tracking] = $shipmethod->provider_url_status('{TRACKID}'); + $this->listmeths[$i]['tracking'] = $shipmethod->provider_url_status('{TRACKID}'); } } } - $this->listmeths[$i][active] = $obj->active; + $this->listmeths[$i]['active'] = $obj->active; $i++; } } @@ -1227,7 +1227,9 @@ class Expedition extends CommonObject /** * Update/create delivery method. - * @param id $id id method to activate + * + * @param string $id id method to activate + * * @return void */ function update_delivery_method($id='') @@ -1235,16 +1237,16 @@ class Expedition extends CommonObject if ($id=='') { $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)"; - $sql.=" VALUES ('".$this->update[code]."','".$this->update[libelle]."','".$this->update[description]."','".$this->update[tracking]."')"; + $sql.=" VALUES ('".$this->update['code']."','".$this->update['libelle']."','".$this->update['description']."','".$this->update['tracking']."')"; $resql = $this->db->query($sql); } else { $sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET"; - $sql.= " code='".$this->update[code]."'"; - $sql.= ",libelle='".$this->update[libelle]."'"; - $sql.= ",description='".$this->update[description]."'"; - $sql.= ",tracking='".$this->update[tracking]."'"; + $sql.= " code='".$this->update['code']."'"; + $sql.= ",libelle='".$this->update['libelle']."'"; + $sql.= ",description='".$this->update['description']."'"; + $sql.= ",tracking='".$this->update['tracking']."'"; $sql.= " WHERE rowid=".$id; $resql = $this->db->query($sql); } @@ -1253,7 +1255,9 @@ class Expedition extends CommonObject /** * Activate delivery method. + * * @param id $id id method to activate + * * @return void */ function activ_delivery_method($id) @@ -1267,7 +1271,9 @@ class Expedition extends CommonObject /** * DesActivate delivery method. + * * @param id $id id method to desactivate + * * @return void */ function disable_delivery_method($id) diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index d36cd39c441..82f791e6b35 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -210,3 +210,14 @@ ALTER TABLE llx_user ADD COLUMN fk_state integer DEFAULT 0; ALTER TABLE llx_user ADD COLUMN fk_country integer DEFAULT 0; ALTER TABLE llx_product_price ADD COLUMN import_key varchar(14) AFTER price_by_qty; +CREATE TABLE llx_printer_ipp +( + rowid int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + printer_name text NOT NULL, + printer_location text NOT NULL, + printer_uri varchar(256) NOT NULL, + copy int(11) NOT NULL DEFAULT '1', + module varchar(16) NOT NULL, + login varchar(32) NOT NULL, +)ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_printer_ipp.sql b/htdocs/install/mysql/tables/llx_printer_ipp.sql new file mode 100644 index 00000000000..0e030b24c95 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_printer_ipp.sql @@ -0,0 +1,28 @@ +-- ============================================================================ +-- Copyright (C) 2013 Florian HENRY +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + +CREATE TABLE llx_printer_ipp +( + rowid int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + printer_name text NOT NULL, + printer_location text NOT NULL, + printer_uri varchar(256) NOT NULL, + copy int(11) NOT NULL DEFAULT '1', + module varchar(16) NOT NULL, + login varchar(32) NOT NULL, +)ENGINE=innodb; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 0edb8291677..f3538c6e266 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -202,14 +202,14 @@ $sql.= $where; if ($month > 0) { if ($year > 0) { $start = dol_mktime(0, 0, 0, $month, 1, $year); - $end = dol_time_plus_duree($start, 1 , 'm') - 1; + $end = dol_time_plus_duree($start,1,'m') - 1; $sql.= " AND ".$datePrint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; } else { $sql.= " AND date_format(".$datePrint.", '%m') = '".sprintf('%02d',$month)."'"; } } else if ($year > 0) { $start = dol_mktime(0, 0, 0, 1, 1, $year); - $end = dol_time_plus_duree($start, 1 , 'y') - 1; + $end = dol_time_plus_duree($start,1,'y') - 1; $sql.= " AND ".$datePrint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; } if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 607e0563e7d..70883769602 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2090,11 +2090,15 @@ class User extends CommonObject } /** - * Update user using data from the LDAP - * // TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?) + * Update user using data from the LDAP + * + * @param ldapuser &$ldapuser Ladp User + * + * @return int <0 if KO, >0 if OK */ function update_ldap2dolibarr(&$ldapuser) { + // TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?) global $user, $conf; $this->firstname=$ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME}; From 61b28274f7fa7ab1c491095acbdfa4749798bf0a Mon Sep 17 00:00:00 2001 From: juanjo Date: Thu, 4 Apr 2013 16:32:06 +0200 Subject: [PATCH 13/28] [ bug #790 ] Spanish localtax RE not being correctly calculated --- htdocs/core/lib/functions.lib.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index adb8f190ef6..71dbfbc1b2b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2689,7 +2689,18 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") // Some test to guess with no need to make database access if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe { - if ($local == 1 && ! $thirdparty_buyer->localtax1_assuj) return 0; + if ($local == 1) + { + if ($thirdparty_seller->id==$mysoc->id) + { + if (! $thirdparty_buyer->localtax1_assuj) return 0; + } + else + { + if (! $thirdparty_seller->localtax1_assuj) return 0; + } + } + if ($local == 2 && ! $thirdparty_buyer->localtax2_assuj) return 0; } else From 992ec308d2d02bd35b83c850da15d02a58eb5f97 Mon Sep 17 00:00:00 2001 From: Simnandez Date: Thu, 4 Apr 2013 16:54:41 +0200 Subject: [PATCH 14/28] Update Changelog --- ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6e3fc51de0c..a95ef991d5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,14 @@ English Dolibarr ChangeLog +***** ChangeLog for 3.3.2 compared to 3.3.1 ***** + +-Fix: Ducth (nl_NL) translation +-Fix: [ bug #790 ] Spanish localtax RE not being correctly calculated +-Generalize fix: file with a specific mask not found, again + + + ***** ChangeLog for 3.3.1 compared to 3.3 ***** - Fix: [ bug #733 ] Mass emailing tools do not support