diff --git a/ChangeLog b/ChangeLog
index 63952957652..bddd25d5dd1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.3 compared to 3.2 *****
For users:
+- New: If field "signature" is filled into user table, text is added
+ at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this
+ feautre is disabled.
- New: Add link "Back to list" on all cards.
- New: After first install, warning are visible onto mandatory setup not
configured. Show also total number of activated modules.
@@ -42,7 +45,8 @@ For developers:
- New: Can add a link on title field of added dictionnary.
- New: Uniformize code.
- New: Add option WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER and
- WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER
+ WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER.
+- New: A module can add several css and js.
- New: removed deprecated methods
ldap::connect, formadmin::select_lang,
html::select_tva
diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl
index 6951bc28bb4..bff952cd317 100755
--- a/build/makepack-dolibarr.pl
+++ b/build/makepack-dolibarr.pl
@@ -324,7 +324,6 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/amarok`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
- $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/lightbox`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php
index 98e50bc813a..71401511e7a 100644
--- a/dev/skeletons/modMyModule.class.php
+++ b/dev/skeletons/modMyModule.class.php
@@ -73,16 +73,17 @@ class modMyModule extends DolibarrModules
// for specific path of parts (eg: /mymodule/core/modules/barcode)
// for specific css file (eg: /mymodule/css/mymodule.css.php)
//$this->module_parts = array(
- // 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers)
- // 'login' => 0, // Set this to 1 if module has its own login method directory (core/login)
- // 'substitutions' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions)
- // 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus)
- // 'theme' => 0, // Set this to 1 if module has its own theme directory (core/theme)
- // 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl)
- // 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode)
- // 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
- // 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css if module has its own css file
- // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module
+ // 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers)
+ // 'login' => 0, // Set this to 1 if module has its own login method directory (core/login)
+ // 'substitutions' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions)
+ // 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus)
+ // 'theme' => 0, // Set this to 1 if module has its own theme directory (core/theme)
+ // 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl)
+ // 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode)
+ // 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
+ // 'css' => array('/mymodule/css/mymodule.css.php'), // Set this to relative path of css file if module has its own css file
+ // 'js' => array('/mymodule/js/mymodule.js'), // Set this to relative path of js file if module must load a js on all pages
+ // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module
// 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule')) // Set here all workflow context managed by module
// );
$this->module_parts = array();
diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php
index efc3b826b2a..4c6c3fa533d 100644
--- a/htdocs/admin/fournisseur.php
+++ b/htdocs/admin/fournisseur.php
@@ -55,7 +55,7 @@ if ($action == 'updateMask')
{
$maskconstorder=GETPOST('maskconstorder','alpha');
$maskorder=GETPOST('maskorder','alpha');
-
+
if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
@@ -77,7 +77,7 @@ if ($action == 'specimen') // For orders
$commande = new CommandeFournisseur($db);
$commande->initAsSpecimen();
$commande->thirdparty=$specimenthirdparty;
-
+
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
@@ -91,13 +91,13 @@ if ($action == 'specimen') // For orders
break;
}
}
-
+
if ($filefound)
{
require_once($file);
-
- $module = new $classname($db);
-
+
+ $module = new $classname($db,$commande);
+
if ($module->write_file($commande,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
@@ -123,7 +123,7 @@ if ($action == 'specimenfacture') // For invoices
$facture = new FactureFournisseur($db);
$facture->initAsSpecimen();
$facture->thirdparty=$specimenthirdparty; // Define who should has build the invoice (so the supplier)
-
+
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
@@ -137,13 +137,13 @@ if ($action == 'specimenfacture') // For invoices
break;
}
}
-
+
if ($filefound)
{
require_once($file);
-
- $module = new $classname($db);
-
+
+ $module = new $classname($db,$facture);
+
if ($module->write_file($facture,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf");
@@ -166,7 +166,7 @@ if ($action == 'set')
{
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
-
+
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
@@ -198,7 +198,7 @@ if ($action == 'setdoc')
{
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
-
+
$db->begin();
if ($type == 'order_supplier' && dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
diff --git a/htdocs/admin/project.php b/htdocs/admin/project.php
index ad67ba3a317..80be64c8153 100644
--- a/htdocs/admin/project.php
+++ b/htdocs/admin/project.php
@@ -51,7 +51,7 @@ if ($action == 'updateMask')
{
$maskconstproject=GETPOST('maskconstproject','alpha');
$maskproject=GETPOST('maskproject','alpha');
-
+
if ($maskconstproject) $res = dolibarr_set_const($db,$maskconstproject,$maskproject,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
@@ -86,7 +86,7 @@ if ($action == 'specimen')
break;
}
}
-
+
if ($filefound)
{
require_once($file);
@@ -207,7 +207,7 @@ foreach ($dirmodels as $reldir)
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
- {
+ {
$var=!$var;
print '
'.$module->nom." \n";
print $module->info();
@@ -339,10 +339,10 @@ foreach ($dirmodels as $reldir)
// Active
if (in_array($name, $def))
{
- print " \n";
+ print " \n";
print 'scandir.'&label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on');
- print ' ';
+ print '';
print " ";
}
else
@@ -371,7 +371,7 @@ foreach ($dirmodels as $reldir)
$htmltooltip.=''.$langs->trans("FeaturesSupported").': ';
$htmltooltip.=' '.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '';
- $link=''.img_object($langs->trans("Preview"),'order').' ';
+ $link=''.img_object($langs->trans("Preview"),'project').' ';
print $form->textwithpicto(' '.$link,$htmltooltip,-1,0);
print ' ';
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 76cdd822ce5..11ce0f53b4b 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -280,7 +280,7 @@ class Commande extends CommonOrder
dol_syslog("Rename ok");
// Suppression ancien fichier PDF dans nouveau rep
- dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'.*');
+ dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'*.*');
}
}
}
diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php
index 5efeaad7b04..9416732af77 100644
--- a/htdocs/commande/liste.php
+++ b/htdocs/commande/liste.php
@@ -98,7 +98,8 @@ $formother = new FormOther($db);
$formfile = new FormFile($db);
$companystatic = new Societe($db);
-llxHeader();
+$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
+llxHeader('',$langs->trans("Orders"),$help_url);
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
$sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee';
diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index cae2461a780..b99b92391a9 100755
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -29,10 +29,12 @@
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
-require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php");
+require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
+require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/report.lib.php");
+if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
$langs->load('orders');
$langs->load('deliveries');
@@ -73,10 +75,9 @@ if ($action == 'create')
}
}
$now=dol_now();
-$html = new Form($db);
-$formfile = new FormFile($db);
-$companystatic = new Societe($db);
-$htmlother = new FormOther($db);
+
+$viewstatut=GETPOST('viewstatut');
+
/*
* Actions
@@ -267,30 +268,30 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
{
$fk_parent_line = 0;
}
- $result = $object->addline(
- $id,
- $desc,
- $lines[$i]->subprice,
- $lines[$i]->qty,
- $lines[$i]->tva_tx,
- $lines[$i]->localtax1_tx,
- $lines[$i]->localtax2_tx,
- $lines[$i]->fk_product,
- $lines[$i]->remise_percent,
- $date_start,
- $date_end,
- 0,
- $lines[$i]->info_bits,
- $lines[$i]->fk_remise_except,
- 'HT',
- 0,
- $product_type,
- $lines[$i]->rang,
- $lines[$i]->special_code,
- $object->origin,
- $lines[$i]->rowid,
- $fk_parent_line
- );
+ $result = $object->addline(
+ $id,
+ $desc,
+ $lines[$i]->subprice,
+ $lines[$i]->qty,
+ $lines[$i]->tva_tx,
+ $lines[$i]->localtax1_tx,
+ $lines[$i]->localtax2_tx,
+ $lines[$i]->fk_product,
+ $lines[$i]->remise_percent,
+ $date_start,
+ $date_end,
+ 0,
+ $lines[$i]->info_bits,
+ $lines[$i]->fk_remise_except,
+ 'HT',
+ 0,
+ $product_type,
+ $lines[$i]->rang,
+ $lines[$i]->special_code,
+ $object->origin,
+ $lines[$i]->rowid,
+ $fk_parent_line
+ );
if ($result > 0)
{
$lineid=$result;
@@ -342,146 +343,149 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
$mesgs[]=''.$object->error.'
';
}
}
+}
- /*
- * View
- */
- $html = new Form($db);
- $htmlother = new FormOther($db);
- $formfile = new FormFile($db);
- $now=dol_now();
- // Mode creation
- if ($action == 'create')
+/*
+ * View
+ */
+
+$html = new Form($db);
+$htmlother = new FormOther($db);
+$formfile = new FormFile($db);
+$companystatic = new Societe($db);
+
+// Mode creation
+if ($action == 'create')
+{
+ $facturestatic=new Facture($db);
+
+ llxHeader();
+ print_fiche_titre($langs->trans('NewBill'));
+
+ $soc = new Societe($db);
+ if ($socid) $res=$soc->fetch($socid);
+ if ($res)
{
- $facturestatic=new Facture($db);
+ $cond_reglement_id = $soc->cond_reglement_id;
+ $mode_reglement_id = $soc->mode_reglement_id;
+ $remise_percent = $soc->remise_percent;
+ }
+ $remise_absolue = 0;
+ $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
- llxHeader();
- print_fiche_titre($langs->trans('NewBill'));
+ $absolute_discount=$soc->getAvailableDiscounts();
+ print ' ';
+
+
while ($i < $n)
{
print ' ';
-
+
$i++;
}
-
+
print "\n";
// Button "Create Draft"
print ' ';
print "\n";
}
+
//Mode liste
-else
+if (($action != 'create' && $action != 'add') || ! empty($mesgs))
{
llxHeader();
?>
-
rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ' WHERE c.fk_soc = s.rowid';
- $sql.= ' AND c.fk_statut in (1, 2) AND c.facture = 0';
+ // Which invoice to show
+ if ($viewstatut <> '')
+ {
+ if ($viewstatut < 4 && $viewstatut > -2)
+ {
+ $sql.= ' AND c.fk_statut ='.$viewstatut; // brouillon, validee, en cours, annulee
+ if ($viewstatut == 3)
+ {
+ $sql.= ' AND c.facture = 0'; // need to create invoice
+ }
+ }
+ if ($viewstatut == 4)
+ {
+ $sql.= ' AND c.facture = 1'; // invoice created
+ }
+ if ($viewstatut == -2) // To process
+ {
+ //$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0';
+ $sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected
+ }
+ }
$sql.= ' AND s.entity = '.$conf->entity;
if ($socid) $sql.= ' AND s.rowid = '.$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
@@ -511,18 +535,18 @@ else
{
$sql.= " AND (c.ref LIKE '%".$db->escape($sall)."%' OR c.note LIKE '%".$db->escape($sall)."%')";
}
-
+
//Date filter
if ($date_start && $date_end) $sql.= " AND c.date_commande >= '".$db->idate($date_start)."' AND c.date_commande <= '".$db->idate($date_end)."'";
if ($date_starty && $date_endy) $sql.= " AND c.date_livraison >= '".$db->idate($date_starty)."' AND c.date_livraison <= '".$db->idate($date_endy)."'";
-
+
if (!empty($sref_client))
{
$sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\'';
}
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
$resql = $db->query($sql);
-
+
if ($resql)
{
if ($socid)
@@ -545,7 +569,7 @@ else
print '';
$companystatic->id=$socid;
$companystatic->nom=$soc->nom;
-
+
print $companystatic->getNomUrl(1,'customer');
print ' ';
print '';
@@ -557,7 +581,7 @@ else
print_liste_field_titre($langs->trans('Status'),'','','','','align="right"');
print_liste_field_titre($langs->trans('GenerateBill'),'','','','','align="center"');
print '';
-
+
// Lignes des champs de filtre
print '';
print ' ';
@@ -569,52 +593,52 @@ else
//print '';
print ' ';
print ' ';
-
+
//DATE ORDER
print ' ';
print $period;
- print ' ';
-
+ print '';
+
//DATE DELIVERY
print '';
print $periodely;
print ' ';
-
- //SEARCH BUTTON
+
+ //SEARCH BUTTON
print '';
print ' ';
-
+
//ALL/NONE
print ' ';
if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").' ';
print ' ';
-
+
print '';
print ' ';
-
+
print '';
$var=True;
$generic_commande = new Commande($db);
-
+
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$var=!$var;
print '';
print '';
-
+
$generic_commande->id=$objp->rowid;
$generic_commande->ref=$objp->ref;
-
+
print '';
print '';
print $generic_commande->getNomUrl(1,$objp->fk_statut);
print ' ';
-
+
print '';
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $db->jdate($objp->date_valid) < ($now - $conf->commande->client->warning_delay)) print img_picto($langs->trans("Late"),"warning");
print ' ';
-
+
print '';
$filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
@@ -622,37 +646,37 @@ else
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
print '
';
print ' ';
-
+
print ''.$objp->ref_client.' ';
-
+
// Order date
print '';
print dol_print_date($db->jdate($objp->date_commande),'day');
print ' ';
-
+
//Delivery date
print '';
print dol_print_date($db->jdate($objp->date_livraison),'day');
print ' ';
-
+
// Statut
print ''.$generic_commande->LibStatut($objp->fk_statut,$objp->facturee,5).' ';
-
+
// Checkbox
print '';
print ' ';
print ' ' ;
-
+
print ' ';
-
+
$total = $total + $objp->price;
$subtotal = $subtotal + $objp->price;
$i++;
}
print '
';
-
+
/*
- * Boutons actions
+ * Boutons actions
*/
print '';
print '
';
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index a8e10747977..87405b5e0be 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1724,7 +1724,7 @@ class Facture extends CommonInvoice
dol_syslog("Rename ok");
// Suppression ancien fichier PDF dans nouveau rep
- dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'.*');
+ dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'*.*');
}
}
}
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index 494867ec94f..cd474a141bf 100755
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -165,6 +165,24 @@ abstract class CommonDocGenerator
);
}
+ /**
+ * Rect pdf
+ *
+ * @param unknown_type $pdf
+ * @param unknown_type $x
+ * @param unknown_type $y
+ * @param unknown_type $l
+ * @param unknown_type $h
+ * @param int $hidetop Hide top
+ * @param int $hidebottom Hide bottom
+ */
+ function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
+ {
+ if (empty($hidetop)) $pdf->line($x, $y, $x+$l, $y);
+ $pdf->line($x+$l, $y, $x+$l, $y+$h);
+ if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
+ $pdf->line($x, $y+$h, $x, $y);
+ }
}
?>
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 78255aa9084..c3c64758225 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -52,7 +52,7 @@ class Conf
public $smart_menu;
public $modules = array(); // List of activated modules
- public $modules_parts = array('js'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'hooks'=>array()); // List of modules parts
+ public $modules_parts = array('css'=>array(), 'js'=>array(),'triggers'=>array(),'login'=>array(),'substitutions'=>array(),'menus'=>array(),'theme'=>array(),'tpl'=>array(),'barcode'=>array(),'models'=>array(),'hooks'=>array()); // List of modules parts
// TODO Remove thoose arrays with generic module_parts
public $tabs_modules = array();
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 29433cfb63b..19f5e7de09b 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1424,7 +1424,7 @@ class Form
$outval='';
$opt = '
idprodfournprice) $opt.= ' selected="selected"';
+ if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected="selected"';
if ($objp->fprice == '') $opt.=' disabled="disabled"';
$opt.= '>';
@@ -3709,30 +3709,6 @@ class Form
}
else dol_print_error('','Call of showphoto with wrong parameters');
- /* Disabled. lightbox seems to not work. I don't know why.
- $ret.="\n\n";
-
- $ret.="\n\n";
- */
-
return $ret;
}
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 8347725fd32..597d143f6ea 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -601,12 +601,13 @@ class FormMail
{
if (! isset($this->ckeditortoolbar)) $this->ckeditortoolbar = 'dolibarr_notes';
- if(! empty($conf->global->MAIL_USE_SIGN) && $this->fromid > 0)
+ if (empty($conf->global->MAIL_DO_NOT_USE_SIGN) && $this->fromid > 0)
{
$fuser=new User($this->db);
$fuser->fetch($this->fromid);
- if(!empty($fuser->signature)) {
+ if(! empty($fuser->signature))
+ {
$defaultmessage.=dol_htmlentitiesbr_decode($fuser->signature);
}
}
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 140361265f2..220a3c65bc0 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -222,12 +222,18 @@ function getCountry($id,$withcode='',$dbtouse=0,$outputlangs='',$entconv=1)
{
global $db,$langs;
+ // Check parameters
+ if (empty($id))
+ {
+ if ($withcode === 'all') return array('id'=>'','code'=>'','label'=>'');
+ else return '';
+ }
if (! is_object($dbtouse)) $dbtouse=$db;
if (! is_object($outputlangs)) $outputlangs=$langs;
$sql = "SELECT rowid, code, libelle FROM ".MAIN_DB_PREFIX."c_pays";
if (is_numeric($id)) $sql.= " WHERE rowid=".$id;
- else $sql.= " WHERE code='".$id."'";
+ else $sql.= " WHERE code='".$db->escape($id)."'";
dol_syslog("Company.lib::getCountry sql=".$sql);
$resql=$dbtouse->query($sql);
@@ -251,10 +257,11 @@ function getCountry($id,$withcode='',$dbtouse=0,$outputlangs='',$entconv=1)
}
else
{
- return "NotDefined";
+ return 'NotDefined';
}
}
else dol_print_error($dbtouse,'');
+ return 'Error';
}
/**
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 99cac8eb60b..2a7b004c7c3 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -524,12 +524,12 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
* @param Translate $outputlangs Object lang for output
* @param string $paramfreetext Constant name of free text
* @param Societe $fromcompany Object company
- * @param int $marge_basse Margin bottom
- * @param int $marge_gauche Margin left
- * @param int $page_hauteur Page height
+ * @param int $marge_basse Margin bottom we use for the autobreak
+ * @param int $marge_gauche Margin left (no more used)
+ * @param int $page_hauteur Page height (no more used)
* @param Object $object Object shown in PDF
- * @param int $showdetails Show company details
- * @return void
+ * @param int $showdetails Show company details into footer. This param seems to not be used by standard version.
+ * @return int Return height of bottom margin including footer text
*/
function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_basse,$marge_gauche,$page_hauteur,$object,$showdetails=0)
{
@@ -538,6 +538,8 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
$outputlangs->load("dict");
$line='';
+ $dims=$pdf->getPageDimensions();
+
// Line of free text
if (! empty($conf->global->$paramfreetext))
{
@@ -659,11 +661,12 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
$nbofline=dol_nboflines_bis($line,0,$outputlangs->charset_output);
//print 'nbofline='.$nbofline; exit;
//print 'e'.$line.'t'.dol_nboflines($line);exit;
- $posy=$marge_basse + ($nbofline*3) + (! empty($line1)?3:0) + (! empty($line2)?3:0) + (! empty($line3)?3:0) + (! empty($line4)?3:0);
+ $marginwithfooter=$marge_basse + ($nbofline*3) + (! empty($line1)?3:0) + (! empty($line2)?3:0) + (! empty($line3)?3:0) + (! empty($line4)?3:0);
+ $posy=$marginwithfooter+0;
if ($line) // Free text
{
- $pdf->SetXY($marge_gauche,-$posy);
+ $pdf->SetXY($dims['lm'],-$posy);
$width=20000; $align='L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
if ($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT) { $width=200; $align='C'; }
$pdf->MultiCell($width, 3, $line, 0, $align, 0);
@@ -671,13 +674,13 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
}
$pdf->SetY(-$posy);
- $pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
+ $pdf->line($dims['lm'], $dims['hk']-$posy, $dims['wk']-$dims['rm'], $dims['hk']-$posy);
$posy--;
if (! empty($line1))
{
$pdf->SetFont('','B',7);
- $pdf->SetXY($marge_gauche,-$posy);
+ $pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line1, 0, 'C', 0);
$posy-=3;
$pdf->SetFont('','',7);
@@ -686,7 +689,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
if (! empty($line2))
{
$pdf->SetFont('','B',7);
- $pdf->SetXY($marge_gauche,-$posy);
+ $pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
$posy-=3;
$pdf->SetFont('','',7);
@@ -694,14 +697,14 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
if (! empty($line3))
{
- $pdf->SetXY($marge_gauche,-$posy);
+ $pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line3, 0, 'C', 0);
}
if (! empty($line4))
{
$posy-=3;
- $pdf->SetXY($marge_gauche,-$posy);
+ $pdf->SetXY($dims['lm'],-$posy);
$pdf->MultiCell(200, 2, $line4, 0, 'C', 0);
}
@@ -712,6 +715,8 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
$pdf->MultiCell(11, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
//print 'xxx'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
}
+
+ return $marginwithfooter;
}
/**
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 9a51e08ea37..3aae851a2d6 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -744,12 +744,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
$newmenu->add("/societe/soc.php?action=create", $langs->trans("MenuNewThirdParty"),1);
if (! $conf->use_javascript_ajax) $newmenu->add("/societe/soc.php?action=create&private=1",$langs->trans("MenuNewPrivateIndividual"),1);
}
-
- // TODO Avoid doing dir scan
- if(is_dir("societe/groupe"))
- {
- $newmenu->add("/societe/groupe/index.php", $langs->trans("MenuSocGroup"),1);
- }
}
// Prospects
@@ -858,8 +852,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
$newmenu->add("/commande/liste.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire);
if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire);
if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire);
- if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->commande->lire);
- if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=3", $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire);
+ if ($leftmenu=="orders" && $conf->expedition->enabled) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->commande->lire);
+ if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=".($conf->expedition->enabled?"3":"-2"), $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire);
if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire);
if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire);
$newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire);
diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php
index c98aff33804..5653c8977cd 100644
--- a/htdocs/core/modules/DolibarrModules.class.php
+++ b/htdocs/core/modules/DolibarrModules.class.php
@@ -1286,6 +1286,20 @@ abstract class DolibarrModules
/**
* Insert activation of generic parts from modules in llx_const
+ * Input entry use $this->module_parts = array(
+ * 'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers)
+ * 'login' => 0, // Set this to 1 if module has its own login method directory (core/login)
+ * 'substitutions' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions)
+ * 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus)
+ * 'theme' => 0, // Set this to 1 if module has its own theme directory (core/theme)
+ * 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl)
+ * 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode)
+ * 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
+ * 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css file if module has its own css file
+ * 'js' => '/mymodule/js/mymodule.js', // Set this to relative path of js file if module must load a js on all pages
+ * 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module
+ * 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule') // Set here all workflow context managed by module
+ * )
*
* @return int Nb of errors (0 if OK)
*/
diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php
index e2a92b18753..5a9d1438261 100644
--- a/htdocs/core/modules/action/rapport.pdf.php
+++ b/htdocs/core/modules/action/rapport.pdf.php
@@ -112,6 +112,9 @@ class CommActionRapport
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -132,7 +135,6 @@ class CommActionRapport
$pdf->SetKeywords($outputlangs->convToOutputCharset($this->title." ".$this->subject));
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
$nbpage = $this->_pages($pdf, $outputlangs);
diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php
index 923ee55baf0..98bea5676f8 100644
--- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php
+++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php
@@ -117,6 +117,9 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
// Create PDF instance
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -137,7 +140,6 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
$nboflines=count($this->lines);
// Define nb of page
diff --git a/htdocs/core/modules/commande/doc/pdf_edison.modules.php b/htdocs/core/modules/commande/doc/pdf_edison.modules.php
index 0ec5df0960d..c8d707b51ce 100644
--- a/htdocs/core/modules/commande/doc/pdf_edison.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_edison.modules.php
@@ -141,6 +141,9 @@ class pdf_edison extends ModelePDFCommandes
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -167,7 +170,6 @@ class pdf_edison extends ModelePDFCommandes
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
@@ -200,9 +202,16 @@ class pdf_edison extends ModelePDFCommandes
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
+ $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
+ $pageposbefore=$pdf->getPage();
+
// Description of product line
pdf_writelinedesc($pdf,$object,$i,$outputlangs,100,3,30,$curY,1,$hidedesc,0,$hookmanager);
+ $pageposafter=$pdf->getPage();
+ $pdf->setPage($pageposbefore);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@@ -228,39 +237,51 @@ class pdf_edison extends ModelePDFCommandes
$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
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter)
{
- //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);
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ $pagenb++;
+ $pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
}
- else // If it's last line
+ if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
- $nblineFollowDesc = 0;
- }
-
- if ((($nexY+$nblineFollowDesc) > ($tab_top+$tab_height) && $i < ($nblignes - 1)) || (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak))
- {
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
-
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
// New page
$pdf->AddPage();
- if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
-
- $nexY = $tab_top + 8;
}
}
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
-
- $bottomlasttab=$tab_top + $tab_height + 1;
+ // Show square
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
+ }
// Affiche zone infos
$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
@@ -467,9 +488,11 @@ class pdf_edison extends ModelePDFCommandes
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $langs,$conf;
$langs->load("main");
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index 899ea1c69b4..76ac2268b0f 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -177,6 +177,9 @@ class pdf_einstein extends ModelePDFCommandes
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -203,7 +206,6 @@ class pdf_einstein extends ModelePDFCommandes
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
@@ -262,10 +264,17 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
+ $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
+ $pageposbefore=$pdf->getPage();
+
// Description of product line
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
+ $pageposafter=$pdf->getPage();
+ $pdf->setPage($pageposbefore);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@@ -321,71 +330,50 @@ class pdf_einstein extends ModelePDFCommandes
$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)
- {
- $tab_top_in_current_page=$tab_top;
- $tab_height_in_current_page=$tab_height;
- }
- else
- {
- $tab_top_in_current_page=$tab_top_newpage;
- $tab_height_in_current_page=$tab_height_newpage;
- }
- if ((($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1)) || (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak))
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter)
{
if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ $pagenb++;
+ $pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ }
+ if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
-
$this->_pagefoot($pdf,$object,$outputlangs);
-
// New page
$pdf->AddPage();
- if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
-
- $nexY = $tab_top_newpage + 7;
}
}
// Show square
if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
- $bottomlasttab=$tab_top + $tab_height + 1;
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
- $bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
// Affiche zone infos
@@ -797,9 +785,11 @@ class pdf_einstein extends ModelePDFCommandes
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php
index 3b657f5967b..01575734d97 100644
--- a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php
@@ -147,6 +147,9 @@ class pdf_expedition_merou extends ModelePdfExpedition
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format,'mm','l');
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -174,7 +177,6 @@ class pdf_expedition_merou extends ModelePdfExpedition
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
$pdf->SetFont('','', $default_font_size - 3);
@@ -284,9 +286,11 @@ class pdf_expedition_merou extends ModelePdfExpedition
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php
index 16d757aaafc..e0a9f5211a8 100644
--- a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php
@@ -126,6 +126,9 @@ class pdf_expedition_rouget extends ModelePdfExpedition
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -154,7 +157,6 @@ class pdf_expedition_rouget extends ModelePdfExpedition
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
@@ -223,9 +225,16 @@ class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
+ $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
+ $pageposbefore=$pdf->getPage();
+
// Description de la ligne produit
pdf_writelinedesc($pdf,$object,$i,$outputlangs,150,3,$this->posxdesc,$curY,0,1);
+ $pageposafter=$pdf->getPage();
+ $pdf->setPage($pageposbefore);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@@ -274,9 +283,11 @@ class pdf_expedition_rouget extends ModelePdfExpedition
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
@@ -385,7 +396,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition
}
- $posx=100;
+ $posx=$this->page_largeur - 100 - $this->marge_droite;
$posy=$this->marge_haute;
$pdf->SetFont('','B', $default_font_size + 2);
@@ -467,7 +478,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition
$posx=$this->marge_gauche;
$posy=42;
$hautcadre=40;
- if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=118;
+ if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur - 80 - $this->marge_droite;
// Show sender frame
$pdf->SetTextColor(0,0,0);
@@ -516,7 +527,7 @@ class pdf_expedition_rouget extends ModelePdfExpedition
// Show recipient
$posy=42;
- $posx=100;
+ $posx=$this->page_largeur - 100 - $this->marge_droite;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
// Show recipient frame
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 1ab1f99dbbc..327ad5e8b19 100755
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -178,6 +178,9 @@ class pdf_crabe extends ModelePDFFactures
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -204,7 +207,6 @@ class pdf_crabe extends ModelePDFFactures
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
@@ -225,7 +227,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
- $tab_top_newpage = 50;
+ $tab_top_newpage = 10;
$tab_height = 130;
$tab_height_newpage = 150;
@@ -262,8 +264,9 @@ class pdf_crabe extends ModelePDFFactures
{
$curY = $nexY;
+ $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
-
+
// Description of product line
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$curX = $this->posxdesc-1;
@@ -271,7 +274,8 @@ class pdf_crabe extends ModelePDFFactures
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
-
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@@ -332,84 +336,47 @@ class pdf_crabe extends ModelePDFFactures
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
- if ($pagenb == 1)
+ if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height + 40, 0, $outputlangs);
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, 0, $outputlangs);
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
+ $this->_pagefoot($pdf,$object,$outputlangs);
$pagenb++;
$pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
}
-
- // Cherche nombre de lignes a venir pour savoir si place suffisante
- if ($i < ($nblignes - 1) && empty($hidedesc)) // If it's not last line
+ if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
- //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;
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ // New page
+ $pdf->AddPage();
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ $pagenb++;
}
- else // If it's last line
- {
- $nblineFollowDesc = 0;
- }
-
- // Test if a new page is required
- if ($pagenb == 1)
- {
- $tab_top_in_current_page=$tab_top;
- $tab_height_in_current_page=$tab_height;
- }
- else
- {
- $tab_top_in_current_page=$tab_top_newpage;
- $tab_height_in_current_page=$tab_height_newpage;
- }
- if ((($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1)) || (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak))
- {
- if ($pagenb == 1)
- {
- $this->_tableau($pdf, $tab_top, $tab_height + 40, $nexY, $outputlangs);
- }
- else
- {
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
- }
-
- $this->_pagefoot($pdf,$object,$outputlangs);
-
- // New page
- $pdf->AddPage();
- if (! empty($tplidx)) $pdf->useTemplate($tplidx);
- $pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
-
- $nexY = $tab_top_newpage + 7;
- }
-
}
// Show square
if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
- $bottomlasttab=$tab_top + $tab_height + 1;
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
- $bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
// Affiche zone infos
@@ -960,11 +927,13 @@ class pdf_crabe extends ModelePDFFactures
* @param PDF &$pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
- * @param int $nexY Y
+ * @param int $nexY Y (not used)
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
@@ -973,51 +942,70 @@ class pdf_crabe extends ModelePDFFactures
// Amount in (at tab_top - 1)
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
- $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
- $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
- $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
+
+ if (empty($hidetop))
+ {
+ $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency));
+ $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4);
+ $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
+ }
$pdf->SetDrawColor(128,128,128);
+ $pdf->SetFont('','', $default_font_size - 1);
- // Rect prend une longueur en 3eme param et 4eme param
- $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
- // line prend une position y en 2eme param et 4eme param
- $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
+ // Output Rect
+ $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
- $pdf->SetFont('','', $default_font_size - 1);
+ if (empty($hidetop))
+ {
+ $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param
- $pdf->SetXY($this->posxdesc-1, $tab_top+1);
- $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
+ $pdf->SetXY($this->posxdesc-1, $tab_top+1);
+ $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
+ }
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
- $pdf->SetXY($this->posxtva-3, $tab_top+1);
- $pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
+ if (empty($hidetop))
+ {
+ $pdf->SetXY($this->posxtva-3, $tab_top+1);
+ $pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C');
+ }
}
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
- $pdf->SetXY($this->posxup-1, $tab_top+1);
- $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
-
- $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
- $pdf->SetXY($this->posxqty-1, $tab_top+1);
- $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
-
- $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
- if ($this->atleastonediscount)
+ if (empty($hidetop))
{
- $pdf->SetXY($this->posxdiscount-1, $tab_top+1);
- $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
+ $pdf->SetXY($this->posxup-1, $tab_top+1);
+ $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C');
}
+ $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
+ if (empty($hidetop))
+ {
+ $pdf->SetXY($this->posxqty-1, $tab_top+1);
+ $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
+ }
+
+ $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height);
+ if (empty($hidetop))
+ {
+ if ($this->atleastonediscount)
+ {
+ $pdf->SetXY($this->posxdiscount-1, $tab_top+1);
+ $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C');
+ }
+ }
if ($this->atleastonediscount)
{
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
}
- $pdf->SetXY($this->postotalht-1, $tab_top+1);
- $pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C');
-
+ if (empty($hidetop))
+ {
+ $pdf->SetXY($this->postotalht-1, $tab_top+1);
+ $pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C');
+ }
}
/**
@@ -1244,7 +1232,7 @@ class pdf_crabe extends ModelePDFFactures
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
- * @return void
+ * @return int Return height of bottom margin including footer text
*/
function _pagefoot(&$pdf,$object,$outputlangs)
{
diff --git a/htdocs/core/modules/facture/doc/pdf_oursin.modules.php b/htdocs/core/modules/facture/doc/pdf_oursin.modules.php
index d6c8102f2b7..57a7c7a3abd 100755
--- a/htdocs/core/modules/facture/doc/pdf_oursin.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_oursin.modules.php
@@ -166,6 +166,9 @@ class pdf_oursin extends ModelePDFFactures
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -191,8 +194,16 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Invoice"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
- $pdf->SetMargins(10, 10, 10);
- $pdf->SetAutoPageBreak(1,0);
+ $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
+
+ // Positionne $this->atleastonediscount si on a au moins une remise
+ for ($i = 0 ; $i < $nblignes ; $i++)
+ {
+ if ($object->lines[$i]->remise_percent)
+ {
+ $this->atleastonediscount++;
+ }
+ }
// New page
$pdf->AddPage();
@@ -204,7 +215,9 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetTextColor(0,0,0);
$tab_top = $this->marges['h']+90;
+ $tab_top_newpage = $this->marges['h'];
$tab_height = 110;
+ $tab_height_newpage = 150;
$pdf->SetFillColor(220,220,220);
$pdf->SetFont('','', $default_font_size - 1);
@@ -220,20 +233,24 @@ class pdf_oursin extends ModelePDFFactures
{
$curY = $nexY;
+ $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
+ $pageposbefore=$pdf->getPage();
+
// Description of product line
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY+1,$hideref,$hidedesc,0,$hookmanager);
+ $pageposafter=$pdf->getPage();
+ $pdf->setPage($pageposbefore);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+
$nexY = $pdf->GetY();
// TVA
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
- if ($this->franchise!=1)
- {
- $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails, $hookmanager);
- $pdf->SetXY($this->marges['g']+118, $curY);
- $pdf->MultiCell(12, 3, $vat_rate, 0, 'R');
- }
+ $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails, $hookmanager);
+ $pdf->SetXY($this->marges['g']+118, $curY);
+ $pdf->MultiCell(12, 3, $vat_rate, 0, 'R');
}
// Prix unitaire HT avant remise
@@ -258,25 +275,64 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetXY($this->marges['g']+168, $curY);
$pdf->MultiCell(21, 3, $total_excl_tax, 0, 'R', 0);
-
- if (($nexY > 200 && $i < $nblignes - 1) || (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak))
- {
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $object, $outputlangs);
- $nexY = $iniY;
-
- // New page
- $pdf->AddPage();
- if (! empty($tplidx)) $pdf->useTemplate($tplidx);
- $pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $tab_height + 40, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ $pagenb++;
+ $pdf->setPage($pagenb);
}
-
+ /*if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $tab_height + 40, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ // New page
+ $pdf->AddPage();
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ $pagenb++;
+ }*/
+ if (($nexY > 200 && $i < $nblignes - 1) || (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak))
+ {
+ $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $object, $outputlangs);
+ $nexY = $iniY;
+
+ // New page
+ $pdf->AddPage();
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ $pagenb++;
+ $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
+ $pdf->SetFont('','', $default_font_size - 1);
+ $pdf->MultiCell(0, 3, ''); // Set interline to 3
+ $pdf->SetTextColor(0,0,0);
+ }
+ }
+
+ // Show square
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
+ $bottomlasttab=$tab_top + $tab_height + 1;
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs, 1, 0);
+ $bottomlasttab=$tab_top + $tab_height + 1;
}
- $posy=$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $object, $outputlangs);
- $bottomlasttab=$tab_top + $tab_height + 1;
// Affiche zone infos
$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
@@ -744,11 +800,12 @@ class pdf_oursin extends ModelePDFFactures
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
- * @param Object $object Object
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $object, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf,$langs;
$langs->load("main");
@@ -775,16 +832,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetXY($this->marges['g']+153,$tab_top + 1);
$pdf->MultiCell(0, 4, $outputlangs->transnoentities("Qty"), 0, 'L');
- $nblignes = count($object->lines);
- $rem=0;
- for ($i = 0 ; $i < $nblignes ; $i++)
- {
- if ($object->lines[$i]->remise_percent)
- {
- $rem=1;
- }
- }
- if ($rem==1)
+ if ($this->atleastonediscount)
{
$pdf->SetXY($this->marges['g']+165,$tab_top + 1);
$pdf->MultiCell(0, 4, $outputlangs->transnoentities("%"), 0, 'L');
@@ -1018,7 +1066,7 @@ class pdf_oursin extends ModelePDFFactures
* @param PDF &$pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
- * @return void
+ * @return int Return height of bottom margin including footer text
*/
function _pagefoot(&$pdf, $object, $outputlangs)
{
diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
index 91f4b18c172..eee3a6ebf9d 100644
--- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
+++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
@@ -134,6 +134,9 @@ class pdf_soleil extends ModelePDFFicheinter
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -160,7 +163,6 @@ class pdf_soleil extends ModelePDFFicheinter
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
@@ -268,67 +270,51 @@ class pdf_soleil extends ModelePDFFicheinter
$nexY+=2; // Passe espace entre les lignes
- // Cherche nombre de lignes a venir pour savoir si place suffisante
- if ($i < ($nblines - 1) && empty($hidedesc)) // If it's not last line
- {
- //on recupere la description du produit suivant
- $follow_descproduitservice = $objectligne->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)*3);
- }
- else // If it's last line
- {
- $nblineFollowDesc = 0;
- }
-
- // Test if a new page is required
- if ($pagenb == 1)
- {
- $tab_top_in_current_page=$tab_top;
- $tab_height_in_current_page=$tab_height;
- }
- else
- {
- $tab_top_in_current_page=$tab_top_newpage;
- $tab_height_in_current_page=$tab_height_middlepage;
- }
- if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblines - 1))
- {
- if ($pagenb == 1)
- {
- $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
- }
- else
- {
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_middlepage, $nexY, $outputlangs);
- }
-
- $this->_pagefoot($pdf,$object,$outputlangs);
-
- // New page
- $pdf->AddPage();
- if (! empty($tplidx)) $pdf->useTemplate($tplidx);
- $pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
-
- $nexY = $tab_top_newpage + 7;
- }
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ $pagenb++;
+ $pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ }
+ if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ // New page
+ $pdf->AddPage();
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ $pagenb++;
+ }
}
}
// Show square
if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
- $bottomlasttab=$tab_top + $tab_height + 1;
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
- $bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
@@ -367,9 +353,11 @@ class pdf_soleil extends ModelePDFFicheinter
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -406,13 +394,13 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0);
$pdf->SetXY(20,235);
- $pdf->MultiCell(80,30, '', 1);
+ $pdf->MultiCell(80,25, '', 1);
$pdf->SetXY(110,230);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0);
$pdf->SetXY(110,235);
- $pdf->MultiCell(80,30, '', 1);
+ $pdf->MultiCell(80,25, '', 1);
}
/**
diff --git a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php
index d32f1370ef0..5ae3b4133e0 100644
--- a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php
+++ b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php
@@ -120,6 +120,9 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -158,7 +161,6 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
@@ -184,10 +186,15 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
- // Description de la ligne produit
- //$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
+ $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
+ $pageposbefore=$pdf->getPage();
+
+ // Description de la ligne produit
pdf_writelinedesc($pdf,$object,$i,$outputlangs,100,3,30,$curY,1);
- //$pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
+
+ $pageposafter=$pdf->getPage();
+ $pdf->setPage($pageposbefore);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$nexY = $pdf->GetY();
@@ -217,66 +224,50 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$nexY+=2; // Passe espace entre les lignes
- // Cherche nombre de lignes a venir pour savoir si place suffisante
- if ($i < ($nblines - 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);
- }
- else // If it's last line
- {
- $nblineFollowDesc = 0;
- }
-
- // Test if a new page is required
- if ($pagenb == 1)
- {
- $tab_top_in_current_page=$tab_top;
- $tab_height_in_current_page=$tab_height;
- }
- else
- {
- $tab_top_in_current_page=$tab_top_newpage;
- $tab_height_in_current_page=$tab_height_newpage;
- }
-
- if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblines - 1))
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter)
{
if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
-
- $this->_pagefoot($pdf, $object, $outputlangs);
-
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ $pagenb++;
+ $pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ }
+ if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
// New page
$pdf->AddPage();
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
-
- $nexY = $tab_top_newpage + 7;
}
}
// Show square
if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
- $bottomlasttab=$tab_top + $tab_height + 1;
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
- $bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
/*
@@ -309,9 +300,11 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
index 05da0f4bed4..098a59323da 100644
--- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
+++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
@@ -142,6 +142,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -180,7 +183,6 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
/*
// Positionne $this->atleastonediscount si on a au moins une remise
@@ -240,10 +242,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
- // Description de la ligne produit
- //$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
+ $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
+ $pageposbefore=$pdf->getPage();
+
+ // Description de la ligne produit
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY);
- //$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
+
+ $pageposafter=$pdf->getPage();
+ $pdf->setPage($pageposbefore);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@@ -281,68 +288,52 @@ class pdf_typhon extends ModelePDFDeliveryOrder
*/
$nexY+=2; // Passe espace entre les lignes
- // Cherche nombre de lignes a venir pour savoir si place suffisante
- if ($i < ($nblines - 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);
- }
- else // If it's last line
- {
- $nblineFollowDesc = 0;
- }
-
- // Test if a new page is required
- if ($pagenb == 1)
- {
- $tab_top_in_current_page=$tab_top;
- $tab_height_in_current_page=$tab_height;
- }
- else
- {
- $tab_top_in_current_page=$tab_top_newpage;
- $tab_height_in_current_page=$tab_height_newpage;
- }
- if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblines - 1))
- {
- if ($pagenb == 1)
- {
- $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
- }
- else
- {
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
- }
-
- $this->_pagefoot($pdf, $object, $outputlangs);
-
- // New page
- $pdf->AddPage();
- $pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
-
- $nexY = $tab_top_newpage + 7;
- }
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ $pagenb++;
+ $pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ }
+ if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ // New page
+ $pdf->AddPage();
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ $pagenb++;
+ }
}
// Show square
if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
- $bottomlasttab=$tab_top + $tab_height + 1;
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
- $bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
-
/*
* Pied de page
*/
@@ -437,9 +428,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php
index b34d3b9a6fc..8f6fe597449 100644
--- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php
+++ b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php
@@ -127,6 +127,9 @@ class pdf_baleine extends ModelePDFProjects
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -154,7 +157,6 @@ class pdf_baleine extends ModelePDFProjects
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
@@ -225,43 +227,51 @@ class pdf_baleine extends ModelePDFProjects
$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);
- }
- else // If it's last line
- {
- $nblineFollowDesc = 0;
- }
-
- if (($nexY+$nblineFollowDesc) > ($tab_top+$tab_height) && $i < ($nblignes - 1))
- {
- $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
-
- $this->_pagefoot($pdf, $object, $outputlangs);
-
- // New page
- $pdf->AddPage();
- $pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
-
- $tab_top=$tab_top_newpage;
- $tab_height=$tab_height_newpage;
-
- $nexY = $tab_top + 7;
- }
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ $pagenb++;
+ $pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ }
+ if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ // New page
+ $pdf->AddPage();
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ $pagenb++;
+ }
}
// Show square
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
- $bottomlasttab=$tab_top + $tab_height + 1;
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 1, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
+ }
/*
* Pied de page
@@ -297,9 +307,11 @@ class pdf_baleine extends ModelePDFProjects
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf,$mysoc;
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index dd55cf728f9..a9d6e5d1fdb 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -163,6 +163,9 @@ class pdf_azur extends ModelePDFPropales
// Create pdf instance
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -189,7 +192,6 @@ class pdf_azur extends ModelePDFPropales
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
@@ -249,10 +251,17 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
+ $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
+ $pageposbefore=$pdf->getPage();
+
// Description de la ligne produit
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
+ $pageposafter=$pdf->getPage();
+ $pdf->setPage($pageposbefore);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@@ -308,67 +317,50 @@ class pdf_azur extends ModelePDFPropales
$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);
- }
- else // If it's last line
- {
- $nblineFollowDesc = 0;
- }
-
- // Test if a new page is required
- if ($pagenb == 1)
- {
- $tab_top_in_current_page=$tab_top;
- $tab_height_in_current_page=$tab_height;
- }
- else
- {
- $tab_top_in_current_page=$tab_top_newpage;
- $tab_height_in_current_page=$tab_height_middlepage;
- }
- if ((($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1)) || (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak))
- {
- if ($pagenb == 1)
- {
- $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
- }
- else
- {
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_middlepage, $nexY, $outputlangs);
- }
-
- $this->_pagefoot($pdf,$object,$outputlangs);
-
- // New page
- $pdf->AddPage();
- if (! empty($tplidx)) $pdf->useTemplate($tplidx);
- $pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
-
- $nexY = $tab_top_newpage + 7;
- }
-
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ $pagenb++;
+ $pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ }
+ if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ // New page
+ $pdf->AddPage();
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ $pagenb++;
+ }
}
// Show square
if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
- $bottomlasttab=$tab_top + $tab_height + 1;
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_endpage, $nexY, $outputlangs);
- $bottomlasttab=$tab_top_newpage + $tab_height_endpage + 1;
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
// Affiche zone infos
@@ -828,9 +820,11 @@ class pdf_azur extends ModelePDFPropales
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
diff --git a/htdocs/core/modules/propale/doc/pdf_jaune.modules.php b/htdocs/core/modules/propale/doc/pdf_jaune.modules.php
index 400da56bb75..1160bdbf3c8 100644
--- a/htdocs/core/modules/propale/doc/pdf_jaune.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_jaune.modules.php
@@ -163,6 +163,9 @@ class pdf_jaune extends ModelePDFPropales
// Create pdf instance
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -189,7 +192,6 @@ class pdf_jaune extends ModelePDFPropales
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
@@ -249,10 +251,17 @@ class pdf_jaune extends ModelePDFPropales
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
+ $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
+ $pageposbefore=$pdf->getPage();
+
// Description de la ligne produit
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,0,$hookmanager);
+ $pageposafter=$pdf->getPage();
+ $pdf->setPage($pageposbefore);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@@ -308,67 +317,50 @@ class pdf_jaune extends ModelePDFPropales
$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);
- }
- else // If it's last line
- {
- $nblineFollowDesc = 0;
- }
-
- // Test if a new page is required
- if ($pagenb == 1)
- {
- $tab_top_in_current_page=$tab_top;
- $tab_height_in_current_page=$tab_height;
- }
- else
- {
- $tab_top_in_current_page=$tab_top_newpage;
- $tab_height_in_current_page=$tab_height_middlepage;
- }
- if ((($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1)) || (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak))
- {
- if ($pagenb == 1)
- {
- $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
- }
- else
- {
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_middlepage, $nexY, $outputlangs);
- }
-
- $this->_pagefoot($pdf,$object,$outputlangs);
-
- // New page
- $pdf->AddPage();
- if (! empty($tplidx)) $pdf->useTemplate($tplidx);
- $pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
-
- $nexY = $tab_top_newpage + 7;
- }
-
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ $pagenb++;
+ $pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ }
+ if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ // New page
+ $pdf->AddPage();
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ $pagenb++;
+ }
}
// Show square
if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
- $bottomlasttab=$tab_top + $tab_height + 1;
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_endpage, $nexY, $outputlangs);
- $bottomlasttab=$tab_top_newpage + $tab_height_endpage + 1;
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
// Affiche zone infos
@@ -809,9 +801,11 @@ class pdf_jaune extends ModelePDFPropales
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
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 3fc64061d0b..70728e8ea4d 100755
--- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
+++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
@@ -171,6 +171,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -197,7 +200,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
@@ -253,13 +255,19 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
{
$curY = $nexY;
- $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
-
- // Description of product line
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
+
+ $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
+ $pageposbefore=$pdf->getPage();
+
+ // Description of product line
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,0,0,1);
+ $pageposafter=$pdf->getPage();
+ $pdf->setPage($pageposbefore);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@@ -310,72 +318,50 @@ 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)
- {
- $tab_top_in_current_page=$tab_top;
- $tab_height_in_current_page=$tab_height;
- }
- else
- {
- $tab_top_in_current_page=$tab_top_newpage;
- $tab_height_in_current_page=$tab_height_newpage;
- }
- if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1))
- {
- if ($pagenb == 1)
- {
- $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
- }
- else
- {
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
- }
-
- $this->_pagefoot($pdf, $object, $outputlangs);
-
- // New page
- $pdf->AddPage();
- if (! empty($tplidx)) $pdf->useTemplate($tplidx);
- $pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
-
- $nexY = $tab_top_newpage + 7;
- }
-
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ $pagenb++;
+ $pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ }
+ if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ // New page
+ $pdf->AddPage();
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ $pagenb++;
+ }
}
// Show square
if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
- $bottomlasttab=$tab_top + $tab_height + 1;
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
- $bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
// Affiche zone totaux
@@ -627,9 +613,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
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 e8fba3d9b46..bc1904b20d6 100644
--- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -188,6 +188,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$nblignes = count($object->lines);
$pdf=pdf_getInstance($this->format);
+ $heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
+ $heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
+ $pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
@@ -214,7 +217,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
- $pdf->SetAutoPageBreak(1,0);
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
@@ -272,10 +274,17 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
+ $pdf->setPageOrientation('', 1, $this->marge_basse+$heightforfooter+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
+ $pageposbefore=$pdf->getPage();
+
// Description of product line
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,0,0,1,$hookmanager);
+ $pageposafter=$pdf->getPage();
+ $pdf->setPage($pageposbefore);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@@ -328,72 +337,50 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$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)
- {
- $tab_top_in_current_page=$tab_top;
- $tab_height_in_current_page=$tab_height;
- }
- else
- {
- $tab_top_in_current_page=$tab_top_newpage;
- $tab_height_in_current_page=$tab_height_newpage;
- }
- if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1))
- {
- if ($pagenb == 1)
- {
- $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
- }
- else
- {
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
- }
-
- $this->_pagefoot($pdf, $object, $outputlangs);
-
- // New page
- $pdf->AddPage();
- if (! empty($tplidx)) $pdf->useTemplate($tplidx);
- $pagenb++;
- $this->_pagehead($pdf, $object, 0, $outputlangs, $hookmanager);
- $pdf->SetFont('','', $default_font_size - 1);
- $pdf->MultiCell(0, 3, ''); // Set interline to 3
- $pdf->SetTextColor(0,0,0);
-
- $nexY = $tab_top_newpage + 7;
- }
-
+ // Detect if some page were added automatically and output _tableau for past pages
+ while ($pagenb < $pageposafter)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ $pagenb++;
+ $pdf->setPage($pagenb);
+ $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
+ }
+ if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
+ {
+ if ($pagenb == 1)
+ {
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
+ }
+ else
+ {
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
+ }
+ $this->_pagefoot($pdf,$object,$outputlangs);
+ // New page
+ $pdf->AddPage();
+ if (! empty($tplidx)) $pdf->useTemplate($tplidx);
+ $pagenb++;
+ }
}
// Show square
if ($pagenb == 1)
{
- $this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
- $bottomlasttab=$tab_top + $tab_height + 1;
+ $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
else
{
- $this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
- $bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
+ $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
+ $bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
// Affiche zone infos
@@ -808,9 +795,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
+ * @param int $hidetop Hide top bar of array
+ * @param int $hidebottom Hide bottom bar of array
* @return void
- */
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
+ */
+ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf;
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 46f469a2d42..a69c7a04873 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -560,7 +560,7 @@ class Expedition extends CommonObject
dol_syslog("Rename ok");
// Suppression ancien fichier PDF dans nouveau rep
- dol_delete_file($dirdest.'/'.$oldref.'.*');
+ dol_delete_file($dirdest.'/'.$oldref.'*.*');
}
}
}
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 612bfb01ee0..af36be18a44 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -367,7 +367,7 @@ class CommandeFournisseur extends CommonOrder
dol_syslog("Rename ok");
// Suppression ancien fichier PDF dans nouveau rep
- dol_delete_file($dirdest.'/'.$oldref.'.*');
+ dol_delete_file($dirdest.'/'.$oldref.'*.*');
}
}
}
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index d17b97393d0..c85e8e81dc8 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -1282,6 +1282,7 @@ class FactureFournisseur extends CommonInvoice
function initAsSpecimen()
{
global $langs,$conf;
+ include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
$now = dol_now();
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index 99638d7c1ce..d238bf1eb41 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -217,13 +217,13 @@ if ($id > 0 || ! empty($ref))
$db->free($resql);
}
- $sql = "SELECT l.rowid, l.ref, l.fk_product, l.description, l.subprice, sum(l.qty) as qty";
- $sql.= ", p.label";
+ $sql = "SELECT l.fk_product, l.subprice, SUM(l.qty) as qty,";
+ $sql.= " p.ref, p.label";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product=p.rowid";
$sql.= " WHERE l.fk_commande = ".$commande->id;
- $sql.= " GROUP BY l.fk_product";
- $sql.= " ORDER BY l.rowid";
+ $sql.= " GROUP BY p.ref, p.label, l.fk_product, l.subprice"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
+ $sql.= " ORDER BY p.ref, p.label";
$resql = $db->query($sql);
if ($resql)
@@ -260,7 +260,7 @@ if ($id > 0 || ! empty($ref))
{
$nbproduct++;
- $remaintodispatch=($objp->qty - $products_dispatched[$objp->fk_product]);
+ $remaintodispatch=($objp->qty - $products_dispatched[$objp->fk_product]); // Calculation of dispatched
if ($remaintodispatch < 0) $remaintodispatch=0;
$var=!$var;
@@ -268,7 +268,9 @@ if ($id > 0 || ! empty($ref))
print '';
print ''.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.' ';
print ' - '.$objp->label;
- if ($objp->description) print ' '.nl2br($objp->description);
+ // To show detail cref and description value, we must make calculation by cref
+ //print ($objp->cref?' ('.$objp->cref.')':'');
+ //if ($objp->description) print ' '.nl2br($objp->description);
print ' ';
print ' ';
print " \n";
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index 55fc63df8d0..0f88a16d7f2 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -473,6 +473,8 @@ elseif ($action == 'addline')
// cas special pour lequel on a les meme reference que le fournisseur
// $label = '['.$product->ref.'] - '. $product->libelle;
$label = $product->description;
+ $label.= $product->description && $_POST['np_desc'] ? "\n" : "";
+ $label.= $_POST['np_desc'];
$tvatx=get_default_tva($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']);
@@ -1784,12 +1786,19 @@ else
print '';
$form->select_produits_fournisseurs($object->socid,'','idprodfournprice');
+ if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print ' ';
+
if (is_object($hookmanager))
{
$parameters=array('htmlname'=>'idprodfournprice');
echo $hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action);
}
+ $nbrows=ROWS_2;
+ if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
+ $doleditor = new DolEditor('np_desc', GETPOST('np_desc'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);
+ $doleditor->Create();
+
print ' ';
print ' ';
print ' ';
diff --git a/htdocs/includes/jquery/plugins/lightbox/css/jquery.lightbox-0.5.css b/htdocs/includes/jquery/plugins/lightbox/css/jquery.lightbox-0.5.css
deleted file mode 100644
index c7c3d1cb1c2..00000000000
--- a/htdocs/includes/jquery/plugins/lightbox/css/jquery.lightbox-0.5.css
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * jQuery lightBox plugin
- * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
- * and adapted to me for use like a plugin from jQuery.
- * @name jquery-lightbox-0.5.css
- * @author Leandro Vieira Pinho - http://leandrovieira.com
- * @version 0.5
- * @date April 11, 2008
- * @category jQuery plugin
- * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
- * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
- * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
- */
-#jquery-overlay {
- position: absolute;
- top: 0;
- left: 0;
- z-index: 90;
- width: 100%;
- height: 500px;
-}
-#jquery-lightbox {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- z-index: 100;
- text-align: center;
- line-height: 0;
-}
-#jquery-lightbox a img { border: none; }
-#lightbox-container-image-box {
- position: relative;
- background-color: #fff;
- width: 250px;
- height: 250px;
- margin: 0 auto;
-}
-#lightbox-container-image { padding: 10px; }
-#lightbox-loading {
- position: absolute;
- top: 40%;
- left: 0%;
- height: 25%;
- width: 100%;
- text-align: center;
- line-height: 0;
-}
-#lightbox-nav {
- position: absolute;
- top: 0;
- left: 0;
- height: 100%;
- width: 100%;
- z-index: 10;
-}
-#lightbox-container-image-box > #lightbox-nav { left: 0; }
-#lightbox-nav a { outline: none;}
-#lightbox-nav-btnPrev, #lightbox-nav-btnNext {
- width: 49%;
- height: 100%;
- zoom: 1;
- display: block;
-}
-#lightbox-nav-btnPrev {
- left: 0;
- float: left;
-}
-#lightbox-nav-btnNext {
- right: 0;
- float: right;
-}
-#lightbox-container-image-data-box {
- font: 10px Verdana, Helvetica, sans-serif;
- background-color: #fff;
- margin: 0 auto;
- line-height: 1.4em;
- overflow: auto;
- width: 100%;
- padding: 0 10px 0;
-}
-#lightbox-container-image-data {
- padding: 0 10px;
- color: #666;
-}
-#lightbox-container-image-data #lightbox-image-details {
- width: 70%;
- float: left;
- text-align: left;
-}
-#lightbox-image-details-caption { font-weight: bold; }
-#lightbox-image-details-currentNumber {
- display: block;
- clear: left;
- padding-bottom: 1.0em;
-}
-#lightbox-secNav-btnClose {
- width: 66px;
- float: right;
- padding-bottom: 0.7em;
-}
\ No newline at end of file
diff --git a/htdocs/includes/jquery/plugins/lightbox/images/lightbox-blank.gif b/htdocs/includes/jquery/plugins/lightbox/images/lightbox-blank.gif
deleted file mode 100644
index 1d11fa9ada9..00000000000
Binary files a/htdocs/includes/jquery/plugins/lightbox/images/lightbox-blank.gif and /dev/null differ
diff --git a/htdocs/includes/jquery/plugins/lightbox/images/lightbox-btn-close.gif b/htdocs/includes/jquery/plugins/lightbox/images/lightbox-btn-close.gif
deleted file mode 100644
index 33bcf517a35..00000000000
Binary files a/htdocs/includes/jquery/plugins/lightbox/images/lightbox-btn-close.gif and /dev/null differ
diff --git a/htdocs/includes/jquery/plugins/lightbox/images/lightbox-btn-next.gif b/htdocs/includes/jquery/plugins/lightbox/images/lightbox-btn-next.gif
deleted file mode 100644
index a0d4fcf84a7..00000000000
Binary files a/htdocs/includes/jquery/plugins/lightbox/images/lightbox-btn-next.gif and /dev/null differ
diff --git a/htdocs/includes/jquery/plugins/lightbox/images/lightbox-btn-prev.gif b/htdocs/includes/jquery/plugins/lightbox/images/lightbox-btn-prev.gif
deleted file mode 100644
index 040ee5992f7..00000000000
Binary files a/htdocs/includes/jquery/plugins/lightbox/images/lightbox-btn-prev.gif and /dev/null differ
diff --git a/htdocs/includes/jquery/plugins/lightbox/images/lightbox-ico-loading.gif b/htdocs/includes/jquery/plugins/lightbox/images/lightbox-ico-loading.gif
deleted file mode 100644
index 4f1429c06cb..00000000000
Binary files a/htdocs/includes/jquery/plugins/lightbox/images/lightbox-ico-loading.gif and /dev/null differ
diff --git a/htdocs/includes/jquery/plugins/lightbox/js/jquery.lightbox-0.5.min.js b/htdocs/includes/jquery/plugins/lightbox/js/jquery.lightbox-0.5.min.js
deleted file mode 100644
index 429f0c557c8..00000000000
--- a/htdocs/includes/jquery/plugins/lightbox/js/jquery.lightbox-0.5.min.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * jQuery lightBox plugin
- * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
- * and adapted to me for use like a plugin from jQuery.
- * @name jquery-lightbox-0.5.js
- * @author Leandro Vieira Pinho - http://leandrovieira.com
- * @version 0.5
- * @date April 11, 2008
- * @category jQuery plugin
- * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
- * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
- * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
- */
-(function($){$.fn.lightBox=function(settings){settings=jQuery.extend({overlayBgColor:'#000',overlayOpacity:0.8,fixedNavigation:false,imageLoading:'images/lightbox-ico-loading.gif',imageBtnPrev:'images/lightbox-btn-prev.gif',imageBtnNext:'images/lightbox-btn-next.gif',imageBtnClose:'images/lightbox-btn-close.gif',imageBlank:'images/lightbox-blank.gif',containerBorderSize:10,containerResizeSpeed:400,txtImage:'Image',txtOf:'of',keyToClose:'c',keyToPrev:'p',keyToNext:'n',imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;}
-function _start(objClicked,jQueryMatchedObj){$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));}else{for(var i=0;i ');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});}
-function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}
-var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}}
-$('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();}
-if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}}
-function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}}
-if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}}
-_enable_keyboard_navigation();}
-function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});}
-function _disable_keyboard_navigation(){$(document).unbind();}
-function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;}
-key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();}
-if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}}
-if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}}
-function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];}
-if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}}
-function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});}
-function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
-var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
-windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
-if(yScroll35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.2N.3g=6(4){4=23.2H({2B:\'#34\',2g:0.8,1d:F,1M:\'18/5-33-Y.16\',1v:\'18/5-1u-2Q.16\',1E:\'18/5-1u-2L.16\',1W:\'18/5-1u-2I.16\',19:\'18/5-2F.16\',1f:10,2A:3d,2s:\'1j\',2o:\'32\',2j:\'c\',2f:\'p\',2d:\'n\',h:[],9:0},4);f I=N;6 20(){1X(N,I);u F}6 1X(1e,I){$(\'1U, 1S, 1R\').l({\'1Q\':\'2E\'});1O();4.h.B=0;4.9=0;7(I.B==1){4.h.1J(v 1m(1e.17(\'J\'),1e.17(\'2v\')))}j{36(f i=0;i<1w g="5-b"><1w W="\'+4.1M+\'"> <1i g="5-b-A-1t">1i><1i g="5-b-A-1g">1i> <1w W="\'+4.1W+\'"> \');f z=1D();$(\'#q-13\').l({2K:4.2B,2J:4.2g,S:z[0],P:z[1]}).1V();f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]}).E();$(\'#q-13,#q-5\').C(6(){1a()});$(\'#5-Y-29,#5-1s-22\').C(6(){1a();u F});$(G).2G(6(){f z=1D();$(\'#q-13\').l({S:z[0],P:z[1]});f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]})})}6 D(){$(\'#5-Y\').E();7(4.1d){$(\'#5-b,#5-s-b-T-w,#5-b-A-1g\').1b()}j{$(\'#5-b,#5-k,#5-k-V,#5-k-X,#5-s-b-T-w,#5-b-A-1g\').1b()}f Q=v 1j();Q.1P=6(){$(\'#5-b\').2D(\'W\',4.h[4.9][0]);1N(Q.S,Q.P);Q.1P=6(){}};Q.W=4.h[4.9][0]};6 1N(1o,1r){f 1L=$(\'#5-s-b-w\').S();f 1K=$(\'#5-s-b-w\').P();f 1n=(1o+(4.1f*2));f 1y=(1r+(4.1f*2));f 1I=1L-1n;f 2z=1K-1y;$(\'#5-s-b-w\').3f({S:1n,P:1y},4.2A,6(){2y()});7((1I==0)&&(2z==0)){7($.3e.3c){1H(3b)}j{1H(3a)}}$(\'#5-s-b-T-w\').l({S:1o});$(\'#5-k-V,#5-k-X\').l({P:1r+(4.1f*2)})};6 2y(){$(\'#5-Y\').1b();$(\'#5-b\').1V(6(){2u();2t()});2r()};6 2u(){$(\'#5-s-b-T-w\').38(\'35\');$(\'#5-b-A-1t\').1b();7(4.h[4.9][1]){$(\'#5-b-A-1t\').2p(4.h[4.9][1]).E()}7(4.h.B>1){$(\'#5-b-A-1g\').2p(4.2s+\' \'+(4.9+1)+\' \'+4.2o+\' \'+4.h.B).E()}}6 2t(){$(\'#5-k\').E();$(\'#5-k-V,#5-k-X\').l({\'K\':\'1C M(\'+4.19+\') L-O\'});7(4.9!=0){7(4.1d){$(\'#5-k-V\').l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9-1;D();u F})}j{$(\'#5-k-V\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9-1;D();u F})}}7(4.9!=(4.h.B-1)){7(4.1d){$(\'#5-k-X\').l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9+1;D();u F})}j{$(\'#5-k-X\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9+1;D();u F})}}2k()}6 2k(){$(d).30(6(12){2i(12)})}6 1G(){$(d).11()}6 2i(12){7(12==2h){U=2Z.2e;1x=27}j{U=12.2e;1x=12.2Y}14=2X.2W(U).2U();7((14==4.2j)||(14==\'x\')||(U==1x)){1a()}7((14==4.2f)||(U==37)){7(4.9!=0){4.9=4.9-1;D();1G()}}7((14==4.2d)||(U==39)){7(4.9!=(4.h.B-1)){4.9=4.9+1;D();1G()}}}6 2r(){7((4.h.B-1)>4.9){2c=v 1j();2c.W=4.h[4.9+1][0]}7(4.9>0){2b=v 1j();2b.W=4.h[4.9-1][0]}}6 1a(){$(\'#q-5\').2a();$(\'#q-13\').2T(6(){$(\'#q-13\').2a()});$(\'1U, 1S, 1R\').l({\'1Q\':\'2S\'})}6 1D(){f o,r;7(G.1h&&G.28){o=G.26+G.2R;r=G.1h+G.28}j 7(d.m.25>d.m.24){o=d.m.2P;r=d.m.25}j{o=d.m.2O;r=d.m.24}f y,H;7(Z.1h){7(d.t.1l){y=d.t.1l}j{y=Z.26}H=Z.1h}j 7(d.t&&d.t.1A){y=d.t.1l;H=d.t.1A}j 7(d.m){y=d.m.1l;H=d.m.1A}7(r '."\n"; // JQuery
print ' '."\n"; // Tooltip
print ' '."\n"; // JNotify
- //print ' '."\n"; // Lightbox
if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD)) // jQuery fileupload
{
print ' '."\n";
@@ -903,17 +902,22 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache'];
//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
print ' '."\n";
+
// CSS forced by modules (relative url starting with /)
if (isset($conf->modules_parts['css']))
{
- $dircss=(array) $conf->modules_parts['css'];
- foreach($dircss as $key => $cssfile)
+ $arraycss=(array) $conf->modules_parts['css'];
+ foreach($arraycss as $modcss => $filescss)
{
- // cssfile is a relative path
- print ' '."\n";
+ $filescss=(array) $filescss; // To be sure filecss is an array
+ foreach($filescss as $cssfile)
+ {
+ // cssfile is a relative path
+ print ' '."\n";
+ }
}
}
// CSS forced by page in top_htmlhead call (relative url starting with /)
@@ -948,7 +952,6 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
else print ''."\n";
print ''."\n";
print ''."\n";
- //print ''."\n";
// jQuery Layout
if (! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) || defined('REQUIRE_JQUERY_LAYOUT'))
{
@@ -1044,12 +1047,19 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print ''."\n";
// JS forced by modules (relative url starting with /)
- $dirjs=(array) $conf->modules_parts['js'];
- foreach($dirjs as $key => $jsfile)
- {
- // jsfile is a relative path
- print ''."\n";
- }
+ if (isset($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2'))
+ {
+ $arrayjs=(array) $conf->modules_parts['js'];
+ foreach($arrayjs as $modjs => $filesjs)
+ {
+ $filesjs=(array) $filesjs; // To be sure filejs is an array
+ foreach($filesjs as $jsfile)
+ {
+ // jsfile is a relative path
+ print ''."\n";
+ }
+ }
+ }
// JS forced by page in top_htmlhead (relative url starting with /)
if (is_array($arrayofjs))
{
diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php
index 617e477c0fd..37b48c7be00 100755
--- a/htdocs/product/canvas/product/actions_card_product.class.php
+++ b/htdocs/product/canvas/product/actions_card_product.class.php
@@ -106,7 +106,7 @@ class ActionsCardProduct
$this->tpl['description'] = nl2br($this->description);
// Statut
- $this->tpl['status'] = $this->getLibStatut(2);
+ $this->tpl['status'] = $this->object->getLibStatut(2);
// Note
$this->tpl['note'] = nl2br($this->note);
diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php
index d665e175c27..3e27cd968dc 100755
--- a/htdocs/product/canvas/service/actions_card_service.class.php
+++ b/htdocs/product/canvas/service/actions_card_service.class.php
@@ -105,7 +105,7 @@ class ActionsCardService
$this->tpl['description'] = nl2br($this->description);
// Statut
- $this->tpl['status'] = $this->getLibStatut(2);
+ $this->tpl['status'] = $this->object->getLibStatut(2);
// Note
$this->tpl['note'] = nl2br($this->note);
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index aff8a64e7fc..cc671d254d0 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -2593,23 +2593,6 @@ class Product extends CommonObject
$pdirthumb = $pdir.'thumbs/';
$return =''."\n";
- /*$return.="\n";
- */
$nbphoto=0;
$dir_osencoded=dol_osencode($dir);
@@ -2647,7 +2630,7 @@ class Product extends CommonObject
if ($nbbyrow) $return.= '';
$return.= "\n";
- $return.= '';
+ $return.= ' ';
// Show image (width height=$maxHeight)
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 2e0d8b66984..68d2ced3d7e 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -170,6 +170,7 @@ if (! empty($project_ref) && ! empty($withproject))
llxHeader("",$langs->trans("Task"));
$form = new Form($db);
+$userstatic = new User($db);
if ($id > 0 || ! empty($ref))
{
@@ -403,17 +404,17 @@ if ($id > 0 || ! empty($ref))
print ' ';
// User
- $user->id = $task_time->fk_user;
print '';
if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid)
{
- print $form->select_users($user->id,'userid_line');
+ print $form->select_users($task_time->fk_user,'userid_line');
}
else
{
- $user->nom = $task_time->name;
- $user->prenom = $task_time->firstname;
- print $user->getNomUrl(1);
+ $userstatic->id = $task_time->fk_user;
+ $userstatic->nom = $task_time->name;
+ $userstatic->prenom = $task_time->firstname;
+ print $userstatic->getNomUrl(1);
}
print ' ';