29require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancyexport.class.php';
36$langs->loadLangs(array(
"compta",
"bills",
"admin",
"accountancy"));
39if (!$user->hasRight(
'accounting',
'chartofaccount')) {
43$action =
GETPOST(
'action',
'aZ09');
47 'ACCOUNTING_EXPORT_PREFIX_SPEC',
51$configuration = $accountancyexport->getTypeConfig();
53$listparam = $configuration[
'param'];
55$listformat = $configuration[
'format'];
57$listcr = $configuration[
'cr'];
62 'label' =>
'ACCOUNTING_EXPORT_FORMAT',
63 'param' => $listformat,
66 'label' =>
'ACCOUNTING_EXPORT_SEPARATORCSV',
70 'label' =>
'ACCOUNTING_EXPORT_ENDLINE',
74 'label' =>
'ACCOUNTING_EXPORT_DATE',
84if ($action ==
'update') {
87 $modelcsv =
GETPOST(
'ACCOUNTING_EXPORT_MODELCSV',
'int');
89 if (!empty($modelcsv)) {
90 if (!
dolibarr_set_const($db,
'ACCOUNTING_EXPORT_MODELCSV', $modelcsv,
'chaine', 0,
'', $conf->entity)) {
100 foreach ($main_option as $constname) {
101 $constvalue =
GETPOST($constname,
'alpha');
103 if (!
dolibarr_set_const($db, $constname, $constvalue,
'chaine', 0,
'', $conf->entity)) {
108 foreach ($listparam[$modelcsv] as $key => $value) {
111 if (strpos($constante,
'ACCOUNTING') !==
false) {
112 $constvalue =
GETPOST($key,
'alpha');
113 if (!
dolibarr_set_const($db, $constante, $constvalue,
'chaine', 0,
'', $conf->entity)) {
121 $configuration = $accountancyexport->getTypeConfig();
122 $listparam = $configuration[
'param'];
135$form =
new Form($db);
137$title = $langs->trans(
'ExportOptions');
143print
load_fiche_titre($langs->trans(
'ExportOptions'), $linkback,
'accountancy');
146print
"\n".
'<script type="text/javascript">'.
"\n";
147print
'jQuery(document).ready(function () {'.
"\n";
148print
' function initfields()'.
"\n";
150foreach ($listparam as $key => $param) {
151 print
' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.
'")'.
"\n";
153 print
' //console.log("'.$param[
'label'].
'");'.
"\n";
154 if (empty($param[
'ACCOUNTING_EXPORT_FORMAT'])) {
155 print
' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.
'");'.
"\n";
156 print
' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'.
"\n";
158 print
' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param[
'ACCOUNTING_EXPORT_FORMAT'].
'");'.
"\n";
159 print
' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'.
"\n";
161 if (empty($param[
'ACCOUNTING_EXPORT_SEPARATORCSV'])) {
162 print
' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'.
"\n";
163 print
' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'.
"\n";
165 print
' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.
'");'.
"\n";
166 print
' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'.
"\n";
168 if (empty($param[
'ACCOUNTING_EXPORT_ENDLINE'])) {
169 print
' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'.
"\n";
171 print
' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'.
"\n";
173 if (empty($param[
'ACCOUNTING_EXPORT_DATE'])) {
174 print
' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'.
"\n";
175 print
' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'.
"\n";
177 print
' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.$conf->global->ACCOUNTING_EXPORT_DATE.
'");'.
"\n";
178 print
' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'.
"\n";
183print
' initfields();'.
"\n";
184print
' jQuery("#ACCOUNTING_EXPORT_MODELCSV").change(function() {'.
"\n";
185print
' initfields();'.
"\n";
188print
'</script>'.
"\n";
190print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
191print
'<input type="hidden" name="token" value="'.newToken().
'">';
192print
'<input type="hidden" name="action" value="update">';
198print
'<table class="noborder centpercent">';
199print
'<tr class="liste_titre">';
200print
'<td colspan="3">'.$langs->trans(
'Options').
'</td>';
203$num = count($main_option);
205 foreach ($main_option as $key) {
206 print
'<tr class="oddeven value">';
209 $label = $langs->trans($key);
210 print
'<td width="50%">'.$label.
'</td>';
214 print
'<input type="text" size="20" id="'.$key.
'" name="'.$key.
'" value="'.
getDolGlobalString($key).
'">';
226print
'<table class="noborder centpercent">';
228print
'<tr class="liste_titre">';
229print
'<td colspan="2">'.$langs->trans(
"Modelcsv").
'</td>';
233print
'<tr class="oddeven">';
234print
'<td width="50%">'.$langs->trans(
"Selectmodelcsv").
'</td>';
235if (!$conf->use_javascript_ajax) {
236 print
'<td class="nowrap">';
237 print $langs->trans(
"NotAvailableWhenAjaxDisabled");
241 $listmodelcsv = $accountancyexport->getType();
242 print $form->selectarray(
"ACCOUNTING_EXPORT_MODELCSV", $listmodelcsv,
getDolGlobalString(
'ACCOUNTING_EXPORT_MODELCSV'), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
255$num2 = count($model_option);
257 print
'<table class="noborder centpercent">';
258 print
'<tr class="liste_titre">';
259 print
'<td colspan="3">'.$langs->trans(
'OtherOptions').
'</td>';
262 foreach ($model_option as $key) {
263 print
'<tr class="oddeven value">';
266 $label = $key[
'label'];
267 print
'<td width="50%">'.$langs->trans($label).
'</td>';
271 if (is_array($key[
'param'])) {
274 print
'<input type="text" size="20" id="'.$label.
'" name="'.$key[
'label'].
'" value="'.
getDolGlobalString($label).
'">';
283print
'<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Modify')).
'" name="button"></div>';
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).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Manage the different format accountancy export.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.