diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a568be433397d6267598d3815a33b6b4669b2f13..80803d6d71452e0d28af1cc5d7c85eed4173ec1d 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -179,7 +179,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes') if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $ret=$object->fetch($id); // Reload to get new records - $result=facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); + $result=facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); } if ($result >= 0) { @@ -360,7 +360,7 @@ if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->v if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $ret=$object->fetch($id); // Reload to get new records - facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); + facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); } } else @@ -437,7 +437,7 @@ if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $ret=$object->fetch($id); // Reload to get new records - facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); + facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); } } } @@ -1098,7 +1098,7 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $ret=$object->fetch($id); // Reload to get new records - facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); + facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); } unset($_POST['qty']); unset($_POST['type']); @@ -1200,7 +1200,7 @@ if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['save'] if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $ret=$object->fetch($id); // Reload to get new records - facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); + facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); } } } @@ -1229,7 +1229,7 @@ if ($action == 'up' && $user->rights->facture->creer) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'#'.$_GET['rowid']); exit; @@ -1251,7 +1251,7 @@ if ($action == 'down' && $user->rights->facture->creer) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'#'.$_GET['rowid']); exit; @@ -1485,7 +1485,7 @@ if (GETPOST('action') == 'builddoc') // En get ou en post $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); + $result=facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); if ($result <= 0) { dol_print_error($db,$result); @@ -3057,7 +3057,7 @@ else $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=facture_pdf_create($db, $object, '', $_REQUEST['model'], $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); + $result=facture_pdf_create($db, $object, $_REQUEST['model'], $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager); if ($result <= 0) { dol_print_error($db,$result); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7fcaaced30c20af4656078607b97a0435a76a3c3..04ece4813c1437ed81a49d2739e70e357b43c7ad 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1188,7 +1188,7 @@ class Facture extends CommonObject } else { - $this->error=$this->db->error()." sql=".$sql; + $this->error=$this->db->lasterror()." sql=".$sql; dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -6; @@ -1196,7 +1196,7 @@ class Facture extends CommonObject } else { - $this->error=$this->db->error()." sql=".$sql; + $this->error=$this->db->lasterror()." sql=".$sql; dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -4; @@ -1204,7 +1204,7 @@ class Facture extends CommonObject } else { - $this->error=$this->db->error()." sql=".$sql; + $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -2; diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php index 0fd3e8863547eb5dce4aa88272664fccc7a94d1c..e4af98742aeee1e3a5e319ca18fffb7e597d77e3 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/fiche.php @@ -112,7 +112,7 @@ if ($action == 'confirm_valide' && GETPOST('confirm') == 'yes' && $user->rights- $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, '', $fac->modelpdf, $outputlangs, $hookmanager); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs, $hookmanager); } Header('Location: fiche.php?id='.$paiement->id); diff --git a/htdocs/compta/payment_sc/fiche.php b/htdocs/compta/payment_sc/fiche.php index ab14d509a850c9c316cbb47167e3743ac60aec81..d9bee27e91a8a9b031921d6bb2dafe66f3d3791c 100644 --- a/htdocs/compta/payment_sc/fiche.php +++ b/htdocs/compta/payment_sc/fiche.php @@ -94,7 +94,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, '', $fac->modelpdf, $outputlangs, $hookmanager); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs, $hookmanager); } Header('Location: fiche.php?id='.$paiement->id); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index df46828fed67d4fc6a7213bd25a24956f49e9744..4dd667e388e9e60d2d0551908352ca73f79252ea 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1811,6 +1811,8 @@ abstract class CommonObject { global $langs; + $error=0; + if (count($this->array_options) > 0) { // Check parameters diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c587cecffa143700a69cdb348c2c695a2519fa0e..b6dc024b0e3e49dfe149841612966fa54975342f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1050,7 +1050,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) if ($usealternatemethod || $gm) // Si time gm, seule adodb peut convertir { - $date=adodb_mktime($hour,$minute,$second,$month,$day,$year,$isdst,$gm); + $date=adodb_mktime($hour,$minute,$second,$month,$day,$year,0,$gm); } else { diff --git a/htdocs/core/modules/cheque/pdf/modules_chequereceipts.php b/htdocs/core/modules/cheque/pdf/modules_chequereceipts.php index 9a3fa4c68c8583c69c5665be724b9098febeb007..668e64bf43165087321ef6a4fd643c5a7a35e1a0 100644 --- a/htdocs/core/modules/cheque/pdf/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/pdf/modules_chequereceipts.php @@ -112,7 +112,7 @@ function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs) else { $outputlangs->charset_output=$sav_charset_output; - dol_print_error($db,"facture_pdf_create Error: ".$obj->error); + dol_print_error($db,"chequereceipt_pdf_create Error: ".$obj->error); return -1; } diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index f0a282725adbfe505a115f1a5c956cf341daadd5..62d8f11411a85fb449d279c2c4235315ec1c39e4 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -205,7 +205,7 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0 require_once($file); $obj = new $classname($db); - $obj->message = $message; + //$obj->message = $message; // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index c2f19ba3d169588d75e9134d41f8a463aa50b36d..a6e5d6ae38fc88653a15da22b65297c26b3f2dcf 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -130,11 +130,10 @@ abstract class ModeleNumRefFactures /** - * 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 invoice - * @param string $message message * @param string $modele Force template to use ('' to not force) * @param Translate $outputlangs objet lang a utiliser pour traduction * @param int $hidedetails Hide details of lines @@ -143,7 +142,7 @@ abstract class ModeleNumRefFactures * @param HookManager $hookmanager Hook manager instance * @return int <0 if KO, >0 if OK */ -function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false) +function facture_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false) { global $conf,$user,$langs; @@ -204,7 +203,6 @@ function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hide require_once($file); $obj = new $classname($db); - $obj->message = $message; // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index dfc6c2322f05c26fbb0c828c3405b2638c162d17..68887d575434701abd556530c4b0e3053463fc6d 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -155,7 +155,7 @@ class modWorkflow extends DolibarrModules $sql = array(); - return $this->_init($sql,$option); + return $this->_init($sql,$options); } /** diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index ab9c6f09dd3288f418bf24fff8e6b020f60ca485..2ab268c6d9e71a7ff87db728b1010b1d996b1c6e 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -195,7 +195,7 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, require_once($file); $obj = new $classname($db); - $obj->message = $message; + //$obj->message = $message; // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. 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 62f182c6ab8efb1eb16f49a93cae0fab77c8f745..adab34b9e5ac88eb82c19618e34a3b82fd9b5882 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -303,6 +303,24 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $nexY+=2; // Passe espace entre les lignes + // Cherche nombre de lignes a venir pour savoir si place suffisante + if ($i < ($nblignes - 1) && empty($hidedesc)) // If it's not last line + { + //on recupere la description du produit suivant + $follow_descproduitservice = $object->lines[$i+1]->desc; + //on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres) + $nblineFollowDesc = dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4; + // Et si on affiche dates de validite, on ajoute encore une ligne + if ($object->lines[$i]->date_start && $object->lines[$i]->date_end) + { + $nblineFollowDesc += 4; + } + } + else // If it's last line + { + $nblineFollowDesc = 0; + } + // Test if a new page is required if ($pagenb == 1) { diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index 4f0dc72bf2ea1b00a952f03b0e2f55223cdfc906..c6487d262f7141cb95f39f5e3d985e709b1b4ca5 100644 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -270,7 +270,7 @@ if ( $resql=$db->query($sql) ) } } print "Build PDF for invoice ".$obj->facnumber." - Lang = ".$outputlangs->defaultlang."\n"; - $result=facture_pdf_create($db, $fac, '', $newmodel?$newmodel:$fac->modelpdf, $outputlangs); + $result=facture_pdf_create($db, $fac, $newmodel?$newmodel:$fac->modelpdf, $outputlangs); // Add file into files array $files[] = $conf->facture->dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf'; diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php index c3c490ef4e1b8f9109ff88201941de3754538328..b0977142f33dde58f72abc0a329dd7018735141b 100644 --- a/test/phpunit/BuildDocTest.php +++ b/test/phpunit/BuildDocTest.php @@ -162,14 +162,14 @@ class BuildDocTest extends PHPUnit_Framework_TestCase // Crabe $localobject->modelpdf='crabe'; - $result=facture_pdf_create($db, $localobject, '', $localobject->modelpdf, $langs); + $result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $langs); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n"; // Oursin $localobject->modelpdf='oursin'; - $result=facture_pdf_create($db, $localobject, '', $localobject->modelpdf, $langs); + $result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $langs); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n";