*
* 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.
* or see http://www.gnu.org/
*/
/**
* \file /htdocs/admin/commissions.php
* \ingroup commissions
* \brief Page to setup advanced commissions module
*/
$res=@include("../main.inc.php"); // For root directory
require_once(DOL_DOCUMENT_ROOT."/commissions/lib/commissions.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
$langs->load("admin");
$langs->load("commissions");
if (!$user->admin)
accessforbidden();
// init
if ($conf->global->COMMISSION_BASE == "") {
if ($conf->marges->enabled)
$conf->global->COMMISSION_BASE = "MARGES";
else
$conf->global->COMMISSION_BASE = "CA";
}
/*
* Action
*/
if (isset($_POST['commissionBase']))
{
if (dolibarr_set_const($db, 'COMMISSION_BASE', $_POST['commissionBase'], 'string', 0, '', $conf->entity) > 0)
{
$conf->global->COMMISSION_BASE = $_POST['commissionBase'];
}
else
{
dol_print_error($db);
}
}
if (isset($_POST['productCommissionRate']))
{
if (dolibarr_set_const($db, 'PRODUCT_COMMISSION_RATE', $_POST['productCommissionRate'], 'rate', 0, '', $conf->entity) > 0)
{
}
else
{
dol_print_error($db);
}
}
if (isset($_POST['serviceCommissionRate']))
{
if (dolibarr_set_const($db, 'SERVICE_COMMISSION_RATE', $_POST['serviceCommissionRate'], 'rate', 0, '', $conf->entity) > 0)
{
}
else
{
dol_print_error($db);
}
}
/*
* View
*/
llxHeader('',$langs->trans("CommissionsSetup"));
$linkback=''.$langs->trans("BackToModuleList").'';
print_fiche_titre($langs->trans("commissionsSetup"),$linkback,'setup');
$head = commissions_admin_prepare_head($adh);
dol_fiche_head($head, 'parameters', $langs->trans("Commissions"), 0, 'commissions');
print "
";
print_fiche_titre($langs->trans("MemberMainOptions"),'','');
print '
| '.$langs->trans("Description").' | '; print ''.$langs->trans("Value").' | '."\n"; print ''.$langs->trans("Details").' | '."\n"; print '