2004-10-19 20:58:50 +02:00
|
|
|
<?php
|
2012-08-25 10:49:59 +02:00
|
|
|
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
|
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
|
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
|
|
|
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
|
|
|
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
2018-10-27 14:43:12 +02:00
|
|
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
2012-08-25 10:49:59 +02:00
|
|
|
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
2018-05-03 21:27:52 +02:00
|
|
|
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
|
2025-02-08 01:49:29 +01:00
|
|
|
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
2024-04-27 22:01:34 +02:00
|
|
|
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
2003-11-19 15:57:07 +01:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-11-19 15:57:07 +01:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2003-11-19 15:57:07 +01:00
|
|
|
*/
|
2004-08-29 14:01:58 +02:00
|
|
|
|
2005-04-06 00:02:26 +02:00
|
|
|
/**
|
2010-02-25 00:29:46 +01:00
|
|
|
* \file htdocs/admin/expedition.php
|
|
|
|
|
* \ingroup expedition
|
|
|
|
|
* \brief Page d'administration/configuration du module Expedition
|
2008-09-02 03:34:37 +02:00
|
|
|
*/
|
2004-08-29 14:01:58 +02:00
|
|
|
|
2022-09-07 20:08:59 +02:00
|
|
|
// Load Dolibarr environment
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
2017-05-29 15:25:37 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
2015-12-16 16:18:29 +01:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
2003-11-19 15:57:07 +01:00
|
|
|
|
2024-11-04 23:53:20 +01:00
|
|
|
/**
|
|
|
|
|
* @var Conf $conf
|
|
|
|
|
* @var DoliDB $db
|
|
|
|
|
* @var HookManager $hookmanager
|
|
|
|
|
* @var Societe $mysoc
|
|
|
|
|
* @var Translate $langs
|
|
|
|
|
* @var User $user
|
|
|
|
|
*/
|
|
|
|
|
|
2018-05-26 18:41:16 +02:00
|
|
|
// Load translation files required by the page
|
2018-05-03 21:27:52 +02:00
|
|
|
$langs->loadLangs(array("admin", "sendings", "deliveries", "other"));
|
2004-08-29 14:01:58 +02:00
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if (!$user->admin) {
|
2012-08-25 10:49:59 +02:00
|
|
|
accessforbidden();
|
2021-02-26 22:04:03 +01:00
|
|
|
}
|
2003-11-19 15:57:07 +01:00
|
|
|
|
2020-09-16 19:39:50 +02:00
|
|
|
$action = GETPOST('action', 'aZ09');
|
2020-04-10 10:59:32 +02:00
|
|
|
$value = GETPOST('value', 'alpha');
|
2022-01-26 13:49:46 +01:00
|
|
|
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
|
|
|
|
|
|
2019-01-27 11:55:16 +01:00
|
|
|
$label = GETPOST('label', 'alpha');
|
|
|
|
|
$scandir = GETPOST('scan_dir', 'alpha');
|
2020-04-10 10:59:32 +02:00
|
|
|
$type = 'shipping';
|
2011-08-31 16:28:42 +02:00
|
|
|
|
2023-10-24 17:00:13 +02:00
|
|
|
if (!getDolGlobalString('EXPEDITION_ADDON_NUMBER')) {
|
2020-09-07 10:18:17 +02:00
|
|
|
$conf->global->EXPEDITION_ADDON_NUMBER = 'mod_expedition_safor';
|
2011-02-20 23:53:59 +01:00
|
|
|
}
|
|
|
|
|
|
2005-04-06 00:02:26 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Actions
|
|
|
|
|
*/
|
2024-11-10 11:16:23 +01:00
|
|
|
$error = 0;
|
2017-06-01 12:11:45 +02:00
|
|
|
|
|
|
|
|
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
|
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($action == 'updateMask') {
|
2023-01-04 15:10:09 +01:00
|
|
|
$maskconst = GETPOST('maskconstexpedition', 'aZ09');
|
2020-04-10 10:59:32 +02:00
|
|
|
$maskvalue = GETPOST('maskexpedition', 'alpha');
|
2023-01-04 15:10:09 +01:00
|
|
|
if (!empty($maskconst) && preg_match('/_MASK$/', $maskconst)) {
|
2019-01-27 11:55:16 +01:00
|
|
|
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
2021-02-26 22:04:03 +01:00
|
|
|
}
|
2012-08-25 10:49:59 +02:00
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if (isset($res)) {
|
|
|
|
|
if ($res > 0) {
|
2015-10-27 13:42:00 +01:00
|
|
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
2021-02-26 22:04:03 +01:00
|
|
|
} else {
|
|
|
|
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
|
|
|
}
|
2012-08-25 10:49:59 +02:00
|
|
|
}
|
2021-02-26 22:04:03 +01:00
|
|
|
} elseif ($action == 'set_param') {
|
2020-09-18 01:29:17 +02:00
|
|
|
$freetext = GETPOST('SHIPPING_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
|
2019-07-18 18:19:51 +02:00
|
|
|
$res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($res <= 0) {
|
2019-07-18 18:19:51 +02:00
|
|
|
$error++;
|
|
|
|
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$draft = GETPOST('SHIPPING_DRAFT_WATERMARK', 'alpha');
|
2019-01-27 11:55:16 +01:00
|
|
|
$res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($res <= 0) {
|
2017-03-22 20:34:01 +01:00
|
|
|
$error++;
|
|
|
|
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
|
|
|
}
|
2012-04-10 15:41:27 +02:00
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if (!$error) {
|
2015-10-27 13:42:00 +01:00
|
|
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
2017-03-22 20:34:01 +01:00
|
|
|
}
|
2021-02-26 22:04:03 +01:00
|
|
|
} elseif ($action == 'specimen') {
|
2020-04-10 10:59:32 +02:00
|
|
|
$modele = GETPOST('module', 'alpha');
|
2006-08-26 15:47:10 +02:00
|
|
|
|
|
|
|
|
$exp = new Expedition($db);
|
|
|
|
|
$exp->initAsSpecimen();
|
|
|
|
|
|
2012-04-04 17:48:47 +02:00
|
|
|
// Search template files
|
2023-12-04 11:41:14 +01:00
|
|
|
$file = '';
|
|
|
|
|
$classname = '';
|
2020-04-10 10:59:32 +02:00
|
|
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
2021-02-26 22:04:03 +01:00
|
|
|
foreach ($dirmodels as $reldir) {
|
2020-09-07 10:18:17 +02:00
|
|
|
$file = dol_buildpath($reldir."core/modules/expedition/doc/pdf_".$modele.".modules.php", 0);
|
2021-02-26 22:04:03 +01:00
|
|
|
if (file_exists($file)) {
|
2013-07-10 15:54:28 +02:00
|
|
|
$classname = "pdf_".$modele;
|
2012-04-04 17:48:47 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-12 16:15:39 +01:00
|
|
|
if ($classname !== '') {
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once $file;
|
2006-08-26 15:47:10 +02:00
|
|
|
|
2012-04-04 17:48:47 +02:00
|
|
|
$module = new $classname($db);
|
2024-03-24 21:35:58 +01:00
|
|
|
'@phan-var-force ModelePdfExpedition $module';
|
2006-08-26 15:47:10 +02:00
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($module->write_file($exp, $langs) > 0) {
|
2006-08-26 15:47:10 +02:00
|
|
|
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expedition&file=SPECIMEN.pdf");
|
|
|
|
|
return;
|
2020-05-21 09:35:30 +02:00
|
|
|
} else {
|
2015-10-27 13:42:00 +01:00
|
|
|
setEventMessages($module->error, $module->errors, 'errors');
|
2012-04-22 00:41:13 +02:00
|
|
|
dol_syslog($module->error, LOG_ERR);
|
2008-07-11 08:46:55 +02:00
|
|
|
}
|
2020-05-21 09:35:30 +02:00
|
|
|
} else {
|
2015-10-27 13:42:00 +01:00
|
|
|
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
2009-02-20 23:53:15 +01:00
|
|
|
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
2006-08-26 15:47:10 +02:00
|
|
|
}
|
2021-02-26 22:04:03 +01:00
|
|
|
} elseif ($action == 'set') {
|
|
|
|
|
// Activate a model
|
2012-04-10 15:41:27 +02:00
|
|
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
2021-02-26 22:04:03 +01:00
|
|
|
} elseif ($action == 'del') {
|
2012-04-10 15:41:27 +02:00
|
|
|
$ret = delDocumentModel($value, $type);
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($ret > 0) {
|
2022-06-21 23:39:31 +02:00
|
|
|
if (getDolGlobalString('EXPEDITION_ADDON_PDF') == "$value") {
|
2021-02-26 22:04:03 +01:00
|
|
|
dolibarr_del_const($db, 'EXPEDITION_ADDON_PDF', $conf->entity);
|
|
|
|
|
}
|
2008-09-02 03:34:37 +02:00
|
|
|
}
|
2021-02-26 22:04:03 +01:00
|
|
|
} elseif ($action == 'setdoc') {
|
|
|
|
|
// Set default model
|
|
|
|
|
if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
|
2012-08-25 15:21:34 +02:00
|
|
|
// La constante qui a ete lue en avant du nouveau set
|
|
|
|
|
// on passe donc par une variable pour avoir un affichage coherent
|
|
|
|
|
$conf->global->EXPEDITION_ADDON_PDF = $value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// On active le modele
|
|
|
|
|
$ret = delDocumentModel($value, $type);
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($ret > 0) {
|
2012-08-25 15:21:34 +02:00
|
|
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
|
|
|
|
}
|
2021-02-26 22:04:03 +01:00
|
|
|
} elseif ($action == 'setmodel') {
|
2019-01-27 11:55:16 +01:00
|
|
|
dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity);
|
2011-02-19 23:53:25 +01:00
|
|
|
}
|
2006-04-29 00:54:02 +02:00
|
|
|
|
|
|
|
|
|
2003-11-19 15:57:07 +01:00
|
|
|
/*
|
2011-02-19 23:53:25 +01:00
|
|
|
* View
|
2003-11-19 15:57:07 +01:00
|
|
|
*/
|
2009-02-03 03:39:28 +01:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
2008-01-26 16:10:18 +01:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$form = new Form($db);
|
2003-11-19 15:57:07 +01:00
|
|
|
|
2024-06-08 14:53:14 +02:00
|
|
|
llxHeader("", $langs->trans("SendingsSetup"), '', '', 0, 0, '', '', '', 'mod-admin page-expedition');
|
2005-07-09 03:16:31 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
2019-01-27 11:55:16 +01:00
|
|
|
print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup');
|
2008-01-26 16:10:18 +01:00
|
|
|
print '<br>';
|
2015-12-16 16:18:29 +01:00
|
|
|
$head = expedition_admin_prepare_head();
|
2006-08-26 15:47:10 +02:00
|
|
|
|
2020-10-22 22:50:03 +02:00
|
|
|
print dol_get_fiche_head($head, 'shipment', $langs->trans("Sendings"), -1, 'shipment');
|
2003-11-19 15:57:07 +01:00
|
|
|
|
2017-03-22 20:34:01 +01:00
|
|
|
// Shipment numbering model
|
2011-02-19 23:53:25 +01:00
|
|
|
|
2020-01-28 02:21:39 +01:00
|
|
|
print load_fiche_titre($langs->trans("SendingsNumberingModules"), '', '');
|
2011-02-19 23:53:25 +01:00
|
|
|
|
2019-11-05 21:24:41 +01:00
|
|
|
print '<table class="noborder centpercent">';
|
2011-02-19 23:53:25 +01:00
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td width="100">'.$langs->trans("Name").'</td>';
|
|
|
|
|
print '<td>'.$langs->trans("Description").'</td>';
|
|
|
|
|
print '<td>'.$langs->trans("Example").'</td>';
|
2017-03-22 20:34:01 +01:00
|
|
|
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
|
|
|
|
|
print '<td class="center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
2011-02-19 23:53:25 +01:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
clearstatcache();
|
|
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
foreach ($dirmodels as $reldir) {
|
2012-04-04 17:48:47 +02:00
|
|
|
$dir = dol_buildpath($reldir."core/modules/expedition/");
|
2011-02-19 23:53:25 +01:00
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if (is_dir($dir)) {
|
2011-04-17 09:15:17 +02:00
|
|
|
$handle = opendir($dir);
|
2021-02-26 22:04:03 +01:00
|
|
|
if (is_resource($handle)) {
|
|
|
|
|
while (($file = readdir($handle)) !== false) {
|
2020-10-25 17:02:25 +01:00
|
|
|
if (preg_match('/^mod_expedition_([a-z0-9_]*)\.php$/', $file)) {
|
2020-04-10 10:59:32 +02:00
|
|
|
$file = substr($file, 0, dol_strlen($file) - 4);
|
2011-05-04 20:34:16 +02:00
|
|
|
|
2013-03-17 11:00:38 +01:00
|
|
|
require_once $dir.$file.'.php';
|
2011-05-04 20:34:16 +02:00
|
|
|
|
2023-12-04 11:41:14 +01:00
|
|
|
$module = new $file();
|
2024-08-17 19:32:52 +02:00
|
|
|
'@phan-var-force ModelNumRefExpedition $module';
|
2013-09-25 19:07:25 +02:00
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($module->isEnabled()) {
|
2013-03-17 11:00:38 +01:00
|
|
|
// Show modules according to features level
|
2023-11-27 12:24:18 +01:00
|
|
|
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
2021-02-26 22:04:03 +01:00
|
|
|
continue;
|
|
|
|
|
}
|
2023-11-27 12:24:18 +01:00
|
|
|
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
|
2021-02-26 22:04:03 +01:00
|
|
|
continue;
|
|
|
|
|
}
|
2013-09-25 19:07:25 +02:00
|
|
|
|
2020-10-25 17:02:25 +01:00
|
|
|
print '<tr><td>'.$module->name."</td>\n";
|
2011-04-17 09:15:17 +02:00
|
|
|
print '<td>';
|
2023-08-09 18:00:31 +02:00
|
|
|
print $module->info($langs);
|
2011-04-17 09:15:17 +02:00
|
|
|
print '</td>';
|
2011-05-04 20:34:16 +02:00
|
|
|
|
2020-09-07 10:18:17 +02:00
|
|
|
// Show example of numbering module
|
|
|
|
|
print '<td class="nowrap">';
|
|
|
|
|
$tmp = $module->getExample();
|
|
|
|
|
if (preg_match('/^Error/', $tmp)) {
|
2020-11-28 02:09:27 +01:00
|
|
|
$langs->load("errors");
|
|
|
|
|
print '<div class="error">'.$langs->trans($tmp).'</div>';
|
2021-02-26 22:04:03 +01:00
|
|
|
} elseif ($tmp == 'NotConfigured') {
|
2021-09-05 02:25:32 +02:00
|
|
|
print '<span class="opacitymedium">'.$langs->trans($tmp).'</span>';
|
2021-02-26 22:04:03 +01:00
|
|
|
} else {
|
|
|
|
|
print $tmp;
|
|
|
|
|
}
|
2020-09-07 10:18:17 +02:00
|
|
|
print '</td>'."\n";
|
2011-05-04 20:34:16 +02:00
|
|
|
|
2019-03-20 09:49:38 +01:00
|
|
|
print '<td class="center">';
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($conf->global->EXPEDITION_ADDON_NUMBER == "$file") {
|
2019-01-27 11:55:16 +01:00
|
|
|
print img_picto($langs->trans("Activated"), 'switch_on');
|
2020-05-21 09:35:30 +02:00
|
|
|
} else {
|
2022-06-20 16:01:25 +02:00
|
|
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmodel&token='.newToken().'&value='.urlencode($file).'&label='.urlencode($module->name).'">';
|
2019-01-27 11:55:16 +01:00
|
|
|
print img_picto($langs->trans("Disabled"), 'switch_off');
|
2011-04-17 09:15:17 +02:00
|
|
|
print '</a>';
|
|
|
|
|
}
|
|
|
|
|
print '</td>';
|
2011-05-04 20:34:16 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$expedition = new Expedition($db);
|
2011-04-17 09:15:17 +02:00
|
|
|
$expedition->initAsSpecimen();
|
2011-05-04 20:34:16 +02:00
|
|
|
|
2011-04-17 09:15:17 +02:00
|
|
|
// Info
|
2020-04-10 10:59:32 +02:00
|
|
|
$htmltooltip = '';
|
|
|
|
|
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
|
|
|
|
$nextval = $module->getNextValue($mysoc, $expedition);
|
2020-09-07 10:18:17 +02:00
|
|
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
|
|
|
|
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
|
|
|
|
if ($nextval) {
|
2021-02-26 22:04:03 +01:00
|
|
|
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
|
2020-09-07 10:18:17 +02:00
|
|
|
$nextval = $langs->trans($nextval);
|
2021-02-26 22:04:03 +01:00
|
|
|
}
|
2020-09-07 10:18:17 +02:00
|
|
|
$htmltooltip .= $nextval.'<br>';
|
|
|
|
|
} else {
|
|
|
|
|
$htmltooltip .= $langs->trans($module->error).'<br>';
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-04 20:34:16 +02:00
|
|
|
|
2019-03-20 09:49:38 +01:00
|
|
|
print '<td class="center">';
|
2025-02-08 01:49:29 +01:00
|
|
|
print $form->textwithpicto('', $htmltooltip, 1, 'info');
|
2011-04-17 09:15:17 +02:00
|
|
|
print '</td>';
|
2011-05-04 20:34:16 +02:00
|
|
|
|
2011-04-17 09:15:17 +02:00
|
|
|
print '</tr>';
|
2011-02-19 23:53:25 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-04-17 09:15:17 +02:00
|
|
|
closedir($handle);
|
2011-02-19 23:53:25 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '</table><br>';
|
2003-11-19 15:57:07 +01:00
|
|
|
|
|
|
|
|
|
2006-04-29 00:54:02 +02:00
|
|
|
/*
|
2013-03-17 11:00:38 +01:00
|
|
|
* Documents models for Sendings Receipt
|
2006-04-29 00:54:02 +02:00
|
|
|
*/
|
2020-01-28 02:21:39 +01:00
|
|
|
print load_fiche_titre($langs->trans("SendingsReceiptModel"), '', '');
|
2003-11-19 15:57:07 +01:00
|
|
|
|
2006-04-29 00:54:02 +02:00
|
|
|
// Defini tableau def de modele invoice
|
2020-04-10 10:59:32 +02:00
|
|
|
$type = "shipping";
|
2006-04-29 00:54:02 +02:00
|
|
|
$def = array();
|
2009-04-27 22:37:50 +02:00
|
|
|
|
2006-04-29 00:54:02 +02:00
|
|
|
$sql = "SELECT nom";
|
2020-04-10 10:59:32 +02:00
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
2020-09-19 23:11:38 +02:00
|
|
|
$sql .= " WHERE type = '".$db->escape($type)."'";
|
2020-04-10 10:59:32 +02:00
|
|
|
$sql .= " AND entity = ".$conf->entity;
|
2009-04-27 22:37:50 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$resql = $db->query($sql);
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($resql) {
|
2006-04-29 00:54:02 +02:00
|
|
|
$i = 0;
|
2020-04-10 10:59:32 +02:00
|
|
|
$num_rows = $db->num_rows($resql);
|
2021-02-26 22:04:03 +01:00
|
|
|
while ($i < $num_rows) {
|
2006-04-29 00:54:02 +02:00
|
|
|
$array = $db->fetch_array($resql);
|
2024-04-27 22:01:34 +02:00
|
|
|
if (is_array($array)) {
|
|
|
|
|
array_push($def, $array[0]);
|
|
|
|
|
}
|
2006-04-29 00:54:02 +02:00
|
|
|
$i++;
|
|
|
|
|
}
|
2020-05-21 09:35:30 +02:00
|
|
|
} else {
|
2009-02-20 23:53:15 +01:00
|
|
|
dol_print_error($db);
|
2006-04-29 00:54:02 +02:00
|
|
|
}
|
|
|
|
|
|
2019-11-05 21:24:41 +01:00
|
|
|
print '<table class="noborder centpercent">';
|
2003-11-19 15:57:07 +01:00
|
|
|
print '<tr class="liste_titre">';
|
2006-04-29 00:54:02 +02:00
|
|
|
print '<td width="140">'.$langs->trans("Name").'</td>';
|
|
|
|
|
print '<td>'.$langs->trans("Description").'</td>';
|
2019-03-20 09:49:38 +01:00
|
|
|
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
|
|
|
|
|
print '<td class="center" width="60">'.$langs->trans("Default").'</td>';
|
|
|
|
|
print '<td class="nowrap center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
|
|
|
|
print '<td class="nowrap center" width="80" >'.$langs->trans("Preview").'</td>';
|
2003-11-19 15:57:07 +01:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
|
|
|
|
clearstatcache();
|
|
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
foreach ($dirmodels as $reldir) {
|
|
|
|
|
foreach (array('', '/doc') as $valdir) {
|
2020-09-07 10:18:17 +02:00
|
|
|
$dir = dol_buildpath($reldir."core/modules/expedition".$valdir);
|
|
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if (is_dir($dir)) {
|
2020-09-07 10:18:17 +02:00
|
|
|
$handle = opendir($dir);
|
2021-02-26 22:04:03 +01:00
|
|
|
if (is_resource($handle)) {
|
2024-03-09 02:43:57 +01:00
|
|
|
$filelist = array();
|
2021-02-26 22:04:03 +01:00
|
|
|
while (($file = readdir($handle)) !== false) {
|
2020-09-07 10:18:17 +02:00
|
|
|
$filelist[] = $file;
|
|
|
|
|
}
|
|
|
|
|
closedir($handle);
|
|
|
|
|
arsort($filelist);
|
|
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
foreach ($filelist as $file) {
|
|
|
|
|
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
|
|
|
|
if (file_exists($dir.'/'.$file)) {
|
2020-09-07 10:18:17 +02:00
|
|
|
$name = substr($file, 4, dol_strlen($file) - 16);
|
|
|
|
|
$classname = substr($file, 0, dol_strlen($file) - 12);
|
|
|
|
|
|
|
|
|
|
require_once $dir.'/'.$file;
|
|
|
|
|
$module = new $classname($db);
|
|
|
|
|
|
2024-08-17 19:32:52 +02:00
|
|
|
'@phan-var-force ModelePdfExpedition $module';
|
|
|
|
|
|
2020-09-07 10:18:17 +02:00
|
|
|
$modulequalified = 1;
|
2023-11-27 12:24:18 +01:00
|
|
|
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
2021-02-26 22:04:03 +01:00
|
|
|
$modulequalified = 0;
|
|
|
|
|
}
|
2023-11-27 12:24:18 +01:00
|
|
|
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
|
2021-02-26 22:04:03 +01:00
|
|
|
$modulequalified = 0;
|
|
|
|
|
}
|
2020-09-07 10:18:17 +02:00
|
|
|
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($modulequalified) {
|
2020-09-07 10:18:17 +02:00
|
|
|
print '<tr><td width="100">';
|
2023-12-04 11:41:14 +01:00
|
|
|
print(empty($module->name) ? $name : $module->name);
|
2020-09-07 10:18:17 +02:00
|
|
|
print "</td><td>\n";
|
2021-02-26 22:04:03 +01:00
|
|
|
if (method_exists($module, 'info')) {
|
2024-08-17 19:32:52 +02:00
|
|
|
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
|
2021-02-26 22:04:03 +01:00
|
|
|
} else {
|
|
|
|
|
print $module->description;
|
|
|
|
|
}
|
2020-09-07 10:18:17 +02:00
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
|
|
// Active
|
2021-02-26 22:04:03 +01:00
|
|
|
if (in_array($name, $def)) {
|
2020-09-07 10:18:17 +02:00
|
|
|
print '<td class="center">'."\n";
|
2021-09-19 14:41:46 +02:00
|
|
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
|
2020-09-07 10:18:17 +02:00
|
|
|
print img_picto($langs->trans("Enabled"), 'switch_on');
|
|
|
|
|
print '</a>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
} else {
|
|
|
|
|
print '<td class="center">'."\n";
|
2021-09-19 14:41:46 +02:00
|
|
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
2020-09-07 10:18:17 +02:00
|
|
|
print "</td>";
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-11 09:59:52 +01:00
|
|
|
// Default
|
2020-09-07 10:18:17 +02:00
|
|
|
print '<td class="center">';
|
2022-06-21 23:39:31 +02:00
|
|
|
if (getDolGlobalString('EXPEDITION_ADDON_PDF') == $name) {
|
2020-09-07 10:18:17 +02:00
|
|
|
print img_picto($langs->trans("Default"), 'on');
|
|
|
|
|
} else {
|
2021-09-19 14:41:46 +02:00
|
|
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
2020-09-07 10:18:17 +02:00
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
|
|
// Info
|
|
|
|
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
|
|
|
|
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($module->type == 'pdf') {
|
2020-09-07 10:18:17 +02:00
|
|
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
|
|
|
|
}
|
|
|
|
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
|
|
|
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
|
|
|
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
|
|
|
|
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
|
|
|
|
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
|
|
|
|
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
|
|
|
|
|
|
|
|
|
print '<td class="center">';
|
2025-02-08 01:49:29 +01:00
|
|
|
print $form->textwithpicto('', $htmltooltip, 1, 'info');
|
2020-09-07 10:18:17 +02:00
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
|
|
// Preview
|
|
|
|
|
print '<td class="center">';
|
2021-02-26 22:04:03 +01:00
|
|
|
if ($module->type == 'pdf') {
|
2020-12-03 13:19:35 +01:00
|
|
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
|
2020-09-07 10:18:17 +02:00
|
|
|
} else {
|
2025-01-08 17:45:28 +01:00
|
|
|
print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
|
2020-09-07 10:18:17 +02:00
|
|
|
}
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-11-19 15:57:07 +01:00
|
|
|
}
|
2011-05-04 20:34:16 +02:00
|
|
|
|
2003-11-19 15:57:07 +01:00
|
|
|
print '</table>';
|
|
|
|
|
|
|
|
|
|
|
2011-06-04 15:44:55 +02:00
|
|
|
/*
|
|
|
|
|
* Other options
|
|
|
|
|
*/
|
2024-10-15 00:26:13 +02:00
|
|
|
|
2020-01-28 02:21:39 +01:00
|
|
|
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
|
2011-06-04 15:44:55 +02:00
|
|
|
|
2019-04-16 16:16:37 +02:00
|
|
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
2019-12-18 23:12:31 +01:00
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
2019-04-16 16:16:37 +02:00
|
|
|
print '<input type="hidden" name="action" value="set_param">';
|
2011-06-04 15:44:55 +02:00
|
|
|
|
2024-10-15 00:26:13 +02:00
|
|
|
print '<table class="noborder centpercent">';
|
|
|
|
|
print '<tr class="liste_titre">';
|
2019-07-18 18:19:51 +02:00
|
|
|
print "<td>".$langs->trans("Parameter")."</td>\n";
|
2024-10-15 00:26:13 +02:00
|
|
|
print "<td></td>\n";
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
print '<tr class="oddeven">';
|
|
|
|
|
print '<td>'.$langs->trans('SHIPPING_DISPLAY_STOCK_ENTRY_DATE');
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
print ajax_constantonoff('SHIPPING_DISPLAY_STOCK_ENTRY_DATE');
|
|
|
|
|
print '</td></tr>';
|
2019-07-18 18:19:51 +02:00
|
|
|
|
2020-04-10 10:59:32 +02:00
|
|
|
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
|
|
|
|
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
2019-07-18 18:19:51 +02:00
|
|
|
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
2021-02-26 22:04:03 +01:00
|
|
|
foreach ($substitutionarray as $key => $val) {
|
|
|
|
|
$htmltext .= $key.'<br>';
|
|
|
|
|
}
|
2020-04-10 10:59:32 +02:00
|
|
|
$htmltext .= '</i>';
|
2019-07-18 18:19:51 +02:00
|
|
|
|
2024-10-15 00:26:13 +02:00
|
|
|
print '<tr><td colspan="2">';
|
2019-07-18 18:19:51 +02:00
|
|
|
print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
2020-04-10 10:59:32 +02:00
|
|
|
$variablename = 'SHIPPING_FREE_TEXT';
|
2023-10-24 17:00:13 +02:00
|
|
|
if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) {
|
2022-06-21 20:25:25 +02:00
|
|
|
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.getDolGlobalString($variablename).'</textarea>';
|
2020-05-21 09:35:30 +02:00
|
|
|
} else {
|
2020-09-07 10:18:17 +02:00
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
2022-06-21 23:39:31 +02:00
|
|
|
$doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes');
|
2020-09-07 10:18:17 +02:00
|
|
|
print $doleditor->Create();
|
2019-07-18 18:19:51 +02:00
|
|
|
}
|
|
|
|
|
print "</td></tr>\n";
|
|
|
|
|
|
2017-03-22 20:34:01 +01:00
|
|
|
print '<tr><td>';
|
2024-10-15 00:26:13 +02:00
|
|
|
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip');
|
|
|
|
|
print '</td><td>';
|
2022-07-24 18:59:07 +02:00
|
|
|
print '<input class="flat minwidth200" type="text" name="SHIPPING_DRAFT_WATERMARK" value="'.dol_escape_htmltag(getDolGlobalString('SHIPPING_DRAFT_WATERMARK')).'">';
|
2011-06-04 15:44:55 +02:00
|
|
|
print "</td></tr>\n";
|
|
|
|
|
|
2024-05-05 02:48:02 +02:00
|
|
|
// Allow OnLine Sign
|
|
|
|
|
print '<tr class="oddeven">';
|
2024-10-15 00:26:13 +02:00
|
|
|
print '<td>'.$langs->trans("AllowOnLineSign");
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td>';
|
2024-11-18 13:20:55 +01:00
|
|
|
print ajax_constantonoff('EXPEDITION_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1, '', '', 'inline-block', 0, $langs->trans("WarningOnlineSignature"));
|
2024-05-05 02:48:02 +02:00
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2025-01-13 11:54:58 +01:00
|
|
|
// Pre fill shipment qty option
|
|
|
|
|
print '<tr class="oddeven">';
|
|
|
|
|
print '<td>'.$langs->trans("DontPrefillShipmentQty");
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td>';
|
|
|
|
|
print ajax_constantonoff('SHIPMENT_DONT_PREFILL_QTY', array(), null, 0, 0, 0, 2, 0, 1, '', '', 'inline-block', 0, '');
|
|
|
|
|
print '</td></tr>';
|
|
|
|
|
|
2019-04-16 16:16:37 +02:00
|
|
|
print '</table>';
|
|
|
|
|
|
2021-08-24 17:04:17 +02:00
|
|
|
print $form->buttonsSaveCancel("Modify", '');
|
2019-07-18 18:19:51 +02:00
|
|
|
|
|
|
|
|
print '</form>';
|
|
|
|
|
|
2018-07-28 17:26:56 +02:00
|
|
|
// End of page
|
2003-11-19 15:57:07 +01:00
|
|
|
llxFooter();
|
2012-08-25 10:49:59 +02:00
|
|
|
$db->close();
|