diff --git a/htdocs/core/modules/member/labels/pdf_standardlabel.class.php b/htdocs/core/modules/member/labels/pdf_standardlabel.class.php index 85cba5f324a376db2610c9055870fd5d12292d7e..583caddfe4dc46b8a82cadc6f982d6381e315baa 100644 --- a/htdocs/core/modules/member/labels/pdf_standardlabel.class.php +++ b/htdocs/core/modules/member/labels/pdf_standardlabel.class.php @@ -144,7 +144,9 @@ class pdf_standardlabel { $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; } } - + // Define photo + $photo=''; + // Print lines if ($this->code == "CARD") { @@ -436,7 +438,7 @@ class pdf_standardlabel { $filename='tmplabels.pdf'; $type=dol_mimetype($filename); - if ($encoding) header('Content-Encoding: '.$encoding); + //if ($encoding) header('Content-Encoding: '.$encoding); if ($type) header('Content-Type: '.$type); if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); else header('Content-Disposition: inline; filename="'.$filename.'"'); diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index 744360612c6655787f78390603f31f387b867a2d..0aaf3629deeeef5721b4f79bffe84b34a7ab5deb 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -47,7 +47,7 @@ class mod_project_universal extends ModeleNumRefProjects $langs->load("projects"); $langs->load("admin"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; diff --git a/htdocs/core/modules/propale/mod_propale_saphir.php b/htdocs/core/modules/propale/mod_propale_saphir.php index a44fc23a750163edaed9c80d9060e4662154917d..8249fa306046836337472bab7259c3de28234060 100644 --- a/htdocs/core/modules/propale/mod_propale_saphir.php +++ b/htdocs/core/modules/propale/mod_propale_saphir.php @@ -48,7 +48,7 @@ class mod_propale_saphir extends ModeleNumRefPropales $langs->load("bills"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index f726b63727ef8c4659f05a3ec42dd64f0d5ef41a..f04c20feae5ca9762fec29fce6b49dfcb09d61a1 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -128,7 +128,7 @@ abstract class ModeleNumRefPropales /** - * Create a document onto disk accordign to template module. + * Create a document onto disk according to template module. * * @param DoliDB $db Database handler * @param Object $object Object proposal @@ -145,6 +145,8 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, global $conf,$user,$langs; $langs->load("propale"); + $error=0; + $dir = "/core/modules/propale/"; $srctemplatepath=''; $modelisok=0; @@ -181,7 +183,7 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, } // Si model pas encore bon - if (! $modelisok && is_array($liste)) + if (! $modelisok) { $liste=ModelePDFPropales::liste_modeles($db); $modele=key($liste); // Renvoie premiere valeur de cle trouve dans le tableau diff --git a/htdocs/core/modules/propale/pdf_propale_azur.modules.php b/htdocs/core/modules/propale/pdf_propale_azur.modules.php index 2a036aa8f0fc69b51ba1678a3c60232023031606..2befc3339cd46f1fc798f7eba4c8a8c907f6761d 100644 --- a/htdocs/core/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/core/modules/propale/pdf_propale_azur.modules.php @@ -654,9 +654,9 @@ class pdf_propale_azur extends ModelePDFPropales { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1); } // Total LocalTax2 @@ -664,9 +664,9 @@ class pdf_propale_azur extends ModelePDFPropales { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1); } } else diff --git a/htdocs/core/modules/propale/pdf_propale_jaune.modules.php b/htdocs/core/modules/propale/pdf_propale_jaune.modules.php index 79c76a4c5c913802168047db68dd3a1f65872896..aed35de0c83f5eb977d6b912b474bcbd568dc6ec 100644 --- a/htdocs/core/modules/propale/pdf_propale_jaune.modules.php +++ b/htdocs/core/modules/propale/pdf_propale_jaune.modules.php @@ -654,9 +654,9 @@ class pdf_propale_jaune extends ModelePDFPropales { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1); } // Total LocalTax2 @@ -664,9 +664,9 @@ class pdf_propale_jaune extends ModelePDFPropales { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1); } } else diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 68681e069fca3ec4b8a6a0091088bbbb29cee81a..1831e4cff2cf5121570f12c1bc3fa2e91a352ac8 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -88,7 +88,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $langs->load("companies"); $langs->load("errors"); - $form = new Form($db); + $form = new Form($this->db); $texte = $this->description.".<br>\n"; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; @@ -187,11 +187,10 @@ class doc_generic_odt extends ModeleThirdPartyDoc { $id = $object; $object = new Societe($this->db); - $object->fetch($id); - + $result=$object->fetch($id); if ($result < 0) { - dol_print_error($db,$object->error); + dol_print_error($this->db,$object->error); return -1; } } diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 59b8196dc11f3a6dbd967fd5a5a3da1485af77fa..e3db286e92a7dd80426545ae6e187376ffc64ec7 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -72,7 +72,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode $langs->load("companies"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index e4b94e0b75aac2efee2d614de6f9c9b8a2e5c718..4d3ea14cd455d992bc4908590dbd7f1785a9f76f 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -61,7 +61,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode $langs->load("companies"); - $form = new Form($db); + $form = new Form($this->db); $tooltip=''; $texte = '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 26262e3bc96bdd53e5b6c1a02a77f53e1f45a43b..1cdcc83c2f1ee8b426950438c7fd60fcc364c98e 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -355,6 +355,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Affiche zone totaux $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + $amount_credit_notes_included=0; + $amount_deposits_included=0; + if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) { $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); @@ -423,6 +426,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Affichage des totaux de TVA par taux (conformement a reglementation) $pdf->SetFillColor(248,248,248); + $index=0; foreach( $this->tva as $tvakey => $tvaval ) { if ($tvakey > 0) // On affiche pas taux 0 @@ -461,9 +465,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1); } // Total LocalTax2 @@ -471,9 +475,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1); } } else diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index e65a179f277ec5d5c80ca6d3c31049b588692241..ae153661fb3b8be5e619227d849d154c6b35004d 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -48,7 +48,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders $langs->load("bills"); $langs->load("admin"); - $form = new Form($db); + $form = new Form($this->db); $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 71b8c244d50207ce221700942bb640208e6e9573..846c3de4c1635ae2ef812d37d4cbb98ab2de9464 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -356,6 +356,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Affiche zone totaux $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + $amount_credit_notes_included=0; + $amount_deposits_included=0; if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) { $this->_tableau_versements($pdf, $object, $posy); @@ -426,6 +428,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Affichage des totaux de TVA par taux (conformement a reglementation) $pdf->SetFillColor(248,248,248); + $index=0; foreach( $this->tva as $tvakey => $tvaval ) { if ($tvakey > 0) // On affiche pas taux 0 @@ -465,9 +468,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1); } // Total LocalTax2 @@ -475,9 +478,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1); } } else diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 0c5f8c375f75dc613033784c4e3c98b2f24b22ca..2ceac9d703536eab6222ca3a0e2d95a0ba406d39 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -70,6 +70,7 @@ class EcmDirectory // extends CommonObject { global $conf, $langs; + $error=0; $now=dol_now(); // Clean parameters @@ -328,6 +329,8 @@ class EcmDirectory // extends CommonObject global $conf, $langs; require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); + $error=0; + $relativepath=$this->getRelativePath(1); // Ex: dir1/dir2/dir3 dol_syslog("EcmDirectories::delete remove directory ".$relativepath); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 76c473ac851f8683e4f7a06def47716364f727b7..7c956ae34054439bcf1491ba79bb1d475ab3fcdd 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -398,14 +398,14 @@ class Expedition extends CommonObject } else { - dol_syslog('Expedition::Fetch Error rowid='.$rowid.' numrows=0 sql='.$sql); - $this->error='Delivery with id '.$rowid.' not found sql='.$sql; + dol_syslog('Expedition::Fetch Error -2'); + $this->error='Delivery with id '.$id.' not found sql='.$sql; return -2; } } else { - dol_syslog('Expedition::Fetch Error rowid='.$rowid.' Erreur dans fetch de l\'expedition'); + dol_syslog('Expedition::Fetch Error -1'); $this->error=$this->db->error(); return -1; } @@ -768,8 +768,10 @@ class Expedition extends CommonObject function delete() { global $conf, $langs, $user; - require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); + + $error=0; + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet"; diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index c5ddf7eb96e1b16e095a1fe35d3f3e8b1665f0c3..c1f62634c16986b6f944de78b631d02bf25f75ce 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -267,7 +267,7 @@ class Export $file = "export_".$model.".modules.php"; $classname = "Export".$model; require_once($dir.$file); - $objmodel = new $classname($db); + $objmodel = new $classname($this->db); if ($sqlquery) $sql = $sqlquery; else $sql=$this->build_sql($indice,$array_selected); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 212c7d84694c4a93ef9e0eb5202ccea1226e5cba..b1975181df79ab84b3677d9baf7b893b09cb0839 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -309,7 +309,9 @@ class Fichinter extends CommonObject function setValid($user, $outputdir) { global $langs, $conf; - + + $error=0; + if ($this->statut != 1) { $this->db->begin(); @@ -578,6 +580,7 @@ class Fichinter extends CommonObject if (! $this->db->query($sql) ) { dol_syslog("Fichinter::delete error", LOG_ERR); + $this->error=$this->db->lasterror(); $error++; } @@ -589,7 +592,7 @@ class Fichinter extends CommonObject $error++; } - if ($err > 0) + if ($error) { $this->db->rollback(); return -1; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d4825c62fd10a65173051a78fb3fef6c8b8ab14c..1db422884f5fd217a3a85681c353da098757e445 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -706,6 +706,8 @@ class CommandeFournisseur extends Commande { global $conf, $langs; + $error=0; + dol_syslog("CommandeFournisseur::Refuse"); $result = 0; if ($user->rights->fournisseur->commande->approuver) @@ -750,6 +752,8 @@ class CommandeFournisseur extends Commande { global $langs,$conf; + $error=0; + //dol_syslog("CommandeFournisseur::Cancel"); $result = 0; if ($user->rights->fournisseur->commande->commander) @@ -847,7 +851,8 @@ class CommandeFournisseur extends Commande global $langs,$conf; $this->db->begin(); - + + $error=0; $now=dol_now(); /* On positionne en mode brouillon la commande */ @@ -919,6 +924,7 @@ class CommandeFournisseur extends Commande /** * Add order line + * * @param desc Description * @param pu_ht Unit price * @param qty Quantity @@ -934,7 +940,7 @@ class CommandeFournisseur extends Commande * @param type Type of line (0=product, 1=service) * @return int <=0 if KO, >0 if OK */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0, $info_bits=0) { global $langs,$mysoc; @@ -1134,7 +1140,6 @@ class CommandeFournisseur extends Commande $error++; } } - $i++; } if ($error == 0) @@ -1188,13 +1193,14 @@ class CommandeFournisseur extends Commande /** * Delete an order * - * @return int <0 if KO, >0 if OK + * @param User $user Object user + * @return int <0 if KO, >0 if OK */ - function delete() + function delete($user='') { global $langs,$conf; - $err = 0; + $error = 0; $this->db->begin(); @@ -1202,7 +1208,7 @@ class CommandeFournisseur extends Commande dol_syslog("FournisseurCommande::delete sql=".$sql, LOG_DEBUG); if (! $this->db->query($sql) ) { - $err++; + $error++; } $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE rowid =".$this->id; @@ -1211,15 +1217,15 @@ class CommandeFournisseur extends Commande { if ($this->db->affected_rows($resql) < 1) { - $err++; + $error++; } } else { - $err++; + $error++; } - if ($err == 0) + if ($error == 0) { // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); @@ -1630,10 +1636,10 @@ class CommandeFournisseur extends Commande $sql.= ",localtax1_tx='".price2num($txlocaltax1)."'"; $sql.= ",localtax2_tx='".price2num($txlocaltax2)."'"; $sql.= ",qty='".price2num($qty)."'"; - if ($date_end) { $sql.= ",date_start='$date_end'"; } + /*if ($date_end) { $sql.= ",date_start='$date_end'"; } else { $sql.=',date_start=null'; } if ($date_end) { $sql.= ",date_end='$date_end'"; } - else { $sql.=',date_end=null'; } + else { $sql.=',date_end=null'; }*/ $sql.= ",info_bits='".$info_bits."'"; $sql.= ",total_ht='".price2num($total_ht)."'"; $sql.= ",total_tva='".price2num($total_tva)."'"; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index c21d73be1a322e1976b21245ed5df939d89e7aa2..43cfa12ca22a50e02b68ef1de4d0623444507f1b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -82,14 +82,11 @@ class FactureFournisseur extends Facture /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ - function FactureFournisseur($DB) + function FactureFournisseur($db) { - $this->db = $DB ; - - $this->id = $facid; - $this->socid = $socid; + $this->db = $db; $this->amount = 0; $this->remise = 0; @@ -115,6 +112,7 @@ class FactureFournisseur extends Facture { global $langs,$conf; + $error=0; $now=dol_now(); // Clear parameters @@ -255,6 +253,7 @@ class FactureFournisseur extends Facture function fetch($id='',$ref='') { global $langs; + $sql = "SELECT"; $sql.= " t.rowid,"; $sql.= " t.facnumber,"; @@ -356,8 +355,8 @@ class FactureFournisseur extends Facture } else { - $this->error='Bill with id '.$rowid.' not found sql='.$sql; - dol_syslog(get_class($this).'::Fetch rowid='.$rowid.' numrows=0 sql='.$sql); + $this->error='Bill with id '.$id.' not found sql='.$sql; + dol_syslog(get_class($this).'::Fetch rowid='.$id.' numrows=0 sql='.$sql); return -2; } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 820a8921a6c2991e0c3c2483e1f29c0701f79a35..de78ffcc49fd83b88c11284240c71be5fae8d7ef 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -1354,13 +1354,11 @@ function migrate_price_propal($db,$langs,$conf) else { print "Error id=".$propal->id; - $err++; } } else { print "Error #3"; - $err++; } */ $i++; @@ -1378,7 +1376,6 @@ function migrate_price_propal($db,$langs,$conf) else { print "Error #1 ".$db->error(); - $err++; $db->rollback(); } @@ -1458,13 +1455,11 @@ function migrate_price_contrat($db,$langs,$conf) else { print "Error id=".$propal->id; - $err++; } } else { print "Error #3"; - $err++; } */ $i++; @@ -1482,7 +1477,6 @@ function migrate_price_contrat($db,$langs,$conf) else { print "Error #1 ".$db->error(); - $err++; $db->rollback(); } @@ -1560,13 +1554,11 @@ function migrate_price_commande($db,$langs,$conf) else { print "Error id=".$commande->id; - $err++; } } else { print "Error #3"; - $err++; } */ $i++; @@ -1594,7 +1586,6 @@ function migrate_price_commande($db,$langs,$conf) else { print "Error #1 ".$db->error(); - $err++; $db->rollback(); } @@ -1672,13 +1663,11 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) else { print "Error id=".$commande->id; - $err++; } } else { print "Error #3"; - $err++; } */ $i++; @@ -1706,7 +1695,6 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) else { print "Error #1 ".$db->error(); - $err++; $db->rollback(); } diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 7f1f32c174185bfa687e1feec40db4748ac53eef..2bf23fcb2dfc5a219dfe89cb7028c50ecf528dc3 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -293,7 +293,7 @@ class Livraison extends CommonObject } else { - $this->error='Delivery with id '.$rowid.' not found sql='.$sql; + $this->error='Delivery with id '.$id.' not found sql='.$sql; dol_syslog('Livraison::Fetch Error '.$this->error, LOG_ERR); return -2; } @@ -308,12 +308,13 @@ class Livraison extends CommonObject /** * Validate object and update stock if option enabled - * @param user Object user that validate - * @return int + * + * @param User $user Object user that validate + * @return int */ function valid($user) { - global $conf; + global $conf, $langs; require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); dol_syslog("livraison.class.php::valid begin"); @@ -375,11 +376,11 @@ class Livraison extends CommonObject if ($resql) { // On efface le repertoire de pdf provisoire - $livraisonref = dol_sanitizeFileName($this->ref); + $numref = dol_sanitizeFileName($this->ref); if ($conf->expedition->dir_output) { - $dir = $conf->livraison->dir_output . "/" . $livraisonref ; - $file = $dir . "/" . $livraisonref . ".pdf"; + $dir = $conf->livraison->dir_output . "/" . $numref ; + $file = $dir . "/" . $numref . ".pdf"; if (file_exists($file)) { if (!dol_delete_file($file)) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index fe7d05f877fd7ac523411dc0bc05e4c0c16a6708..0797bbb78d887aad3ea1e9c836eb3d4f1fa8569b 100755 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -155,6 +155,8 @@ function paypaladmin_prepare_head() $head[$h][2] = 'paypalaccount'; $h++; + $object=(object) array(); + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 675285fe2c0037520767a83b51fb73012d0d6834..57dd51a10a616f7e0691b3ea57ecc5372be13391 100755 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -303,7 +303,7 @@ class ActionsCardProduct extends Product } else { - dol_print_error($db,$sql); + dol_print_error($this->db,$sql); } } @@ -441,7 +441,7 @@ class ActionsCardProduct extends Product } else { - dol_print_error($db); + dol_print_error($this->db); } } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3d200fef7e430609290e07dd2656af311f81775e..8192b4bb9e65c6be5794b30b4fcf95fb4bdc72a3 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -144,14 +144,13 @@ class Product extends CommonObject /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ - function Product($DB) + function Product($db) { global $langs; - $this->db = $DB; - $this->id = $id ; + $this->db = $db; $this->status = 0; $this->status_buy = 0; $this->nbphoto = 0; @@ -403,6 +402,8 @@ class Product extends CommonObject { global $langs, $conf; + $error=0; + // Verification parametres if (! $this->libelle) $this->libelle = 'MISSING LABEL'; @@ -881,7 +882,6 @@ class Product extends CommonObject dol_syslog("Product:get_buyprice ".$this->error, LOG_ERR); return -2; } - return $result; } @@ -2555,11 +2555,12 @@ class Product extends CommonObject * @param nbbyrow Nombre vignettes par ligne (si mode vignette) * @param showfilename 1=Show filename * @param showaction 1=Show icon with action links (resize, delete) - * @param maxheight Max height of image when size=1 + * @param maxHeight Max height of image when size=1 + * @param maxWidth Max width of image when size=1 * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto * TODO Move this into html.formproduct.class.php */ - function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxheight=120) + function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160) { global $conf,$user,$langs; @@ -2629,17 +2630,17 @@ class Product extends CommonObject $return.= "\n"; $return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" class="lightbox" target="_blank">'; - // Show image (width height=$maxheight) + // Show image (width height=$maxHeight) // Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine $alt=$langs->transnoentitiesnoconv('File').': '.$pdir.$photo; $alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height']; - if ($photo_vignette && $imgarray['height'] > $maxheight) { + if ($photo_vignette && $imgarray['height'] > $maxHeight) { $return.= '<!-- Show thumb -->'; - $return.= '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">'; + $return.= '<img class="photo" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">'; } else { $return.= '<!-- Show original file -->'; - $return.= '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">'; + $return.= '<img class="photo" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">'; } $return.= '</a>'."\n"; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index c516101295b160648f9351f868d15a92911b4f44..5eb8a997094d0a42761b90132f52f03ff8da73ba 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -258,7 +258,7 @@ class Entrepot extends CommonObject } else { - dol_print_error($db); + dol_print_error($this->db); } $this->pays=$objp->libelle; $this->pays_code=$objp->code; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index d96539e311ece6719050c69798fd31dbb9f76266..8dd66a154c15b098638377452c30a754719102a5 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -58,7 +58,7 @@ class MouvementStock */ function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label='') { - global $conf; + global $conf, $langs; $error = 0; dol_syslog("MouvementStock::_create start userid=$user->id, fk_product=$fk_product, warehouse=$entrepot_id, qty=$qty, type=$type, price=$price label=$label"); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index bd3132a322c81d7c5c1a499ebed83f19cfc6d46b..94e75a456374b6d032e3e33e83f5b12033526b09 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -74,7 +74,7 @@ class Project extends CommonObject */ function create($user, $notrigger=0) { - global $conf; + global $conf, $langs; $error = 0; $ret = 0; @@ -170,7 +170,9 @@ class Project extends CommonObject function update($user, $notrigger=0) { global $langs, $conf; - + + $error=0; + // Clean parameters $this->title = trim($this->title); $this->description = trim($this->description); @@ -496,6 +498,8 @@ class Project extends CommonObject { global $langs, $conf; + $error=0; + if ($this->statut != 1) { $this->db->begin(); @@ -553,6 +557,8 @@ class Project extends CommonObject { global $langs, $conf; + $error=0; + if ($this->statut != 2) { $this->db->begin(); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 462edcb1f256dcde283b3d92bb2b001daa762e19..317b9cab6944a4b8798efbe420b0c4d1af46db59 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -381,6 +381,7 @@ class Task extends CommonObject */ function hasChildren() { + $error=0; $ret=0; $sql = "SELECT COUNT(*) as nb"; @@ -664,6 +665,7 @@ class Task extends CommonObject { global $conf,$langs; + $error=0; $ret = 0; // Clean parameters @@ -781,6 +783,9 @@ class Task extends CommonObject */ function updateTimeSpent($user, $notrigger=0) { + global $conf,$langs; + + $error=0; $ret = 0; // Clean parameters diff --git a/htdocs/projet/ganttchart.php b/htdocs/projet/ganttchart.php index 4bd08f83c045dc39fa0a59c17607e85d7f5a8558..586fbf3518c44abc9f3606d77f841d77bdeb8ab0 100644 --- a/htdocs/projet/ganttchart.php +++ b/htdocs/projet/ganttchart.php @@ -149,7 +149,7 @@ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_ $name=$task['task_name']; for($i=0; $i < $level; $i++) { $name=' '.$name; } // Add line to gantt - $s = "// Add taks id=".$tasks["task_id"]." level = ".$level."\n"; + $s = "// Add taks id=".$task["task_id"]." level = ".$level."\n"; //$s.= "g.AddElementItem(new JSGantt.ElementItem('task',".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '', ".$task['task_milestone'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", ".$parent.", 1".($depend?", ".$depend:"")."));"; $s = "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."'));"; echo $s."\n"; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index accc3365c6f3735ac62ff778f6e467d0607e28e2..ff9430a0136b64dc2ef2729abeca0b7ba21aadad 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -546,7 +546,7 @@ abstract class ActionsCardCommon { $head = societe_prepare_head($this->object); - $this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'company'); + $this->tpl['showhead']=dol_get_fiche_head($head, 'card', '', 0, 'company'); $this->tpl['showend']=dol_get_fiche_end(); $this->tpl['showrefnav'] = $form->showrefnav($this->object,'socid','',($user->societe_id?0:1),'rowid','nom'); @@ -595,7 +595,7 @@ abstract class ActionsCardCommon } else if ($nbofsalesrepresentative > 0) { - $userstatic=new User($db); + $userstatic=new User($this->db); $i=0; foreach($listsalesrepresentatives as $val) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 3d1b5ac9f7072d62b6a7c6f457d6405257aa7c9d..f154a18d0cfac30fe41e95840c30d944f9b20e3b 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -175,6 +175,8 @@ class Societe extends CommonObject { global $langs,$conf; + $error=0; + // Clean parameters if (empty($this->status)) $this->status=0; $this->name=$this->name?trim($this->name):trim($this->nom); @@ -373,9 +375,10 @@ class Societe extends CommonObject */ function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update') { + global $langs,$conf; require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php"); - global $langs,$conf; + $error=0; dol_syslog("Societe::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur); @@ -544,7 +547,7 @@ class Societe extends CommonObject include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); $hookmanager=new HookManager($this->db); $hookmanager->callHooks(array('thirdpartydao')); - $parameters=array('socid'=>$socid); + $parameters=array('socid'=>$this->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { @@ -2352,34 +2355,9 @@ class Societe extends CommonObject } - /** - * Add a line in log table to save status change. - * - * @param $id_status - */ - function set_status($id_status) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_log (datel, fk_soc, fk_statut, fk_user, author, label)"; - $sql.= " VALUES ('".$dateaction."', ".$socid.", ".$id_status.","; - $sql.= "'".$user->id."',"; - $sql.= "'".$this->db->escape($user->login)."',"; - $sql.= "'Change statut from ".$oldstcomm." to ".$stcommid."'"; - $sql.= ")"; - $result = $thi->db->query($sql); - if ($result) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$stcommid." WHERE rowid=".$socid; - $result = $this->db->query($sql); - } - else - { - $errmesg = $this->db->lasterror(); - } - } - - /** * Create a third party into database from a member object + * * @param member Object member * @param socname Name of third party to force * @return int <0 if KO, id of created account if OK diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 173608c820e0f4d07a4c57b9c8596737d14025bb..c866085e50c7dcc36cdcfbb4a0147c1dab00aae4 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -654,6 +654,8 @@ class User extends CommonObject { global $user,$conf,$langs; + $error=0; + $this->db->begin(); $this->fetch($this->id); @@ -845,6 +847,8 @@ class User extends CommonObject { global $conf,$user,$langs; + $error=0; + // Positionne parametres $this->admin = 0; $this->nom = $contact->nom; // TODO deprecated @@ -1358,7 +1362,8 @@ class User extends CommonObject function send_password($user, $password='', $changelater=0) { global $conf,$langs; - + global $dolibarr_main_url_root; + require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; $subject = $langs->trans("SubjectNewPassword"); diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 0bf7953545e4cd6995d10a2b7ff8d260513dc2f1..653a28411c36c1b464bcf017c896e69d4e7c2553 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -480,6 +480,8 @@ class UserGroup extends CommonObject { global $user,$conf,$langs; + $error=0; + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_rights"; @@ -523,6 +525,7 @@ class UserGroup extends CommonObject { global $user, $conf, $langs; + $error=0; $now=dol_now(); $entity=$conf->entity; diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 2fe69d8055b14d882827185faa4f97ef730b7bff..ea7ad07159961e68585d7c1b788690dc295b4b17 100644 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -124,6 +124,7 @@ function envoi_mail($oldemail,$message,$total) $subject = "[Dolibarr] List of unpaid invoices"; $sendto = $oldemail; $from = $conf->global->MAIN_EMAIL_FROM; + $errorsto = $conf->global->MAIN_MAIL_ERRORS_TO; $msgishtml = 0; print "Envoi mail pour $oldemail, total: $total\n"; diff --git a/test/phpunit/CategorieTest.php b/test/phpunit/CategorieTest.php index 190afe1e2fbb3be8657bda62d62b62cb41bbeeba..52263f47341e39903c2e95f1c82202c894f50524 100755 --- a/test/phpunit/CategorieTest.php +++ b/test/phpunit/CategorieTest.php @@ -245,12 +245,12 @@ class CategorieTest extends PHPUnit_Framework_TestCase $localobject2->initAsSpecimen(); $retarray=$localobject->liste_photos('/'); - print __METHOD__." retarry size=".count($rearray)."\n"; + print __METHOD__." retarray size=".count($retarray)."\n"; $this->assertTrue(is_array($retarray)); - $ret=$localobject->is_fille($localobject2); - print __METHOD__." retarry size=".count($rearray)."\n"; - $this->assertFalse($ret); + $retarray=$localobject->is_fille($localobject2); + print __METHOD__." retarry size=".count($retarray)."\n"; + $this->assertFalse($retarray); return $localobject->id; } @@ -292,7 +292,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase print __METHOD__." retarray size=".count($retarray)."\n"; $this->assertTrue(is_array($retarray)); - return $result; + return $retarray; } } diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index bf4b5c85775e6487c486bca6d2f94180a61c3dd5..e961816e612839f82847d737183666601302a4df 100755 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -187,7 +187,7 @@ class SecurityTest extends PHPUnit_Framework_TestCase print __METHOD__." encodedstring=".$encodedstring." ".base64_encode($stringtotest)."\n"; $this->assertEquals($stringtotest,$decodedstring); - return $result; + return 0; } /** @@ -210,7 +210,7 @@ class SecurityTest extends PHPUnit_Framework_TestCase print __METHOD__." genpass3=".$genpass3."\n"; $this->assertEquals(strlen($genpass3),8); - return $result; + return 0; } } ?> \ No newline at end of file