33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
41$langs->loadLangs(array(
"admin",
"other",
"orders"));
43$action =
GETPOST(
'action',
'aZ09');
45$type =
GETPOST(
'type',
'alpha');
46$value =
GETPOST(
'value',
'alpha');
47$modulepart =
GETPOST(
'modulepart',
'aZ09');
49$label =
GETPOST(
'label',
'alpha');
50$scandir =
GETPOST(
'scan_dir',
'alpha');
52$specimenthirdparty =
new Societe($db);
53$specimenthirdparty->initAsSpecimen();
66include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
68if ($action ==
'updateMask') {
69 $maskconstinvoice =
GETPOST(
'maskconstinvoice',
'aZ09');
70 $maskconstcredit =
GETPOST(
'maskconstcredit',
'aZ09');
71 $maskconstdeposit =
GETPOST(
'maskconstdeposit',
'aZ09');
72 $maskinvoice =
GETPOST(
'maskinvoice',
'alpha');
73 $maskcredit =
GETPOST(
'maskcredit',
'alpha');
74 $maskdeposit =
GETPOST(
'maskdeposit',
'alpha');
77 if ($maskconstinvoice && preg_match(
'/_MASK$/', $maskconstinvoice)) {
78 $res =
dolibarr_set_const($db, $maskconstinvoice, $maskinvoice,
'chaine', 0,
'', $conf->entity);
80 if ($maskconstcredit && preg_match(
'/_MASK$/', $maskconstcredit)) {
81 $res =
dolibarr_set_const($db, $maskconstcredit, $maskcredit,
'chaine', 0,
'', $conf->entity);
83 if ($maskconstdeposit && preg_match(
'/_MASK$/', $maskconstdeposit)) {
84 $res =
dolibarr_set_const($db, $maskconstdeposit, $maskdeposit,
'chaine', 0,
'', $conf->entity);
98if ($action ==
'specimen') {
99 $modele =
GETPOST(
'module',
'alpha');
102 $facture->initAsSpecimen();
103 $facture->thirdparty = $specimenthirdparty;
108 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
109 foreach ($dirmodels as $reldir) {
110 $file =
dol_buildpath($reldir.
"core/modules/supplier_invoice/doc/pdf_".$modele.
".modules.php", 0);
111 if (file_exists($file)) {
112 $classname =
"pdf_".$modele;
117 if ($classname !==
'') {
120 $module =
new $classname($db, $facture);
121 '@phan-var-force ModelePDFSuppliersInvoices $module';
123 if ($module->write_file($facture, $langs) > 0) {
124 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf");
132 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
134} elseif ($action ==
'set') {
137} elseif ($action ==
'del') {
140 if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF ==
"$value") {
144} elseif ($action ==
'setdoc') {
146 if (
dolibarr_set_const($db,
"INVOICE_SUPPLIER_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
149 $conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value;
157} elseif ($action ==
'unsetdoc') {
161if ($action ==
'setmod') {
165 dolibarr_set_const($db,
"INVOICE_SUPPLIER_ADDON_NUMBER", $value,
'chaine', 0,
'', $conf->entity);
168if ($action ==
'addcat') {
170 $fourn->CreateCategory($user,
GETPOST(
'cat',
'alphanohtml'));
173if ($action ==
'set_SUPPLIER_INVOICE_FREE_TEXT') {
174 $freetext =
GETPOST(
'SUPPLIER_INVOICE_FREE_TEXT',
'restricthtml');
176 $res =
dolibarr_set_const($db,
"SUPPLIER_INVOICE_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
194$form =
new Form($db);
196$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
198llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-supplier_invoice');
200$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
201print
load_fiche_titre($langs->trans(
"SuppliersSetup"), $linkback,
'title_setup');
212print
load_fiche_titre($langs->trans(
"SuppliersInvoiceNumberingModel"),
'',
'');
214print
'<div class="div-table-responsive-no-min">';
215print
'<table class="noborder centpercent">';
216print
'<tr class="liste_titre">';
217print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
218print
'<td>'.$langs->trans(
"Description").
'</td>';
219print
'<td>'.$langs->trans(
"Example").
'</td>';
220print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
221print
'<td align="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
226foreach ($dirmodels as $reldir) {
227 $dir =
dol_buildpath($reldir.
"core/modules/supplier_invoice");
230 $handle = opendir($dir);
231 if (is_resource($handle)) {
232 while (($file = readdir($handle)) !==
false) {
233 if (substr($file, 0, 24) ==
'mod_facture_fournisseur_' && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
234 $file = substr($file, 0,
dol_strlen($file) - 4);
236 require_once $dir.
'/'.$file.
'.php';
238 $module =
new $file();
240 '@phan-var-force ModeleNumRefSuppliersInvoices $module';
242 if ($module->isEnabled()) {
244 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
247 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
252 print
'<tr class="oddeven"><td>'.$module->getName($langs).
"</td><td>\n";
253 print $module->info($langs);
257 print
'<td class="nowrap">';
258 $tmp = $module->getExample();
259 if (preg_match(
'/^Error/', $tmp)) {
260 $langs->load(
"errors");
261 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
262 } elseif ($tmp ==
'NotConfigured') {
263 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
269 print
'<td class="center">';
270 if ($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER ==
"$file") {
271 print
img_picto($langs->trans(
"Activated"),
'switch_on');
273 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>';
278 $invoice->initAsSpecimen();
282 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
283 $nextval = $module->getNextValue($mysoc, $invoice);
284 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
285 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
287 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
288 $nextval = $langs->trans($nextval);
290 $htmltooltip .= $nextval.
'<br>';
292 $htmltooltip .= $langs->trans($module->error).
'<br>';
296 print
'<td class="center">';
297 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
309print
'</table></div><br>';
324$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
325$sql .=
" WHERE type = 'invoice_supplier'";
326$sql .=
" AND entity = ".$conf->entity;
328$resql = $db->query($sql);
331 $num_rows = $db->num_rows($resql);
332 while ($i < $num_rows) {
333 $array = $db->fetch_array($resql);
334 if (is_array($array)) {
335 array_push($def, $array[0]);
343print
'<div class="div-table-responsive-no-min">';
344print
'<table class="noborder centpercent">'.
"\n";
345print
'<tr class="liste_titre">'.
"\n";
346print
'<td width="100">'.$langs->trans(
"Name").
'</td>'.
"\n";
347print
'<td>'.$langs->trans(
"Description").
'</td>'.
"\n";
348print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>'.
"\n";
349print
'<td align="center" width="60">'.$langs->trans(
"Default").
'</td>'.
"\n";
350print
'<td align="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
351print
'<td align="center" width="40">'.$langs->trans(
"Preview").
'</td>';
356foreach ($dirmodels as $reldir) {
357 $realpath = $reldir.
"core/modules/supplier_invoice/doc";
361 $handle = opendir($dir);
364 if (is_resource($handle)) {
365 while (($file = readdir($handle)) !==
false) {
366 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
367 $name = substr($file, 4,
dol_strlen($file) - 16);
368 $classname = substr($file, 0,
dol_strlen($file) - 12);
370 require_once $dir.
'/'.$file;
373 '@phan-var-force ModelePDFSuppliersInvoices $module';
376 print
"<tr class=\"oddeven\">\n";
378 print(empty($module->name) ? $name : $module->
name);
381 require_once $dir.
'/'.$file;
382 $module =
new $classname($db, $specimenthirdparty);
383 '@phan-var-force ModelePDFSuppliersInvoices $module';
384 if (method_exists($module,
'info')) {
385 print $module->info($langs);
387 print $module->description;
393 if (in_array($name, $def)) {
394 print
'<td class="center">'.
"\n";
398 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">';
399 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
408 print
'<td class="center">'.
"\n";
409 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>';
414 print
'<td class="center">';
418 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>';
420 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>';
425 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
426 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
427 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
428 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
430 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
431 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
432 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
433 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
434 print
'<td class="center">';
435 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
437 print
'<td class="center">';
438 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.urlencode($name).
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
450print
'</table></div><br>';
456print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
457print
'<input type="hidden" name="token" value="'.newToken().
'">';
458print
'<input type="hidden" name="action" value="set_SUPPLIER_INVOICE_FREE_TEXT">';
462print
'<div class="div-table-responsive-no-min">';
463print
'<table class="noborder centpercent">';
464print
'<tr class="liste_titre">';
465print
'<td>'.$langs->trans(
"Parameter").
'</td>';
466print
'<td align="center" width="60">'.$langs->trans(
"Value").
'</td>';
467print
'<td width="80"> </td>';
471$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
472$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
473foreach ($substitutionarray as $key => $val) {
474 $htmltext .= $key.
'<br>';
478print
'<tr class="oddeven"><td colspan="2">';
479print $form->textwithpicto($langs->trans(
"FreeLegalTextOnInvoices"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
480$variablename =
'SUPPLIER_INVOICE_FREE_TEXT';
482 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
484 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
486 print $doleditor->Create();
488print
'</td><td class="right">';
489print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
492print
'</table></div><br>';
503print
'<div class="div-table-responsive-no-min">';
504print
'<table class="noborder centpercent">';
505print
'<tr class="liste_titre">';
506print
'<td>'.$langs->trans(
"Parameter").
'</td>';
507print
'<td align="center" width="60"></td>';
508print
'<td width="80"> </td>';
511print
'<tr class="oddeven"><td colspan="2">';
512print $langs->trans(
"YouMayFindNotificationsFeaturesIntoModuleNotification").
'<br>';
513print
'</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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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 information.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a 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.