*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/admin/contract.php
* \ingroup contract
* \brief Setup page of module Contracts
* \version $Id$
*/
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php');
$langs->load("admin");
$langs->load("bills");
$langs->load("other");
$langs->load("contracts");
if (!$user->admin)
accessforbidden();
if (empty($conf->global->CONTRACT_ADDON))
{
$conf->global->CONTRACT_ADDON='mod_contract_serpis';
}
/*
* Actions
*/
if ($_POST["action"] == 'updateMask')
{
$maskconst=$_POST['maskconstcontract'];
$maskvalue=$_POST['maskcontract'];
if ($maskconst) dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
}
if ($_GET["action"] == 'setmod')
{
dolibarr_set_const($db, "CONTRACT_ADDON",$_GET["value"],'chaine',0,'',$conf->entity);
}
// constants of magre model
if ($_POST["action"] == 'updateMatrice') dolibarr_set_const($db, "CONTRACT_NUM_MATRICE",$_POST["matrice"],'chaine',0,'',$conf->entity);
if ($_POST["action"] == 'updatePrefix') dolibarr_set_const($db, "CONTRACT_NUM_PREFIX",$_POST["prefix"],'chaine',0,'',$conf->entity);
if ($_POST["action"] == 'setOffset') dolibarr_set_const($db, "CONTRACT_NUM_DELTA",$_POST["offset"],'chaine',0,'',$conf->entity);
if ($_POST["action"] == 'setNumRestart') dolibarr_set_const($db, "CONTRACT_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"],'chaine',0,'',$conf->entity);
/*
* View
*/
llxHeader();
$dir=DOL_DOCUMENT_ROOT."/includes/modules/contract/";
$html=new Form($db);
$linkback=''.$langs->trans("BackToModuleList").'';
print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup');
print "
";
print_titre($langs->trans("ContractsNumberingModules"));
print '
| '.$langs->trans("Name").' | '; print ''.$langs->trans("Description").' | '; print ''.$langs->trans("Example").' | '; print ''.$langs->trans("Status").' | '; print ''.$langs->trans("Infos").' | '; print "
| '.$module->nom." | \n"; print ''; print $module->info(); print ' | '; // Show example of numbering module print ''; $tmp=$module->getExample(); if (preg_match('/^Error/',$tmp)) print $langs->trans($tmp); else print $tmp; print ' | '."\n"; print ''; if ($conf->global->CONTRACT_ADDON == "$file") { print img_picto($langs->trans("Activated"),'on'); } else { print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Disabled"),'off'); print ''; } print ' | '; $contract=new Contrat($db); $contract->initAsSpecimen(); // Info $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().''; print $html->textwithpicto('',$htmltooltip,1,0); print ' | '; print '