Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
c6b4259735
@ -53,10 +53,10 @@ $specimenthirdparty->initAsSpecimen();
|
|||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconstorder=GETPOST('maskconstorder','alpha');
|
$maskconstinvoice=GETPOST('maskconstinvoice','alpha');
|
||||||
$maskorder=GETPOST('maskorder','alpha');
|
$maskvalue=GETPOST('maskvalue','alpha');
|
||||||
|
|
||||||
if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity);
|
if ($maskconstinvoice) $res = dolibarr_set_const($db,$maskconstinvoice,$maskvalue,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
@ -116,71 +116,37 @@ if ($action == 'specimen') // For invoices
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'set')
|
// Activate a model
|
||||||
|
else if ($action == 'set')
|
||||||
{
|
{
|
||||||
$label = GETPOST('label','alpha');
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
$scandir = GETPOST('scandir','alpha');
|
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
|
||||||
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
|
|
||||||
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
|
|
||||||
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
|
|
||||||
$sql.= ")";
|
|
||||||
$res=$db->query($sql);
|
|
||||||
if ($res)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
// else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'del')
|
else if ($action == 'del')
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
$ret = delDocumentModel($value, $type);
|
||||||
$sql.= " WHERE nom = '".$value."'";
|
if ($ret > 0)
|
||||||
$sql.= " AND type = '".$type."'";
|
{
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$value") dolibarr_del_const($db, 'INVOICE_SUPPLIER_ADDON_PDF',$conf->entity);
|
||||||
$db->query($sql);
|
}
|
||||||
if ($res)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
// else dol_print_error($db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setdoc')
|
// Set default model
|
||||||
|
else if ($action == 'setdoc')
|
||||||
{
|
{
|
||||||
$label = GETPOST('label','alpha');
|
if (dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||||
$scandir = GETPOST('scandir','alpha');
|
{
|
||||||
|
// La constante qui a ete lue en avant du nouveau set
|
||||||
|
// on passe donc par une variable pour avoir un affichage coherent
|
||||||
|
$conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value;
|
||||||
|
}
|
||||||
|
|
||||||
$db->begin();
|
// On active le modele
|
||||||
|
$ret = delDocumentModel($value, $type);
|
||||||
if ($type == 'order_supplier' && dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
if ($ret > 0)
|
||||||
{
|
{
|
||||||
$conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value;
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// On active le modele
|
|
||||||
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
|
||||||
$sql_del.= " WHERE nom = '".$db->escape($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, libelle, description)";
|
|
||||||
$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
|
|
||||||
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
|
|
||||||
$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
|
|
||||||
$sql.= ")";
|
|
||||||
$result2=$db->query($sql);
|
|
||||||
if ($result1 && $result2)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setmod')
|
if ($action == 'setmod')
|
||||||
@ -294,7 +260,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
print $module->info();
|
print $module->info();
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Show example of numbering module
|
// Show example of numbering model
|
||||||
print '<td nowrap="nowrap">';
|
print '<td nowrap="nowrap">';
|
||||||
$tmp=$module->getExample();
|
$tmp=$module->getExample();
|
||||||
if (preg_match('/^Error/',$tmp)) {
|
if (preg_match('/^Error/',$tmp)) {
|
||||||
@ -447,7 +413,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Defaut
|
// Default
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name")
|
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name")
|
||||||
{
|
{
|
||||||
@ -484,6 +450,12 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table><br/>';
|
print '</table><br/>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Other options
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
print_titre($langs->trans("OtherOptions"));
|
print_titre($langs->trans("OtherOptions"));
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -25,7 +25,8 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/core/modules/expedition/modules_expedition.php
|
* \file htdocs/core/modules/expedition/modules_expedition.php
|
||||||
* \ingroup expedition
|
* \ingroup expedition
|
||||||
* \brief File of class to manage expedition numbering
|
* \brief File that contains parent class for sending receipts models
|
||||||
|
* and parent class for sending receipts numbering models
|
||||||
*/
|
*/
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||||
|
|
||||||
@ -60,15 +61,15 @@ abstract class ModelePdfExpedition extends CommonDocGenerator
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe mere des modeles de numerotation des references d expedition
|
* Parent Class of numbering models of sending receipts references
|
||||||
*/
|
*/
|
||||||
abstract class ModelNumRefExpedition
|
abstract class ModelNumRefExpedition
|
||||||
{
|
{
|
||||||
var $error='';
|
var $error='';
|
||||||
|
|
||||||
/** Return if a module can be used or not
|
/** Return if a model can be used or not
|
||||||
*
|
*
|
||||||
* @return boolean true if module can be used
|
* @return boolean true if model can be used
|
||||||
*/
|
*/
|
||||||
function isEnabled()
|
function isEnabled()
|
||||||
{
|
{
|
||||||
@ -88,7 +89,7 @@ abstract class ModelNumRefExpedition
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return numbering example
|
* Returns numbering example
|
||||||
*
|
*
|
||||||
* @return string Example
|
* @return string Example
|
||||||
*/
|
*/
|
||||||
@ -110,7 +111,7 @@ abstract class ModelNumRefExpedition
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return next value
|
* Returns next value assigned
|
||||||
*
|
*
|
||||||
* @param Societe $objsoc Third party object
|
* @param Societe $objsoc Third party object
|
||||||
* @param Object $shipment Shipment object
|
* @param Object $shipment Shipment object
|
||||||
@ -123,7 +124,7 @@ abstract class ModelNumRefExpedition
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return numbering version module
|
* Returns version of the numbering model
|
||||||
*
|
*
|
||||||
* @return string Value
|
* @return string Value
|
||||||
*/
|
*/
|
||||||
@ -158,7 +159,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
|||||||
|
|
||||||
$srctemplatepath='';
|
$srctemplatepath='';
|
||||||
|
|
||||||
// Positionne le modele sur le nom du modele a utiliser
|
// Sets the model on the model name to use
|
||||||
if (! dol_strlen($modele))
|
if (! dol_strlen($modele))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->EXPEDITION_ADDON_PDF))
|
if (! empty($conf->global->EXPEDITION_ADDON_PDF))
|
||||||
@ -171,7 +172,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
// If selected model is a filename template (then $modele="modelname:filename")
|
||||||
$tmp=explode(':',$modele,2);
|
$tmp=explode(':',$modele,2);
|
||||||
if (! empty($tmp[1]))
|
if (! empty($tmp[1]))
|
||||||
{
|
{
|
||||||
@ -189,7 +190,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
|||||||
{
|
{
|
||||||
$file = $prefix."_expedition_".$modele.".modules.php";
|
$file = $prefix."_expedition_".$modele.".modules.php";
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
// We check the model location
|
||||||
$file=dol_buildpath($reldir."core/modules/expedition/doc/".$file,0);
|
$file=dol_buildpath($reldir."core/modules/expedition/doc/".$file,0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
@ -201,7 +202,7 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
|||||||
if ($filefound) break;
|
if ($filefound) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Charge le modele
|
// Load the model
|
||||||
if ($filefound)
|
if ($filefound)
|
||||||
{
|
{
|
||||||
require_once $file;
|
require_once $file;
|
||||||
@ -221,14 +222,14 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
|||||||
//require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
//require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
//dol_delete_preview($object);
|
//dol_delete_preview($object);
|
||||||
|
|
||||||
// Appel des triggers
|
// Calls triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface=new Interfaces($db);
|
$interface=new Interfaces($db);
|
||||||
$result=$interface->run_triggers('SHIPPING_BUILDDOC',$object,$user,$langs,$conf);
|
$result=$interface->run_triggers('SHIPPING_BUILDDOC',$object,$user,$langs,$conf);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++; $this->errors=$interface->errors;
|
$error++; $this->errors=$interface->errors;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End calls triggers
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -242,8 +243,15 @@ function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file));
|
if (! $conf->global->EXPEDITION_ADDON_PDF)
|
||||||
return -1;
|
{
|
||||||
|
print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_PDF_NotDefined");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -102,7 +102,7 @@ class modFournisseur extends DolibarrModules
|
|||||||
|
|
||||||
$this->const[$r][0] = "INVOICE_SUPPLIER_ADDON_NUMBER";
|
$this->const[$r][0] = "INVOICE_SUPPLIER_ADDON_NUMBER";
|
||||||
$this->const[$r][1] = "chaine";
|
$this->const[$r][1] = "chaine";
|
||||||
$this->const[$r][2] = "mod_facture_fournisseur_tulip";
|
$this->const[$r][2] = "mod_facture_fournisseur_cactus";
|
||||||
$this->const[$r][3] = 'Nom du gestionnaire de numerotation des factures fournisseur';
|
$this->const[$r][3] = 'Nom du gestionnaire de numerotation des factures fournisseur';
|
||||||
$this->const[$r][4] = 0;
|
$this->const[$r][4] = 0;
|
||||||
$r++;
|
$r++;
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/core/modules/supplier_order/modules_commandefournisseur.php
|
* \file htdocs/core/modules/supplier_order/modules_commandefournisseur.php
|
||||||
* \ingroup commande fournisseur
|
* \ingroup commande fournisseur
|
||||||
* \brief File that contain parent class for supplier orders models
|
* \brief File that contains parent class for supplier orders models
|
||||||
* and parent class for supplier orders numbering models
|
* and parent class for supplier orders numbering models
|
||||||
*/
|
*/
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||||
@ -44,13 +44,13 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator
|
|||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param string $maxfilenamelength Max length of value to show
|
* @param string $maxfilenamelength Max length of value to show
|
||||||
* @return array List of numbers
|
* @return array List of templates
|
||||||
*/
|
*/
|
||||||
static function liste_modeles($db,$maxfilenamelength=0)
|
static function liste_modeles($db,$maxfilenamelength=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$type='order_supplier';
|
$type='supplier_order';
|
||||||
$liste=array();
|
$liste=array();
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
@ -79,7 +79,7 @@ abstract class ModeleNumRefSuppliersOrders
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the default description of the model numbering
|
/** Returns default description of numbering model
|
||||||
*
|
*
|
||||||
* @return string Description Text
|
* @return string Description Text
|
||||||
*/
|
*/
|
||||||
@ -101,7 +101,7 @@ abstract class ModeleNumRefSuppliersOrders
|
|||||||
return $langs->trans("NoExample");
|
return $langs->trans("NoExample");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Tests if the numbers already in force in the database do not cause conflicts that would prevent this numbering.
|
/** Tests if existing numbers make problems with numbering
|
||||||
*
|
*
|
||||||
* @return boolean false if conflict, true if ok
|
* @return boolean false if conflict, true if ok
|
||||||
*/
|
*/
|
||||||
@ -120,7 +120,7 @@ abstract class ModeleNumRefSuppliersOrders
|
|||||||
return $langs->trans("NotAvailable");
|
return $langs->trans("NotAvailable");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns version of the model numbering
|
/** Returns version of the numbering model
|
||||||
*
|
*
|
||||||
* @return string Value
|
* @return string Value
|
||||||
*/
|
*/
|
||||||
@ -138,7 +138,7 @@ abstract class ModeleNumRefSuppliersOrders
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a document onto disk according to template module.
|
* Create a document onto disk according to template model.
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param Object $object Object supplier order
|
* @param Object $object Object supplier order
|
||||||
@ -164,7 +164,7 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet
|
|||||||
|
|
||||||
$srctemplatepath='';
|
$srctemplatepath='';
|
||||||
|
|
||||||
// Set the model on the model name to use
|
// Sets the model on the model name to use
|
||||||
if (! dol_strlen($modele))
|
if (! dol_strlen($modele))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF))
|
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF))
|
||||||
@ -195,7 +195,7 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet
|
|||||||
{
|
{
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
$file = $prefix."_".$modele.".modules.php";
|
||||||
|
|
||||||
// We checked the location of the model
|
// We check the model location
|
||||||
$file=dol_buildpath($reldir."core/modules/supplier_order/pdf/".$file,0);
|
$file=dol_buildpath($reldir."core/modules/supplier_order/pdf/".$file,0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
@ -229,7 +229,9 @@ function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedet
|
|||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface=new Interfaces($db);
|
$interface=new Interfaces($db);
|
||||||
$result=$interface->run_triggers('ORDER_SUPPLIER_BUILDDOC',$object,$user,$langs,$conf);
|
$result=$interface->run_triggers('ORDER_SUPPLIER_BUILDDOC',$object,$user,$langs,$conf);
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
if ($result < 0) {
|
||||||
|
$error++; $this->errors=$interface->errors;
|
||||||
|
}
|
||||||
// End calls triggers
|
// End calls triggers
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user