Fix: merge problem
This commit is contained in:
parent
f3cb926c3c
commit
6aa7e90834
@ -75,33 +75,42 @@ if ($action == 'specimen') // For orders
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
$commande->thirdparty=$specimenthirdparty;
|
||||
|
||||
// Charge le modele
|
||||
$dir = "/core/modules/supplier_order/pdf/";
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
$file = dol_buildpath($dir.$file);
|
||||
if (file_exists($file))
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($file);
|
||||
|
||||
$obj = new $classname($db,$commande);
|
||||
|
||||
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>';
|
||||
dol_syslog($obj->error, LOG_ERR);
|
||||
}
|
||||
$file=dol_buildpath($reldir."core/modules/supplier_order/pdf/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once($file);
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($commande,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<font class="error">'.$module->error.'</font>';
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
$mesg='<font class="error">'.$langs->trans("ErrorModuleNotFound").'</font>';
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,33 +121,42 @@ if ($action == 'specimenfacture') // For invoices
|
||||
$facture = new FactureFournisseur($db);
|
||||
$facture->initAsSpecimen();
|
||||
$facture->thirdparty=$specimenthirdparty; // Define who should has build the invoice (so the supplier)
|
||||
|
||||
// Charge le modele
|
||||
$dir = "/core/modules/supplier_invoice/pdf/";
|
||||
$file = "pdf_".$modele.".modules.php";
|
||||
$file = dol_buildpath($dir.$file);
|
||||
if (file_exists($file))
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$classname = "pdf_".$modele;
|
||||
require_once($file);
|
||||
|
||||
$obj = new $classname($db,$facture);
|
||||
|
||||
if ($obj->write_file($facture,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$obj->error.'</div>';
|
||||
dol_syslog($obj->error, LOG_ERR);
|
||||
}
|
||||
$file=dol_buildpath($reldir."core/modules/supplier_invoice/pdf/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once($file);
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($facture,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<font class="error">'.$module->error.'</font>';
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
$mesg='<font class="error">'.$langs->trans("ErrorModuleNotFound").'</font>';
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,10 +262,12 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("SuppliersSetup"),$linkback,'setup');
|
||||
|
||||
@ -269,9 +289,9 @@ print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = $dirroot . "/core/modules/supplier_order/";
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_order/");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -403,9 +423,9 @@ print '</tr>'."\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = $dirroot . "/core/modules/supplier_order/pdf/";
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_order/pdf/");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -536,9 +556,9 @@ print '</tr>'."\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = $dirroot . "/core/modules/supplier_invoice/pdf/";
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -645,7 +665,6 @@ print '</form>';
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
llxFooter();
|
||||
?>
|
||||
|
||||
@ -65,9 +65,6 @@ class Conf
|
||||
public $barcode_modules = array();
|
||||
public $substitutions_modules = array();
|
||||
public $societe_modules = array();
|
||||
public $facture_modules = array();
|
||||
public $commande_modules = array();
|
||||
public $propale_modules = array();
|
||||
|
||||
var $logbuffer = array();
|
||||
|
||||
@ -171,7 +168,7 @@ class Conf
|
||||
$arrValue = @unserialize($value);
|
||||
if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue;
|
||||
else if (in_array($partname,array('login','menus','triggers'))) $value = '/'.$modulename.'/core/'.$partname.'/';
|
||||
else if (in_array($partname,array('models','facture','commande','propale'))) $value = '/'.$modulename.'/';
|
||||
else if (in_array($partname,array('models'))) $value = '/'.$modulename.'/';
|
||||
else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/';
|
||||
$this->$varname = array_merge($this->$varname, array($modulename => $value)); // TODO deprecated
|
||||
$this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value));
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
@ -76,7 +77,6 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs)
|
||||
@set_time_limit(120);
|
||||
error_reporting($err);
|
||||
|
||||
$dir = "/core/modules/supplier_invoice/";
|
||||
$srctemplatepath='';
|
||||
|
||||
// Positionne modele sur le nom du modele de invoice fournisseur a utiliser
|
||||
@ -102,19 +102,23 @@ function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs)
|
||||
|
||||
// Search template file
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
foreach(array('doc','pdf') as $prefix)
|
||||
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file = $prefix."_".$modele.".modules.php";
|
||||
|
||||
// On verifie l'emplacement du modele
|
||||
$file = dol_buildpath($dir.'pdf/'.$file); // TODO rename into doc/
|
||||
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname=$prefix.'_'.$modele;
|
||||
break;
|
||||
}
|
||||
foreach(array('doc','pdf') as $prefix)
|
||||
{
|
||||
$file = $prefix."_".$modele.".modules.php";
|
||||
|
||||
// On verifie l'emplacement du modele
|
||||
$file=dol_buildpath($reldir."core/modules/supplier_invoice/pdf/".$file,0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname=$prefix.'_'.$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($filefound) break;
|
||||
}
|
||||
|
||||
// Charge le modele
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
@ -153,43 +153,62 @@ function supplier_order_pdf_create($db, $object, $model, $outputlangs, $hidedeta
|
||||
{
|
||||
global $conf,$langs;
|
||||
$langs->load("suppliers");
|
||||
|
||||
$dir = "/core/modules/supplier_order/pdf/";
|
||||
|
||||
$error=0;
|
||||
|
||||
// Increase limit for PDF build
|
||||
$err=error_reporting();
|
||||
error_reporting(0);
|
||||
@set_time_limit(120);
|
||||
error_reporting($err);
|
||||
|
||||
$srctemplatepath='';
|
||||
$modelisok=0;
|
||||
$liste=array();
|
||||
|
||||
// Positionne modele sur le nom du modele de commande fournisseur a utiliser
|
||||
$file = "pdf_".$model.".modules.php";
|
||||
// On verifie l'emplacement du modele
|
||||
$file = dol_buildpath($dir.$file);
|
||||
if ($model && file_exists($file)) $modelisok=1;
|
||||
|
||||
// Si model pas encore bon
|
||||
if (! $modelisok)
|
||||
|
||||
// Positionne le modele sur le nom du modele a utiliser
|
||||
if (! dol_strlen($modele))
|
||||
{
|
||||
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF) $model = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF;
|
||||
$file = "pdf_".$model.".modules.php";
|
||||
// On verifie l'emplacement du modele
|
||||
$file = dol_buildpath($dir.$file);
|
||||
if (file_exists($file)) $modelisok=1;
|
||||
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF))
|
||||
{
|
||||
$modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF;
|
||||
}
|
||||
else
|
||||
{
|
||||
$modele = 'muscadet';
|
||||
}
|
||||
}
|
||||
|
||||
// Si model pas encore bon
|
||||
if (! $modelisok)
|
||||
|
||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
||||
$tmp=explode(':',$modele,2);
|
||||
if (! empty($tmp[1]))
|
||||
{
|
||||
$liste=ModelePDFSuppliersOrders::liste_modeles($db);
|
||||
$model=key($liste); // Renvoie la premiere valeur de cle trouvee dans le tableau
|
||||
$file = "pdf_".$model.".modules.php";
|
||||
// On verifie l'emplacement du modele
|
||||
$file = dol_buildpath($dir.$file);
|
||||
if (file_exists($file)) $modelisok=1;
|
||||
$modele=$tmp[0];
|
||||
$srctemplatepath=$tmp[1];
|
||||
}
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),$conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
foreach(array('doc','pdf') as $prefix)
|
||||
{
|
||||
$file = $prefix."_".$modele.".modules.php";
|
||||
|
||||
// On verifie l'emplacement du modele
|
||||
$file=dol_buildpath($reldir."core/modules/supplier_order/pdf/".$file,0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname=$prefix.'_'.$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($filefound) break;
|
||||
}
|
||||
|
||||
// Charge le modele
|
||||
if ($modelisok)
|
||||
if ($filefound)
|
||||
{
|
||||
$classname = "pdf_".$model;
|
||||
require_once($file);
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user