31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
39$langs->loadLangs(array(
"admin",
"other",
"orders"));
41$action =
GETPOST(
'action',
'aZ09');
43$type =
GETPOST(
'type',
'alpha');
44$value =
GETPOST(
'value',
'alpha');
45$modulepart =
GETPOST(
'modulepart',
'aZ09');
47$label =
GETPOST(
'label',
'alpha');
48$scandir =
GETPOST(
'scan_dir',
'alpha');
50$specimenthirdparty =
new Societe($db);
51$specimenthirdparty->initAsSpecimen();
64include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
66if ($action ==
'updateMask') {
67 $maskconstinvoice =
GETPOST(
'maskconstinvoice',
'aZ09');
68 $maskconstcredit =
GETPOST(
'maskconstcredit',
'aZ09');
69 $maskconstdeposit =
GETPOST(
'maskconstdeposit',
'aZ09');
70 $maskinvoice =
GETPOST(
'maskinvoice',
'alpha');
71 $maskcredit =
GETPOST(
'maskcredit',
'alpha');
72 $maskdeposit =
GETPOST(
'maskdeposit',
'alpha');
74 if ($maskconstinvoice && preg_match(
'/_MASK$/', $maskconstinvoice)) {
75 $res =
dolibarr_set_const($db, $maskconstinvoice, $maskinvoice,
'chaine', 0,
'', $conf->entity);
77 if ($maskconstcredit && preg_match(
'/_MASK$/', $maskconstcredit)) {
78 $res =
dolibarr_set_const($db, $maskconstcredit, $maskcredit,
'chaine', 0,
'', $conf->entity);
80 if ($maskconstdeposit && preg_match(
'/_MASK$/', $maskconstdeposit)) {
81 $res =
dolibarr_set_const($db, $maskconstdeposit, $maskdeposit,
'chaine', 0,
'', $conf->entity);
95if ($action ==
'specimen') {
96 $modele =
GETPOST(
'module',
'alpha');
99 $facture->initAsSpecimen();
100 $facture->thirdparty = $specimenthirdparty;
106 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
107 foreach ($dirmodels as $reldir) {
108 $file =
dol_buildpath($reldir.
"core/modules/supplier_invoice/doc/pdf_".$modele.
".modules.php", 0);
109 if (file_exists($file)) {
111 $classname =
"pdf_".$modele;
119 $module =
new $classname($db, $facture);
121 if ($module->write_file($facture, $langs) > 0) {
122 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf");
130 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
132} elseif ($action ==
'set') {
135} elseif ($action ==
'del') {
138 if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF ==
"$value") {
142} elseif ($action ==
'setdoc') {
144 if (
dolibarr_set_const($db,
"INVOICE_SUPPLIER_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
147 $conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value;
155} elseif ($action ==
'unsetdoc') {
159if ($action ==
'setmod') {
163 dolibarr_set_const($db,
"INVOICE_SUPPLIER_ADDON_NUMBER", $value,
'chaine', 0,
'', $conf->entity);
166if ($action ==
'addcat') {
168 $fourn->CreateCategory($user,
GETPOST(
'cat',
'alphanohtml'));
171if ($action ==
'set_SUPPLIER_INVOICE_FREE_TEXT') {
172 $freetext =
GETPOST(
'SUPPLIER_INVOICE_FREE_TEXT',
'restricthtml');
174 $res =
dolibarr_set_const($db,
"SUPPLIER_INVOICE_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
192$form =
new Form($db);
194$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
198$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
199print
load_fiche_titre($langs->trans(
"SuppliersSetup"), $linkback,
'title_setup');
210print
load_fiche_titre($langs->trans(
"SuppliersInvoiceNumberingModel"),
'',
'');
212print
'<div class="div-table-responsive-no-min">';
213print
'<table class="noborder centpercent">';
214print
'<tr class="liste_titre">';
215print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
216print
'<td>'.$langs->trans(
"Description").
'</td>';
217print
'<td>'.$langs->trans(
"Example").
'</td>';
218print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
219print
'<td align="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
224foreach ($dirmodels as $reldir) {
225 $dir =
dol_buildpath($reldir.
"core/modules/supplier_invoice");
228 $handle = opendir($dir);
229 if (is_resource($handle)) {
230 while (($file = readdir($handle)) !==
false) {
231 if (substr($file, 0, 24) ==
'mod_facture_fournisseur_' && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
232 $file = substr($file, 0,
dol_strlen($file) - 4);
234 require_once $dir.
'/'.$file.
'.php';
238 if ($module->isEnabled()) {
240 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
243 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
248 print
'<tr class="oddeven"><td>'.$module->nom.
"</td><td>\n";
249 print $module->info();
253 print
'<td class="nowrap">';
254 $tmp = $module->getExample();
255 if (preg_match(
'/^Error/', $tmp)) {
256 $langs->load(
"errors");
257 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
258 } elseif ($tmp ==
'NotConfigured') {
259 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
265 print
'<td class="center">';
266 if ($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER ==
"$file") {
267 print
img_picto($langs->trans(
"Activated"),
'switch_on');
269 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.newToken().
'&value='.urlencode($file).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
274 $invoice->initAsSpecimen();
278 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
279 $nextval = $module->getNextValue($mysoc, $invoice);
280 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
281 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
283 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
284 $nextval = $langs->trans($nextval);
286 $htmltooltip .= $nextval.
'<br>';
288 $htmltooltip .= $langs->trans($module->error).
'<br>';
292 print
'<td class="center">';
293 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
305print
'</table></div><br>';
320$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
321$sql .=
" WHERE type = 'invoice_supplier'";
322$sql .=
" AND entity = ".$conf->entity;
324$resql = $db->query($sql);
327 $num_rows = $db->num_rows($resql);
328 while ($i < $num_rows) {
329 $array = $db->fetch_array($resql);
330 array_push($def, $array[0]);
337print
'<div class="div-table-responsive-no-min">';
338print
'<table class="noborder centpercent">'.
"\n";
339print
'<tr class="liste_titre">'.
"\n";
340print
'<td width="100">'.$langs->trans(
"Name").
'</td>'.
"\n";
341print
'<td>'.$langs->trans(
"Description").
'</td>'.
"\n";
342print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>'.
"\n";
343print
'<td align="center" width="60">'.$langs->trans(
"Default").
'</td>'.
"\n";
344print
'<td align="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
345print
'<td align="center" width="40">'.$langs->trans(
"Preview").
'</td>';
350foreach ($dirmodels as $reldir) {
351 $realpath = $reldir.
"core/modules/supplier_invoice/doc";
355 $handle = opendir($dir);
358 if (is_resource($handle)) {
359 while (($file = readdir($handle)) !==
false) {
360 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
361 $name = substr($file, 4,
dol_strlen($file) - 16);
362 $classname = substr($file, 0,
dol_strlen($file) - 12);
364 require_once $dir.
'/'.$file;
368 print
"<tr class=\"oddeven\">\n";
370 print (empty($module->name) ? $name : $module->
name);
373 require_once $dir.
'/'.$file;
374 $module =
new $classname($db, $specimenthirdparty);
375 if (method_exists($module,
'info')) {
376 print $module->info($langs);
378 print $module->description;
384 if (in_array($name, $def)) {
385 print
'<td class="center">'.
"\n";
389 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'&type=invoice_supplier">';
390 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
399 print
'<td class="center">'.
"\n";
400 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'&type=invoice_supplier">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
405 print
'<td class="center">';
409 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=unsetdoc&token='.newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'&type=invoice_supplier"" alt="'.$langs->trans(
"Disable").
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
411 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'&type=invoice_supplier"" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
416 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
417 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
418 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
419 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
421 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
422 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
423 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
424 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
425 print
'<td class="center">';
426 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
428 print
'<td class="center">';
429 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.urlencode($name).
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
441print
'</table></div><br>';
447print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
448print
'<input type="hidden" name="token" value="'.newToken().
'">';
449print
'<input type="hidden" name="action" value="set_SUPPLIER_INVOICE_FREE_TEXT">';
453print
'<div class="div-table-responsive-no-min">';
454print
'<table class="noborder centpercent">';
455print
'<tr class="liste_titre">';
456print
'<td>'.$langs->trans(
"Parameter").
'</td>';
457print
'<td align="center" width="60">'.$langs->trans(
"Value").
'</td>';
458print
'<td width="80"> </td>';
462$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
463$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
464foreach ($substitutionarray as $key => $val) {
465 $htmltext .= $key.
'<br>';
469print
'<tr class="oddeven"><td colspan="2">';
470print $form->textwithpicto($langs->trans(
"FreeLegalTextOnInvoices"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
471$variablename =
'SUPPLIER_INVOICE_FREE_TEXT';
472if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
473 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
475 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
477 print $doleditor->Create();
479print
'</td><td class="right">';
480print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
483print
'</table></div><br>';
494print
'<div class="div-table-responsive-no-min">';
495print
'<table class="noborder centpercent">';
496print
'<tr class="liste_titre">';
497print
'<td>'.$langs->trans(
"Parameter").
'</td>';
498print
'<td align="center" width="60"></td>';
499print
'<td width="80"> </td>';
502print
'<tr class="oddeven"><td colspan="2">';
503print $langs->trans(
"YouMayFindNotificationsFeaturesIntoModuleNotification").
'<br>';
504print
'</td><td class="right">';
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage a WYSIWYG editor.
Class to manage suppliers invoices.
Class to manage suppliers.
Class to manage third parties objects (customers, suppliers, prospects...)
supplierorder_admin_prepare_head()
Return array head with list of tabs to view object informations.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.