dolibarr  16.0.5
confexped.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
5  * Copyright (C) 2011-2016 Juanjo Menent <jmenent@2byte.es>รน
6  * Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
28 require '../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php';
31 
32 // Load translation files required by the page
33 $langs->loadLangs(array('admin', 'sendings', 'deliveries'));
34 
35 if (!$user->admin) {
37 }
38 
39 $action = GETPOST('action', 'aZ09');
40 
41 
42 /*
43  * Actions
44  */
45 
46 // Shipment note
47 if (!empty($conf->expedition->enabled) && empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
48  // This option should always be set to on when module is on.
49  dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity);
50 }
51 /*
52 if ($action == 'activate_sending')
53 {
54  dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1",'chaine',0,'',$conf->entity);
55  header("Location: confexped.php");
56  exit;
57 }
58 if ($action == 'disable_sending')
59 {
60  dolibarr_del_const($db, "MAIN_SUBMODULE_EXPEDITION",$conf->entity);
61  header("Location: confexped.php");
62  exit;
63 }
64 */
65 
66 // Delivery note
67 if ($action == 'activate_delivery') {
68  dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); // We must also enable this
69  dolibarr_set_const($db, "MAIN_SUBMODULE_DELIVERY", "1", 'chaine', 0, '', $conf->entity);
70  header("Location: confexped.php");
71  exit;
72 } elseif ($action == 'disable_delivery') {
73  dolibarr_del_const($db, "MAIN_SUBMODULE_DELIVERY", $conf->entity);
74  header("Location: confexped.php");
75  exit;
76 }
77 
78 
79 /*
80  * View
81  */
82 
83 $dir = DOL_DOCUMENT_ROOT."/core/modules/expedition/";
84 $form = new Form($db);
85 
86 llxHeader("", $langs->trans("SendingsSetup"));
87 
88 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
89 print load_fiche_titre($langs->trans("SendingsSetup"), $linkback, 'title_setup');
90 print '<br>';
92 
93 print dol_get_fiche_head($head, 'general', $langs->trans("Sendings"), -1, 'shipment');
94 
95 // Miscellaneous parameters
96 
97 print '<table class="noborder centpercent">';
98 print '<tr class="liste_titre">';
99 print '<td>'.$langs->trans("Feature").'</td>';
100 print '<td width="20">&nbsp;</td>';
101 print '<td class="center">'.$langs->trans("Status").'</td>';
102 print '</tr>'."\n";
103 
104 // expedition activation/desactivation
105 print "<tr>";
106 print '<td>'.$langs->trans("SendingsAbility").'</td>';
107 print '<td>';
108 print '</td>';
109 print '<td class="center">';
110 print '<span class="opacitymedium">'.img_picto($langs->trans("Required"), 'switch_on').'</span>';
111 /*if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
112 {
113  print '<a href="confexped.php?action=activate_sending&token='.newToken().'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
114 }
115 else
116 {
117  print '<a href="confexped.php?action=disable_sending&token='.newToken().'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
118 }*/
119 print "</td>";
120 print '</tr>';
121 
122 // Delivery note activate/deactivate Bon de livraison activation/desactivation
123 print '<tr>';
124 print '<td>';
125 print $langs->trans("DeliveriesOrderAbility");
126 print '<br>'.info_admin($langs->trans("NoNeedForDeliveryReceipts"), 0, 1);
127 print '</td>';
128 print '<td>';
129 print '</td>';
130 print '<td class="center">';
131 
132 if (empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
133  print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_delivery&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
134 } else {
135  print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_delivery&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
136 }
137 
138 print "</td>";
139 print '</tr>';
140 print '</table>';
141 
142 print '</div>';
143 
144 // End of page
145 llxFooter();
146 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
dolibarr_del_const
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:552
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
expedition_admin_prepare_head
expedition_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: expedition.lib.php:74
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10878
dolibarr_set_const
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).
Definition: admin.lib.php:627
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59