Qual: Uniformize code and remove useless function
This commit is contained in:
parent
d08e058726
commit
ee47cf17cf
@ -190,7 +190,7 @@ if ($_GET["action"] == 'delete')
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View page
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader("",$langs->trans("BillsSetup"),'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura');
|
llxHeader("",$langs->trans("BillsSetup"),'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura');
|
||||||
|
|||||||
@ -84,6 +84,45 @@ if ($_POST["action"] == 'updateMask')
|
|||||||
dolibarr_set_const($db, "COMPANY_ELEPHANT_MASK_SUPPLIER",$_POST["masksupplier"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "COMPANY_ELEPHANT_MASK_SUPPLIER",$_POST["masksupplier"],'chaine',0,'',$conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_GET["action"] == 'set')
|
||||||
|
{
|
||||||
|
$type='company';
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")";
|
||||||
|
if ($db->query($sql))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_GET["action"] == 'setdoc')
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
if (dolibarr_set_const($db, "COMPANY_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity))
|
||||||
|
{
|
||||||
|
$conf->global->COMPANY_ADDON_PDF = $_GET["value"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// On active le modele
|
||||||
|
$type='company';
|
||||||
|
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||||
|
$sql_del.= " WHERE nom = '".$_GET["value"]."'";
|
||||||
|
$sql_del.= " AND type = '".$type."'";
|
||||||
|
$sql_del.= " AND entity = ".$conf->entity;
|
||||||
|
$result1=$db->query($sql_del);
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")";
|
||||||
|
$result2=$db->query($sql);
|
||||||
|
if ($result1 && $result2)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -228,8 +267,143 @@ if ($handle)
|
|||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
|
//
|
||||||
|
/*
|
||||||
|
* Modeles de documents
|
||||||
|
*/
|
||||||
|
print '<br>';
|
||||||
|
print_titre($langs->trans("ModelModules"));
|
||||||
|
|
||||||
|
// Defini tableau def de modele invoice
|
||||||
|
$def = array();
|
||||||
|
$sql = "SELECT nom";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||||
|
$sql.= " WHERE type = 'company'";
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
$num_rows=$db->num_rows($resql);
|
||||||
|
while ($i < $num_rows)
|
||||||
|
{
|
||||||
|
$array = $db->fetch_array($resql);
|
||||||
|
array_push($def, $array[0]);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("Name").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Description").'</td>';
|
||||||
|
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
|
||||||
|
print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
|
||||||
|
print '<td align="center" width="32" colspan="2">'.$langs->trans("Infos").'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
clearstatcache();
|
||||||
|
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
foreach ($conf->file->dol_document_root as $dirroot)
|
||||||
|
{
|
||||||
|
$dir = $dirroot . "/includes/modules/societe/doc";
|
||||||
|
|
||||||
|
if (is_dir($dir))
|
||||||
|
{
|
||||||
|
$handle=opendir($dir);
|
||||||
|
if ($handle)
|
||||||
|
{
|
||||||
|
while (($file = readdir($handle))!==false)
|
||||||
|
{
|
||||||
|
if (preg_match('/\.modules\.php$/i',$file))
|
||||||
|
{
|
||||||
|
$var = !$var;
|
||||||
|
$name = substr($file, 4, strlen($file) -16);
|
||||||
|
$classname = substr($file, 0, strlen($file) -12);
|
||||||
|
|
||||||
|
print '<tr '.$bc[$var].'><td width="100">';
|
||||||
|
echo "$name";
|
||||||
|
print "</td><td>\n";
|
||||||
|
|
||||||
|
require_once($dir.'/'.$file);
|
||||||
|
$module = new $classname($db);
|
||||||
|
print $module->description;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Active
|
||||||
|
if (in_array($name, $def))
|
||||||
|
{
|
||||||
|
print "<td align=\"center\">\n";
|
||||||
|
if ($conf->global->COMPANY_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 "</td>";
|
||||||
|
}
|
||||||
|
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->COMPANY_ADDON_PDF == "$name")
|
||||||
|
{
|
||||||
|
print img_tick($langs->trans("Default"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'" alt="'.$langs->trans("Default").'">'.$langs->trans("Default").'</a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Info
|
||||||
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||||
|
if ($modele->type == 'pdf')
|
||||||
|
{
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
|
||||||
|
}
|
||||||
|
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraft").': '.yn($module->option_draft_watermark,1,1);
|
||||||
|
|
||||||
|
|
||||||
|
print '<td align="center">';
|
||||||
|
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($modele->type == 'pdf')
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
|
||||||
|
}
|
||||||
|
else print ' ';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
// Autres options
|
// Autres options
|
||||||
$html=new Form($db);
|
$html=new Form($db);
|
||||||
|
|||||||
@ -20,19 +20,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/compta/export/ComptaJournalPdf.php
|
* \file htdocs/compta/export/ComptaJournalPdf.php
|
||||||
\ingroup compta
|
* \ingroup compta
|
||||||
\brief Fichier de la classe export compta journal
|
* \brief Fichier de la classe export compta journal
|
||||||
\version $Revision$
|
* \version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\class ComptaJournalPdf
|
* \class ComptaJournalPdf
|
||||||
\brief Classe export compta journal
|
* \brief Classe export compta journal
|
||||||
*/
|
*/
|
||||||
class ComptaJournalPdf extends FPDF {
|
class ComptaJournalPdf extends FPDF {
|
||||||
|
|
||||||
|
|||||||
@ -516,7 +516,7 @@ class RemiseCheque extends CommonObject
|
|||||||
{
|
{
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
$outputlangs->charset_output=$sav_charset_output;
|
||||||
dol_syslog("Error");
|
dol_syslog("Error");
|
||||||
dol_print_error($db,$pdf->pdferror());
|
dol_print_error($db,$pdf->error);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,7 +72,7 @@ if ($_POST["action"] == 'builddoc')
|
|||||||
{
|
{
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
$outputlangs->charset_output=$sav_charset_output;
|
||||||
dol_syslog("Erreur dans commande_pdf_create");
|
dol_syslog("Erreur dans commande_pdf_create");
|
||||||
dol_print_error($db,$obj->pdferror());
|
dol_print_error($db,$obj->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$year = $_POST["reyear"];
|
$year = $_POST["reyear"];
|
||||||
|
|||||||
@ -1458,8 +1458,16 @@ class Facture extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
if ($this->statut != 0)
|
$error=0;
|
||||||
|
|
||||||
|
if ($this->statut == 0)
|
||||||
{
|
{
|
||||||
|
dol_syslog("Facture::set_draft already draft status", LOG_WARNING);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
|
||||||
$sql.= " SET fk_statut = 0";
|
$sql.= " SET fk_statut = 0";
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
@ -1484,17 +1492,22 @@ class Facture extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($error == 0)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("Facture::set_draft Invoice already with draf status", LOG_WARNING);
|
$this->error=$this->db->error();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
|
* \file htdocs/includes/modules/expedition/pdf/pdf_expedition_merou.modules.php
|
||||||
* \ingroup expedition
|
* \ingroup expedition
|
||||||
* \brief Fichier de la classe permettant de generer les bordereaux envoi au mod<EFBFBD>le Merou
|
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Merou
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -138,17 +138,19 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
//Si le dossier existe
|
//Si le dossier existe
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Initialisation Bon vierge
|
|
||||||
$pdf = new FPDI_Protection('l','mm',$this->format);
|
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
{
|
{
|
||||||
|
$pdf=new FPDI_Protection('l','mm',$this->format);
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||||
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
|
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
|
||||||
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pdf=new FPDI('l','mm',$this->format);
|
||||||
|
}
|
||||||
|
|
||||||
$pdf->Open();
|
$pdf->Open();
|
||||||
$pagenb=0;
|
$pagenb=0;
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
|
* \file htdocs/includes/modules/expedition/pdf/pdf_expedition_rouget.modules.php
|
||||||
* \ingroup expedition
|
* \ingroup expedition
|
||||||
* \brief Fichier de la classe permettant de generer les bordereaux envoi au mod<EFBFBD>le Rouget
|
* \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Rouget
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -40,8 +40,8 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Constructeur
|
* \brief Constructeur
|
||||||
\param db Handler acc<EFBFBD>s base de donn<EFBFBD>e
|
* \param db Database handler
|
||||||
*/
|
*/
|
||||||
function pdf_expedition_rouget($db=0)
|
function pdf_expedition_rouget($db=0)
|
||||||
{
|
{
|
||||||
@ -263,7 +263,19 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
|||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
$pdf=new ModelePdfExpedition();
|
// Protection et encryption du pdf
|
||||||
|
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
|
{
|
||||||
|
$pdf=new FPDI_Protection('P','mm',$this->format);
|
||||||
|
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||||
|
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||||
|
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
|
||||||
|
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pdf=new FPDI('P','mm',$this->format);
|
||||||
|
}
|
||||||
|
|
||||||
$pdf->Open();
|
$pdf->Open();
|
||||||
$pagenb=0;
|
$pagenb=0;
|
||||||
|
|||||||
@ -779,6 +779,9 @@ ModuleCompanyCodePanicum=Return an empty accountancy code.
|
|||||||
ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code.
|
ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code.
|
||||||
UseNotifications=Use notifications
|
UseNotifications=Use notifications
|
||||||
NotificationsDesc=EMails notifications feature allows you to silently send automatic mail, for some Dolibarr events, to third parties (customers or suppliers) that are configured to. Choice of active notification and targets contacts is made one third party at time.
|
NotificationsDesc=EMails notifications feature allows you to silently send automatic mail, for some Dolibarr events, to third parties (customers or suppliers) that are configured to. Choice of active notification and targets contacts is made one third party at time.
|
||||||
|
ModelModules=Documents templates
|
||||||
|
DocumentModelOdt=Generate documents from .ODT file format templates (OpenOffice...)
|
||||||
|
WatermarkOnDraft=Watermark on draft document
|
||||||
##### Webcal setup #####
|
##### Webcal setup #####
|
||||||
WebCalSetup=Webcalendar link setup
|
WebCalSetup=Webcalendar link setup
|
||||||
WebCalSyncro=Add Dolibarr events to WebCalendar
|
WebCalSyncro=Add Dolibarr events to WebCalendar
|
||||||
|
|||||||
@ -779,6 +779,9 @@ ModuleCompanyCodePanicum = Renvoie un code compta vide.
|
|||||||
ModuleCompanyCodeDigitaria = Renvoie un code compta composé suivant le code tiers. Le code est composé du caractère 'C' en première position suivi des 5 premiers caractères du code tiers.
|
ModuleCompanyCodeDigitaria = Renvoie un code compta composé suivant le code tiers. Le code est composé du caractère 'C' en première position suivi des 5 premiers caractères du code tiers.
|
||||||
UseNotifications = Utiliser les notifications
|
UseNotifications = Utiliser les notifications
|
||||||
NotificationsDesc = La fonction des notifications par emails permet d'envoyer automatiquement un email, pour certains évênement Dolibarr, aux tiers (sociétés clients, prospects ou fournisseurs) configurés pour. Le choix des notifications et contacts destinataires se fait tiers par tiers.
|
NotificationsDesc = La fonction des notifications par emails permet d'envoyer automatiquement un email, pour certains évênement Dolibarr, aux tiers (sociétés clients, prospects ou fournisseurs) configurés pour. Le choix des notifications et contacts destinataires se fait tiers par tiers.
|
||||||
|
ModelModules=Modèle de documents
|
||||||
|
DocumentModelOdt=Genérateur depuis des modèles au format .ODT (OpenOffice...)
|
||||||
|
WatermarkOnDraft=Filigrame sur les documents brouillons
|
||||||
##### Webcal setup ##### = undefined
|
##### Webcal setup ##### = undefined
|
||||||
WebCalSetup = Configuration du lien vers le calendrier Webcalendar
|
WebCalSetup = Configuration du lien vers le calendrier Webcalendar
|
||||||
WebCalSyncro = Intégrer les évênements Dolibarr dans WebCalendar
|
WebCalSyncro = Intégrer les évênements Dolibarr dans WebCalendar
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user