29 require
'../../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancyexport.class.php';
36 $langs->loadLangs(array(
"compta",
"bills",
"admin",
"accountancy"));
39 if (empty($user->rights->accounting->chartofaccount))
44 $action =
GETPOST(
'action',
'aZ09');
48 'ACCOUNTING_EXPORT_PREFIX_SPEC',
53 $listparam = $configuration[
'param'];
55 $listformat = $configuration[
'format'];
57 $listcr = $configuration[
'cr'];
60 $model_option = array(
62 'label' =>
'ACCOUNTING_EXPORT_FORMAT',
63 'param' => $listformat,
66 'label' =>
'ACCOUNTING_EXPORT_SEPARATORCSV',
70 'label' =>
'ACCOUNTING_EXPORT_ENDLINE',
74 'label' =>
'ACCOUNTING_EXPORT_DATE',
84 if ($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)) {
122 $listparam = $configuration[
'param'];
135 $form =
new Form($db);
137 $title = $langs->trans(
'ExportOptions');
146 print "\n".
'<script type="text/javascript" language="javascript">'.
"\n";
147 print 'jQuery(document).ready(function () {'.
"\n";
148 print ' function initfields()'.
"\n";
150 foreach ($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";
183 print ' initfields();'.
"\n";
184 print ' jQuery("#ACCOUNTING_EXPORT_MODELCSV").change(function() {'.
"\n";
185 print ' initfields();'.
"\n";
188 print '</script>'.
"\n";
190 print '<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
191 print '<input type="hidden" name="token" value="'.newToken().
'">';
192 print '<input type="hidden" name="action" value="update">';
198 print '<table class="noborder centpercent">';
199 print '<tr class="liste_titre">';
200 print '<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="'.$conf->global->$key.
'">';
226 print '<table class="noborder centpercent">';
228 print '<tr class="liste_titre">';
229 print '<td colspan="2">'.$langs->trans(
"Modelcsv").
'</td>';
233 print '<tr class="oddeven">';
234 print '<td width="50%">'.$langs->trans(
"Selectmodelcsv").
'</td>';
235 if (!$conf->use_javascript_ajax) {
236 print '<td class="nowrap">';
237 print $langs->trans(
"NotAvailableWhenAjaxDisabled");
242 print $form->selectarray(
"ACCOUNTING_EXPORT_MODELCSV", $listmodelcsv, $conf->global->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'])) {
272 print $form->selectarray($label, $key[
'param'], $conf->global->$label, 0);
274 print '<input type="text" size="20" id="'.$label.
'" name="'.$key[
'label'].
'" value="'.$conf->global->$label.
'">';
283 print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Modify')).
'" name="button"></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
static getTypeConfig()
Array with all export type available (key + label) and parameters for config.
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).
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
static getType()
Array with all export type available (key + label)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print
Draft customers invoices.