Maxi debug for UTF8 support
This commit is contained in:
parent
767185b9b6
commit
7deb33c52d
@ -69,11 +69,21 @@ if ($_GET["action"] == 'specimen')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_file($commande) > 0)
|
||||
if ($obj->write_file($commande,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$obj->error.'</div>';
|
||||
dolibarr_syslog($obj->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
|
||||
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -55,11 +55,21 @@ if ($_GET["action"] == 'specimen')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_file($don) > 0)
|
||||
if ($obj->write_file($don,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=don&file=SPECIMEN.html");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$obj->error.'</div>';
|
||||
dolibarr_syslog($obj->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
|
||||
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -78,10 +78,16 @@ if ($_GET["action"] == 'specimen')
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$obj->error.'</div>';
|
||||
dolibarr_syslog($obj->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
|
||||
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -78,10 +78,16 @@ if ($_GET["action"] == 'specimen')
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$obj->error.'</div>';
|
||||
dolibarr_syslog($obj->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
|
||||
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -21,11 +21,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/admin/fournisseur.php
|
||||
\ingroup fournisseur
|
||||
\brief Page d'administration-configuration du module Fournisseur
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/admin/fournisseur.php
|
||||
\ingroup fournisseur
|
||||
\brief Page d'administration-configuration du module Fournisseur
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
@ -38,108 +38,114 @@ $langs->load("other");
|
||||
$langs->load("orders");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if ($_POST["action"] == 'updateMask')
|
||||
{
|
||||
$maskconstorder=$_POST['maskconstorder'];
|
||||
$maskorder=$_POST['maskorder'];
|
||||
if ($maskconstorder) dolibarr_set_const($db,$maskconstorder,$maskorder);
|
||||
}
|
||||
|
||||
|
||||
if ($_GET["action"] == 'specimen')
|
||||
{
|
||||
$modele=$_GET["module"];
|
||||
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
// Charge le modele
|
||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/supplier_order/pdf/";
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
if (file_exists($dir.$file))
|
||||
{
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($dir.$file);
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_file($commande,$langs) > 0)
|
||||
$modele=$_GET["module"];
|
||||
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
// Charge le modele
|
||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/supplier_order/pdf/";
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
if (file_exists($dir.$file))
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
|
||||
return;
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($dir.$file);
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ($obj->write_file($commande,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$obj->error.'</div>';
|
||||
dolibarr_syslog($obj->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
|
||||
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'set')
|
||||
{
|
||||
$type='supplier_order';
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
|
||||
if ($db->query($sql))
|
||||
{
|
||||
|
||||
}
|
||||
$type='supplier_order';
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
|
||||
if ($db->query($sql))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'del')
|
||||
{
|
||||
$type='supplier_order';
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
|
||||
if ($db->query($sql))
|
||||
{
|
||||
|
||||
}
|
||||
$type='supplier_order';
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
|
||||
if ($db->query($sql))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'setdoc')
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$_GET["value"]))
|
||||
{
|
||||
$conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $_GET["value"];
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$type='supplier_order';
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
|
||||
$result1=$db->query($sql_del);
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
|
||||
$result2=$db->query($sql);
|
||||
if ($result1 && $result2)
|
||||
{
|
||||
if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$_GET["value"]))
|
||||
{
|
||||
$conf->global->COMMANDE_SUPPLIER_ADDON_PDF = $_GET["value"];
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$type='supplier_order';
|
||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
|
||||
$result1=$db->query($sql_del);
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
|
||||
$result2=$db->query($sql);
|
||||
if ($result1 && $result2)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'setmod')
|
||||
{
|
||||
// \todo Verifier si module numerotation choisi peut etre activ<69>
|
||||
// par appel methode canBeActivated
|
||||
// \todo Verifier si module numerotation choisi peut etre activ<69>
|
||||
// par appel methode canBeActivated
|
||||
|
||||
dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON",$_GET["value"]);
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'addcat')
|
||||
{
|
||||
$fourn = new Fournisseur($db);
|
||||
$fourn->CreateCategory($user,$_POST["cat"]);
|
||||
$fourn = new Fournisseur($db);
|
||||
$fourn->CreateCategory($user,$_POST["cat"]);
|
||||
}
|
||||
|
||||
// d<>fini les constantes du mod<6F>le orchidee
|
||||
@ -183,55 +189,55 @@ clearstatcache();
|
||||
$handle = opendir($dir);
|
||||
if ($handle)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, strlen($file)-3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, strlen($file)-4);
|
||||
$var=true;
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/supplier_order/".$file.".php");
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, strlen($file)-3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, strlen($file)-4);
|
||||
|
||||
$module = new $file;
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/supplier_order/".$file.".php");
|
||||
|
||||
$module = new $file;
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Examples
|
||||
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->COMMANDE_SUPPLIER_ADDON == "$file")
|
||||
{
|
||||
print img_tick($langs->trans("Activated"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Activate").'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$commande=new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Examples
|
||||
print '<td nowrap="nowrap">'.$module->getExample()."</td>\n";
|
||||
|
||||
print '<td align="center">';
|
||||
if ($conf->global->COMMANDE_SUPPLIER_ADDON == "$file")
|
||||
{
|
||||
print img_tick($langs->trans("Activated"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Activate").'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$commande=new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.='<b>'.$langs->trans("Version").'</b>: '.$module->getVersion().'<br>';
|
||||
$facture->type=0;
|
||||
$nextval=$module->getNextValue($mysoc,$commande);
|
||||
$nextval=$module->getNextValue($mysoc,$commande);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
|
||||
{
|
||||
$htmltooltip.='<b>'.$langs->trans("NextValue").'</b>: ';
|
||||
if ($nextval)
|
||||
if ($nextval)
|
||||
{
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
}
|
||||
@ -240,16 +246,16 @@ if ($handle)
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print $html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
print '<td align="center">';
|
||||
print $html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
@ -302,120 +308,120 @@ $handle=opendir($dir);
|
||||
$var=true;
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_')
|
||||
{
|
||||
$name = substr($file, 4, strlen($file) -16);
|
||||
$classname = substr($file, 0, strlen($file) -12);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">\n <td>$name";
|
||||
print "</td>\n <td>\n";
|
||||
require_once($dir.$file);
|
||||
$module = new $classname($db);
|
||||
print $module->description;
|
||||
print "</td>\n";
|
||||
|
||||
// Activ<69>
|
||||
if (in_array($name, $def))
|
||||
if (eregi('\.modules\.php$',$file) && substr($file,0,4) == 'pdf_')
|
||||
{
|
||||
$name = substr($file, 4, strlen($file) -16);
|
||||
$classname = substr($file, 0, strlen($file) -12);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">\n <td>$name";
|
||||
print "</td>\n <td>\n";
|
||||
require_once($dir.$file);
|
||||
$module = new $classname($db);
|
||||
print $module->description;
|
||||
print "</td>\n";
|
||||
|
||||
// Activ<69>
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name")
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
|
||||
print img_tick($langs->trans("Disable"));
|
||||
print '</a>';
|
||||
}
|
||||
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name")
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
|
||||
print img_tick($langs->trans("Disable"));
|
||||
print '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_tick($langs->trans("Enabled"));
|
||||
}
|
||||
{
|
||||
print img_tick($langs->trans("Enabled"));
|
||||
}
|
||||
print "</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'">'.$langs->trans("Activate").'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Defaut
|
||||
print "<td align=\"center\">";
|
||||
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name")
|
||||
{
|
||||
}
|
||||
|
||||
// Defaut
|
||||
print "<td align=\"center\">";
|
||||
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name")
|
||||
{
|
||||
print img_tick($langs->trans("Default"));
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur;
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$module->page_hauteur;
|
||||
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
|
||||
print '<td align="center">';
|
||||
print $html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur;
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$module->page_hauteur;
|
||||
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
|
||||
print '<td align="center">';
|
||||
print $html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
print '</table><br/>';
|
||||
|
||||
/* Obsolete. Les categories de fournisseurs sont gerees dans la table llx_categories
|
||||
sur le meme principe que les categories clients et produits
|
||||
sur le meme principe que les categories clients et produits
|
||||
|
||||
print_titre($langs->trans("Categories"));
|
||||
print_titre($langs->trans("Categories"));
|
||||
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fournisseur_categorie";
|
||||
$sql.= " ORDER BY label ASC";
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fournisseur_categorie";
|
||||
$sql.= " ORDER BY label ASC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<form action="fournisseur.php" method="POST"><table class="liste" width="100%">';
|
||||
print '<input type="hidden" name="action" value="addcat">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("Num").'</td><td>'.$langs->trans("Name");
|
||||
print "</td></tr>\n";
|
||||
$var=True;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print "<tr $bc[$var]><td> </td>";
|
||||
print '<td><input type="text" name="cat"> ';
|
||||
print '<input type="submit" value="'.$langs->trans("Add").'">';
|
||||
print "</td></tr>\n";
|
||||
print '<form action="fournisseur.php" method="POST"><table class="liste" width="100%">';
|
||||
print '<input type="hidden" name="action" value="addcat">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("Num").'</td><td>'.$langs->trans("Name");
|
||||
print "</td></tr>\n";
|
||||
$var=True;
|
||||
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>\n";
|
||||
print '<td width="10%">'.$obj->rowid.'</td>';
|
||||
print '<td width="90%"><a href="liste.php?cat='.$obj->rowid.'">'.stripslashes($obj->label).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</table></form>\n";
|
||||
print "<tr $bc[$var]><td> </td>";
|
||||
print '<td><input type="text" name="cat"> ';
|
||||
print '<input type="submit" value="'.$langs->trans("Add").'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
*/
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>\n";
|
||||
print '<td width="10%">'.$obj->rowid.'</td>';
|
||||
print '<td width="90%"><a href="liste.php?cat='.$obj->rowid.'">'.stripslashes($obj->label).'</a></td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</table></form>\n";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
*/
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
@ -70,11 +70,21 @@ if ($_GET["action"] == 'specimen')
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($propal) > 0)
|
||||
if ($module->write_file($propal,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$module->error.'</div>';
|
||||
dolibarr_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
|
||||
dolibarr_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ class CommActionRapport
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
|
||||
@ -15,15 +15,13 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/comm/pre.inc.php
|
||||
\ingroup commercial
|
||||
\brief Fichier de gestion du menu gauche de l'espace commercial
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
require("../main.inc.php");
|
||||
|
||||
|
||||
@ -22,10 +22,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/comm/propal.php
|
||||
\ingroup propale
|
||||
\brief Page liste des propales (vision commercial)
|
||||
\version $Id$
|
||||
* \file htdocs/comm/propal.php
|
||||
* \ingroup propale
|
||||
* \brief Page liste des propales (vision commercial)
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
@ -18,10 +18,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/commande/index.php
|
||||
\ingroup commande
|
||||
\brief Page acceuil espace commandes
|
||||
\version $Id$
|
||||
* \file htdocs/commande/index.php
|
||||
* \ingroup commande
|
||||
* \brief Page acceuil espace commandes
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
@ -42,6 +42,11 @@ if ($user->societe_id > 0)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$commandestatic=new Commande($db);
|
||||
$html = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
@ -18,11 +18,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/paiement/cheque/fiche.php
|
||||
\ingroup facture
|
||||
\brief Onglet paiement cheque
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/compta/paiement/cheque/fiche.php
|
||||
\ingroup facture
|
||||
\brief Onglet paiement cheque
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require('./pre.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
||||
@ -55,82 +55,82 @@ $offset = $limit * $page ;
|
||||
*/
|
||||
|
||||
if ($_GET['action'] == 'create' && $_GET["accountid"] > 0 && $user->rights->banque->cheque)
|
||||
{
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
$result = $remisecheque->Create($user, $_GET["accountid"]);
|
||||
if ($result > 0)
|
||||
{
|
||||
Header("Location: fiche.php?id=".$remisecheque->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$remisecheque->error.'</div>';
|
||||
}
|
||||
{
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
$result = $remisecheque->Create($user, $_GET["accountid"]);
|
||||
if ($result > 0)
|
||||
{
|
||||
Header("Location: fiche.php?id=".$remisecheque->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$remisecheque->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET['action'] == 'remove' && $_GET["id"] > 0 && $_GET["lineid"] > 0 && $user->rights->banque)
|
||||
{
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
$remisecheque->id = $_GET["id"];
|
||||
$result = $remisecheque->RemoveCheck($_GET["lineid"]);
|
||||
if ($result === 0)
|
||||
{
|
||||
Header("Location: fiche.php?id=".$remisecheque->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
||||
}
|
||||
{
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
$remisecheque->id = $_GET["id"];
|
||||
$result = $remisecheque->RemoveCheck($_GET["lineid"]);
|
||||
if ($result === 0)
|
||||
{
|
||||
Header("Location: fiche.php?id=".$remisecheque->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->banque)
|
||||
{
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
$remisecheque->id = $_GET["id"];
|
||||
$result = $remisecheque->Delete();
|
||||
if ($result == 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
||||
}
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
$remisecheque->id = $_GET["id"];
|
||||
$result = $remisecheque->Delete();
|
||||
if ($result == 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->banque)
|
||||
{
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
$remisecheque->Fetch($_GET["id"]);
|
||||
$result = $remisecheque->Validate($user);
|
||||
if ($result == 0)
|
||||
{
|
||||
Header("Location: fiche.php?id=".$remisecheque->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
||||
}
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
$remisecheque->Fetch($_GET["id"]);
|
||||
$result = $remisecheque->Validate($user);
|
||||
if ($result == 0)
|
||||
{
|
||||
Header("Location: fiche.php?id=".$remisecheque->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST['action'] == 'builddoc' && $user->rights->banque)
|
||||
{
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
$result = $remisecheque->Fetch($_GET["id"]);
|
||||
if ($result == 0)
|
||||
{
|
||||
$result = $remisecheque->GeneratePdf($_POST["model"]);
|
||||
Header("Location: fiche.php?id=".$remisecheque->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
||||
}
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
$result = $remisecheque->Fetch($_GET["id"]);
|
||||
if ($result == 0)
|
||||
{
|
||||
$result = $remisecheque->GeneratePdf($_POST["model"], $langs);
|
||||
Header("Location: fiche.php?id=".$remisecheque->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -145,13 +145,13 @@ $formfile = new FormFile($db);
|
||||
|
||||
if ($_GET['action'] == 'new')
|
||||
{
|
||||
$h=0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/cheque/fiche.php?action=new';
|
||||
$head[$h][1] = $langs->trans("MenuChequeDeposits");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
$h=0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/cheque/fiche.php?action=new';
|
||||
$head[$h][1] = $langs->trans("MenuChequeDeposits");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Cheques"));
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Cheques"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -165,8 +165,8 @@ else
|
||||
$result = $remisecheque->Fetch('',$_GET["ref"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$h=0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/cheque/fiche.php?id='.$remisecheque->id;
|
||||
$head[$h][1] = $langs->trans("CheckReceipt");
|
||||
@ -174,13 +174,13 @@ else
|
||||
$h++;
|
||||
// $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/cheque/info.php?id='.$remisecheque->id;
|
||||
// $head[$h][1] = $langs->trans("Info");
|
||||
// $h++;
|
||||
// $h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Cheques"));
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression du bordereau
|
||||
*/
|
||||
* Confirmation de la suppression du bordereau
|
||||
*/
|
||||
if ($_GET['action'] == 'delete')
|
||||
{
|
||||
$html->form_confirm('fiche.php?id='.$remisecheque->id, $langs->trans("DeleteCheckReceipt"), 'Etes-vous sûr de vouloir supprimer ce bordereau ?', 'confirm_delete');
|
||||
@ -188,8 +188,8 @@ else
|
||||
}
|
||||
|
||||
/*
|
||||
* Confirmation de la validation du bordereau
|
||||
*/
|
||||
* Confirmation de la validation du bordereau
|
||||
*/
|
||||
if ($_GET['action'] == 'valide')
|
||||
{
|
||||
$facid = $_GET['facid'];
|
||||
@ -205,13 +205,13 @@ if ($_GET['action'] == 'new')
|
||||
{
|
||||
$accounts = array();
|
||||
$lines = array();
|
||||
|
||||
|
||||
$now=time();
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="30%">'.$langs->trans('Date').'</td><td width="70%">'.dolibarr_print_date($now,'day').'</td></tr>';
|
||||
print '</table><br />';
|
||||
|
||||
|
||||
$sql = "SELECT ba.rowid as bid, ".$db->pdate("b.dateo")." as date,";
|
||||
$sql.= " b.amount, ba.label, b.emetteur, b.num_chq, b.banque";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b ";
|
||||
@ -219,7 +219,7 @@ if ($_GET['action'] == 'new')
|
||||
$sql.= " WHERE b.fk_type = 'CHQ' AND b.fk_account = ba.rowid";
|
||||
$sql.= " AND b.fk_bordereau = 0 AND b.amount > 0";
|
||||
$sql.= " ORDER BY b.emetteur ASC, b.rowid ASC";
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -237,10 +237,10 @@ if ($_GET['action'] == 'new')
|
||||
|
||||
if ($i == 0)
|
||||
{
|
||||
print $langs->trans("NoWaitingChecks").'<br>';
|
||||
print $langs->trans("NoWaitingChecks").'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($accounts as $bid => $account_label)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
@ -253,16 +253,16 @@ if ($_GET['action'] == 'new')
|
||||
print '<td>'.$langs->trans("Bank")."</td>\n";
|
||||
print '<td align="right">'.$langs->trans("Amount")."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$var=true;
|
||||
|
||||
|
||||
foreach ($lines[$bid] as $lid => $value)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
|
||||
$account_id = $objp->bid;
|
||||
$accounts[$objp->bid] += 1;
|
||||
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="120">'.dolibarr_print_date($value["date"],'day').'</td>';
|
||||
print '<td>'.$value["numero"]."</td>\n";
|
||||
@ -273,7 +273,7 @@ if ($_GET['action'] == 'new')
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
if ($user->rights->banque->cheque)
|
||||
{
|
||||
@ -292,13 +292,13 @@ else
|
||||
$paymentstatic=new Paiement($db);
|
||||
$accountlinestatic=new AccountLine($db);
|
||||
$accountstatic=new Account($db);
|
||||
|
||||
|
||||
$accountstatic->id=$remisecheque->account_id;
|
||||
$accountstatic->label=$remisecheque->account_label;
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="2" >';
|
||||
|
||||
|
||||
print $html->showrefnav($remisecheque,'ref','', 1, 'number');
|
||||
|
||||
print "</td>";
|
||||
@ -310,7 +310,7 @@ else
|
||||
print $accountstatic->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Nb of cheques
|
||||
// Nb of cheques
|
||||
print '<tr><td>'.$langs->trans('NbOfCheques').'</td><td colspan="2">';
|
||||
print $remisecheque->nbcheque;
|
||||
print '</td></tr>';
|
||||
@ -321,7 +321,7 @@ else
|
||||
|
||||
print '</table><br />';
|
||||
|
||||
|
||||
|
||||
// Liste des cheques
|
||||
$sql = "SELECT b.rowid, b.amount, b.num_chq, b.emetteur,";
|
||||
$sql.= " ".$db->pdate("b.dateo")." as date,".$db->pdate("b.datec")." as datec, b.banque,";
|
||||
@ -400,12 +400,12 @@ print '</div>';
|
||||
|
||||
if ($_GET['action'] != 'new')
|
||||
{
|
||||
if ($remisecheque->statut == 1)
|
||||
{
|
||||
$dir = DOL_DATA_ROOT.'/compta/bordereau/'.get_exdir($remisecheque->number);
|
||||
$gen = array('Blochet');
|
||||
$formfile->show_documents("remisecheque","",$dir,'',$gen,0);
|
||||
}
|
||||
if ($remisecheque->statut == 1)
|
||||
{
|
||||
$dir = DOL_DATA_ROOT.'/compta/bordereau/'.get_exdir($remisecheque->number);
|
||||
$gen = array('Blochet');
|
||||
$formfile->show_documents("remisecheque","",$dir,'',$gen,0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -416,18 +416,18 @@ print '<div class="tabsAction">';
|
||||
|
||||
if ($user->societe_id == 0 && sizeof($accounts) == 1 && $_GET['action'] == 'new')
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?action=create&accountid='.$account_id.'">'.$langs->trans('NewCheckReceipt').'</a>';
|
||||
print '<a class="butAction" href="fiche.php?action=create&accountid='.$account_id.'">'.$langs->trans('NewCheckReceipt').'</a>';
|
||||
}
|
||||
|
||||
if ($user->societe_id == 0 && $remisecheque->statut == 0 && $_GET['action'] == '')
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$_GET['id'].'&facid='.$objp->facid.'&action=valide">'.$langs->trans('Valid').'</a>';
|
||||
print '<a class="butAction" href="fiche.php?id='.$_GET['id'].'&facid='.$objp->facid.'&action=valide">'.$langs->trans('Valid').'</a>';
|
||||
}
|
||||
|
||||
if ($user->societe_id == 0 && $remisecheque->statut == 0 && $_GET['action'] == '')
|
||||
{
|
||||
print '<a class="butActionDelete" href="fiche.php?id='.$_GET['id'].'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
|
||||
print '<a class="butActionDelete" href="fiche.php?id='.$_GET['id'].'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
Liste des termes a employer
|
||||
|
||||
http://fr.wikipedia.org/wiki/Charpente
|
||||
|
||||
dans la section termes utilisés :
|
||||
|
||||
Utilisé
|
||||
=======
|
||||
Blochet
|
||||
|
||||
Libre :
|
||||
=======
|
||||
Aisselier
|
||||
Arbalétrier ou poutre
|
||||
Arêtier
|
||||
|
||||
Chevêtre
|
||||
Chevron
|
||||
Chevron ou faux comble
|
||||
Comble
|
||||
Comble à surcroît
|
||||
Comble brisé dit à la Mansart
|
||||
Contrefiche
|
||||
Coyer
|
||||
Coyau
|
||||
Dé
|
||||
Échantignole
|
||||
Enrayure
|
||||
Entrait moisé
|
||||
Entrait ou Tirant
|
||||
Entrait retroussé ou faux entrait
|
||||
Faîtage
|
||||
Faîte
|
||||
Faux-entrait
|
||||
Ferme
|
||||
Ferme à une pente ou appentis
|
||||
Gousset
|
||||
Hourdis
|
||||
Jambe de force
|
||||
Jambe de force moisée
|
||||
Jambette
|
||||
Lien de faîtage
|
||||
Lierne ou sous faîte
|
||||
Linçoir
|
||||
Moise
|
||||
Noue
|
||||
Panne
|
||||
Panne faîtière
|
||||
Pignon
|
||||
Poinçon
|
||||
Portée
|
||||
Poutre
|
||||
Sablière
|
||||
Solive
|
||||
Solive boiteuse
|
||||
Solive d'enchevêtrure
|
||||
Sous faîte
|
||||
Trémie
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -15,31 +15,28 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/paiement/cheque/remisecheque.class.php
|
||||
\ingroup compta
|
||||
\brief Fichier de la classe des bordereau de remise de cheque
|
||||
\version $Revision$
|
||||
*/
|
||||
* \file htdocs/compta/paiement/cheque/remisecheque.class.php
|
||||
* \ingroup compta
|
||||
* \brief Fichier de la classe des bordereau de remise de cheque
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
|
||||
|
||||
|
||||
/**
|
||||
\class RemiseCheque
|
||||
\brief Classe permettant la gestion des remises de cheque
|
||||
*/
|
||||
|
||||
* \class RemiseCheque
|
||||
* \brief Classe permettant la gestion des remises de cheque
|
||||
*/
|
||||
class RemiseCheque extends CommonObject
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
var $element='chequereceipt';
|
||||
var $table_element='bordereau_cheque';
|
||||
var $element='chequereceipt';
|
||||
var $table_element='bordereau_cheque';
|
||||
|
||||
var $id;
|
||||
var $num;
|
||||
@ -48,23 +45,22 @@ class RemiseCheque extends CommonObject
|
||||
var $errno;
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB handler accès base de données
|
||||
* \param id id compte (0 par defaut)
|
||||
*/
|
||||
function RemiseCheque($DB,$langs='')
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->langs = $langs;
|
||||
$this->next_id = 0;
|
||||
$this->previous_id = 0;
|
||||
}
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB handler accès base de données
|
||||
* \param id id compte (0 par defaut)
|
||||
*/
|
||||
function RemiseCheque($DB)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->next_id = 0;
|
||||
$this->previous_id = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Load record
|
||||
\param id Id record
|
||||
\param ref Ref record
|
||||
*/
|
||||
*/
|
||||
function Fetch($id,$ref='')
|
||||
{
|
||||
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author,bc.fk_bank_account,bc.amount,bc.number,bc.statut,bc.nbcheque";
|
||||
@ -116,7 +112,7 @@ class RemiseCheque extends CommonObject
|
||||
\param user Utilisateur qui effectue l'operation
|
||||
\param account_id Compte bancaire concerne
|
||||
\return int <0 if KO, >0 if OK
|
||||
*/
|
||||
*/
|
||||
function Create($user, $account_id)
|
||||
{
|
||||
$this->errno = 0;
|
||||
@ -126,7 +122,7 @@ class RemiseCheque extends CommonObject
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bordereau_cheque (datec, date_bordereau, fk_user_author, fk_bank_account, amount, number, nbcheque)";
|
||||
$sql.= " VALUES (".$this->db->idate(mktime()).",".$this->db->idate(mktime()).",".$user->id.",".$account_id.",0,0,0)";
|
||||
|
||||
|
||||
dolibarr_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
@ -143,14 +139,14 @@ class RemiseCheque extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET number='(PROV".$this->id.")'";
|
||||
$sql.= " WHERE rowid='".$this->id."';";
|
||||
|
||||
|
||||
dolibarr_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
{
|
||||
$this->errno = -1025;
|
||||
dolibarr_syslog("RemiseCheque::Create ERREUR UPDATE ($this->errno)", LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->id > 0 && $this->errno == 0)
|
||||
@ -186,11 +182,11 @@ class RemiseCheque extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " SET fk_bordereau = ".$this->id;
|
||||
$sql.= " WHERE rowid = ".$lineid;
|
||||
|
||||
|
||||
dolibarr_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
{
|
||||
$this->errno = -18;
|
||||
dolibarr_syslog("RemiseCheque::Create Error update bank ($this->errno)", LOG_ERR);
|
||||
}
|
||||
@ -200,7 +196,7 @@ class RemiseCheque extends CommonObject
|
||||
if ($this->id > 0 && $this->errno == 0)
|
||||
{
|
||||
if ($this->UpdateAmount() <> 0)
|
||||
{
|
||||
{
|
||||
$this->errno = -1027;
|
||||
dolibarr_syslog("RemiseCheque::Create ERREUR ($this->errno)");
|
||||
}
|
||||
@ -212,7 +208,7 @@ class RemiseCheque extends CommonObject
|
||||
$this->error=$this->db->lasterror();
|
||||
dolibarr_syslog("RemiseCheque::Create Erreur $result INSERT Mysql");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($this->errno == 0)
|
||||
{
|
||||
@ -225,346 +221,360 @@ class RemiseCheque extends CommonObject
|
||||
dolibarr_syslog("RemiseCheque::Create ROLLBACK ($this->errno)");
|
||||
return $this->errno;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Supprime la remise en base
|
||||
\param user utilisateur qui effectue l'operation
|
||||
*/
|
||||
function Delete($user='')
|
||||
{
|
||||
$this->errno = 0;
|
||||
$this->db->begin();
|
||||
/**
|
||||
\brief Supprime la remise en base
|
||||
\param user utilisateur qui effectue l'operation
|
||||
*/
|
||||
function Delete($user='')
|
||||
{
|
||||
$this->errno = 0;
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql .= " WHERE rowid = $this->id;";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $this->db->affected_rows($resql);
|
||||
|
||||
if ($num <> 1)
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql .= " WHERE rowid = $this->id;";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $this->db->affected_rows($resql);
|
||||
|
||||
if ($num <> 1)
|
||||
{
|
||||
$this->errno = -2;
|
||||
dolibarr_syslog("Remisecheque::Delete Erreur Lecture ID ($this->errno)");
|
||||
$this->errno = -2;
|
||||
dolibarr_syslog("Remisecheque::Delete Erreur Lecture ID ($this->errno)");
|
||||
}
|
||||
|
||||
if ( $this->errno === 0)
|
||||
if ( $this->errno === 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " SET fk_bordereau=0";
|
||||
$sql.= " WHERE fk_bordereau='".$this->id."';";
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errno = -1028;
|
||||
dolibarr_syslog("RemiseCheque::Delete ERREUR UPDATE ($this->errno)");
|
||||
}
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " SET fk_bordereau=0";
|
||||
$sql.= " WHERE fk_bordereau='".$this->id."';";
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errno = -1028;
|
||||
dolibarr_syslog("RemiseCheque::Delete ERREUR UPDATE ($this->errno)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->errno === 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("RemiseCheque::Delete ROLLBACK ($this->errno)");
|
||||
}
|
||||
|
||||
return $this->errno;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Validate receipt
|
||||
* \param user User
|
||||
*/
|
||||
function Validate($user)
|
||||
{
|
||||
$this->errno = 0;
|
||||
$this->db->begin();
|
||||
if ($this->errno === 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("RemiseCheque::Delete ROLLBACK ($this->errno)");
|
||||
}
|
||||
|
||||
$num=$this->getNextNumber();
|
||||
|
||||
if ($this->errno === 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET statut=1, number='".$num."'";
|
||||
$sql .= " WHERE rowid = $this->id AND statut=0;";
|
||||
return $this->errno;
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $this->db->affected_rows($resql);
|
||||
/**
|
||||
* \brief Validate receipt
|
||||
* \param user User
|
||||
*/
|
||||
function Validate($user)
|
||||
{
|
||||
$this->errno = 0;
|
||||
$this->db->begin();
|
||||
|
||||
if ($num == 1)
|
||||
{
|
||||
$this->statut = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errno = -1029;
|
||||
dolibarr_syslog("Remisecheque::Validate Erreur UPDATE ($this->errno)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errno = -1033;
|
||||
dolibarr_syslog("Remisecheque::Validate Erreur UPDATE ($this->errno)");
|
||||
}
|
||||
}
|
||||
$num=$this->getNextNumber();
|
||||
|
||||
if ($this->errno === 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET statut=1, number='".$num."'";
|
||||
$sql .= " WHERE rowid = $this->id AND statut=0;";
|
||||
|
||||
if ($this->errno === 0)
|
||||
{
|
||||
$this->GeneratePdf();
|
||||
}
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
$num = $this->db->affected_rows($resql);
|
||||
|
||||
if ($this->errno === 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("RemiseCheque::Validate ".$this->errno, LOG_ERR);
|
||||
}
|
||||
if ($num == 1)
|
||||
{
|
||||
$this->statut = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errno = -1029;
|
||||
dolibarr_syslog("Remisecheque::Validate Erreur UPDATE ($this->errno)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errno = -1033;
|
||||
dolibarr_syslog("Remisecheque::Validate Erreur UPDATE ($this->errno)");
|
||||
}
|
||||
}
|
||||
|
||||
return $this->errno;
|
||||
}
|
||||
if ($this->errno === 0)
|
||||
{
|
||||
$this->GeneratePdf();
|
||||
}
|
||||
|
||||
if ($this->errno === 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("RemiseCheque::Validate ".$this->errno, LOG_ERR);
|
||||
}
|
||||
|
||||
return $this->errno;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Old module for cheque receipt numbering
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getNextNumber()
|
||||
{
|
||||
$num=0;
|
||||
|
||||
// We use +0 to convert varchar to number
|
||||
$sql = "SELECT MAX(number+0) FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$num = $row[0];
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errno = -1034;
|
||||
dolibarr_syslog("Remisecheque::Validate Erreur SELECT ($this->errno)");
|
||||
}
|
||||
|
||||
$num++;
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge indicateurs this->nbtodo et this->nbtodolate de tableau de bord
|
||||
* \param user Objet user
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function load_board($user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
|
||||
/**
|
||||
* Old module for cheque receipt numbering
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getNextNumber()
|
||||
{
|
||||
$num=0;
|
||||
|
||||
$this->nbtodo=$this->nbtodolate=0;
|
||||
// We use +0 to convert varchar to number
|
||||
$sql = "SELECT MAX(number+0) FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$num = $row[0];
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errno = -1034;
|
||||
dolibarr_syslog("Remisecheque::Validate Erreur SELECT ($this->errno)");
|
||||
}
|
||||
|
||||
$num++;
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge indicateurs this->nbtodo et this->nbtodolate de tableau de bord
|
||||
* \param user Objet user
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function load_board($user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
|
||||
|
||||
$this->nbtodo=$this->nbtodolate=0;
|
||||
$sql = "SELECT b.rowid,".$this->db->pdate("b.datev")." as datefin";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= " WHERE b.fk_type = 'CHQ' AND b.fk_bordereau = 0";
|
||||
$sql.= " AND b.amount > 0";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$this->nbtodo++;
|
||||
if ($obj->datefin < (time() - $conf->bank->cheque->warning_delay)) $this->nbtodolate++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Génère le fichier PDF
|
||||
\param model Nom du modele
|
||||
\return int <0 si KO, 0 si OK
|
||||
\TODO Finir la gestion multi modèle
|
||||
*/
|
||||
function GeneratePdf($model='Blochet')
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT ."/compta/bank/account.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/compta/paiement/cheque/pdf/pdf_blochet.class.php");
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$this->nbtodo++;
|
||||
if ($obj->datefin < (time() - $conf->bank->cheque->warning_delay)) $this->nbtodolate++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->Fetch($this->id);
|
||||
|
||||
$pdf = new BordereauChequeBlochet($db);
|
||||
/**
|
||||
* \brief Génère le fichier PDF
|
||||
* \param model Nom du modele
|
||||
* \return int <0 si KO, 0 si OK
|
||||
*/
|
||||
function GeneratePdf($model='blochet', $outputlangs)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT ."/compta/bank/account.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/cheque/pdf/pdf_".$model.".class.php");
|
||||
|
||||
$sql = "SELECT b.banque, b.emetteur, b.amount, b.num_chq ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba ";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."bordereau_cheque as bc";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid AND b.fk_bordereau = bc.rowid";
|
||||
$sql.= " AND bc.rowid = ".$this->id;
|
||||
$sql.= " ORDER BY b.emetteur ASC, b.rowid ASC;";
|
||||
$result = $this->Fetch($this->id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$i = 0;
|
||||
while ( $objp = $this->db->fetch_object($result) )
|
||||
{
|
||||
$pdf->lines[$i]->bank_chq = $objp->banque;
|
||||
$pdf->lines[$i]->emetteur_chq = $objp->emetteur;
|
||||
$pdf->lines[$i]->amount_chq = $objp->amount;
|
||||
$pdf->lines[$i]->num_chq = $objp->num_chq;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$pdf->nbcheque = $this->nbcheque;
|
||||
$pdf->number = $this->number;
|
||||
$pdf->amount = $this->amount;
|
||||
$pdf->date = $this->date_bordereau;
|
||||
$class='BordereauCheque'.ucfirst($model);
|
||||
$pdf = new $class($db);
|
||||
|
||||
$account = new Account($this->db);
|
||||
$account->fetch($this->account_id);
|
||||
$sql = "SELECT b.banque, b.emetteur, b.amount, b.num_chq ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba ";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."bordereau_cheque as bc";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid AND b.fk_bordereau = bc.rowid";
|
||||
$sql.= " AND bc.rowid = ".$this->id;
|
||||
$sql.= " ORDER BY b.emetteur ASC, b.rowid ASC;";
|
||||
|
||||
$pdf->account = &$account;
|
||||
|
||||
$pdf->write_file(DOL_DATA_ROOT.'/compta/bordereau', $this->number );
|
||||
}
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
/**
|
||||
\brief Mets a jour le montant total
|
||||
\return int, 0 en cas de succes
|
||||
*/
|
||||
function UpdateAmount()
|
||||
{
|
||||
$this->errno = 0;
|
||||
$this->db->begin();
|
||||
$total = 0;
|
||||
$nb = 0;
|
||||
$sql = "SELECT amount ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE fk_bordereau = $this->id;";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
while ( $row = $this->db->fetch_row($resql) )
|
||||
if ($result)
|
||||
{
|
||||
$i = 0;
|
||||
while ( $objp = $this->db->fetch_object($result) )
|
||||
{
|
||||
$pdf->lines[$i]->bank_chq = $objp->banque;
|
||||
$pdf->lines[$i]->emetteur_chq = $objp->emetteur;
|
||||
$pdf->lines[$i]->amount_chq = $objp->amount;
|
||||
$pdf->lines[$i]->num_chq = $objp->num_chq;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$pdf->nbcheque = $this->nbcheque;
|
||||
$pdf->number = $this->number;
|
||||
$pdf->amount = $this->amount;
|
||||
$pdf->date = $this->date_bordereau;
|
||||
|
||||
$account = new Account($this->db);
|
||||
$account->fetch($this->account_id);
|
||||
|
||||
$pdf->account = &$account;
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($pdf->write_file(DOL_DATA_ROOT.'/compta/bordereau', $this->number, $outputlangs) > 0)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dolibarr_syslog("Error");
|
||||
dolibarr_print_error($db,$pdf->pdferror());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Mets a jour le montant total
|
||||
\return int, 0 en cas de succes
|
||||
*/
|
||||
function UpdateAmount()
|
||||
{
|
||||
$this->errno = 0;
|
||||
$this->db->begin();
|
||||
$total = 0;
|
||||
$nb = 0;
|
||||
$sql = "SELECT amount ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE fk_bordereau = $this->id;";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
while ( $row = $this->db->fetch_row($resql) )
|
||||
{
|
||||
$total += $row[0];
|
||||
$nb++;
|
||||
$total += $row[0];
|
||||
$nb++;
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET amount='".price2num($total)."'";
|
||||
$sql.= " ,nbcheque=".$nb;
|
||||
$sql.= " WHERE rowid='".$this->id."';";
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errno = -1030;
|
||||
dolibarr_syslog("RemiseCheque::UpdateAmount ERREUR UPDATE ($this->errno)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errno = -1031;
|
||||
dolibarr_syslog("RemiseCheque::UpdateAmount ERREUR SELECT ($this->errno)");
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($this->errno === 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("RemiseCheque::UpdateAmount ROLLBACK ($this->errno)");
|
||||
}
|
||||
|
||||
return $this->errno;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Insère la remise en base
|
||||
\param user utilisateur qui effectue l'operation
|
||||
\param account_id Compte bancaire concerne
|
||||
*/
|
||||
function RemoveCheck($account_id)
|
||||
{
|
||||
$this->errno = 0;
|
||||
|
||||
if ($this->id > 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " SET fk_bordereau = 0 ";
|
||||
$sql.= " WHERE rowid = '".$account_id."' AND fk_bordereau='".$this->id."';";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET amount='".price2num($total)."'";
|
||||
$sql.= " ,nbcheque=".$nb;
|
||||
$sql.= " WHERE rowid='".$this->id."';";
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->UpdateAmount();
|
||||
$this->errno = -1030;
|
||||
dolibarr_syslog("RemiseCheque::UpdateAmount ERREUR UPDATE ($this->errno)");
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errno = -1031;
|
||||
dolibarr_syslog("RemiseCheque::UpdateAmount ERREUR SELECT ($this->errno)");
|
||||
}
|
||||
|
||||
if ($this->errno === 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("RemiseCheque::UpdateAmount ROLLBACK ($this->errno)");
|
||||
}
|
||||
|
||||
return $this->errno;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Insère la remise en base
|
||||
\param user utilisateur qui effectue l'operation
|
||||
\param account_id Compte bancaire concerne
|
||||
*/
|
||||
function RemoveCheck($account_id)
|
||||
{
|
||||
$this->errno = 0;
|
||||
|
||||
if ($this->id > 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " SET fk_bordereau = 0 ";
|
||||
$sql.= " WHERE rowid = '".$account_id."' AND fk_bordereau='".$this->id."';";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->errno = -1032;
|
||||
dolibarr_syslog("RemiseCheque::RemoveCheck ERREUR UPDATE ($this->errno)");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
\brief Charge les propriétés ref_previous et ref_next
|
||||
\return int <0 si ko, 0 si ok
|
||||
*/
|
||||
function load_previous_next_id()
|
||||
{
|
||||
$this->errno = 0;
|
||||
$this->UpdateAmount();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errno = -1032;
|
||||
dolibarr_syslog("RemiseCheque::RemoveCheck ERREUR UPDATE ($this->errno)");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
\brief Charge les propriétés ref_previous et ref_next
|
||||
\return int <0 si ko, 0 si ok
|
||||
*/
|
||||
function load_previous_next_id()
|
||||
{
|
||||
$this->errno = 0;
|
||||
|
||||
$sql = "SELECT MAX(rowid)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " WHERE rowid < '".$this->id."'";
|
||||
$sql = "SELECT MAX(rowid)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " WHERE rowid < '".$this->id."'";
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
if (! $result)
|
||||
{
|
||||
$this->errno = -1035;
|
||||
}
|
||||
$row = $this->db->fetch_row($result);
|
||||
$this->previous_id = $row[0];
|
||||
|
||||
$sql = "SELECT MIN(rowid)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " WHERE rowid > '".$this->id."'";
|
||||
$result = $this->db->query($sql) ;
|
||||
if (! $result)
|
||||
{
|
||||
$this->errno = -1035;
|
||||
}
|
||||
$row = $this->db->fetch_row($result);
|
||||
$this->next_id = $row[0];
|
||||
|
||||
return $this->errno;
|
||||
}
|
||||
$result = $this->db->query($sql) ;
|
||||
if (! $result)
|
||||
{
|
||||
$this->errno = -1035;
|
||||
}
|
||||
$row = $this->db->fetch_row($result);
|
||||
$this->previous_id = $row[0];
|
||||
|
||||
$sql = "SELECT MIN(rowid)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " WHERE rowid > '".$this->id."'";
|
||||
$result = $this->db->query($sql) ;
|
||||
if (! $result)
|
||||
{
|
||||
$this->errno = -1035;
|
||||
}
|
||||
$row = $this->db->fetch_row($result);
|
||||
$this->next_id = $row[0];
|
||||
|
||||
return $this->errno;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -576,7 +586,7 @@ class RemiseCheque extends CommonObject
|
||||
function getNomUrl($withpicto=0,$option='')
|
||||
{
|
||||
global $langs; // TODO Renvoyer le libellé anglais et faire traduction a affichage
|
||||
|
||||
|
||||
$result='';
|
||||
|
||||
$number=$this->number;
|
||||
@ -591,21 +601,21 @@ class RemiseCheque extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Retourne le libellé du statut d'une facture (brouillon, validée, abandonnée, payée)
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||
* \return string Libelle
|
||||
*/
|
||||
* \brief Retourne le libellé du statut d'une facture (brouillon, validée, abandonnée, payée)
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||
* \return string Libelle
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return $this->LibStatut($this->statut,$mode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoi le libellé d'un statut donne
|
||||
* \param status Statut
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||
* \return string Libellé du statut
|
||||
*/
|
||||
* \brief Renvoi le libellé d'un statut donne
|
||||
* \param status Statut
|
||||
* \param mode 0=libellé long, 1=libellé court, 2=Picto + Libellé court, 3=Picto, 4=Picto + Libellé long, 5=Libellé court + Picto
|
||||
* \return string Libellé du statut
|
||||
*/
|
||||
function LibStatut($status,$mode=0)
|
||||
{
|
||||
global $langs; // TODO Renvoyer le libellé anglais et faire traduction a affichage
|
||||
@ -642,6 +652,6 @@ class RemiseCheque extends CommonObject
|
||||
}
|
||||
return $langs->trans('Unknown');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
@ -18,29 +18,29 @@
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\file htdocs/compta/paiement/rapport.php
|
||||
\ingroup facture
|
||||
\brief Rapports de paiements
|
||||
\version $Revision$
|
||||
*/
|
||||
\file htdocs/compta/paiement/rapport.php
|
||||
\ingroup facture
|
||||
\brief Rapports de paiements
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/rapport/pdf_paiement.class.php");
|
||||
|
||||
// Sécurité accés
|
||||
if (! $user->rights->facture->lire)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
$dir = $conf->compta->dir_output.'/payments';
|
||||
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0)
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
$dir = DOL_DATA_ROOT.'/private/'.$user->id.'/compta';
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
$dir = DOL_DATA_ROOT.'/private/'.$user->id.'/compta';
|
||||
}
|
||||
|
||||
$year = $_GET["year"];
|
||||
@ -51,12 +51,27 @@ if (! $year) { $year=date("Y"); }
|
||||
*/
|
||||
if ($_POST["action"] == 'gen')
|
||||
{
|
||||
$rap = new pdf_paiement($db);
|
||||
$rap->write_file($dir, $_POST["remonth"], $_POST["reyear"]);
|
||||
|
||||
$year = $_POST["reyear"];
|
||||
$rap = new pdf_paiement($db);
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($rap->write_file($dir, $_POST["remonth"], $_POST["reyear"], $outputlangs) > 0)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dolibarr_syslog("Erreur dans commande_pdf_create");
|
||||
dolibarr_print_error($db,$obj->pdferror());
|
||||
}
|
||||
|
||||
$year = $_POST["reyear"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
/*
|
||||
@ -71,32 +86,32 @@ print '<br><form method="post" action="rapport.php?year='.$year.'">';
|
||||
print '<input type="hidden" name="action" value="gen">';
|
||||
$cmonth = date("n", time());
|
||||
$syear = date("Y", time());
|
||||
|
||||
|
||||
print '<select name="remonth">';
|
||||
for ($month = 1 ; $month < 13 ; $month++)
|
||||
{
|
||||
if ($month == $cmonth)
|
||||
{
|
||||
print "<option value=\"$month\" selected=\"true\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B");
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<option value=\"$month\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B");
|
||||
}
|
||||
if ($month == $cmonth)
|
||||
{
|
||||
print "<option value=\"$month\" selected=\"true\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B");
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<option value=\"$month\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B");
|
||||
}
|
||||
}
|
||||
print "</select>";
|
||||
print '<select name="reyear">';
|
||||
|
||||
for ($formyear = $syear - 2; $formyear < $syear +1 ; $formyear++)
|
||||
{
|
||||
if ($formyear == $syear)
|
||||
{
|
||||
print "<option value=\"$formyear\" selected=\"true\">".$formyear."</option>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<option value=\"$formyear\">".$formyear."</option>";
|
||||
}
|
||||
if ($formyear == $syear)
|
||||
{
|
||||
print "<option value=\"$formyear\" selected=\"true\">".$formyear."</option>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<option value=\"$formyear\">".$formyear."</option>";
|
||||
}
|
||||
}
|
||||
print "</select>\n";
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
|
||||
@ -109,46 +124,46 @@ clearstatcache();
|
||||
$found=0;
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (is_dir($dir.'/'.$file) && ! eregi('^\.',$file))
|
||||
$handle=opendir($dir);
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (is_dir($dir.'/'.$file) && ! eregi('^\.',$file))
|
||||
{
|
||||
$found=1;
|
||||
print '<a href="rapport.php?year='.$file.'">'.$file.'</a> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($year)
|
||||
{
|
||||
if (is_dir($dir.'/'.$year))
|
||||
{
|
||||
$handle=opendir($dir.'/'.$year);
|
||||
|
||||
if ($found) print '<br>';
|
||||
print '<br>';
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Reporting").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Size").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Date").'</td>';
|
||||
print '</tr>';
|
||||
$var=true;
|
||||
while (($file = readdir($handle))!==false)
|
||||
if (is_dir($dir.'/'.$year))
|
||||
{
|
||||
$handle=opendir($dir.'/'.$year);
|
||||
|
||||
if ($found) print '<br>';
|
||||
print '<br>';
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Reporting").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Size").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Date").'</td>';
|
||||
print '</tr>';
|
||||
$var=true;
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (eregi('^payment',$file))
|
||||
{
|
||||
$var=!$var;
|
||||
$tfile = $dir . '/'.$year.'/'.$file;
|
||||
$relativepath = $year.'/'.$file;
|
||||
print "<tr $bc[$var]>".'<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
|
||||
print '<td align="right">'.filesize($tfile). ' '.$langs->trans("Bytes").'</td>';
|
||||
print '<td align="right">'.dolibarr_print_date(filemtime($tfile),"dayhour").'</td></tr>';
|
||||
}
|
||||
{
|
||||
$var=!$var;
|
||||
$tfile = $dir . '/'.$year.'/'.$file;
|
||||
$relativepath = $year.'/'.$file;
|
||||
print "<tr $bc[$var]>".'<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
|
||||
print '<td align="right">'.filesize($tfile). ' '.$langs->trans("Bytes").'</td>';
|
||||
print '<td align="right">'.dolibarr_print_date(filemtime($tfile),"dayhour").'</td></tr>';
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
$db->close();
|
||||
|
||||
|
||||
@ -62,11 +62,14 @@ $staticcontratligne=new ContratLigne($db);
|
||||
* View
|
||||
*/
|
||||
|
||||
$now=mktime();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom, c.rowid as cid,";
|
||||
$sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,";
|
||||
$sql.= " s.rowid as socid, s.nom,";
|
||||
$sql.= " cd.rowid, cd.description, cd.statut, p.rowid as pid, p.label as label,";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||
$sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_ouverture_prevue,";
|
||||
@ -165,14 +168,19 @@ if ($resql)
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
|
||||
$now=mktime();
|
||||
$var=True;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="fiche.php?id='.$obj->cid.'">'.img_object($langs->trans("ShowContract"),"contract").' '.$obj->cid.'</a></td>';
|
||||
print '<td>';
|
||||
$contractstatic=new Contrat($db);
|
||||
$contractstatic->id=$obj->cid;
|
||||
$contractstatic->ref=$obj->ref?$obj->ref:$obj->cid;
|
||||
print $contractstatic->getNomUrl(1);
|
||||
//'<a href="fiche.php?id='.$obj->cid.'">'.img_object($langs->trans("ShowContract"),"contract").' '.$obj->cid.'</a>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($obj->pid)
|
||||
{
|
||||
@ -202,9 +210,17 @@ if ($resql)
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->cid.'&line='.$obj->rowid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut,5);
|
||||
print '</a></td>';
|
||||
if ($obj->cstatut == 0)
|
||||
{
|
||||
print $contractstatic->LibStatut(0,5);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->cid.'&line='.$obj->rowid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut,5);
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -18,11 +18,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/fourn/commande/index.php
|
||||
\ingroup commande
|
||||
\brief Page accueil commandes fournisseurs
|
||||
\version $Revision$
|
||||
*/
|
||||
* \file htdocs/fourn/commande/index.php
|
||||
* \ingroup commande
|
||||
* \brief Page accueil commandes fournisseurs
|
||||
* \version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
@ -40,6 +40,7 @@ $result = restrictedArea($user, 'commande_fournisseur', $orderid,'');
|
||||
llxHeader('',$langs->trans("SuppliersOrdersArea"));
|
||||
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$userstatic=new User($db);
|
||||
|
||||
print_barre_liste($langs->trans("SuppliersOrdersArea"), $page, "index.php", "", $sortfield, $sortorder, '', $num);
|
||||
|
||||
@ -64,7 +65,9 @@ if ($resql)
|
||||
$i = 0;
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Status").'</td><td align="center">'.$langs->trans("Nb").'</td><td> </td>';
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Nb").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
|
||||
@ -75,8 +78,7 @@ if ($resql)
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>'.$commande->statuts[$row[1]].'</td>';
|
||||
print '<td align="center">'.$row[0].'</td>';
|
||||
print '<td align="center"><a href="liste.php?statut='.$row[1].'">'.$commande->LibStatut($row[1],3).'</a></td>';
|
||||
print '<td align="right"><a href="liste.php?statut='.$row[1].'">'.$row[0].' '.$commande->LibStatut($row[1],3).'</a></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
@ -93,11 +95,11 @@ else
|
||||
print '</td><td width="70%" valign="top" class="notopnoleft">';
|
||||
|
||||
|
||||
$sql = "SELECT u.name, u.firstname";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."user_rights as ur";
|
||||
$sql .= " WHERE u.rowid = ur.fk_user";
|
||||
$sql .= " AND ur.fk_id = 184";
|
||||
$sql = "SELECT u.rowid, u.name, u.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."user_rights as ur, ".MAIN_DB_PREFIX."rights_def as rd";
|
||||
$sql.= " WHERE u.rowid = ur.fk_user AND ur.fk_id = rd.id";
|
||||
$sql.= " AND module='fournisseur' AND perms='commande' AND subperms='approuver'";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -106,17 +108,22 @@ if ($resql)
|
||||
$i = 0;
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre"><td>Personnes habilitées à approuver les commandes</td>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("UserWithApproveOrderGrant").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=True;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>'.$row[1].' '.$row[0].'</td>';
|
||||
print '<td>';
|
||||
$userstatic->id=$obj->rowid;
|
||||
$userstatic->nom=$obj->name;
|
||||
$userstatic->prenom=$obj->firstname;
|
||||
print $userstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -15,30 +15,31 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/paiement/cheque/pdf/pdf_blochet.class.php
|
||||
\ingroup banque
|
||||
\brief Fichier de la classe permettant de g<EFBFBD>n<EFBFBD>rer les bordereau de remise de cheque
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
|
||||
|
||||
/**
|
||||
\class BordereauChequeBlochet
|
||||
\brief Classe permettant de g<EFBFBD>n<EFBFBD>rer les bordereau de remise de cheque
|
||||
* \class BordereauChequeBlochet
|
||||
* \brief Classe permettant de g�n�rer les bordereau de remise de cheque
|
||||
*/
|
||||
|
||||
class BordereauChequeBlochet
|
||||
class BordereauChequeBlochet extends FPDF
|
||||
{
|
||||
var $error='';
|
||||
|
||||
var $emetteur; // Objet societe qui emet
|
||||
|
||||
/**
|
||||
\brief Constructeur
|
||||
* \brief Constructeur
|
||||
*/
|
||||
function BordereauChequeBlochet($db)
|
||||
{
|
||||
@ -49,7 +50,6 @@ class BordereauChequeBlochet
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "blochet";
|
||||
$this->description = $langs->transnoentities("CheckReceipt");
|
||||
|
||||
$this->tab_top = 60;
|
||||
|
||||
@ -68,29 +68,36 @@ class BordereauChequeBlochet
|
||||
$this->tab_height = 200; //$this->line_height * $this->line_per_page;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoi le dernier message d'erreur de création de propale
|
||||
*/
|
||||
function pdferror()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Generate Header
|
||||
\param pdf pdf object
|
||||
\param page current page number
|
||||
\param pages number of pages
|
||||
*/
|
||||
function Header(&$pdf, $page, $pages)
|
||||
function Header(&$pdf, $page, $pages, $outputlangs)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$title = $this->description;
|
||||
$title = $outputlangs->transnoentities("CheckReceipt");
|
||||
$pdf->SetFont('Arial','B',10);
|
||||
$pdf->Text(10, 10, $title);
|
||||
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->Text(10, 19, $langs->transnoentities("Numero"));
|
||||
$pdf->Text(10, 19, $outputlangs->transnoentities("Numero"));
|
||||
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->Text(10, 27, $langs->transnoentities("Date") );
|
||||
$pdf->Text(10, 27, $outputlangs->transnoentities("Date") );
|
||||
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->Text(10, 35, $langs->transnoentities("Owner"));
|
||||
$pdf->Text(10, 35, $outputlangs->transnoentities("Owner"));
|
||||
|
||||
$pdf->SetFont('Arial','B',10);
|
||||
$pdf->Text(32, 35, $this->account->proprio);
|
||||
@ -103,7 +110,7 @@ class BordereauChequeBlochet
|
||||
|
||||
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->Text(10, 43, "Compte");
|
||||
$pdf->Text(10, 43, $outputlangs->transnoentities("Account"));
|
||||
|
||||
$pdf->SetFont('Arial','B',10);
|
||||
$pdf->Text(32, 43, $this->account->code_banque);
|
||||
@ -112,7 +119,7 @@ class BordereauChequeBlochet
|
||||
$pdf->Text(104, 43, $this->account->cle_rib);
|
||||
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->Text(114, 19, "Signature");
|
||||
$pdf->Text(114, 19, $outputlangs->transnoentities("Sign"));
|
||||
|
||||
$pdf->Rect(9, 47, 192, 7);
|
||||
$pdf->line(55, 47, 55, 54);
|
||||
@ -120,7 +127,7 @@ class BordereauChequeBlochet
|
||||
$pdf->line(170, 47, 170, 54);
|
||||
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->Text(10, 52, "Nombre de ch<63>que");
|
||||
$pdf->Text(10, 52, $outputlangs->transnoentities("ChequeNumber"));
|
||||
|
||||
$pdf->SetFont('Arial','B',10);
|
||||
$pdf->Text(57, 52, $this->nbcheque);
|
||||
@ -134,16 +141,16 @@ class BordereauChequeBlochet
|
||||
|
||||
// Tableau
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->Text(11,$this->tab_top + 6,$langs->transnoentities("Num"));
|
||||
$pdf->Text(11,$this->tab_top + 6,$outputlangs->transnoentities("Num"));
|
||||
$pdf->line(30, $this->tab_top, 30, $this->tab_top + $this->tab_height + 10);
|
||||
|
||||
$pdf->Text(31,$this->tab_top + 6,$langs->transnoentities("Bank"));
|
||||
$pdf->Text(31,$this->tab_top + 6,$outputlangs->transnoentities("Bank"));
|
||||
$pdf->line(100, $this->tab_top, 100, $this->tab_top + $this->tab_height + 10);
|
||||
$pdf->Text(101, $this->tab_top + 6, $langs->transnoentities("CheckTransmitter"));
|
||||
$pdf->Text(101, $this->tab_top + 6, $outputlangs->transnoentities("CheckTransmitter"));
|
||||
|
||||
$pdf->line(180, $this->tab_top, 180, $this->tab_top + $this->tab_height + 10);
|
||||
$pdf->SetXY (180, $this->tab_top);
|
||||
$pdf->MultiCell(20, 10, $langs->transnoentities("Amount"), 0, 'R');
|
||||
$pdf->MultiCell(20, 10, $outputlangs->transnoentities("Amount"), 0, 'R');
|
||||
$pdf->line(9, $this->tab_top + 10, 201, $this->tab_top + 10 );
|
||||
|
||||
$pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10);
|
||||
@ -162,7 +169,7 @@ class BordereauChequeBlochet
|
||||
}
|
||||
|
||||
|
||||
function Body(&$pdf, $page)
|
||||
function Body(&$pdf, $page, $outputlangs)
|
||||
{
|
||||
// x=10 - Num
|
||||
// x=30 - Banque
|
||||
@ -191,15 +198,27 @@ class BordereauChequeBlochet
|
||||
$yp = $yp + $this->line_height;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction g<EFBFBD>n<EFBFBD>rant le rapport sur le disque
|
||||
\param _dir repertoire
|
||||
\param month mois du rapport
|
||||
\param year annee du rapport
|
||||
*/
|
||||
function write_file($_dir, $number)
|
||||
* \brief Fonction generant le rapport sur le disque
|
||||
* \param _dir Directory
|
||||
* \param number Number
|
||||
* \param outputlangs Lang output object
|
||||
*/
|
||||
function write_file($_dir, $number, $outputlangs)
|
||||
{
|
||||
global $langs;
|
||||
global $user,$conf,$langs,$mysoc;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("companies");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("products");
|
||||
|
||||
$outputlangs->setPhpLang();
|
||||
|
||||
$dir = $_dir . "/".get_exdir($number);
|
||||
|
||||
@ -252,9 +271,9 @@ class BordereauChequeBlochet
|
||||
|
||||
$pdf->AddPage();
|
||||
|
||||
$this->Header($pdf, 1, $pages);
|
||||
$this->Header($pdf, 1, $pages, $outputlangs);
|
||||
|
||||
$this->Body($pdf, 1);
|
||||
$this->Body($pdf, 1, $outputlangs);
|
||||
|
||||
$pdf->Output($_file);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@ -161,10 +161,10 @@ class ModeleNumRefCommandes
|
||||
\brief Crée un bon de commande sur disque en fonction d'un modèle
|
||||
\param db objet base de donnée
|
||||
\param id id de la propale à créer
|
||||
\param modele force le modele à utiliser ('' par defaut)
|
||||
\param modele force le modele à utiliser ('' to not force)
|
||||
\param outputlangs objet lang a utiliser pour traduction
|
||||
*/
|
||||
function commande_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
function commande_pdf_create($db, $id, $modele, $outputlangs)
|
||||
{
|
||||
global $conf,$langs;
|
||||
$langs->load("orders");
|
||||
@ -203,14 +203,19 @@ function commande_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($obj->write_file($id, $outputlangs) > 0)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
// on supprime l'image correspondant au preview
|
||||
commande_delete_preview($db, $id);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dolibarr_syslog("Erreur dans commande_pdf_create");
|
||||
dolibarr_print_error($db,$obj->pdferror());
|
||||
return 0;
|
||||
|
||||
@ -90,7 +90,7 @@ class pdf_edison extends ModelePDFCommandes
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("companies");
|
||||
|
||||
@ -110,7 +110,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
|
||||
@ -159,7 +159,7 @@ class ModeleNumRefDons
|
||||
\param outputlangs objet lang a utiliser pour traduction
|
||||
\return int 0 si KO, 1 si OK
|
||||
*/
|
||||
function don_create($db, $id, $message='', $modele='', $outputlangs='')
|
||||
function don_create($db, $id, $message, $modele, $outputlangs)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$langs->load("bills");
|
||||
@ -192,19 +192,23 @@ function don_create($db, $id, $message='', $modele='', $outputlangs='')
|
||||
|
||||
$obj->message = $message;
|
||||
|
||||
if ( $obj->write_file($id,$outputlangs) > 0)
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($obj->write_file($id,$outputlangs) > 0)
|
||||
{
|
||||
// Succès de la création de la facture. On génère le fichier meta
|
||||
don_meta_create($db, $id);
|
||||
|
||||
// et on supprime l'image correspondant au preview
|
||||
don_delete_preview($db, $id);
|
||||
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Erreur dans don_create");
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dolibarr_syslog("Erreur dans don_create");
|
||||
dolibarr_print_error($db,$obj->pdferror());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -88,10 +88,10 @@ class ModelePdfExpedition extends DolibarrPdfBarCode
|
||||
\brief Cree un bon d'expedition sur disque
|
||||
\param db objet base de donnee
|
||||
\param id id de la expedition a creer
|
||||
\param modele force le modele a utiliser ('' par defaut)
|
||||
\param modele force le modele a utiliser ('' to not force)
|
||||
\param outputlangs objet lang a utiliser pour traduction
|
||||
*/
|
||||
function expedition_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
function expedition_pdf_create($db, $id, $modele, $outputlangs)
|
||||
{
|
||||
global $conf,$langs;
|
||||
$langs->load("sendings");
|
||||
@ -134,14 +134,19 @@ function expedition_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
$result=$expedition->fetch($id);
|
||||
$result=$expedition->fetch_object($expedition->origin);
|
||||
|
||||
if ($obj->write_file($expedition, $langs) > 0)
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($obj->write_file($expedition, $langs) > 0)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
// on supprime l'image correspondant au preview
|
||||
// expedition_delete_preview($db, $id);
|
||||
//expedition_delete_preview($db, $id);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dolibarr_syslog("Erreur dans expedition_pdf_create");
|
||||
dolibarr_print_error($db,$obj->pdferror());
|
||||
return 0;
|
||||
|
||||
@ -80,7 +80,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("companies");
|
||||
|
||||
@ -122,7 +122,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("companies");
|
||||
|
||||
@ -19,160 +19,160 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/export/modules_export.php
|
||||
\ingroup export
|
||||
\brief Fichier contenant la classe mère de generation des exports
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/includes/modules/export/modules_export.php
|
||||
\ingroup export
|
||||
\brief Fichier contenant la classe mère de generation des exports
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
|
||||
|
||||
/**
|
||||
\class ModeleExports
|
||||
\brief Classe mère des modèles de format d'export
|
||||
*/
|
||||
\class ModeleExports
|
||||
\brief Classe mère des modèles de format d'export
|
||||
*/
|
||||
|
||||
class ModeleExports
|
||||
{
|
||||
var $error='';
|
||||
|
||||
var $driverlabel;
|
||||
var $driverversion;
|
||||
var $error='';
|
||||
|
||||
var $libabel;
|
||||
var $libversion;
|
||||
var $driverlabel;
|
||||
var $driverversion;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
*/
|
||||
function ModeleExports()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge en memoire et renvoie la liste des modèles actifs
|
||||
* \param db Handler de base
|
||||
*/
|
||||
function liste_modeles($db)
|
||||
{
|
||||
dolibarr_syslog("ModeleExport::loadFormat");
|
||||
var $libabel;
|
||||
var $libversion;
|
||||
|
||||
$dir=DOL_DOCUMENT_ROOT."/includes/modules/export/";
|
||||
$handle=opendir($dir);
|
||||
|
||||
// Recherche des fichiers drivers exports disponibles
|
||||
$var=True;
|
||||
$i=0;
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (eregi("^export_(.*)\.modules\.php",$file,$reg))
|
||||
{
|
||||
$moduleid=$reg[1];
|
||||
|
||||
// Chargement de la classe
|
||||
$file = $dir."/export_".$moduleid.".modules.php";
|
||||
$classname = "Export".ucfirst($moduleid);
|
||||
|
||||
require_once($file);
|
||||
$module = new $classname($db);
|
||||
/**
|
||||
* \brief Constructeur
|
||||
*/
|
||||
function ModeleExports()
|
||||
{
|
||||
}
|
||||
|
||||
// Driver properties
|
||||
$this->driverlabel[$module->id]=$module->getDriverLabel();
|
||||
$this->driverversion[$module->id]=$module->getDriverVersion();
|
||||
// If use an external lib
|
||||
$this->liblabel[$module->id]=$module->getLibLabel();
|
||||
$this->libversion[$module->id]=$module->getLibVersion();
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return array_keys($this->driverlabel);
|
||||
}
|
||||
/**
|
||||
* \brief Charge en memoire et renvoie la liste des modèles actifs
|
||||
* \param db Handler de base
|
||||
*/
|
||||
function liste_modeles($db)
|
||||
{
|
||||
dolibarr_syslog("ModeleExport::loadFormat");
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoi libelle d'un driver export
|
||||
*/
|
||||
function getDriverLabel($key)
|
||||
{
|
||||
return $this->driverlabel[$key];
|
||||
}
|
||||
$dir=DOL_DOCUMENT_ROOT."/includes/modules/export/";
|
||||
$handle=opendir($dir);
|
||||
|
||||
/**
|
||||
* \brief Renvoi version d'un driver export
|
||||
*/
|
||||
function getDriverVersion($key)
|
||||
{
|
||||
return $this->driverversion[$key];
|
||||
}
|
||||
// Recherche des fichiers drivers exports disponibles
|
||||
$var=True;
|
||||
$i=0;
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (eregi("^export_(.*)\.modules\.php",$file,$reg))
|
||||
{
|
||||
$moduleid=$reg[1];
|
||||
|
||||
/**
|
||||
* \brief Renvoi libelle de librairie externe du driver
|
||||
*/
|
||||
function getLibLabel($key)
|
||||
{
|
||||
return $this->liblabel[$key];
|
||||
}
|
||||
// Chargement de la classe
|
||||
$file = $dir."/export_".$moduleid.".modules.php";
|
||||
$classname = "Export".ucfirst($moduleid);
|
||||
|
||||
/**
|
||||
* \brief Renvoi version de librairie externe du driver
|
||||
*/
|
||||
function getLibVersion($key)
|
||||
{
|
||||
return $this->libversion[$key];
|
||||
}
|
||||
require_once($file);
|
||||
$module = new $classname($db);
|
||||
|
||||
// Driver properties
|
||||
$this->driverlabel[$module->id]=$module->getDriverLabel();
|
||||
$this->driverversion[$module->id]=$module->getDriverVersion();
|
||||
// If use an external lib
|
||||
$this->liblabel[$module->id]=$module->getLibLabel();
|
||||
$this->libversion[$module->id]=$module->getLibVersion();
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return array_keys($this->driverlabel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoi libelle d'un driver export
|
||||
*/
|
||||
function getDriverLabel($key)
|
||||
{
|
||||
return $this->driverlabel[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi version d'un driver export
|
||||
*/
|
||||
function getDriverVersion($key)
|
||||
{
|
||||
return $this->driverversion[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi libelle de librairie externe du driver
|
||||
*/
|
||||
function getLibLabel($key)
|
||||
{
|
||||
return $this->liblabel[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi version de librairie externe du driver
|
||||
*/
|
||||
function getLibVersion($key)
|
||||
{
|
||||
return $this->libversion[$key];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Lance la generation du fichier
|
||||
* \remarks Les tableaux array_export_xxx sont déjà chargées pour le bon datatoexport
|
||||
* aussi le parametre datatoexport est inutilisé
|
||||
*/
|
||||
function build_file($model, $datatoexport, $array_selected)
|
||||
{
|
||||
global $langs;
|
||||
/**
|
||||
* \brief Lance la generation du fichier
|
||||
* \remarks Les tableaux array_export_xxx sont déjà chargées pour le bon datatoexport
|
||||
* aussi le parametre datatoexport est inutilisé
|
||||
*/
|
||||
function build_file($model, $datatoexport, $array_selected)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
dolibarr_syslog("Export::build_file $model, $datatoexport, $array_selected");
|
||||
|
||||
// Creation de la classe d'export du model ExportXXX
|
||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/export/";
|
||||
$file = "export_".$model.".modules.php";
|
||||
$classname = "Export".$model;
|
||||
require_once($dir.$file);
|
||||
$obj = new $classname($db);
|
||||
|
||||
// Execute requete export
|
||||
$sql=$this->array_export_sql[0];
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Genere en-tete
|
||||
$obj->write_header();
|
||||
|
||||
// Genere ligne de titre
|
||||
$obj->write_title();
|
||||
dolibarr_syslog("Export::build_file $model, $datatoexport, $array_selected");
|
||||
|
||||
// Creation de la classe d'export du model ExportXXX
|
||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/export/";
|
||||
$file = "export_".$model.".modules.php";
|
||||
$classname = "Export".$model;
|
||||
require_once($dir.$file);
|
||||
$obj = new $classname($db);
|
||||
|
||||
// Execute requete export
|
||||
$sql=$this->array_export_sql[0];
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Genere en-tete
|
||||
$obj->write_header();
|
||||
|
||||
// Genere ligne de titre
|
||||
$obj->write_title();
|
||||
|
||||
while ($objp = $this->db->fetch_object($resql))
|
||||
{
|
||||
$var=!$var;
|
||||
$obj->write_record($objp,$array_selected);
|
||||
}
|
||||
|
||||
// Genere en-tete
|
||||
$obj->write_footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Error: sql=$sql ".$this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
while ($objp = $this->db->fetch_object($resql))
|
||||
{
|
||||
$var=!$var;
|
||||
$obj->write_record($objp,$array_selected);
|
||||
}
|
||||
|
||||
// Genere en-tete
|
||||
$obj->write_footer();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dolibarr_syslog("Error: sql=$sql ".$this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -162,11 +162,11 @@ class ModeleNumRefFactures
|
||||
\param db objet base de donnee
|
||||
\param id id de la facture a creer
|
||||
\param message message
|
||||
\param modele force le modele a utiliser ('' par defaut)
|
||||
\param modele force le modele a utiliser ('' to not force)
|
||||
\param outputlangs objet lang a utiliser pour traduction
|
||||
\return int <0 si KO, >0 si OK
|
||||
*/
|
||||
function facture_pdf_create($db, $id, $message='', $modele='', $outputlangs='')
|
||||
function facture_pdf_create($db, $id, $message, $modele, $outputlangs)
|
||||
{
|
||||
global $conf,$langs;
|
||||
$langs->load("bills");
|
||||
@ -197,19 +197,23 @@ function facture_pdf_create($db, $id, $message='', $modele='', $outputlangs='')
|
||||
$obj = new $classname($db);
|
||||
$obj->message = $message;
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($obj->write_file($id, $outputlangs) > 0)
|
||||
{
|
||||
// Success in building document. We build meta file.
|
||||
facture_meta_create($db, $id);
|
||||
|
||||
// et on supprime l'image correspondant au preview
|
||||
facture_delete_preview($db, $id);
|
||||
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error('',"facture_pdf_create Error: ".$obj->error);
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dolibarr_print_error($db,"facture_pdf_create Error: ".$obj->error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
|
||||
@ -95,7 +95,7 @@ class pdf_huitre extends ModelePDFFactures
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("companies");
|
||||
|
||||
@ -99,7 +99,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("companies");
|
||||
|
||||
@ -18,133 +18,133 @@
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/fichinter/modules_fichinter.php
|
||||
\ingroup ficheinter
|
||||
\brief Fichier contenant la classe mère de generation des fiches interventions en PDF
|
||||
et la classe mère de numérotation des fiches interventions
|
||||
\version $Id$
|
||||
*/
|
||||
/**
|
||||
\file htdocs/includes/modules/fichinter/modules_fichinter.php
|
||||
\ingroup ficheinter
|
||||
\brief Fichier contenant la classe mère de generation des fiches interventions en PDF
|
||||
et la classe mère de numérotation des fiches interventions
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
|
||||
|
||||
/**
|
||||
\class ModelePDFFicheinter
|
||||
\brief Classe mère des modèles de fiche intervention
|
||||
*/
|
||||
\class ModelePDFFicheinter
|
||||
\brief Classe mère des modèles de fiche intervention
|
||||
*/
|
||||
class ModelePDFFicheinter extends FPDF
|
||||
{
|
||||
var $error='';
|
||||
var $error='';
|
||||
|
||||
/**
|
||||
\brief Constructeur
|
||||
*/
|
||||
function ModelePDFFicheinter()
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
\brief Constructeur
|
||||
*/
|
||||
function ModelePDFFicheinter()
|
||||
{
|
||||
|
||||
/**
|
||||
\brief Renvoi le dernier message d'erreur de création de fiche intervention
|
||||
*/
|
||||
function pdferror()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi la liste des modèles actifs
|
||||
*/
|
||||
function liste_modeles($db)
|
||||
{
|
||||
$type='ficheinter';
|
||||
$liste=array();
|
||||
$sql ="SELECT nom as id, nom as lib";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.=" WHERE type = '".$type."'";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$liste[$row[0]]=$row[1];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return $liste;
|
||||
}
|
||||
/**
|
||||
\brief Renvoi le dernier message d'erreur de création de fiche intervention
|
||||
*/
|
||||
function pdferror()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi la liste des modèles actifs
|
||||
*/
|
||||
function liste_modeles($db)
|
||||
{
|
||||
$type='ficheinter';
|
||||
$liste=array();
|
||||
$sql ="SELECT nom as id, nom as lib";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.=" WHERE type = '".$type."'";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$liste[$row[0]]=$row[1];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return $liste;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\class ModeleNumRefFicheinter
|
||||
\brief Classe mère des modèles de numérotation des références de fiches d'intervention
|
||||
*/
|
||||
\class ModeleNumRefFicheinter
|
||||
\brief Classe mère des modèles de numérotation des références de fiches d'intervention
|
||||
*/
|
||||
|
||||
class ModeleNumRefFicheinter
|
||||
{
|
||||
var $error='';
|
||||
var $error='';
|
||||
|
||||
/** \brief Return if a module can be used or not
|
||||
* \return boolean true if module can be used
|
||||
*/
|
||||
* \return boolean true if module can be used
|
||||
*/
|
||||
function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Renvoi la description par defaut du modele de numérotation
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("ficheinter");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
/** \brief Renvoi la description par defaut du modele de numérotation
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("ficheinter");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/** \brief Renvoi un exemple de numérotation
|
||||
* \return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("ficheinter");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
/** \brief Renvoi un exemple de numérotation
|
||||
* \return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("ficheinter");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette numérotation de fonctionner.
|
||||
* \return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette numérotation de fonctionner.
|
||||
* \return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Renvoi prochaine valeur attribuée
|
||||
* \return string Valeur
|
||||
*/
|
||||
function getNextValue()
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
/** \brief Renvoi prochaine valeur attribuée
|
||||
* \return string Valeur
|
||||
*/
|
||||
function getNextValue()
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
|
||||
/** \brief Renvoi version du module numerotation
|
||||
* \return string Valeur
|
||||
*/
|
||||
* \return string Valeur
|
||||
*/
|
||||
function getVersion()
|
||||
{
|
||||
global $langs;
|
||||
@ -154,25 +154,25 @@ class ModeleNumRefFicheinter
|
||||
if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
|
||||
if ($this->version == 'dolibarr') return DOL_VERSION;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Crée une fiche intervention sur disque en fonction du modèle de FICHEINTER_ADDON_PDF
|
||||
\param db objet base de donnée
|
||||
\param object Object fichinter
|
||||
\param modele force le modele à utiliser ('' par defaut)
|
||||
\param outputlangs objet lang a utiliser pour traduction
|
||||
\return int 0 si KO, 1 si OK
|
||||
*/
|
||||
\brief Crée une fiche intervention sur disque en fonction du modèle de FICHEINTER_ADDON_PDF
|
||||
\param db objet base de donnée
|
||||
\param object Object fichinter
|
||||
\param modele force le modele à utiliser ('' par defaut)
|
||||
\param outputlangs objet lang a utiliser pour traduction
|
||||
\return int 0 si KO, 1 si OK
|
||||
*/
|
||||
function fichinter_create($db, $object, $modele='', $outputlangs='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
$langs->load("ficheinter");
|
||||
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT."/includes/modules/fichinter/";
|
||||
|
||||
|
||||
// Positionne modele sur le nom du modele de facture à utiliser
|
||||
if (! strlen($modele))
|
||||
{
|
||||
@ -187,23 +187,29 @@ function fichinter_create($db, $object, $modele='', $outputlangs='')
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Charge le modele
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
if (file_exists($dir.$file))
|
||||
{
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($dir.$file);
|
||||
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
|
||||
dolibarr_syslog("fichinter_create build PDF", LOG_DEBUG);
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($obj->write_file($object,$outputlangs) > 0)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dolibarr_print_error($db,$obj->pdferror());
|
||||
return 0;
|
||||
}
|
||||
@ -216,53 +222,53 @@ function fichinter_create($db, $object, $modele='', $outputlangs='')
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Supprime l'image de prévisualitation, pour le cas de régénération de propal
|
||||
\param db objet base de donnée
|
||||
\param propalid id de la propal à effacer
|
||||
\param propalref référence de la propal si besoin
|
||||
*/
|
||||
\brief Supprime l'image de prévisualitation, pour le cas de régénération de propal
|
||||
\param db objet base de donnée
|
||||
\param propalid id de la propal à effacer
|
||||
\param propalref référence de la propal si besoin
|
||||
*/
|
||||
function fichinter_delete_preview($db, $fichinterid, $fichinterref='')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
if (!$fichinterref)
|
||||
{
|
||||
$fichinter = new Fichinter($db,"",$fichinterid);
|
||||
$fichinter->fetch($fichinterid);
|
||||
$fichinterref = $fichinter->ref;
|
||||
}
|
||||
|
||||
if ($conf->fichinter->dir_output)
|
||||
{
|
||||
$fichinterref = sanitizeFileName($fichinterref);
|
||||
$dir = $conf->fichinter->dir_output . "/" . $fichinterref ;
|
||||
$file = $dir . "/" . $fichinterref . ".pdf.png";
|
||||
$multiple = $file . ".";
|
||||
|
||||
if ( file_exists( $file ) && is_writable( $file ) )
|
||||
{
|
||||
if ( ! unlink($file) )
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ($i = 0; $i < 20; $i++)
|
||||
{
|
||||
$preview = $multiple.$i;
|
||||
if ( file_exists( $preview ) && is_writable( $preview ) )
|
||||
{
|
||||
if ( ! unlink($preview) )
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFailedToOpenFile",$preview);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$fichinterref)
|
||||
{
|
||||
$fichinter = new Fichinter($db,"",$fichinterid);
|
||||
$fichinter->fetch($fichinterid);
|
||||
$fichinterref = $fichinter->ref;
|
||||
}
|
||||
|
||||
if ($conf->fichinter->dir_output)
|
||||
{
|
||||
$fichinterref = sanitizeFileName($fichinterref);
|
||||
$dir = $conf->fichinter->dir_output . "/" . $fichinterref ;
|
||||
$file = $dir . "/" . $fichinterref . ".pdf.png";
|
||||
$multiple = $file . ".";
|
||||
|
||||
if ( file_exists( $file ) && is_writable( $file ) )
|
||||
{
|
||||
if ( ! unlink($file) )
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ($i = 0; $i < 20; $i++)
|
||||
{
|
||||
$preview = $multiple.$i;
|
||||
if ( file_exists( $preview ) && is_writable( $preview ) )
|
||||
{
|
||||
if ( ! unlink($preview) )
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFailedToOpenFile",$preview);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -84,7 +84,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
|
||||
@ -155,7 +155,14 @@ class ModeleNumRefDeliveryOrder
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Create object on disk
|
||||
* \param db objet base de donnée
|
||||
* \param deliveryid id object
|
||||
* \param modele force le modele à utiliser ('' to not force)
|
||||
* \param outputlangs objet lang a utiliser pour traduction
|
||||
* \return int 0 si KO, 1 si OK
|
||||
*/
|
||||
function delivery_order_pdf_create($db, $deliveryid, $modele='', $outputlangs='')
|
||||
{
|
||||
global $langs;
|
||||
@ -185,14 +192,20 @@ function delivery_order_pdf_create($db, $deliveryid, $modele='', $outputlangs=''
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($obj->write_file($deliveryid,$outputlangs) > 0)
|
||||
{
|
||||
// on supprime l'image correspondant au preview
|
||||
delivery_order_delete_preview($db, $deliveryid);
|
||||
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dolibarr_syslog("Erreur dans delivery_order_pdf_create");
|
||||
dolibarr_print_error($db,$obj->pdferror());
|
||||
return 0;
|
||||
|
||||
@ -91,7 +91,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("bills");
|
||||
|
||||
@ -114,7 +114,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
|
||||
@ -156,11 +156,11 @@ class ModeleNumRefPropales
|
||||
\brief Crée une propale sur disque en fonction du modèle de PROPALE_ADDON_PDF
|
||||
\param db objet base de donnée
|
||||
\param id id de la propale à créer
|
||||
\param modele force le modele à utiliser ('' par defaut)
|
||||
\param modele force le modele à utiliser ('' to not force)
|
||||
\param outputlangs objet lang a utiliser pour traduction
|
||||
\return int 0 si KO, 1 si OK
|
||||
*/
|
||||
function propale_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
function propale_pdf_create($db, $id, $modele, $outputlangs)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("propale");
|
||||
@ -200,15 +200,20 @@ function propale_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($obj->write_file($id, $outputlangs) > 0)
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
// on supprime l'image correspondant au preview
|
||||
propale_delete_preview($db, $id);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Erreur dans propale_pdf_create");
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dolibarr_syslog("modules_propale::propale_pdf_create error");
|
||||
dolibarr_print_error($db,$obj->pdferror());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -20,11 +20,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/includes/modules/propale/pdf_propale_azur.modules.php
|
||||
\ingroup propale
|
||||
\brief Fichier de la classe permettant de générer les propales au modèle Azur
|
||||
\author Laurent Destailleur
|
||||
\version $Id$
|
||||
* \file htdocs/includes/modules/propale/pdf_propale_azur.modules.php
|
||||
* \ingroup propale
|
||||
* \brief Fichier de la classe permettant de générer les propales au modèle Azur
|
||||
* \author Laurent Destailleur
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/propale/modules_propale.php");
|
||||
@ -33,8 +33,8 @@ require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
\class pdf_propale_azur
|
||||
\brief Classe permettant de générer les propales au modèle Azur
|
||||
* \class pdf_propale_azur
|
||||
* \brief Classe permettant de générer les propales au modèle Azur
|
||||
*/
|
||||
|
||||
class pdf_propale_azur extends ModelePDFPropales
|
||||
@ -43,8 +43,8 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
|
||||
|
||||
/**
|
||||
\brief Constructeur
|
||||
\param db Handler accès base de donnée
|
||||
* \brief Constructeur
|
||||
* \param db Handler accès base de donnée
|
||||
*/
|
||||
function pdf_propale_azur($db)
|
||||
{
|
||||
@ -99,19 +99,20 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction générant la propale sur le disque
|
||||
\param propale Objet propal à générer (ou id si ancienne methode)
|
||||
\param outputlangs Lang object for output language
|
||||
\return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_file($propale,$outputlangs='')
|
||||
* \brief Fonction générant la propale sur le disque
|
||||
* \param propale Objet propal à générer (ou id si ancienne methode)
|
||||
* \param outputlangs Lang object for output language
|
||||
* \return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_file($propale,$outputlangs)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
$outputlangs->load("companies");
|
||||
@ -400,6 +401,7 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 1; // Pas d'erreur
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "jaune";
|
||||
$this->description = $langs->trans('DocModelJauneDescription');
|
||||
@ -94,9 +94,10 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
global $user,$langs,$conf;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
|
||||
// Force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
$outputlangs->load("companies");
|
||||
@ -156,15 +157,15 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
|
||||
$pdf->Open();
|
||||
$pdf->AddPage();
|
||||
|
||||
|
||||
$pdf->SetTitle($propale->ref);
|
||||
$pdf->SetSubject("Proposition commerciale");
|
||||
$pdf->SetSubject($outputlangs->transnoentities("CommercialProposal"));
|
||||
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
||||
$pdf->SetAuthor($user->fullname);
|
||||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
|
||||
|
||||
// Tete de page
|
||||
$this->_pagehead($pdf, $propale, $outputlangs);
|
||||
|
||||
@ -227,7 +228,7 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
}
|
||||
}
|
||||
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY);
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||
/*
|
||||
*
|
||||
*/
|
||||
@ -270,16 +271,16 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY)
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
|
||||
{
|
||||
global $langs,$conf;
|
||||
$langs->load("main");
|
||||
@ -288,26 +289,26 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
$pdf->SetFont('Arial','',11);
|
||||
|
||||
$pdf->SetXY(10,$tab_top);
|
||||
$pdf->MultiCell(20,10,$langs->transnoentities("Ref"),0,'C',1);
|
||||
$pdf->MultiCell(20,10,$outputlangs->transnoentities("Ref"),0,'C',1);
|
||||
|
||||
$pdf->SetXY(30,$tab_top);
|
||||
$pdf->MultiCell(102,10,$langs->transnoentities("Designation"),0,'L',1);
|
||||
$pdf->MultiCell(102,10,$outputlangs->transnoentities("Designation"),0,'L',1);
|
||||
|
||||
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
|
||||
$pdf->SetXY(132,$tab_top);
|
||||
$pdf->MultiCell(12, 10,$langs->transnoentities("VAT"),0,'C',1);
|
||||
$pdf->MultiCell(12, 10,$outputlangs->transnoentities("VAT"),0,'C',1);
|
||||
|
||||
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
|
||||
$pdf->SetXY(144,$tab_top);
|
||||
$pdf->MultiCell(10,10,$langs->transnoentities("Qty"),0,'C',1);
|
||||
$pdf->MultiCell(10,10,$outputlangs->transnoentities("Qty"),0,'C',1);
|
||||
|
||||
$pdf->line(154, $tab_top, 154, $tab_top + $tab_height);
|
||||
$pdf->SetXY(154,$tab_top);
|
||||
$pdf->MultiCell(22,10,$langs->transnoentities("PriceU"),0,'R',1);
|
||||
$pdf->MultiCell(22,10,$outputlangs->transnoentities("PriceU"),0,'R',1);
|
||||
|
||||
$pdf->line(176, $tab_top, 176, $tab_top + $tab_height);
|
||||
$pdf->SetXY(176,$tab_top);
|
||||
$pdf->MultiCell(24,10,$langs->transnoentities("Total"),0,'R',1);
|
||||
$pdf->MultiCell(24,10,$outputlangs->transnoentities("Total"),0,'R',1);
|
||||
|
||||
$pdf->Rect(10, $tab_top, 190, $tab_height);
|
||||
|
||||
@ -315,6 +316,7 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
$pdf->SetFont('Arial','',10);
|
||||
}
|
||||
|
||||
|
||||
function _pagehead(&$pdf, $propale, $outputlangs)
|
||||
{
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
@ -356,20 +358,20 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
{
|
||||
$pdf->SetX(12);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->MultiCell(76, 5, "T<EFBFBD>l : ".FAC_PDF_TEL);
|
||||
$pdf->MultiCell(76, 5, $outputlangs->trans("Tel")." : ".FAC_PDF_TEL);
|
||||
}
|
||||
if (defined("MAIN_INFO_SIREN"))
|
||||
{
|
||||
$pdf->SetX(12);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->MultiCell(76, 5, "SIREN : ".MAIN_INFO_SIREN);
|
||||
$pdf->MultiCell(76, 5, $outputlangs->trans("SIREN")." : ".MAIN_INFO_SIREN);
|
||||
}
|
||||
$pdf->rect(10, 40, 80, 40);
|
||||
|
||||
$pdf->SetXY(10,5);
|
||||
$pdf->SetFont('Arial','B',16);
|
||||
$pdf->SetTextColor(0,0,200);
|
||||
$pdf->MultiCell(200, 20, "PROPOSITION COMMERCIALE", '' , 'C');
|
||||
$pdf->MultiCell(200, 20, $outputlangs->transnoentities("CommercialProposal"), '' , 'C');
|
||||
|
||||
/*
|
||||
* Adresse Client
|
||||
|
||||
@ -43,7 +43,6 @@ class pdf_paiement extends FPDF
|
||||
$langs->load("bills");
|
||||
|
||||
$this->db = $db;
|
||||
$this->description = $langs->transnoentities("ListOfCustomerPayments");
|
||||
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
@ -62,43 +61,45 @@ class pdf_paiement extends FPDF
|
||||
$this->tab_height = 230; //$this->line_height * $this->line_per_page;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Generate Header
|
||||
\param pdf pdf object
|
||||
\param page current page number
|
||||
\param pages number of pages
|
||||
*/
|
||||
function Header(&$pdf, $page, $pages)
|
||||
*/
|
||||
function Header(&$pdf, $page, $pages, $outputlangs)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$title=$this->description.' - '.dolibarr_print_date(dolibarr_mktime(0,0,0,$this->month,1,$this->year),"%B %Y");
|
||||
$title=$outputlangs->transnoentities("ListOfCustomerPayments");
|
||||
$title.=' - '.dolibarr_print_date(dolibarr_mktime(0,0,0,$this->month,1,$this->year),"%B %Y");
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$pdf->Text(76, 10, $title);
|
||||
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$pdf->Text(11, 16, $langs->transnoentities("Date")." : ".dolibarr_print_date(time(),"day"));
|
||||
$pdf->Text(11, 16, $outputlangs->transnoentities("Date")." : ".dolibarr_print_date(time(),"day"));
|
||||
|
||||
$pdf->SetFont('Arial','',12);
|
||||
$pdf->Text(11, 22, $langs->transnoentities("Page")." : ".$page);
|
||||
$pdf->Text(11, 22, $outputlangs->transnoentities("Page")." : ".$page);
|
||||
|
||||
$pdf->SetFont('Arial','',12);
|
||||
|
||||
$pdf->Text(11,$this->tab_top + 6,'Date');
|
||||
|
||||
$pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
|
||||
$pdf->Text(42, $this->tab_top + 6, $langs->transnoentities("PaymentMode"));
|
||||
$pdf->Text(42, $this->tab_top + 6, $outputlangs->transnoentities("PaymentMode"));
|
||||
|
||||
$pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10);
|
||||
$pdf->Text(82, $this->tab_top + 6, $langs->transnoentities("Invoice"));
|
||||
$pdf->Text(82, $this->tab_top + 6, $outputlangs->transnoentities("Invoice"));
|
||||
|
||||
$pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10);
|
||||
$pdf->Text(122, $this->tab_top + 6, $langs->transnoentities("AmountInvoice"));
|
||||
$pdf->Text(122, $this->tab_top + 6, $outputlangs->transnoentities("AmountInvoice"));
|
||||
|
||||
$pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10);
|
||||
|
||||
$pdf->SetXY (160, $this->tab_top);
|
||||
$pdf->MultiCell(40, 10, $langs->transnoentities("AmountPayment"), 0, 'R');
|
||||
$pdf->MultiCell(40, 10, $outputlangs->transnoentities("AmountPayment"), 0, 'R');
|
||||
|
||||
$pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 );
|
||||
|
||||
@ -106,7 +107,7 @@ class pdf_paiement extends FPDF
|
||||
}
|
||||
|
||||
|
||||
function Body(&$pdf, $page, $lines)
|
||||
function Body(&$pdf, $page, $lines, $outputlangs)
|
||||
{
|
||||
$pdf->SetFont('Arial','', 9);
|
||||
$oldprowid = 0;
|
||||
@ -163,13 +164,13 @@ class pdf_paiement extends FPDF
|
||||
\param month mois du rapport
|
||||
\param year annee du rapport
|
||||
*/
|
||||
function write_file($_dir, $month, $year, $outputlangs='')
|
||||
function write_file($_dir, $month, $year, $outputlangs)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->setPhpLang();
|
||||
|
||||
@ -274,9 +275,9 @@ class pdf_paiement extends FPDF
|
||||
|
||||
$pdf->AddPage();
|
||||
|
||||
$this->Header($pdf, 1, $pages);
|
||||
$this->Header($pdf, 1, $pages, $outputlangs);
|
||||
|
||||
$this->Body($pdf, 1, $lines);
|
||||
$this->Body($pdf, 1, $lines, $outputlangs);
|
||||
|
||||
$pdf->Output($_file);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
|
||||
@ -31,115 +31,115 @@ require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
|
||||
|
||||
/**
|
||||
\class ModelePDFSuppliersorders
|
||||
\brief Classe mère des modèles de commandes fournisseurs
|
||||
*/
|
||||
\class ModelePDFSuppliersorders
|
||||
\brief Classe mère des modèles de commandes fournisseurs
|
||||
*/
|
||||
|
||||
class ModelePDFSuppliersOrders extends FPDF
|
||||
{
|
||||
var $error='';
|
||||
var $error='';
|
||||
|
||||
/**
|
||||
\brief Renvoi le dernier message d'erreur de création de PDF de commande
|
||||
*/
|
||||
function pdferror()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
/**
|
||||
\brief Renvoi le dernier message d'erreur de création de PDF de commande
|
||||
*/
|
||||
function pdferror()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Renvoi la liste des modèles actifs
|
||||
*/
|
||||
function liste_modeles($db)
|
||||
{
|
||||
$type='supplier_order';
|
||||
$liste=array();
|
||||
$sql ="SELECT nom as id, nom as lib";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.=" WHERE type = '".$type."'";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$liste[$row[0]]=$row[1];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$db->error();
|
||||
return -1;
|
||||
}
|
||||
return $liste;
|
||||
}
|
||||
/**
|
||||
* \brief Renvoi la liste des modèles actifs
|
||||
*/
|
||||
function liste_modeles($db)
|
||||
{
|
||||
$type='supplier_order';
|
||||
$liste=array();
|
||||
$sql ="SELECT nom as id, nom as lib";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.=" WHERE type = '".$type."'";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$liste[$row[0]]=$row[1];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$db->error();
|
||||
return -1;
|
||||
}
|
||||
return $liste;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
\class ModeleNumRefSuppliersOrders
|
||||
\brief Classe mère des modèles de numérotation des références de commandes fournisseurs
|
||||
*/
|
||||
\class ModeleNumRefSuppliersOrders
|
||||
\brief Classe mère des modèles de numérotation des références de commandes fournisseurs
|
||||
*/
|
||||
|
||||
class ModeleNumRefSuppliersOrders
|
||||
{
|
||||
var $error='';
|
||||
var $error='';
|
||||
|
||||
/** \brief Return if a module can be used or not
|
||||
* \return boolean true if module can be used
|
||||
*/
|
||||
* \return boolean true if module can be used
|
||||
*/
|
||||
function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Renvoi la description par defaut du modele de numérotation
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("orders");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
* \return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("orders");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/** \brief Renvoi un exemple de numérotation
|
||||
* \return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("orders");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
/** \brief Renvoi un exemple de numérotation
|
||||
* \return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("orders");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette numérotation de fonctionner.
|
||||
* \return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/** \brief Test si les numéros déjà en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette numérotation de fonctionner.
|
||||
* \return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Renvoi prochaine valeur attribuée
|
||||
* \return string Valeur
|
||||
*/
|
||||
function getNextValue()
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
|
||||
/** \brief Renvoi prochaine valeur attribuée
|
||||
* \return string Valeur
|
||||
*/
|
||||
function getNextValue()
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
|
||||
/** \brief Renvoi version du module numerotation
|
||||
* \return string Valeur
|
||||
*/
|
||||
* \return string Valeur
|
||||
*/
|
||||
function getVersion()
|
||||
{
|
||||
global $langs;
|
||||
@ -153,77 +153,91 @@ class ModeleNumRefSuppliersOrders
|
||||
}
|
||||
|
||||
|
||||
function supplier_order_pdf_create($db, $comid, $modele='',$outputlangs='')
|
||||
/**
|
||||
* \brief Create object on disk
|
||||
* \param db objet base de donnée
|
||||
* \param deliveryid id object
|
||||
* \param modele force le modele à utiliser ('' to not force)
|
||||
* \param outputlangs objet lang a utiliser pour traduction
|
||||
* \return int 0 si KO, 1 si OK
|
||||
*/
|
||||
function supplier_order_pdf_create($db, $comid, $modele,$outputlangs)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("suppliers");
|
||||
|
||||
$dir = DOL_DOCUMENT_ROOT."//includes/modules/supplier_order/pdf/";
|
||||
global $langs;
|
||||
$langs->load("suppliers");
|
||||
|
||||
// Positionne modele sur le nom du modele de commande fournisseur à utiliser
|
||||
if (! strlen($modele))
|
||||
{
|
||||
if (defined("COMMANDE_SUPPLIER_ADDON_PDF") && COMMANDE_SUPPLIER_ADDON_PDF)
|
||||
{
|
||||
$modele = COMMANDE_SUPPLIER_ADDON_PDF;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_SUPPLIER_ADDON_PDF_NotDefined");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// Charge le modele
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
if (file_exists($dir.$file))
|
||||
{
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($dir.$file);
|
||||
|
||||
$obj = new $classname($db);
|
||||
$dir = DOL_DOCUMENT_ROOT."//includes/modules/supplier_order/pdf/";
|
||||
|
||||
if ($obj->write_file($comid,$outputlangs) > 0)
|
||||
{
|
||||
// on supprime l'image correspondant au preview
|
||||
supplier_order_delete_preview($db, $comid);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_syslog("Erreur dans supplier_order_pdf_create");
|
||||
dolibarr_print_error($db,$obj->pdferror());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file);
|
||||
return 0;
|
||||
}
|
||||
// Positionne modele sur le nom du modele de commande fournisseur à utiliser
|
||||
if (! strlen($modele))
|
||||
{
|
||||
if (defined("COMMANDE_SUPPLIER_ADDON_PDF") && COMMANDE_SUPPLIER_ADDON_PDF)
|
||||
{
|
||||
$modele = COMMANDE_SUPPLIER_ADDON_PDF;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_SUPPLIER_ADDON_PDF_NotDefined");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// Charge le modele
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
if (file_exists($dir.$file))
|
||||
{
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($dir.$file);
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charset_output=$outputlangs->charset_output;
|
||||
if ($obj->write_file($comid,$outputlangs) > 0)
|
||||
{
|
||||
// on supprime l'image correspondant au preview
|
||||
supplier_order_delete_preview($db, $comid);
|
||||
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outputlangs->charset_output=$sav_charset_output;
|
||||
dolibarr_syslog("Erreur dans supplier_order_pdf_create");
|
||||
dolibarr_print_error($db,$obj->pdferror());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
function supplier_order_delete_preview($db, $propalid)
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $langs,$conf;
|
||||
|
||||
$comfourn = new CommandeFournisseur($db,"",$propalid);
|
||||
$comfourn->fetch($propalid);
|
||||
$client = new Societe($db);
|
||||
$client->fetch($comfourn->socid);
|
||||
$comfourn = new CommandeFournisseur($db,"",$propalid);
|
||||
$comfourn->fetch($propalid);
|
||||
$client = new Societe($db);
|
||||
$client->fetch($comfourn->socid);
|
||||
|
||||
if ($conf->fournisseur->commande->dir_output)
|
||||
{
|
||||
$comfournref = sanitizeFileName($comfourn->ref);
|
||||
$dir = $conf->commande->dir_output . "/" . $comfournref ;
|
||||
$file = $dir . "/" . $comfournref . ".pdf.png";
|
||||
if ($conf->fournisseur->commande->dir_output)
|
||||
{
|
||||
$comfournref = sanitizeFileName($comfourn->ref);
|
||||
$dir = $conf->commande->dir_output . "/" . $comfournref ;
|
||||
$file = $dir . "/" . $comfournref . ".pdf.png";
|
||||
|
||||
if ( file_exists( $file ) && is_writable( $file ) )
|
||||
{
|
||||
if ( ! unlink($file) )
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( file_exists( $file ) && is_writable( $file ) )
|
||||
{
|
||||
if ( ! unlink($file) )
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -112,7 +112,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output=$outputlangs->character_set_client='ISO-8859-1';
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("companies");
|
||||
|
||||
@ -156,7 +156,7 @@ if ($_POST["action"] == "set")
|
||||
$requestnb++;
|
||||
if ($conf->character_set_client == "UTF-8")
|
||||
{
|
||||
$buffer=utf8_encode ($buffer);
|
||||
$buffer=utf8_encode($buffer);
|
||||
}
|
||||
|
||||
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
|
||||
@ -268,7 +268,7 @@ if ($_POST["action"] == "set")
|
||||
$requestnb++;
|
||||
if ($conf->character_set_client == "UTF-8")
|
||||
{
|
||||
$buffer=utf8_encode ($buffer);
|
||||
$buffer=utf8_encode($buffer);
|
||||
}
|
||||
|
||||
dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
|
||||
|
||||
@ -97,6 +97,7 @@ OrderMode=Order method
|
||||
AuthorRequest=Request author
|
||||
UseCustomerContactAsOrderRecipientIfExist=Use customer contact address if defined instead of third party address as order recipient address
|
||||
RunningOrders=Orders on process
|
||||
UserWithApproveOrderGrant=Useres granted with "approve orders" permission.
|
||||
|
||||
Error_COMMANDE_SUPPLIER_ADDON_NotDefined=Constant COMMANDE_SUPPLIER_ADDON not defined
|
||||
Error_COMMANDE_ADDON_NotDefined=Constant COMMANDE_ADDON not defined
|
||||
|
||||
@ -97,6 +97,7 @@ OrderMode=M
|
||||
AuthorRequest=Auteur/Demandeur
|
||||
UseCustomerContactAsOrderRecipientIfExist=Utiliser adresse contact suivi client si défini plutot que adresse tiers comme destinataire des commandes
|
||||
RunningOrders=Commandes en cours
|
||||
UserWithApproveOrderGrant=Utilisateurs habilités à approuver les commandes
|
||||
|
||||
Error_COMMANDE_SUPPLIER_ADDON_NotDefined=Constante COMMANDE_SUPPLIER_ADDON non définie
|
||||
Error_COMMANDE_ADDON_NotDefined=Constante COMMANDE_ADDON non définie
|
||||
|
||||
@ -788,8 +788,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
{
|
||||
print "<head>\n";
|
||||
|
||||
print $langs->lang_header();
|
||||
print $head;
|
||||
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$conf->character_set_client."\">\n";
|
||||
|
||||
// Affiche meta
|
||||
print '<meta name="robots" content="noindex,nofollow">'."\n"; // Evite indexation par robots
|
||||
|
||||
@ -456,17 +456,6 @@ class Translate {
|
||||
return $langs_available;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Exp<EFBFBD>die le header correct et retourne le d<EFBFBD>but de la page html
|
||||
* [en] Send header and return a string of html start page
|
||||
* \return string html header avec charset
|
||||
*/
|
||||
function lang_header()
|
||||
{
|
||||
$texte = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=".$this->charset_output."\">\n";
|
||||
return $texte;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoi si le fichier $filename existe dans la version de la langue courante ou alternative
|
||||
|
||||
Loading…
Reference in New Issue
Block a user