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 =
GETPOSTINT(
'ACCOUNTING_EXPORT_MODELCSV');
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$help_url =
'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
138$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("'.getDolGlobalString(
'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("'.getDolGlobalString(
'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("'.getDolGlobalString(
'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="2">'.$langs->trans(
'ExportOptions').
'</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>'.dol_escape_htmltag($label).
'</td>';
214 print
'<input type="text" size="20" id="'.$key.
'" name="'.$key.
'" value="'.
getDolGlobalString($key).
'">';
219print
'<tr class="oddeven">';
220print
'<td>'.$langs->trans(
"Selectmodelcsv").
'</td>';
221if (!$conf->use_javascript_ajax) {
222 print
'<td class="nowrap">';
223 print $langs->trans(
"NotAvailableWhenAjaxDisabled");
227 $listofexporttemplates = $accountancyexport->getType(1);
228 print $form->selectarray(
"ACCOUNTING_EXPORT_MODELCSV", $listofexporttemplates,
getDolGlobalString(
'ACCOUNTING_EXPORT_MODELCSV'), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1);
234$num2 = count($model_option);
236 foreach ($model_option as $key) {
237 print
'<tr class="oddeven value">';
240 $label = $key[
'label'];
241 print
'<td>'.$langs->trans($label).
'</td>';
245 if (is_array($key[
'param'])) {
248 print
'<input type="text" size="20" id="'.$label.
'" name="'.$key[
'label'].
'" value="'.
getDolGlobalString($label).
'">';
257print
'<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($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.