* * 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 * the Free Software Foundation; either version 3 of the License, or * (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 * along with this program. If not, see . */ /** * \file htdocs/admin/carrier.php * \ingroup expedition * \brief Page to setup carriers. TODO Delete this page. We mut use dictionnary instead. */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; $langs->load("admin"); $langs->load("sendings"); $langs->load("deliveries"); $langs->load('other'); if (! $user->admin) accessforbidden(); $action=GETPOST('action','alpha'); $carrier=GETPOST('carrier','int'); $object = new Expedition($db); /* * Actions */ //if ($action==setvalue AND $carrier) if ($action=='setvalue') { // need to add check on values $object->update['code']=GETPOST('code','alpha'); $object->update['libelle']=GETPOST('libelle','alpha'); $object->update['description']=GETPOST('description','alpha'); $object->update['tracking']=GETPOST('tracking','alpha'); $object->update_delivery_method($carrier); header("Location: carrier.php"); exit; } if ($action=='activate_carrier' && $carrier!='') { $object->activ_delivery_method($carrier); } if ($action=='disable_carrier' && $carrier!='') { $object->disable_delivery_method($carrier); } /* * View */ $form=new Form($db); llxHeader("",""); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("SendingsSetup"),$linkback,'setup'); print '
'; //if ($mesg) print $mesg.'
'; $h = 0; $head[$h][0] = DOL_URL_ROOT."/admin/confexped.php"; $head[$h][1] = $langs->trans("Setup"); $h++; $head[$h][0] = DOL_URL_ROOT."/admin/carrier.php"; $head[$h][1] = $langs->trans("Carriers"); $hselected=$h; $h++; if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { $head[$h][0] = DOL_URL_ROOT."/admin/expedition.php"; $head[$h][1] = $langs->trans("Sending"); $h++; } if (! empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) { $head[$h][0] = DOL_URL_ROOT."/admin/livraison.php"; $head[$h][1] = $langs->trans("Receivings"); $h++; } dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); /* * Carrier List */ if ($action=='edit_carrier' || $action=='setvalue') { // Carrier Edit if ($carrier!='') $object->list_delivery_methods($carrier); print_titre($langs->trans("CarrierEdit")); print '
'; print ''; print ''; print ''; $var=true; print ''; print ''; print ''; print "\n"; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; if ($carrier) { print ''; } else { print ''; } print '
'.$langs->trans("CarrierParameter").''.$langs->trans("Value").'
'; print $langs->trans("Code").''; print ''; print '   '.$langs->trans("Example").': CODE'; print '
'; print $langs->trans("Name").''; print ''; print '
'; print $langs->trans("Description").''; print ''; print '
'; print $langs->trans("Tracking").''; print ''; print '   '.$langs->trans("Example").': http://www.website.com/dir/{TRACKID}'; print '


'; print '
'; } else { // Display List $object->list_delivery_methods(); $var=true; print_titre($langs->trans("CarrierList")); print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; $numlistmeths=count($object->listmeths); for ($i=0; $i<$numlistmeths; $i++) { $var=!$var; print ""; print ''; print ''; print ''; print ''; print ''; print "\n"; } print ''; print '
'.$langs->trans("Code").''.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("TrackingUrl").''.$langs->trans("Status").''.$langs->trans("Edit").'
'.$object->listmeths[$i]['code'].''.$object->listmeths[$i]['libelle'].''.$object->listmeths[$i]['description'].''.$object->listmeths[$i]['tracking'].''; if($object->listmeths[$i]['active'] == 0) { print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } print ''; print ''.img_picto($langs->trans("Edit"),'edit').''; print '

'.$langs->trans("Add").'

'; print ''; } llxFooter(); $db->close(); ?>