Merge remote-tracking branch 'upstream/develop' into zapieruser

This commit is contained in:
Frédéric FRANCE 2020-10-31 16:10:16 +01:00
commit be4a4cb54b
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
1184 changed files with 82007 additions and 81393 deletions

View File

@ -17,8 +17,10 @@ filter:
- build/* - build/*
- dev/* - dev/*
- doc/* - doc/*
- test/* - documents/*
- htdocs/includes/* - htdocs/includes/*
- node_modules/*
- test/*
paths: paths:
- htdocs/* - htdocs/*
- scripts/* - scripts/*

View File

@ -15,6 +15,7 @@ NEW: Accountancy - Add options to disable binding on sales, purchases & expense
NEW: Accountancy balance - Add a input to show subtotal by group NEW: Accountancy balance - Add a input to show subtotal by group
NEW: Accountancy - Move to real ledger, real journals, menu disposition NEW: Accountancy - Move to real ledger, real journals, menu disposition
NEW: Accountancy - On transfers, select the periodicity by default NEW: Accountancy - On transfers, select the periodicity by default
NEW: New currency rate editor.
NEW: Add 2 rules for emailcollector: Message send/not sent from Dolibarr NEW: Add 2 rules for emailcollector: Message send/not sent from Dolibarr
NEW: Add a counter of number of words of pages in website module NEW: Add a counter of number of words of pages in website module
NEW: add alert before change thirdparty in takepos NEW: add alert before change thirdparty in takepos

View File

@ -65,12 +65,12 @@ if (!$sortfield) $sortfield = "aa.account_number";
if (!$sortorder) $sortorder = "ASC"; if (!$sortorder) $sortorder = "ASC";
$arrayfields = array( $arrayfields = array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), 'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1), 'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1), 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1), 'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1),
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
); );
@ -93,24 +93,24 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook)) if (empty($reshook))
{ {
if (!empty($cancel)) $action = ''; if (!empty($cancel)) $action = '';
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
{ {
$search_account = ""; $search_account = "";
$search_label = ""; $search_label = "";
$search_labelshort = ""; $search_labelshort = "";
$search_accountparent = ""; $search_accountparent = "";
$search_pcgtype = ""; $search_pcgtype = "";
$search_array_options = array(); $search_array_options = array();
} }
if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) // a submit of form is done and chartofaccounts combo has been modified || (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) // a submit of form is done and chartofaccounts combo has been modified
{ {
if ($chartofaccounts > 0) if ($chartofaccounts > 0)
{ {
// Get language code for this $chartofaccounts // Get language code for this $chartofaccounts
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a'; $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a';
$sql .= ' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts; $sql .= ' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
@ -147,34 +147,34 @@ if (empty($reshook))
} }
} }
if (!dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
$error++; $error++;
} }
} else { } else {
$error++; $error++;
} }
} }
if ($action == 'disable') { if ($action == 'disable') {
if ($accounting->fetch($id)) { if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int'); $mode = GETPOST('mode', 'int');
$result = $accounting->accountDeactivate($id, $mode); $result = $accounting->accountDeactivate($id, $mode);
} }
$action = 'update'; $action = 'update';
if ($result < 0) { if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors'); setEventMessages($accounting->error, $accounting->errors, 'errors');
} }
} elseif ($action == 'enable') { } elseif ($action == 'enable') {
if ($accounting->fetch($id)) { if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int'); $mode = GETPOST('mode', 'int');
$result = $accounting->account_activate($id, $mode); $result = $accounting->account_activate($id, $mode);
} }
$action = 'update'; $action = 'update';
if ($result < 0) { if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors'); setEventMessages($accounting->error, $accounting->errors, 'errors');
} }
} }
} }
@ -273,9 +273,9 @@ if ($resql)
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype); if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if (!empty($conf->use_javascript_ajax)) if (!empty($conf->use_javascript_ajax))
{ {
print '<!-- Add javascript to reload page when we click "Change plan" --> print '<!-- Add javascript to reload page when we click "Change plan" -->
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
$("#change_chart").on("click", function (e) { $("#change_chart").on("click", function (e) {
@ -285,7 +285,7 @@ if ($resql)
}); });
}); });
</script>'; </script>';
} }
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -296,48 +296,48 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton .= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create');
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
// Box to select active chart of account // Box to select active chart of account
print $langs->trans("Selectchartofaccounts")." : "; print $langs->trans("Selectchartofaccounts")." : ";
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">'; print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code"; $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON a.fk_country = c.rowid AND c.active = 1"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON a.fk_country = c.rowid AND c.active = 1";
$sql .= " WHERE a.active = 1"; $sql .= " WHERE a.active = 1";
dol_syslog('accountancy/admin/account.php $sql='.$sql); dol_syslog('accountancy/admin/account.php $sql='.$sql);
print $sql; print $sql;
$resqlchart = $db->query($sql); $resqlchart = $db->query($sql);
if ($resqlchart) { if ($resqlchart) {
$numbis = $db->num_rows($resqlchart); $numbis = $db->num_rows($resqlchart);
$i = 0; $i = 0;
while ($i < $numbis) { while ($i < $numbis) {
$obj = $db->fetch_object($resqlchart); $obj = $db->fetch_object($resqlchart);
print '<option value="'.$obj->rowid.'"'; print '<option value="'.$obj->rowid.'"';
print ($pcgver == $obj->rowid) ? ' selected' : ''; print ($pcgver == $obj->rowid) ? ' selected' : '';
print '>'.$obj->pcg_version.' - '.$obj->label.' - ('.$obj->country_code.')</option>'; print '>'.$obj->pcg_version.' - '.$obj->label.' - ('.$obj->country_code.')</option>';
$i++; $i++;
} }
} else dol_print_error($db); } else dol_print_error($db);
print "</select>"; print "</select>";
print ajax_combobox("chartofaccounts"); print ajax_combobox("chartofaccounts");
print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">'; print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<br>'; print '<br>';
print '<br>'; print '<br>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$moreforfilter = ''; $moreforfilter = '';
$massactionbutton = ''; $massactionbutton = '';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Line for search fields // Line for search fields
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
@ -358,7 +358,7 @@ if ($resql)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (!empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
@ -422,7 +422,7 @@ if ($resql)
print '<!-- obj->account_parent = '.$obj->account_parent.' obj->rowid2 = '.$obj->rowid2.' -->'; print '<!-- obj->account_parent = '.$obj->account_parent.' obj->rowid2 = '.$obj->rowid2.' -->';
$accountparent->id = $obj->rowid2; $accountparent->id = $obj->rowid2;
$accountparent->label = $obj->label2; $accountparent->label = $obj->label2;
$accountparent->account_number = $obj->account_number2; // Sotre an account number for output $accountparent->account_number = $obj->account_number2; // Sotre an account number for output
print $accountparent->getNomUrl(1); print $accountparent->getNomUrl(1);
print "</td>\n"; print "</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;

View File

@ -472,13 +472,13 @@ if ($id)
if ($valuetoshow != '') { if ($valuetoshow != '') {
print '<td class="'.$class.'">'; print '<td class="'.$class.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>'; print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) { } elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else { } else {
print $valuetoshow; print $valuetoshow;
} }
print '</td>'; print '</td>';
} }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1; if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;

View File

@ -108,16 +108,16 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} elseif ($res < 0) } elseif ($res < 0)
{ {
$error++; $error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action = "create"; $action = "create";
} }
if (!$error) if (!$error)
{ {
setEventMessages("RecordCreatedSuccessfully", null, 'mesgs'); setEventMessages("RecordCreatedSuccessfully", null, 'mesgs');
$urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1); $urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1);
header("Location: ".$urltogo); header("Location: ".$urltogo);
exit; exit;
} }
} }
} elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) { } elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) {
@ -158,15 +158,15 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
$result = $object->update($user); $result = $object->update($user);
if ($result > 0) { if ($result > 0) {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id); $urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo); header("Location: ".$urltogo);
exit(); exit();
} else { } else {
$mesg = $object->error; $mesg = $object->error;
} }
} else { } else {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id); $urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo); header("Location: ".$urltogo);
exit(); exit();
} }
} elseif ($action == 'delete' && $user->rights->accounting->chartofaccount) { } elseif ($action == 'delete' && $user->rights->accounting->chartofaccount) {

File diff suppressed because it is too large Load Diff

View File

@ -39,8 +39,8 @@ $action = GETPOST('action', 'aZ09');
$list_account_main = array( $list_account_main = array(
'ACCOUNTING_RESULT_PROFIT', 'ACCOUNTING_RESULT_PROFIT',
'ACCOUNTING_RESULT_LOSS' 'ACCOUNTING_RESULT_LOSS'
); );
/* /*
@ -48,17 +48,17 @@ $list_account_main = array(
*/ */
if ($action == 'update') { if ($action == 'update') {
$error = 0; $error = 0;
$defaultjournal = GETPOST('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', 'alpha'); $defaultjournal = GETPOST('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', 'alpha');
if (!empty($defaultjournal)) { if (!empty($defaultjournal)) {
if (!dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) {
$error++; $error++;
} }
} else { } else {
$error++; $error++;
} }
foreach ($list_account_main as $constname) { foreach ($list_account_main as $constname) {
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
@ -99,20 +99,20 @@ print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
foreach ($list_account_main as $key) { foreach ($list_account_main as $key) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param
$label = $langs->trans($key); $label = $langs->trans($key);
$keydesc = $key.'_Desc'; $keydesc = $key.'_Desc';
$htmltext = $langs->trans($keydesc); $htmltext = $langs->trans($keydesc);
print '<td class="fieldrequired" width="50%">'; print '<td class="fieldrequired" width="50%">';
print $form->textwithpicto($label, $htmltext); print $form->textwithpicto($label, $htmltext);
print '</td>'; print '</td>';
// Value // Value
print '<td>'; // Do not force class=right, or it align also the content of the select box print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
// Journal // Journal

View File

@ -45,7 +45,7 @@ $action = GETPOST('action', 'aZ09');
// Parameters ACCOUNTING_EXPORT_* // Parameters ACCOUNTING_EXPORT_*
$main_option = array( $main_option = array(
'ACCOUNTING_EXPORT_PREFIX_SPEC', 'ACCOUNTING_EXPORT_PREFIX_SPEC',
); );
$configuration = AccountancyExport::getTypeConfig(); $configuration = AccountancyExport::getTypeConfig();
@ -58,22 +58,22 @@ $listcr = $configuration['cr'];
$model_option = array( $model_option = array(
'1' => array( '1' => array(
'label' => 'ACCOUNTING_EXPORT_FORMAT', 'label' => 'ACCOUNTING_EXPORT_FORMAT',
'param' => $listformat, 'param' => $listformat,
), ),
'2' => array( '2' => array(
'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV', 'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV',
'param' => '', 'param' => '',
), ),
'3' => array( '3' => array(
'label' => 'ACCOUNTING_EXPORT_ENDLINE', 'label' => 'ACCOUNTING_EXPORT_ENDLINE',
'param' => $listcr, 'param' => $listcr,
), ),
'4' => array( '4' => array(
'label' => 'ACCOUNTING_EXPORT_DATE', 'label' => 'ACCOUNTING_EXPORT_DATE',
'param' => '', 'param' => '',
), ),
); );
@ -105,22 +105,22 @@ if ($action == 'update') {
} }
} }
foreach ($listparam[$modelcsv] as $key => $value) { foreach ($listparam[$modelcsv] as $key => $value) {
$constante = $key; $constante = $key;
if (strpos($constante, 'ACCOUNTING') !== false) { if (strpos($constante, 'ACCOUNTING') !== false) {
$constvalue = GETPOST($key, 'alpha'); $constvalue = GETPOST($key, 'alpha');
if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++; $error++;
} }
} }
} }
if (!$error) { if (!$error) {
// reload // reload
$configuration = AccountancyExport::getTypeConfig(); $configuration = AccountancyExport::getTypeConfig();
$listparam = $configuration['param']; $listparam = $configuration['param'];
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
@ -148,36 +148,36 @@ print 'jQuery(document).ready(function () {'."\n";
print ' function initfields()'."\n"; print ' function initfields()'."\n";
print ' {'."\n"; print ' {'."\n";
foreach ($listparam as $key => $param) { foreach ($listparam as $key => $param) {
print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n"; print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n";
print ' {'."\n"; print ' {'."\n";
print ' //console.log("'.$param['label'].'");'."\n"; print ' //console.log("'.$param['label'].'");'."\n";
if (empty($param['ACCOUNTING_EXPORT_FORMAT'])) { if (empty($param['ACCOUNTING_EXPORT_FORMAT'])) {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n";
} else { } else {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param['ACCOUNTING_EXPORT_FORMAT'].'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param['ACCOUNTING_EXPORT_FORMAT'].'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n";
} }
if (empty($param['ACCOUNTING_EXPORT_SEPARATORCSV'])) { if (empty($param['ACCOUNTING_EXPORT_SEPARATORCSV'])) {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n";
} else { } else {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n";
} }
if (empty($param['ACCOUNTING_EXPORT_ENDLINE'])) { if (empty($param['ACCOUNTING_EXPORT_ENDLINE'])) {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n";
} else { } else {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n";
} }
if (empty($param['ACCOUNTING_EXPORT_DATE'])) { if (empty($param['ACCOUNTING_EXPORT_DATE'])) {
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n";
} else { } else {
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.$conf->global->ACCOUNTING_EXPORT_DATE.'");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.$conf->global->ACCOUNTING_EXPORT_DATE.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'."\n"; print ' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'."\n";
} }
print ' }'."\n"; print ' }'."\n";
} }
print ' }'."\n"; print ' }'."\n";
print ' initfields();'."\n"; print ' initfields();'."\n";
@ -262,17 +262,17 @@ if ($num2) {
foreach ($model_option as $key) { foreach ($model_option as $key) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param
$label = $key['label']; $label = $key['label'];
print '<td width="50%">'.$langs->trans($label).'</td>'; print '<td width="50%">'.$langs->trans($label).'</td>';
// Value // Value
print '<td>'; print '<td>';
if (is_array($key['param'])) { if (is_array($key['param'])) {
print $form->selectarray($label, $key['param'], $conf->global->$label, 0); print $form->selectarray($label, $key['param'], $conf->global->$label, 0);
} else { } else {
print '<input type="text" size="20" id="'.$label.'" name="'.$key['label'].'" value="'.$conf->global->$label.'">'; print '<input type="text" size="20" id="'.$label.'" name="'.$key['label'].'" value="'.$conf->global->$label.'">';
} }
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -113,7 +113,7 @@ if ($result)
$i = 0; $i = 0;
$addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write); $addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write);
$title = $langs->trans('AccountingPeriods'); $title = $langs->trans('AccountingPeriods');

View File

@ -420,15 +420,15 @@ if ($id)
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut $valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate $valuetoshow = $langs->trans($valuetoshow); // try to translate
$class = "left"; $class = "left";
if ($fieldlist[$field] == 'code') { if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code"); $valuetoshow = $langs->trans("Code");
} }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label"); $valuetoshow = $langs->trans("Label");
} }
if ($fieldlist[$field] == 'nature') { if ($fieldlist[$field] == 'nature') {
$valuetoshow = $langs->trans("NatureOfJournal"); $valuetoshow = $langs->trans("NatureOfJournal");
} }
if ($valuetoshow != '') { if ($valuetoshow != '') {
print '<td class="'.$class.'">'; print '<td class="'.$class.'">';
@ -540,14 +540,14 @@ if ($id)
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut $valuetoshow = ucfirst($fieldlist[$field]); // By defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate $valuetoshow = $langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field] == 'code') { if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code"); $valuetoshow = $langs->trans("Code");
} }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label"); $valuetoshow = $langs->trans("Label");
} }
if ($fieldlist[$field] == 'nature') { if ($fieldlist[$field] == 'nature') {
$valuetoshow = $langs->trans("NatureOfJournal"); $valuetoshow = $langs->trans("NatureOfJournal");
} }
// Affiche nom du champ // Affiche nom du champ
if ($showfield) { if ($showfield) {
@ -594,7 +594,7 @@ if ($id)
if (empty($reshook)) if (empty($reshook))
{ {
$langs->load("accountancy"); $langs->load("accountancy");
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
$showfield = 1; $showfield = 1;
@ -607,7 +607,7 @@ if ($id)
$valuetoshow = ($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature)) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature)) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') { } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') {
$valuetoshow = $langs->trans($obj->label); $valuetoshow = $langs->trans($obj->label);
} }
$class = 'tddict'; $class = 'tddict';
// Show value for field // Show value for field
@ -619,15 +619,15 @@ if ($id)
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
if (isset($obj->code) && $id != 10) { if (isset($obj->code) && $id != 10) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0; $iserasable = 0;
$canbedisabled = 0; $canbedisabled = 0;
} elseif ($obj->code == 'RECEP') { } elseif ($obj->code == 'RECEP') {
$iserasable = 0; $iserasable = 0;
$canbedisabled = 0; $canbedisabled = 0;
} elseif ($obj->code == 'EF0') { } elseif ($obj->code == 'EF0') {
$iserasable = 0; $iserasable = 0;
$canbedisabled = 0; $canbedisabled = 0;
} }
} }
$canbemodified = $iserasable; $canbemodified = $iserasable;

View File

@ -42,7 +42,7 @@ if (empty($conf->accounting->enabled)) {
accessforbidden(); accessforbidden();
} }
if (!$user->rights->accounting->bind->write) if (!$user->rights->accounting->bind->write)
accessforbidden(); accessforbidden();
// search & action GETPOST // search & action GETPOST
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -100,14 +100,14 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
{ {
$search_ref = ''; $search_ref = '';
$search_label = ''; $search_label = '';
$search_desc = ''; $search_desc = '';
$search_vat = ''; $search_vat = '';
$search_onsell = ''; $search_onsell = '';
$search_onpurchase = ''; $search_onpurchase = '';
$search_current_account = ''; $search_current_account = '';
$search_current_account_valid = '-1'; $search_current_account_valid = '-1';
} }
// Sales or Purchase mode ? // Sales or Purchase mode ?
@ -117,8 +117,8 @@ if ($action == 'update') {
$accounting_product_modes = array( $accounting_product_modes = array(
'ACCOUNTANCY_SELL', 'ACCOUNTANCY_SELL',
'ACCOUNTANCY_SELL_INTRA', 'ACCOUNTANCY_SELL_INTRA',
'ACCOUNTANCY_SELL_EXPORT', 'ACCOUNTANCY_SELL_EXPORT',
'ACCOUNTANCY_BUY', 'ACCOUNTANCY_BUY',
'ACCOUNTANCY_BUY_INTRA', 'ACCOUNTANCY_BUY_INTRA',
'ACCOUNTANCY_BUY_EXPORT' 'ACCOUNTANCY_BUY_EXPORT'
@ -172,22 +172,22 @@ if ($action == 'update') {
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') { if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
$sql .= " SET accountancy_code_sell = ".$accounting->account_number; $sql .= " SET accountancy_code_sell = ".$accounting->account_number;
} }
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { if ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$sql .= " SET accountancy_code_sell_intra = ".$accounting->account_number; $sql .= " SET accountancy_code_sell_intra = ".$accounting->account_number;
} }
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') { if ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
$sql .= " SET accountancy_code_sell_export = ".$accounting->account_number; $sql .= " SET accountancy_code_sell_export = ".$accounting->account_number;
} }
$sql .= " WHERE rowid = ".((int) $productid); $sql .= " WHERE rowid = ".((int) $productid);
dol_syslog("/accountancy/admin/productaccount.php sql=".$sql, LOG_DEBUG); dol_syslog("/accountancy/admin/productaccount.php sql=".$sql, LOG_DEBUG);
if ($db->query($sql)) if ($db->query($sql))
{ {
$ok++; $ok++;
$db->commit(); $db->commit();
} else { } else {
$ko++; $ko++;
$db->rollback(); $db->rollback();
} }
} }
@ -253,7 +253,7 @@ $sql .= " aa.rowid as aaid";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$sql .= " p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'"; $sql .= " p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA')
{ {
$sql .= " p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'"; $sql .= " p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'";
@ -271,9 +271,9 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
} }
$sql .= ' WHERE p.entity IN ('.getEntity('product').')'; $sql .= ' WHERE p.entity IN ('.getEntity('product').')';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
if (strlen(trim($search_current_account))) { if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy", $search_current_account); $sql .= natural_search("p.accountancy_code_buy", $search_current_account);
} }
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
if (strlen(trim($search_current_account))) { if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy_intra", $search_current_account); $sql .= natural_search("p.accountancy_code_buy_intra", $search_current_account);
@ -283,17 +283,17 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$sql .= natural_search("p.accountancy_code_buy_export", $search_current_account); $sql .= natural_search("p.accountancy_code_buy_export", $search_current_account);
} }
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
if (strlen(trim($search_current_account))) { if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell", $search_current_account); $sql .= natural_search("p.accountancy_code_sell", $search_current_account);
} }
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
if (strlen(trim($search_current_account))) { if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_intra", $search_current_account); $sql .= natural_search("p.accountancy_code_sell_intra", $search_current_account);
} }
} else { } else {
if (strlen(trim($search_current_account))) { if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_export", $search_current_account); $sql .= natural_search("p.accountancy_code_sell_export", $search_current_account);
} }
} }
if ($search_current_account_valid == 'withoutvalidaccount') if ($search_current_account_valid == 'withoutvalidaccount')
{ {
@ -301,7 +301,7 @@ if ($search_current_account_valid == 'withoutvalidaccount')
} }
if ($search_current_account_valid == 'withvalidaccount') if ($search_current_account_valid == 'withvalidaccount')
{ {
$sql .= " AND aa.account_number IS NOT NULL"; $sql .= " AND aa.account_number IS NOT NULL";
} }
// Add search filter like // Add search filter like
if (strlen(trim($search_ref))) { if (strlen(trim($search_ref))) {
@ -324,13 +324,13 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{ {
$result = $db->query($sql); $result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result); $nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{ {
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
} }
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
@ -342,32 +342,32 @@ if ($result)
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_ref > 0) $param .= "&search_desc=".urlencode($search_ref); if ($search_ref > 0) $param .= "&search_desc=".urlencode($search_ref);
if ($search_label > 0) $param .= "&search_desc=".urlencode($search_label); if ($search_label > 0) $param .= "&search_desc=".urlencode($search_label);
if ($search_desc > 0) $param .= "&search_desc=".urlencode($search_desc); if ($search_desc > 0) $param .= "&search_desc=".urlencode($search_desc);
if ($search_vat > 0) $param .= '&search_vat='.urlencode($search_vat); if ($search_vat > 0) $param .= '&search_vat='.urlencode($search_vat);
if ($search_current_account > 0) $param .= "&search_current_account=".urlencode($search_current_account); if ($search_current_account > 0) $param .= "&search_current_account=".urlencode($search_current_account);
if ($search_current_account_valid && $search_current_account_valid != '-1') $param .= "&search_current_account_valid=".urlencode($search_current_account_valid); if ($search_current_account_valid && $search_current_account_valid != '-1') $param .= "&search_current_account_valid=".urlencode($search_current_account_valid);
if ($accounting_product_mode) $param .= '&accounting_product_mode='.urlencode($accounting_product_mode); if ($accounting_product_mode) $param .= '&accounting_product_mode='.urlencode($accounting_product_mode);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy'); print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
print '<br>'; print '<br>';
print '<span class="opacitymedium">'.$langs->trans("InitAccountancyDesc").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("InitAccountancyDesc").'</span><br>';
print '<br>'; print '<br>';
// Select mode // Select mode
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Options').'</td><td>'.$langs->trans('Description').'</td>'; print '<td>'.$langs->trans('Options').'</td><td>'.$langs->trans('Description').'</td>';
@ -377,13 +377,13 @@ if ($result)
print "</td></tr>\n"; print "</td></tr>\n";
if ($mysoc->isInEEC()) if ($mysoc->isInEEC())
{ {
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellIntra').'</td>'; print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellIntra').'</td>';
print '<td>'.$langs->trans('OptionModeProductSellIntraDesc'); print '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
print "</td></tr>\n"; print "</td></tr>\n";
} }
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellExport').'</td>'; print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellExport').'</td>';
print '<td>'.$langs->trans('OptionModeProductSellExportDesc'); print '<td>'.$langs->trans('OptionModeProductSellExportDesc');
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"'.($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuy').'</td>'; print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"'.($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuy').'</td>';
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n"; print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
if ($mysoc->isInEEC()) if ($mysoc->isInEEC())
@ -405,8 +405,8 @@ if ($result)
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="'.$langs->trans("Save").'">'; $buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="'.$langs->trans("Save").'">';
//print '<br><div class="center">'.$buttonsave.'</div>'; //print '<br><div class="center">'.$buttonsave.'</div>';
$texte = $langs->trans("ListOfProductsServices"); $texte = $langs->trans("ListOfProductsServices");
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1); print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
@ -444,22 +444,22 @@ if ($result)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder); if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "p.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "p.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
// On sell / On purchase // On sell / On purchase
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') { if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell"; $fieldtosortaccount = "p.accountancy_code_sell";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_intra"; $fieldtosortaccount = "p.accountancy_code_sell_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_export"; $fieldtosortaccount = "p.accountancy_code_sell_export";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy"; $fieldtosortaccount = "p.accountancy_code_buy";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy_intra"; $fieldtosortaccount = "p.accountancy_code_buy_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
@ -475,8 +475,8 @@ if ($result)
$product_static = new Product($db); $product_static = new Product($db);
$i = 0; $i = 0;
while ($i < min($num, $limit)) while ($i < min($num, $limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
// Ref produit as link // Ref produit as link
@ -494,12 +494,12 @@ if ($result)
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell; $compta_prodsell_id = $aarowid_prodsell;
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_intra; $compta_prodsell_id = $aarowid_prodsell_intra;
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_export; $compta_prodsell_id = $aarowid_prodsell_export;
} else { } else {
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); $compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell; $compta_prodsell_id = $aarowid_prodsell;
} }
@ -560,11 +560,11 @@ if ($result)
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC))
{ {
// TODO ADJUST DESCRIPTION SIZE // TODO ADJUST DESCRIPTION SIZE
// print '<td class="left">' . $obj->description . '</td>'; // print '<td class="left">' . $obj->description . '</td>';
// TODO: we should set a user defined value to adjust user square / wide screen size // TODO: we should set a user defined value to adjust user square / wide screen size
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print '<td>'.nl2br(dol_trunc($obj->description, $trunclength)).'</td>'; print '<td>'.nl2br(dol_trunc($obj->description, $trunclength)).'</td>';
} }
// VAT // VAT
@ -581,30 +581,30 @@ if ($result)
// Current accounting account // Current accounting account
print '<td class="left">'; print '<td class="left">';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print length_accountg($obj->accountancy_code_buy); print length_accountg($obj->accountancy_code_buy);
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
print length_accountg($obj->accountancy_code_buy_intra); print length_accountg($obj->accountancy_code_buy_intra);
if ($obj->accountancy_code_buy_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); if ($obj->accountancy_code_buy_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
print length_accountg($obj->accountancy_code_buy_export); print length_accountg($obj->accountancy_code_buy_export);
if ($obj->accountancy_code_buy_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); if ($obj->accountancy_code_buy_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print length_accountg($obj->accountancy_code_sell); print length_accountg($obj->accountancy_code_sell);
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
print length_accountg($obj->accountancy_code_sell_intra); print length_accountg($obj->accountancy_code_sell_intra);
if ($obj->accountancy_code_sell_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); if ($obj->accountancy_code_sell_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} else { } else {
print length_accountg($obj->accountancy_code_sell_export); print length_accountg($obj->accountancy_code_sell_export);
if ($obj->accountancy_code_sell_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount")); if ($obj->accountancy_code_sell_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} }
print '</td>'; print '</td>';
// New account to set // New account to set
$defaultvalue = ''; $defaultvalue = '';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
// Accounting account buy // Accounting account buy
print '<td class="left">'; print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code //$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy; if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy;
@ -643,25 +643,25 @@ if ($result)
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print '</td>'; print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { } elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
// Accounting account sell intra (In EEC) // Accounting account sell intra (In EEC)
print '<td class="left">'; print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code //$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell; if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_intra); $codesell = length_accountg($obj->accountancy_code_sell_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell); //var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print '</td>'; print '</td>';
} else { } else {
// Accounting account sell export (Out of EEC) // Accounting account sell export (Out of EEC)
print '<td class="left">'; print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code //$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell; if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_export); $codesell = length_accountg($obj->accountancy_code_sell_export);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1); print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print '</td>'; print '</td>';
} }
// Checkbox select // Checkbox select
print '<td class="center">'; print '<td class="center">';

View File

@ -274,11 +274,11 @@ if ($action != 'export_csv')
$sous_total_credit = 0; $sous_total_credit = 0;
$displayed_account = ""; $displayed_account = "";
$accountingaccountstatic = new AccountingAccount($db); $accountingaccountstatic = new AccountingAccount($db);
$sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance"; $sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
$sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features $sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'"; $sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'";
$sql .= " GROUP BY t.numero_compte"; $sql .= " GROUP BY t.numero_compte";
@ -292,12 +292,12 @@ if ($action != 'export_csv')
foreach ($object->lines as $line) foreach ($object->lines as $line)
{ {
$accountingaccountstatic->fetch(null, $line->numero_compte, true); $accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) { if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1); $accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
} else { } else {
$accounting_account = length_accountg($line->numero_compte); $accounting_account = length_accountg($line->numero_compte);
} }
$link = ''; $link = '';
$total_debit += $line->debit; $total_debit += $line->debit;

View File

@ -114,12 +114,12 @@ if ($action == "confirm_update") {
$object->credit = $credit; $object->credit = $credit;
if (floatval($debit) != 0.0) { if (floatval($debit) != 0.0) {
$object->montant = $debit; // deprecated $object->montant = $debit; // deprecated
$object->amount = $debit; $object->amount = $debit;
$object->sens = 'D'; $object->sens = 'D';
} }
if (floatval($credit) != 0.0) { if (floatval($credit) != 0.0) {
$object->montant = $credit; // deprecated $object->montant = $credit; // deprecated
$object->amount = $credit; $object->amount = $credit;
$object->sens = 'C'; $object->sens = 'C';
} }
@ -175,13 +175,13 @@ if ($action == "confirm_update") {
$object->fk_docdet = (int) GETPOST('fk_docdet', 'int'); $object->fk_docdet = (int) GETPOST('fk_docdet', 'int');
if (floatval($debit) != 0.0) { if (floatval($debit) != 0.0) {
$object->montant = $debit; // deprecated $object->montant = $debit; // deprecated
$object->amount = $debit; $object->amount = $debit;
$object->sens = 'D'; $object->sens = 'D';
} }
if (floatval($credit) != 0.0) { if (floatval($credit) != 0.0) {
$object->montant = $credit; // deprecated $object->montant = $credit; // deprecated
$object->amount = $credit; $object->amount = $credit;
$object->sens = 'C'; $object->sens = 'C';
} }
@ -245,7 +245,7 @@ if ($action == "confirm_update") {
$object->journal_label = $journal_label; $object->journal_label = $journal_label;
$object->fk_doc = 0; $object->fk_doc = 0;
$object->fk_docdet = 0; $object->fk_docdet = 0;
$object->montant = 0; // deprecated $object->montant = 0; // deprecated
$object->amount = 0; $object->amount = 0;
$result = $object->createStd($user, 0, $mode); $result = $object->createStd($user, 0, $mode);

View File

@ -151,7 +151,7 @@ $arrayfields = array(
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1), 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
); );
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']); if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
@ -176,145 +176,145 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook)) if (empty($reshook))
{ {
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{ {
$search_mvt_num = ''; $search_mvt_num = '';
$search_doc_type = ''; $search_doc_type = '';
$search_doc_ref = ''; $search_doc_ref = '';
$search_doc_date = ''; $search_doc_date = '';
$search_accountancy_code = ''; $search_accountancy_code = '';
$search_accountancy_code_start = ''; $search_accountancy_code_start = '';
$search_accountancy_code_end = ''; $search_accountancy_code_end = '';
$search_accountancy_aux_code = ''; $search_accountancy_aux_code = '';
$search_accountancy_aux_code_start = ''; $search_accountancy_aux_code_start = '';
$search_accountancy_aux_code_end = ''; $search_accountancy_aux_code_end = '';
$search_mvt_label = ''; $search_mvt_label = '';
$search_direction = ''; $search_direction = '';
$search_ledger_code = ''; $search_ledger_code = '';
$search_date_start = ''; $search_date_start = '';
$search_date_end = ''; $search_date_end = '';
$search_date_creation_start = ''; $search_date_creation_start = '';
$search_date_creation_end = ''; $search_date_creation_end = '';
$search_date_modification_start = ''; $search_date_modification_start = '';
$search_date_modification_end = ''; $search_date_modification_end = '';
$search_date_export_start = ''; $search_date_export_start = '';
$search_date_export_end = ''; $search_date_export_end = '';
$search_debit = ''; $search_debit = '';
$search_credit = ''; $search_credit = '';
$search_lettering_code = ''; $search_lettering_code = '';
$search_not_reconciled = ''; $search_not_reconciled = '';
} }
// Must be after the remove filter action, before the export. // Must be after the remove filter action, before the export.
$param = ''; $param = '';
$filter = array(); $filter = array();
if (!empty($search_date_start)) { if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start; $filter['t.doc_date>='] = $search_date_start;
$tmp = dol_getdate($search_date_start); $tmp = dol_getdate($search_date_start);
$param .= '&search_date_startmonth='.urlencode($tmp['mon']).'&search_date_startday='.urlencode($tmp['mday']).'&search_date_startyear='.urlencode($tmp['year']); $param .= '&search_date_startmonth='.urlencode($tmp['mon']).'&search_date_startday='.urlencode($tmp['mday']).'&search_date_startyear='.urlencode($tmp['year']);
} }
if (!empty($search_date_end)) { if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end; $filter['t.doc_date<='] = $search_date_end;
$tmp = dol_getdate($search_date_end); $tmp = dol_getdate($search_date_end);
$param .= '&search_date_endmonth='.urlencode($tmp['mon']).'&search_date_endday='.urlencode($tmp['mday']).'&search_date_endyear='.urlencode($tmp['year']); $param .= '&search_date_endmonth='.urlencode($tmp['mon']).'&search_date_endday='.urlencode($tmp['mday']).'&search_date_endyear='.urlencode($tmp['year']);
} }
if (!empty($search_doc_date)) { if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date; $filter['t.doc_date'] = $search_doc_date;
$tmp = dol_getdate($search_doc_date); $tmp = dol_getdate($search_doc_date);
$param .= '&doc_datemonth='.urlencode($tmp['mon']).'&doc_dateday='.urlencode($tmp['mday']).'&doc_dateyear='.urlencode($tmp['year']); $param .= '&doc_datemonth='.urlencode($tmp['mon']).'&doc_dateday='.urlencode($tmp['mday']).'&doc_dateyear='.urlencode($tmp['year']);
} }
if (!empty($search_doc_type)) { if (!empty($search_doc_type)) {
$filter['t.doc_type'] = $search_doc_type; $filter['t.doc_type'] = $search_doc_type;
$param .= '&search_doc_type='.urlencode($search_doc_type); $param .= '&search_doc_type='.urlencode($search_doc_type);
} }
if (!empty($search_doc_ref)) { if (!empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref; $filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref='.urlencode($search_doc_ref); $param .= '&search_doc_ref='.urlencode($search_doc_ref);
} }
if (!empty($search_accountancy_code)) { if (!empty($search_accountancy_code)) {
$filter['t.numero_compte'] = $search_accountancy_code; $filter['t.numero_compte'] = $search_accountancy_code;
$param .= '&search_accountancy_code='.urlencode($search_accountancy_code); $param .= '&search_accountancy_code='.urlencode($search_accountancy_code);
} }
if (!empty($search_accountancy_code_start)) { if (!empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start; $filter['t.numero_compte>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start); $param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
} }
if (!empty($search_accountancy_code_end)) { if (!empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end; $filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end); $param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
} }
if (!empty($search_accountancy_aux_code)) { if (!empty($search_accountancy_aux_code)) {
$filter['t.subledger_account'] = $search_accountancy_aux_code; $filter['t.subledger_account'] = $search_accountancy_aux_code;
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code); $param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
} }
if (!empty($search_accountancy_aux_code_start)) { if (!empty($search_accountancy_aux_code_start)) {
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start; $filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
$param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start); $param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
} }
if (!empty($search_accountancy_aux_code_end)) { if (!empty($search_accountancy_aux_code_end)) {
$filter['t.subledger_account<='] = $search_accountancy_aux_code_end; $filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
$param .= '&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end); $param .= '&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
} }
if (!empty($search_mvt_label)) { if (!empty($search_mvt_label)) {
$filter['t.label_operation'] = $search_mvt_label; $filter['t.label_operation'] = $search_mvt_label;
$param .= '&search_mvt_label='.urlencode($search_mvt_label); $param .= '&search_mvt_label='.urlencode($search_mvt_label);
} }
if (!empty($search_direction)) { if (!empty($search_direction)) {
$filter['t.sens'] = $search_direction; $filter['t.sens'] = $search_direction;
$param .= '&search_direction='.urlencode($search_direction); $param .= '&search_direction='.urlencode($search_direction);
} }
if (!empty($search_ledger_code)) { if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code; $filter['t.code_journal'] = $search_ledger_code;
$param .= '&search_ledger_code='.urlencode($search_ledger_code); $param .= '&search_ledger_code='.urlencode($search_ledger_code);
} }
if (!empty($search_mvt_num)) { if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num; $filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num='.urlencode($search_mvt_num); $param .= '&search_mvt_num='.urlencode($search_mvt_num);
} }
if (!empty($search_date_creation_start)) { if (!empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $search_date_creation_start; $filter['t.date_creation>='] = $search_date_creation_start;
$tmp = dol_getdate($search_date_creation_start); $tmp = dol_getdate($search_date_creation_start);
$param .= '&date_creation_startmonth='.urlencode($tmp['mon']).'&date_creation_startday='.urlencode($tmp['mday']).'&date_creation_startyear='.urlencode($tmp['year']); $param .= '&date_creation_startmonth='.urlencode($tmp['mon']).'&date_creation_startday='.urlencode($tmp['mday']).'&date_creation_startyear='.urlencode($tmp['year']);
} }
if (!empty($search_date_creation_end)) { if (!empty($search_date_creation_end)) {
$filter['t.date_creation<='] = $search_date_creation_end; $filter['t.date_creation<='] = $search_date_creation_end;
$tmp = dol_getdate($search_date_creation_end); $tmp = dol_getdate($search_date_creation_end);
$param .= '&date_creation_endmonth='.urlencode($tmp['mon']).'&date_creation_endday='.urlencode($tmp['mday']).'&date_creation_endyear='.urlencode($tmp['year']); $param .= '&date_creation_endmonth='.urlencode($tmp['mon']).'&date_creation_endday='.urlencode($tmp['mday']).'&date_creation_endyear='.urlencode($tmp['year']);
} }
if (!empty($search_date_modification_start)) { if (!empty($search_date_modification_start)) {
$filter['t.tms>='] = $search_date_modification_start; $filter['t.tms>='] = $search_date_modification_start;
$tmp = dol_getdate($search_date_modification_start); $tmp = dol_getdate($search_date_modification_start);
$param .= '&date_modification_startmonth='.urlencode($tmp['mon']).'&date_modification_startday='.urlencode($tmp['mday']).'&date_modification_startyear='.urlencode($tmp['year']); $param .= '&date_modification_startmonth='.urlencode($tmp['mon']).'&date_modification_startday='.urlencode($tmp['mday']).'&date_modification_startyear='.urlencode($tmp['year']);
} }
if (!empty($search_date_modification_end)) { if (!empty($search_date_modification_end)) {
$filter['t.tms<='] = $search_date_modification_end; $filter['t.tms<='] = $search_date_modification_end;
$tmp = dol_getdate($search_date_modification_end); $tmp = dol_getdate($search_date_modification_end);
$param .= '&date_modification_endmonth='.urlencode($tmp['mon']).'&date_modification_endday='.urlencode($tmp['mday']).'&date_modification_endyear='.urlencode($tmp['year']); $param .= '&date_modification_endmonth='.urlencode($tmp['mon']).'&date_modification_endday='.urlencode($tmp['mday']).'&date_modification_endyear='.urlencode($tmp['year']);
} }
if (!empty($search_date_export_start)) { if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start; $filter['t.date_export>='] = $search_date_export_start;
$tmp = dol_getdate($search_date_export_start); $tmp = dol_getdate($search_date_export_start);
$param .= '&date_export_startmonth='.urlencode($tmp['mon']).'&date_export_startday='.urlencode($tmp['mday']).'&date_export_startyear='.urlencode($tmp['year']); $param .= '&date_export_startmonth='.urlencode($tmp['mon']).'&date_export_startday='.urlencode($tmp['mday']).'&date_export_startyear='.urlencode($tmp['year']);
} }
if (!empty($search_date_export_end)) { if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end; $filter['t.date_export<='] = $search_date_export_end;
$tmp = dol_getdate($search_date_export_end); $tmp = dol_getdate($search_date_export_end);
$param .= '&date_export_endmonth='.urlencode($tmp['mon']).'&date_export_endday='.urlencode($tmp['mday']).'&date_export_endyear='.urlencode($tmp['year']); $param .= '&date_export_endmonth='.urlencode($tmp['mon']).'&date_export_endday='.urlencode($tmp['mday']).'&date_export_endyear='.urlencode($tmp['year']);
} }
if (!empty($search_debit)) { if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit; $filter['t.debit'] = $search_debit;
$param .= '&search_debit='.urlencode($search_debit); $param .= '&search_debit='.urlencode($search_debit);
} }
if (!empty($search_credit)) { if (!empty($search_credit)) {
$filter['t.credit'] = $search_credit; $filter['t.credit'] = $search_credit;
$param .= '&search_credit='.urlencode($search_credit); $param .= '&search_credit='.urlencode($search_credit);
} }
if (!empty($search_lettering_code)) { if (!empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code; $filter['t.lettering_code'] = $search_lettering_code;
$param .= '&search_lettering_code='.urlencode($search_lettering_code); $param .= '&search_lettering_code='.urlencode($search_lettering_code);
} }
if (!empty($search_not_reconciled)) { if (!empty($search_not_reconciled)) {
$filter['t.reconciled_option'] = $search_not_reconciled; $filter['t.reconciled_option'] = $search_not_reconciled;
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled); $param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
@ -475,48 +475,48 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
// Export files // Export files
$accountancyexport = new AccountancyExport($db); $accountancyexport = new AccountancyExport($db);
$accountancyexport->export($object->lines, $formatexportset); $accountancyexport->export($object->lines, $formatexportset);
if (!empty($accountancyexport->errors)) if (!empty($accountancyexport->errors))
{ {
setEventMessages('', $accountancyexport->errors, 'errors'); setEventMessages('', $accountancyexport->errors, 'errors');
} else { } else {
// Specify as export : update field date_export // Specify as export : update field date_export
$error = 0; $error = 0;
$db->begin(); $db->begin();
if (is_array($object->lines)) if (is_array($object->lines))
{ {
foreach ($object->lines as $movement) foreach ($object->lines as $movement)
{ {
$now = dol_now(); $now = dol_now();
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET date_export = '".$db->idate($now)."'"; $sql .= " SET date_export = '".$db->idate($now)."'";
$sql .= " WHERE rowid = ".$movement->id; $sql .= " WHERE rowid = ".$movement->id;
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG); dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if (!$result) if (!$result)
{ {
$error++; $error++;
break; break;
} }
} }
} }
if (!$error) if (!$error)
{ {
$db->commit(); $db->commit();
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs'); // setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
} else { } else {
$error++; $error++;
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors'); setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
} }
} }
exit; exit;
} }
} }
@ -629,9 +629,9 @@ else $buttonLabel = $langs->trans("ExportList");
// Button re-export // Button re-export
if (!empty($conf->global->ACCOUNTING_REEXPORT)) { if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> '; $newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
} else { } else {
$newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> '; $newcardbutton = '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
} }
$newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>'; $newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
@ -791,14 +791,14 @@ if (!empty($arrayfields['t.tms']['checked']))
// Date export // Date export
if (!empty($arrayfields['t.date_export']['checked'])) if (!empty($arrayfields['t.date_export']['checked']))
{ {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $form->selectDate($search_date_export_start, 'date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print $form->selectDate($search_date_export_start, 'date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>'; print '</div>';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $form->selectDate($search_date_export_end, 'date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); print $form->selectDate($search_date_export_end, 'date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>'; print '</div>';
print '</td>'; print '</td>';
} }
// Action column // Action column
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
@ -854,7 +854,7 @@ while ($i < min($num, $limit))
$line->label_operation = $obj->label_operation; $line->label_operation = $obj->label_operation;
$line->debit = $obj->debit; $line->debit = $obj->debit;
$line->credit = $obj->credit; $line->credit = $obj->credit;
$line->montant = $obj->amount; // deprecated $line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount; $line->amount = $obj->amount;
$line->sens = $obj->sens; $line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code; $line->lettering_code = $obj->lettering_code;
@ -893,65 +893,65 @@ while ($i < min($num, $limit))
// Document ref // Document ref
if (!empty($arrayfields['t.doc_ref']['checked'])) if (!empty($arrayfields['t.doc_ref']['checked']))
{ {
if ($line->doc_type == 'customer_invoice') if ($line->doc_type == 'customer_invoice')
{ {
$langs->loadLangs(array('bills')); $langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$objectstatic = new Facture($db); $objectstatic = new Facture($db);
$objectstatic->fetch($line->fk_doc); $objectstatic->fetch($line->fk_doc);
//$modulepart = 'facture'; //$modulepart = 'facture';
$filename = dol_sanitizeFileName($line->doc_ref); $filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'supplier_invoice') } elseif ($line->doc_type == 'supplier_invoice')
{ {
$langs->loadLangs(array('bills')); $langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$objectstatic = new FactureFournisseur($db); $objectstatic = new FactureFournisseur($db);
$objectstatic->fetch($line->fk_doc); $objectstatic->fetch($line->fk_doc);
//$modulepart = 'invoice_supplier'; //$modulepart = 'invoice_supplier';
$filename = dol_sanitizeFileName($line->doc_ref); $filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
} elseif ($line->doc_type == 'expense_report') } elseif ($line->doc_type == 'expense_report')
{ {
$langs->loadLangs(array('trips')); $langs->loadLangs(array('trips'));
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$objectstatic = new ExpenseReport($db); $objectstatic = new ExpenseReport($db);
$objectstatic->fetch($line->fk_doc); $objectstatic->fetch($line->fk_doc);
//$modulepart = 'expensereport'; //$modulepart = 'expensereport';
$filename = dol_sanitizeFileName($line->doc_ref); $filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} else { } else {
// Other type // Other type
} }
print '<td class="nowrap">'; print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref // Picto + Ref
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
{ {
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
print $documentlink; print $documentlink;
} else { } else {
print $line->doc_ref; print $line->doc_ref;
} }
print '</td></tr></table>'; print '</td></tr></table>';
print "</td>\n"; print "</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
@ -1065,9 +1065,9 @@ print '</div>';
// TODO Replace this with mass delete action // TODO Replace this with mass delete action
if ($user->rights->accounting->mouvements->supprimer_tous) { if ($user->rights->accounting->mouvements->supprimer_tous) {
print '<div class="tabsAction tabsActionNoBottom">'."\n"; print '<div class="tabsAction tabsActionNoBottom">'."\n";
print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>'; print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear'.($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
print '</div>'; print '</div>';
} }
print '</form>'; print '</form>';

View File

@ -138,7 +138,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook)) if (empty($reshook))
{ {
include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{ {
@ -172,55 +172,55 @@ if (empty($reshook))
if (!empty($search_date_start)) { if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start; $filter['t.doc_date>='] = $search_date_start;
$param .= '&search_date_startmonth=' . GETPOST('search_date_startmonth', 'int') . '&search_date_startday=' . GETPOST('search_date_startday', 'int') . '&search_date_startyear=' . GETPOST('search_date_startyear', 'int'); $param .= '&search_date_startmonth='.GETPOST('search_date_startmonth', 'int').'&search_date_startday='.GETPOST('search_date_startday', 'int').'&search_date_startyear='.GETPOST('search_date_startyear', 'int');
} }
if (!empty($search_date_end)) { if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end; $filter['t.doc_date<='] = $search_date_end;
$param .= '&search_date_endmonth=' . GETPOST('search_date_endmonth', 'int') . '&search_date_endday=' . GETPOST('search_date_endday', 'int') . '&search_date_endyear=' . GETPOST('search_date_endyear', 'int'); $param .= '&search_date_endmonth='.GETPOST('search_date_endmonth', 'int').'&search_date_endday='.GETPOST('search_date_endday', 'int').'&search_date_endyear='.GETPOST('search_date_endyear', 'int');
} }
if (!empty($search_doc_date)) { if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date; $filter['t.doc_date'] = $search_doc_date;
$param .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int'); $param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int');
} }
if (!empty($search_accountancy_code_start)) { if (!empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start; $filter['t.numero_compte>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start); $param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
} }
if (!empty($search_accountancy_code_end)) { if (!empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end; $filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end); $param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
} }
if (!empty($search_label_account)) { if (!empty($search_label_account)) {
$filter['t.label_compte'] = $search_label_account; $filter['t.label_compte'] = $search_label_account;
$param .= '&search_label_compte=' . urlencode($search_label_account); $param .= '&search_label_compte='.urlencode($search_label_account);
} }
if (!empty($search_mvt_num)) { if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num; $filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num=' . urlencode($search_mvt_num); $param .= '&search_mvt_num='.urlencode($search_mvt_num);
} }
if (!empty($search_doc_ref)) { if (!empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref; $filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref=' . urlencode($search_doc_ref); $param .= '&search_doc_ref='.urlencode($search_doc_ref);
} }
if (!empty($search_label_operation)) { if (!empty($search_label_operation)) {
$filter['t.label_operation'] = $search_label_operation; $filter['t.label_operation'] = $search_label_operation;
$param .= '&search_label_operation=' . urlencode($search_label_operation); $param .= '&search_label_operation='.urlencode($search_label_operation);
} }
if (!empty($search_direction)) { if (!empty($search_direction)) {
$filter['t.sens'] = $search_direction; $filter['t.sens'] = $search_direction;
$param .= '&search_direction=' . urlencode($search_direction); $param .= '&search_direction='.urlencode($search_direction);
} }
if (!empty($search_ledger_code)) { if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code; $filter['t.code_journal'] = $search_ledger_code;
$param .= '&search_ledger_code=' . urlencode($search_ledger_code); $param .= '&search_ledger_code='.urlencode($search_ledger_code);
} }
if (!empty($search_debit)) { if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit; $filter['t.debit'] = $search_debit;
$param .= '&search_debit=' . urlencode($search_debit); $param .= '&search_debit='.urlencode($search_debit);
} }
if (!empty($search_credit)) { if (!empty($search_credit)) {
$filter['t.credit'] = $search_credit; $filter['t.credit'] = $search_credit;
$param .= '&search_credit=' . urlencode($search_credit); $param .= '&search_credit='.urlencode($search_credit);
} }
if (!empty($search_lettering_code)) { if (!empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code; $filter['t.lettering_code'] = $search_lettering_code;
@ -426,7 +426,7 @@ print '<tr class="liste_titre_filter">';
// Code journal // Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) { if (!empty($arrayfields['t.code_journal']['checked'])) {
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . dol_escape_htmltag($search_ledger_code) . '"></td>'; print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="'.dol_escape_htmltag($search_ledger_code).'"></td>';
} }
// Date document // Date document
if (!empty($arrayfields['t.doc_date']['checked'])) { if (!empty($arrayfields['t.doc_date']['checked'])) {
@ -446,19 +446,19 @@ if (!empty($arrayfields['t.piece_num']['checked']))
} }
// Ref document // Ref document
if (!empty($arrayfields['t.doc_ref']['checked'])) { if (!empty($arrayfields['t.doc_ref']['checked'])) {
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="' . dol_escape_htmltag($search_doc_ref) . '"/></td>'; print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>';
} }
// Label operation // Label operation
if (!empty($arrayfields['t.label_operation']['checked'])) { if (!empty($arrayfields['t.label_operation']['checked'])) {
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="' . dol_escape_htmltag($search_label_operation) . '"/></td>'; print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="'.dol_escape_htmltag($search_label_operation).'"/></td>';
} }
// Debit // Debit
if (!empty($arrayfields['t.debit']['checked'])) { if (!empty($arrayfields['t.debit']['checked'])) {
print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="' . dol_escape_htmltag($search_debit) . '"></td>'; print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>';
} }
// Credit // Credit
if (!empty($arrayfields['t.credit']['checked'])) { if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="' . dol_escape_htmltag($search_credit) . '"></td>'; print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>';
} }
// Lettering code // Lettering code
if (!empty($arrayfields['t.lettering_code']['checked'])) if (!empty($arrayfields['t.lettering_code']['checked']))
@ -534,7 +534,7 @@ while ($i < min($num, $limit))
$balance = $sous_total_debit - $sous_total_credit; $balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>'; print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0 ) if ($balance > 0)
{ {
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit); print price($sous_total_debit - $sous_total_credit);
@ -665,7 +665,7 @@ while ($i < min($num, $limit))
if (!empty($arrayfields['t.label_operation']['checked'])) { if (!empty($arrayfields['t.label_operation']['checked'])) {
// Affiche un lien vers la facture client/fournisseur // Affiche un lien vers la facture client/fournisseur
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref); $doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>'; print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>'.$line->label_operation.'</td>' : '<td>'.$line->label_operation.'<br><span style="font-size:0.8em">('.length_accounta($line->subledger_account).')</span></td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
@ -680,7 +680,7 @@ while ($i < min($num, $limit))
// Amount credit // Amount credit
if (!empty($arrayfields['t.credit']['checked'])) { if (!empty($arrayfields['t.credit']['checked'])) {
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>'; print '<td class="nowrap right">'.($line->credit ? price($line->credit) : '').'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit'; if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
$totalarray['val']['totalcredit'] += $line->credit; $totalarray['val']['totalcredit'] += $line->credit;
@ -733,7 +733,7 @@ print '</tr>';
$balance = $sous_total_debit - $sous_total_credit; $balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>'; print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0 ) if ($balance > 0)
{ {
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit); print price($sous_total_debit - $sous_total_credit);

View File

@ -400,9 +400,9 @@ $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountAccounting').': '; $moreforfilter .= $langs->trans('AccountAccounting').': ';
$moreforfilter .= '<div class="nowrap inline-block">'; $moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $langs->trans('From').' '; $moreforfilter .= $langs->trans('From').' ';
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200'); $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', 1, 'maxwidth200');
$moreforfilter .= ' '.$langs->trans('to').' '; $moreforfilter .= ' '.$langs->trans('to').' ';
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200'); $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', 1, 'maxwidth200');
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';

View File

@ -195,17 +195,17 @@ dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEB
if ($resql) { if ($resql) {
$i = 0; $i = 0;
$param = "&socid=".$socid; $param = "&socid=".$socid;
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">'; print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="socid" value="'.$object->id.'">'; print '<input type="hidden" name="socid" value="'.$object->id.'">';
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>'; $letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="liste centpercent">'."\n"; print '<table class="liste centpercent">'."\n";
/* /*
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -244,13 +244,13 @@ if ($resql) {
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center '); print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center '); print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center '); print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
print "</tr>\n"; print "</tr>\n";
$solde = 0; $solde = 0;
$tmp = ''; $tmp = '';
while ($obj = $db->fetch_object($resql)) { while ($obj = $db->fetch_object($resql)) {
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code; if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
@ -265,20 +265,20 @@ if ($resql) {
print '<td class="nowrap right">'.price(round($solde, 2)).'</td>'; print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
// Journal // Journal
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal); $result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal); $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>'; print '<td class="center">'.$journaltoshow.'</td>';
if (empty($obj->lettering_code)) { if (empty($obj->lettering_code)) {
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>'; print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">'; print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit(); print img_edit();
print '</a></td>'."\n"; print '</a></td>'."\n";
} else { } else {
print '<td class="center">'.$obj->lettering_code.'</td>'; print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>'; print '<td></td>';
} }
print "</tr>\n"; print "</tr>\n";
} }
@ -299,9 +299,9 @@ if ($resql) {
print "</table>"; print "</table>";
print '<div class="tabsAction tabsActionNoBottom">'."\n"; print '<div class="tabsAction tabsActionNoBottom">'."\n";
print $letteringbutton; print $letteringbutton;
print '</div>'; print '</div>';
print "</form>"; print "</form>";
$db->free($resql); $db->free($resql);

View File

@ -193,17 +193,17 @@ if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$param = "&socid=".$socid; $param = "&socid=".$socid;
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">'; print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="socid" value="'.$object->id.'">'; print '<input type="hidden" name="socid" value="'.$object->id.'">';
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>'; $letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="liste centpercent">'."\n"; print '<table class="liste centpercent">'."\n";
/* /*
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -242,7 +242,7 @@ if ($resql) {
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center '); print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center '); print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center '); print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
print "</tr>\n"; print "</tr>\n";
$solde = 0; $solde = 0;
@ -261,21 +261,21 @@ if ($resql) {
print '<td class="nowrap right">'.price($obj->credit).'</td>'; print '<td class="nowrap right">'.price($obj->credit).'</td>';
print '<td class="nowrap right">'.price(round($solde, 2)).'</td>'; print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
// Journal // Journal
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal); $result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal); $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>'; print '<td class="center">'.$journaltoshow.'</td>';
if (empty($obj->lettering_code) && empty($obj->date_validated)) { if (empty($obj->lettering_code) && empty($obj->date_validated)) {
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>'; print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">'; print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit(); print img_edit();
print '</a></td>'."\n"; print '</a></td>'."\n";
} else { } else {
print '<td class="center">'.$obj->lettering_code.'</td>'; print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>'; print '<td></td>';
} }
print "</tr>\n"; print "</tr>\n";
} }
@ -296,9 +296,9 @@ if ($resql) {
print "</table>"; print "</table>";
print '<div class="tabsAction tabsActionNoBottom">'."\n"; print '<div class="tabsAction tabsActionNoBottom">'."\n";
print $letteringbutton; print $letteringbutton;
print '</div>'; print '</div>';
print "</form>"; print "</form>";
$db->free($resql); $db->free($resql);

View File

@ -31,10 +31,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
*/ */
class AccountancyCategory // extends CommonObject class AccountancyCategory // extends CommonObject
{ {
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
/** /**
* @var string Error string * @var string Error string
@ -63,9 +63,9 @@ class AccountancyCategory // extends CommonObject
public $rowid; public $rowid;
/** /**
* @var int ID * @var int ID
*/ */
public $id; public $id;
/** /**
* @var string Accountancy code * @var string Accountancy code
@ -73,11 +73,11 @@ class AccountancyCategory // extends CommonObject
public $code; public $code;
/** /**
* @var string Accountancy Category label * @var string Accountancy Category label
*/ */
public $label; public $label;
/** /**
* @var string Accountancy range account * @var string Accountancy range account
*/ */
public $range_account; public $range_account;
@ -381,8 +381,8 @@ class AccountancyCategory // extends CommonObject
* @param int $id Id * @param int $id Id
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function display($id) public function display($id)
{ {
global $conf; global $conf;
$sql = "SELECT t.rowid, t.account_number, t.label"; $sql = "SELECT t.rowid, t.account_number, t.label";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
@ -408,7 +408,7 @@ class AccountancyCategory // extends CommonObject
return -1; return -1;
} }
} }
/** /**
* Function to select accounting category of an accounting account present in chart of accounts * Function to select accounting category of an accounting account present in chart of accounts
@ -417,8 +417,8 @@ class AccountancyCategory // extends CommonObject
* *
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function getCptBK($id) public function getCptBK($id)
{ {
global $conf; global $conf;
$sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref"; $sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref";
@ -457,7 +457,7 @@ class AccountancyCategory // extends CommonObject
return -1; return -1;
} }
} }
/** /**
* Function to select accounting category of an accounting account present in chart of accounts * Function to select accounting category of an accounting account present in chart of accounts
@ -466,41 +466,41 @@ class AccountancyCategory // extends CommonObject
* *
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function getAccountsWithNoCategory($id) public function getAccountsWithNoCategory($id)
{ {
global $conf; global $conf;
$sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte"; $sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)"; $sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)";
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity; $sql .= " AND aa.entity = ".$conf->entity;
$sql .= " GROUP BY aa.account_number, aa.label"; $sql .= " GROUP BY aa.account_number, aa.label";
$sql .= " ORDER BY aa.account_number, aa.label"; $sql .= " ORDER BY aa.account_number, aa.label";
$this->lines_CptBk = array(); $this->lines_CptBk = array();
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
if ($num) { if ($num) {
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
$this->lines_cptbk[] = $obj; $this->lines_cptbk[] = $obj;
} }
} }
return $num; return $num;
} else { } else {
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = $this->error; $this->errors[] = $this->error;
dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR); dol_syslog(__METHOD__." ".implode(','.$this->errors), LOG_ERR);
return -1; return -1;
} }
} }
/** /**
* Function to add an accounting account in an accounting category * Function to add an accounting account in an accounting category
@ -510,8 +510,8 @@ class AccountancyCategory // extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function updateAccAcc($id_cat, $cpts = array()) public function updateAccAcc($id_cat, $cpts = array())
{ {
global $conf; global $conf;
$error = 0; $error = 0;
@ -523,7 +523,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity; $sql .= " AND aa.entity = ".$conf->entity;
$sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql $sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql
$this->db->begin(); $this->db->begin();
@ -539,13 +539,13 @@ class AccountancyCategory // extends CommonObject
$accountincptsadded = array(); $accountincptsadded = array();
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$account_number_formated = length_accountg($obj->account_number); $account_number_formated = length_accountg($obj->account_number);
if (!empty($accountincptsadded[$account_number_formated])) continue; if (!empty($accountincptsadded[$account_number_formated])) continue;
if (array_key_exists($account_number_formated, $cpts)) if (array_key_exists($account_number_formated, $cpts))
{ {
$accountincptsadded[$account_number_formated] = 1; $accountincptsadded[$account_number_formated] = 1;
// We found an account number that is in list $cpts of account to add // We found an account number that is in list $cpts of account to add
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account"; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account";
$sql .= " SET fk_accounting_category=".$id_cat; $sql .= " SET fk_accounting_category=".$id_cat;
$sql .= " WHERE rowid=".$obj->rowid; $sql .= " WHERE rowid=".$obj->rowid;
@ -572,7 +572,7 @@ class AccountancyCategory // extends CommonObject
return 1; return 1;
} }
} }
/** /**
* Function to delete an accounting account from an accounting category * Function to delete an accounting account from an accounting category
@ -581,8 +581,8 @@ class AccountancyCategory // extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function deleteCptCat($cpt_id) public function deleteCptCat($cpt_id)
{ {
$error = 0; $error = 0;
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account as aa"; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account as aa";
@ -598,7 +598,7 @@ class AccountancyCategory // extends CommonObject
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
foreach ($this->errors as $errmsg) { foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR); dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
@ -606,12 +606,12 @@ class AccountancyCategory // extends CommonObject
$this->db->rollback(); $this->db->rollback();
return -1 * $error; return -1 * $error;
} else { } else {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
} }
/** /**
* Function to know all category from accounting account * Function to know all category from accounting account
@ -781,7 +781,7 @@ class AccountancyCategory // extends CommonObject
'formula' => $obj->formula, 'formula' => $obj->formula,
'position' => $obj->position, 'position' => $obj->position,
'category_type' => $obj->category_type, 'category_type' => $obj->category_type,
'bc' => $obj->sens 'bc' => $obj->sens
); );
$i++; $i++;
} }

View File

@ -55,7 +55,7 @@ class AccountancyExport
public static $EXPORT_TYPE_QUADRATUS = 60; public static $EXPORT_TYPE_QUADRATUS = 60;
public static $EXPORT_TYPE_WINFIC = 70; public static $EXPORT_TYPE_WINFIC = 70;
public static $EXPORT_TYPE_OPENCONCERTO = 100; public static $EXPORT_TYPE_OPENCONCERTO = 100;
public static $EXPORT_TYPE_LDCOMPTA = 110; public static $EXPORT_TYPE_LDCOMPTA = 110;
public static $EXPORT_TYPE_LDCOMPTA10 = 120; public static $EXPORT_TYPE_LDCOMPTA10 = 120;
public static $EXPORT_TYPE_FEC = 1000; public static $EXPORT_TYPE_FEC = 1000;
@ -111,7 +111,7 @@ class AccountancyExport
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'), self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'), self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'), self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'), self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'),
self::$EXPORT_TYPE_SAGE50_SWISS => $langs->trans('Modelcsv_Sage50_Swiss'), self::$EXPORT_TYPE_SAGE50_SWISS => $langs->trans('Modelcsv_Sage50_Swiss'),
self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'), self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'),
self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'), self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'),
@ -144,9 +144,9 @@ class AccountancyExport
self::$EXPORT_TYPE_COGILOG => 'cogilog', self::$EXPORT_TYPE_COGILOG => 'cogilog',
self::$EXPORT_TYPE_AGIRIS => 'agiris', self::$EXPORT_TYPE_AGIRIS => 'agiris',
self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto', self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto',
self::$EXPORT_TYPE_SAGE50_SWISS => 'sage50ch', self::$EXPORT_TYPE_SAGE50_SWISS => 'sage50ch',
self::$EXPORT_TYPE_LDCOMPTA => 'ldcompta', self::$EXPORT_TYPE_LDCOMPTA => 'ldcompta',
self::$EXPORT_TYPE_LDCOMPTA10 => 'ldcompta10', self::$EXPORT_TYPE_LDCOMPTA10 => 'ldcompta10',
self::$EXPORT_TYPE_FEC => 'fec', self::$EXPORT_TYPE_FEC => 'fec',
); );
@ -201,22 +201,22 @@ class AccountancyExport
self::$EXPORT_TYPE_AGIRIS => array( self::$EXPORT_TYPE_AGIRIS => array(
'label' => $langs->trans('Modelcsv_agiris'), 'label' => $langs->trans('Modelcsv_agiris'),
), ),
self::$EXPORT_TYPE_OPENCONCERTO => array( self::$EXPORT_TYPE_OPENCONCERTO => array(
'label' => $langs->trans('Modelcsv_openconcerto'), 'label' => $langs->trans('Modelcsv_openconcerto'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv', 'ACCOUNTING_EXPORT_FORMAT' => 'csv',
), ),
self::$EXPORT_TYPE_SAGE50_SWISS => array( self::$EXPORT_TYPE_SAGE50_SWISS => array(
'label' => $langs->trans('Modelcsv_Sage50_Swiss'), 'label' => $langs->trans('Modelcsv_Sage50_Swiss'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv', 'ACCOUNTING_EXPORT_FORMAT' => 'csv',
), ),
self::$EXPORT_TYPE_LDCOMPTA => array( self::$EXPORT_TYPE_LDCOMPTA => array(
'label' => $langs->trans('Modelcsv_LDCompta'), 'label' => $langs->trans('Modelcsv_LDCompta'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv', 'ACCOUNTING_EXPORT_FORMAT' => 'csv',
), ),
self::$EXPORT_TYPE_LDCOMPTA10 => array( self::$EXPORT_TYPE_LDCOMPTA10 => array(
'label' => $langs->trans('Modelcsv_LDCompta10'), 'label' => $langs->trans('Modelcsv_LDCompta10'),
'ACCOUNTING_EXPORT_FORMAT' => 'csv', 'ACCOUNTING_EXPORT_FORMAT' => 'csv',
), ),
self::$EXPORT_TYPE_FEC => array( self::$EXPORT_TYPE_FEC => array(
'label' => $langs->trans('Modelcsv_FEC'), 'label' => $langs->trans('Modelcsv_FEC'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt', 'ACCOUNTING_EXPORT_FORMAT' => 'txt',
@ -254,7 +254,7 @@ class AccountancyExport
$filename = 'general_ledger-'.$this->getFormatCode($formatexportset); $filename = 'general_ledger-'.$this->getFormatCode($formatexportset);
$type_export = 'general_ledger'; $type_export = 'general_ledger';
global $db; // The tpl file use $db global $db; // The tpl file use $db
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
@ -289,21 +289,21 @@ class AccountancyExport
case self::$EXPORT_TYPE_AGIRIS : case self::$EXPORT_TYPE_AGIRIS :
$this->exportAgiris($TData); $this->exportAgiris($TData);
break; break;
case self::$EXPORT_TYPE_OPENCONCERTO : case self::$EXPORT_TYPE_OPENCONCERTO :
$this->exportOpenConcerto($TData); $this->exportOpenConcerto($TData);
break; break;
case self::$EXPORT_TYPE_SAGE50_SWISS : case self::$EXPORT_TYPE_SAGE50_SWISS :
$this->exportSAGE50SWISS($TData); $this->exportSAGE50SWISS($TData);
break; break;
case self::$EXPORT_TYPE_LDCOMPTA : case self::$EXPORT_TYPE_LDCOMPTA :
$this->exportLDCompta($TData); $this->exportLDCompta($TData);
break; break;
case self::$EXPORT_TYPE_LDCOMPTA10 : case self::$EXPORT_TYPE_LDCOMPTA10 :
$this->exportLDCompta10($TData); $this->exportLDCompta10($TData);
break; break;
case self::$EXPORT_TYPE_FEC : case self::$EXPORT_TYPE_FEC :
$this->exportFEC($TData); $this->exportFEC($TData);
break; break;
case self::$EXPORT_TYPE_CHARLEMAGNE : case self::$EXPORT_TYPE_CHARLEMAGNE :
$this->exportCharlemagne($TData); $this->exportCharlemagne($TData);
break; break;
@ -599,7 +599,7 @@ class AccountancyExport
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0'); $Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0');
if ($data->sens == 'D') { if ($data->sens == 'D') {
$Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT);
$Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
} else { } else {
@ -659,10 +659,10 @@ class AccountancyExport
print $date.$separator; print $date.$separator;
print $line->code_journal.$separator; print $line->code_journal.$separator;
if (empty($line->subledger_account)) { if (empty($line->subledger_account)) {
print $line->numero_compte.$separator; print $line->numero_compte.$separator;
} else { } else {
print $line->subledger_account.$separator; print $line->subledger_account.$separator;
} }
//print substr(length_accountg($line->numero_compte), 0, 2) . $separator; //print substr(length_accountg($line->numero_compte), 0, 2) . $separator;
print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"'.$separator; print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"'.$separator;
print '"'.dol_trunc($line->piece_num, 15, 'right', 'UTF-8', 1).'"'.$separator; print '"'.dol_trunc($line->piece_num, 15, 'right', 'UTF-8', 1).'"'.$separator;
@ -714,36 +714,36 @@ class AccountancyExport
} }
} }
/** /**
* Export format : OpenConcerto * Export format : OpenConcerto
* *
* @param array $objectLines data * @param array $objectLines data
* @return void * @return void
*/ */
public function exportOpenConcerto($objectLines) public function exportOpenConcerto($objectLines)
{ {
$separator = ';'; $separator = ';';
$end_line = "\n"; $end_line = "\n";
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d/%m/%Y'); $date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date.$separator; print $date.$separator;
print $line->code_journal.$separator; print $line->code_journal.$separator;
if (empty($line->subledger_account)) { if (empty($line->subledger_account)) {
print length_accountg($line->numero_compte).$separator; print length_accountg($line->numero_compte).$separator;
} else { } else {
print length_accounta($line->subledger_account).$separator; print length_accounta($line->subledger_account).$separator;
} }
print $line->doc_ref.$separator; print $line->doc_ref.$separator;
print $line->label_operation.$separator; print $line->label_operation.$separator;
print price($line->debit).$separator; print price($line->debit).$separator;
print price($line->credit).$separator; print price($line->credit).$separator;
print $end_line; print $end_line;
} }
} }
/** /**
* Export format : Configurable CSV * Export format : Configurable CSV
@ -822,25 +822,25 @@ class AccountancyExport
print $line->piece_num.$separator; print $line->piece_num.$separator;
// FEC:EcritureDate // FEC:EcritureDate
print $date_document . $separator; print $date_document.$separator;
// FEC:CompteNum // FEC:CompteNum
print $line->numero_compte.$separator; print $line->numero_compte.$separator;
// FEC:CompteLib // FEC:CompteLib
print dol_string_unaccent($line->label_compte) . $separator; print dol_string_unaccent($line->label_compte).$separator;
// FEC:CompAuxNum // FEC:CompAuxNum
print $line->subledger_account.$separator; print $line->subledger_account.$separator;
// FEC:CompAuxLib // FEC:CompAuxLib
print dol_string_unaccent($line->subledger_label) . $separator; print dol_string_unaccent($line->subledger_label).$separator;
// FEC:PieceRef // FEC:PieceRef
print $line->doc_ref.$separator; print $line->doc_ref.$separator;
// FEC:PieceDate // FEC:PieceDate
print dol_string_unaccent($date_creation) . $separator; print dol_string_unaccent($date_creation).$separator;
// FEC:EcritureLib // FEC:EcritureLib
print $line->label_operation.$separator; print $line->label_operation.$separator;
@ -858,7 +858,7 @@ class AccountancyExport
print $line->date_lettering.$separator; print $line->date_lettering.$separator;
// FEC:ValidDate // FEC:ValidDate
print $date_validation . $separator; print $date_validation.$separator;
// FEC:Montantdevise // FEC:Montantdevise
print $line->multicurrency_amount.$separator; print $line->multicurrency_amount.$separator;
@ -870,152 +870,152 @@ class AccountancyExport
} }
} }
/** /**
* Export format : SAGE50SWISS * Export format : SAGE50SWISS
* *
* https://onlinehelp.sageschweiz.ch/default.aspx?tabid=19984 * https://onlinehelp.sageschweiz.ch/default.aspx?tabid=19984
* http://media.topal.ch/Public/Schnittstellen/TAF/Specification/Sage50-TAF-format.pdf * http://media.topal.ch/Public/Schnittstellen/TAF/Specification/Sage50-TAF-format.pdf
* *
* @param array $objectLines data * @param array $objectLines data
* *
* @return void * @return void
*/ */
public function exportSAGE50SWISS($objectLines) public function exportSAGE50SWISS($objectLines)
{ {
// SAGE50SWISS // SAGE50SWISS
$this->separator = ','; $this->separator = ',';
$this->end_line = "\r\n"; $this->end_line = "\r\n";
// Print header line // Print header line
print "Blg,Datum,Kto,S/H,Grp,GKto,SId,SIdx,KIdx,BTyp,MTyp,Code,Netto,Steuer,FW-Betrag,Tx1,Tx2,PkKey,OpId,Flag"; print "Blg,Datum,Kto,S/H,Grp,GKto,SId,SIdx,KIdx,BTyp,MTyp,Code,Netto,Steuer,FW-Betrag,Tx1,Tx2,PkKey,OpId,Flag";
print $this->end_line; print $this->end_line;
$thisPieceNum = ""; $thisPieceNum = "";
$thisPieceAccountNr = ""; $thisPieceAccountNr = "";
$aSize = count($objectLines); $aSize = count($objectLines);
foreach ($objectLines as $aIndex=>$line) foreach ($objectLines as $aIndex=>$line)
{ {
$sammelBuchung = false; $sammelBuchung = false;
if ($aIndex - 2 >= 0 && $objectLines[$aIndex - 2]->piece_num == $line->piece_num) if ($aIndex - 2 >= 0 && $objectLines[$aIndex - 2]->piece_num == $line->piece_num)
{ {
$sammelBuchung = true; $sammelBuchung = true;
} elseif ($aIndex + 2 < $aSize && $objectLines[$aIndex + 2]->piece_num == $line->piece_num) } elseif ($aIndex + 2 < $aSize && $objectLines[$aIndex + 2]->piece_num == $line->piece_num)
{ {
$sammelBuchung = true; $sammelBuchung = true;
} elseif ($aIndex + 1 < $aSize } elseif ($aIndex + 1 < $aSize
&& $objectLines[$aIndex + 1]->piece_num == $line->piece_num && $objectLines[$aIndex + 1]->piece_num == $line->piece_num
&& $aIndex - 1 < $aSize && $aIndex - 1 < $aSize
&& $objectLines[$aIndex - 1]->piece_num == $line->piece_num && $objectLines[$aIndex - 1]->piece_num == $line->piece_num
) )
{ {
$sammelBuchung = true; $sammelBuchung = true;
} }
//Blg //Blg
print $line->piece_num.$this->separator; print $line->piece_num.$this->separator;
// Datum // Datum
$date = dol_print_date($line->doc_date, '%d.%m.%Y'); $date = dol_print_date($line->doc_date, '%d.%m.%Y');
print $date.$this->separator; print $date.$this->separator;
// Kto // Kto
print length_accountg($line->numero_compte).$this->separator; print length_accountg($line->numero_compte).$this->separator;
// S/H // S/H
if ($line->sens == 'D') if ($line->sens == 'D')
{ {
print 'S'.$this->separator; print 'S'.$this->separator;
} else { } else {
print 'H'.$this->separator; print 'H'.$this->separator;
} }
//Grp //Grp
print self::trunc($line->code_journal, 1).$this->separator; print self::trunc($line->code_journal, 1).$this->separator;
// GKto // GKto
if (empty($line->code_tiers)) if (empty($line->code_tiers))
{ {
if ($line->piece_num == $thisPieceNum) if ($line->piece_num == $thisPieceNum)
{ {
print length_accounta($thisPieceAccountNr).$this->separator; print length_accounta($thisPieceAccountNr).$this->separator;
} else { } else {
print "div".$this->separator; print "div".$this->separator;
} }
} else { } else {
print length_accounta($line->code_tiers).$this->separator; print length_accounta($line->code_tiers).$this->separator;
} }
//SId //SId
print $this->separator; print $this->separator;
//SIdx //SIdx
print "0".$this->separator; print "0".$this->separator;
//KIdx //KIdx
print "0".$this->separator; print "0".$this->separator;
//BTyp //BTyp
print "0".$this->separator; print "0".$this->separator;
//MTyp 1=Fibu Einzelbuchung 2=Sammebuchung //MTyp 1=Fibu Einzelbuchung 2=Sammebuchung
if ($sammelBuchung) if ($sammelBuchung)
{ {
print "2".$this->separator; print "2".$this->separator;
} else { } else {
print "1".$this->separator; print "1".$this->separator;
} }
// Code // Code
print '""'.$this->separator; print '""'.$this->separator;
// Netto // Netto
if ($line->montant >= 0) if ($line->montant >= 0)
{ {
print $line->montant.$this->separator; print $line->montant.$this->separator;
} else { } else {
print ($line->montant * -1).$this->separator; print ($line->montant * -1).$this->separator;
} }
// Steuer // Steuer
print "0.00".$this->separator; print "0.00".$this->separator;
// FW-Betrag // FW-Betrag
print "0.00".$this->separator; print "0.00".$this->separator;
// Tx1 // Tx1
$line1 = self::toAnsi($line->label_compte, 29); $line1 = self::toAnsi($line->label_compte, 29);
if ($line1 == "LIQ" || $line1 == "LIQ Beleg ok" || strlen($line1) <= 3) if ($line1 == "LIQ" || $line1 == "LIQ Beleg ok" || strlen($line1) <= 3)
{ {
$line1 = ""; $line1 = "";
} }
$line2 = self::toAnsi($line->doc_ref, 29); $line2 = self::toAnsi($line->doc_ref, 29);
if (strlen($line1) == 0) if (strlen($line1) == 0)
{ {
$line1 = $line2; $line1 = $line2;
$line2 = ""; $line2 = "";
} }
if (strlen($line1) > 0 && strlen($line2) > 0 && (strlen($line1) + strlen($line2)) < 27) if (strlen($line1) > 0 && strlen($line2) > 0 && (strlen($line1) + strlen($line2)) < 27)
{ {
$line1 = $line1.' / '.$line2; $line1 = $line1.' / '.$line2;
$line2 = ""; $line2 = "";
} }
print '"'.self::toAnsi($line1).'"'.$this->separator; print '"'.self::toAnsi($line1).'"'.$this->separator;
// Tx2 // Tx2
print '"'.self::toAnsi($line2).'"'.$this->separator; print '"'.self::toAnsi($line2).'"'.$this->separator;
//PkKey //PkKey
print "0".$this->separator; print "0".$this->separator;
//OpId //OpId
print $this->separator; print $this->separator;
// Flag // Flag
print "0"; print "0";
print $this->end_line; print $this->end_line;
if ($line->piece_num !== $thisPieceNum) if ($line->piece_num !== $thisPieceNum)
{ {
$thisPieceNum = $line->piece_num; $thisPieceNum = $line->piece_num;
$thisPieceAccountNr = $line->numero_compte; $thisPieceAccountNr = $line->numero_compte;
} }
} }
} }
/** /**
* Export format : LD Compta version 9 * Export format : LD Compta version 9
* http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW9.pdf * http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW9.pdf
* *
* @param array $objectLines data * @param array $objectLines data
* *
* @return void * @return void
*/ */
public function exportLDCompta($objectLines) public function exportLDCompta($objectLines)
{ {
@ -1168,23 +1168,23 @@ class AccountancyExport
{ {
$soc = $this->db->fetch_object($resql); $soc = $this->db->fetch_object($resql);
$address = array('', '', ''); $address = array('', '', '');
if (strpos($soc->address, "\n") !== false) { if (strpos($soc->address, "\n") !== false) {
$address = explode("\n", $soc->address); $address = explode("\n", $soc->address);
if (is_array($address) && count($address) > 0) { if (is_array($address) && count($address) > 0) {
foreach ($address as $key=>$data) { foreach ($address as $key=>$data) {
$address[$key] = str_replace(array("\t", "\n", "\r"), "", $data); $address[$key] = str_replace(array("\t", "\n", "\r"), "", $data);
$address[$key] = dol_trunc($address[$key], 40, 'right', 'UTF-8', 1); $address[$key] = dol_trunc($address[$key], 40, 'right', 'UTF-8', 1);
} }
} }
} else { } else {
$address[0] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 0, 40); $address[0] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 0, 40);
$address[1] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 41, 40); $address[1] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 41, 40);
$address[2] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 82, 40); $address[2] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 82, 40);
} }
$type_enregistrement = 'C'; $type_enregistrement = 'C';
//TYPE //TYPE
print $type_enregistrement.$separator; print $type_enregistrement.$separator;
//NOCL //NOCL
print $soc->code_client.$separator; print $soc->code_client.$separator;
@ -1193,15 +1193,15 @@ class AccountancyExport
//LIBI //LIBI
print $separator; print $separator;
//TITR //TITR
print $separator; print $separator;
//RSSO //RSSO
print $soc->nom.$separator; print $soc->nom.$separator;
//CAD1 //CAD1
print $address[0].$separator; print $address[0].$separator;
//CAD2 //CAD2
print $address[1].$separator; print $address[1].$separator;
//CAD3 //CAD3
print $address[2].$separator; print $address[2].$separator;
//COPO //COPO
print $soc->zip.$separator; print $soc->zip.$separator;
//BUDI //BUDI
@ -1223,7 +1223,7 @@ class AccountancyExport
//COMM //COMM
print $separator; print $separator;
//SIRE //SIRE
print str_replace(" ", "", $soc->siret).$separator; print str_replace(" ", "", $soc->siret).$separator;
//RIBP //RIBP
print $separator; print $separator;
//DOBQ //DOBQ
@ -1486,15 +1486,15 @@ class AccountancyExport
* *
* @param string $str Original string to encode and optionaly truncate * @param string $str Original string to encode and optionaly truncate
* @param integer $size Truncate string after $size characters * @param integer $size Truncate string after $size characters
* @return string String encoded in Windows-1251 charset * @return string String encoded in Windows-1251 charset
*/ */
public static function toAnsi($str, $size = -1) public static function toAnsi($str, $size = -1)
{ {
$retVal = dol_string_nohtmltag($str, 1, 'Windows-1251'); $retVal = dol_string_nohtmltag($str, 1, 'Windows-1251');
if ($retVal >= 0 && $size >= 0) if ($retVal >= 0 && $size >= 0)
{ {
$retVal = mb_substr($retVal, 0, $size, 'Windows-1251'); $retVal = mb_substr($retVal, 0, $size, 'Windows-1251');
} }
return $retVal; return $retVal;
} }
} }

View File

@ -28,10 +28,10 @@
*/ */
class AccountancySystem class AccountancySystem
{ {
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
/** /**
* @var string Error code (or message) * @var string Error code (or message)
@ -44,13 +44,13 @@ class AccountancySystem
public $rowid; public $rowid;
/** /**
* @var int ID * @var int ID
*/ */
public $fk_pcg_version; public $fk_pcg_version;
/** /**
* @var string pcg type * @var string pcg type
*/ */
public $pcg_type; public $pcg_type;
/** /**
@ -59,18 +59,18 @@ class AccountancySystem
public $numero; public $numero;
/** /**
* @var string Accountancy System label * @var string Accountancy System label
*/ */
public $label; public $label;
/** /**
* @var string account number * @var string account number
*/ */
public $account_number; public $account_number;
/** /**
* @var string account parent * @var string account parent
*/ */
public $account_parent; public $account_parent;
/** /**
@ -78,10 +78,10 @@ class AccountancySystem
* *
* @param DoliDB $db handler * @param DoliDB $db handler
*/ */
public function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
/** /**
@ -93,42 +93,42 @@ class AccountancySystem
*/ */
public function fetch($rowid = 0, $ref = '') public function fetch($rowid = 0, $ref = '')
{ {
global $conf; global $conf;
if ($rowid > 0 || $ref) if ($rowid > 0 || $ref)
{ {
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active"; $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
$sql .= " WHERE"; $sql .= " WHERE";
if ($rowid) { if ($rowid) {
$sql .= " a.rowid = ".((int) $rowid); $sql .= " a.rowid = ".((int) $rowid);
} elseif ($ref) { } elseif ($ref) {
$sql .= " a.pcg_version = '".$this->db->escape($ref)."'"; $sql .= " a.pcg_version = '".$this->db->escape($ref)."'";
} }
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
if ($obj) { if ($obj) {
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->rowid = $obj->rowid; $this->rowid = $obj->rowid;
$this->pcg_version = $obj->pcg_version; $this->pcg_version = $obj->pcg_version;
$this->ref = $obj->pcg_version; $this->ref = $obj->pcg_version;
$this->label = $obj->label; $this->label = $obj->label;
$this->active = $obj->active; $this->active = $obj->active;
return $this->id; return $this->id;
} else { } else {
return 0; return 0;
} }
} else { } else {
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = "Error ".$this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} }
} }
return -1; return -1;
} }
@ -138,8 +138,8 @@ class AccountancySystem
* @param User $user making insert * @param User $user making insert
* @return int if KO, Id of line if OK * @return int if KO, Id of line if OK
*/ */
public function create($user) public function create($user)
{ {
$now = dol_now(); $now = dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_system"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_system";
@ -165,6 +165,6 @@ class AccountancySystem
dol_syslog($this->error, LOG_ERR); dol_syslog($this->error, LOG_ERR);
} }
return $result; return $result;
} }
} }

View File

@ -74,35 +74,35 @@ class AccountingAccount extends CommonObject
public $rowid; public $rowid;
/** /**
* Date creation record (datec) * Date creation record (datec)
* *
* @var integer * @var integer
*/ */
public $datec; public $datec;
/** /**
* @var string pcg version * @var string pcg version
*/ */
public $fk_pcg_version; public $fk_pcg_version;
/** /**
* @var string pcg type * @var string pcg type
*/ */
public $pcg_type; public $pcg_type;
/** /**
* @var string account number * @var string account number
*/ */
public $account_number; public $account_number;
/** /**
* @var int ID parent account * @var int ID parent account
*/ */
public $account_parent; public $account_parent;
/** /**
* @var int ID category account * @var int ID category account
*/ */
public $account_category; public $account_category;
/** /**
@ -110,10 +110,10 @@ class AccountingAccount extends CommonObject
*/ */
public $status; public $status;
/** /**
* @var string Label of account * @var string Label of account
*/ */
public $label; public $label;
/** /**
* @var string Label short of account * @var string Label short of account
@ -121,19 +121,19 @@ class AccountingAccount extends CommonObject
public $labelshort; public $labelshort;
/** /**
* @var int ID * @var int ID
*/ */
public $fk_user_author; public $fk_user_author;
/** /**
* @var int ID * @var int ID
*/ */
public $fk_user_modif; public $fk_user_modif;
/** /**
* @var int active (duplicate with status) * @var int active (duplicate with status)
*/ */
public $active; public $active;
/** /**
* @var int reconcilable * @var int reconcilable
@ -145,13 +145,13 @@ class AccountingAccount extends CommonObject
* *
* @param DoliDB $db Database handle * @param DoliDB $db Database handle
*/ */
public function __construct($db) public function __construct($db)
{ {
global $conf; global $conf;
$this->db = $db; $this->db = $db;
$this->next_prev_filter = 'fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')'; // Used to add a filter in Form::showrefnav method $this->next_prev_filter = 'fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')'; // Used to add a filter in Form::showrefnav method
} }
/** /**
* Load record in memory * Load record in memory
@ -162,7 +162,7 @@ class AccountingAccount extends CommonObject
* @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code). * @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code).
* @return int <0 if KO, 0 if not found, Id of record if OK and found * @return int <0 if KO, 0 if not found, Id of record if OK and found
*/ */
public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '') public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '')
{ {
global $conf; global $conf;
@ -182,7 +182,7 @@ class AccountingAccount extends CommonObject
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$this->db->escape($conf->global->CHARTOFACCOUNTS).')'; $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$this->db->escape($conf->global->CHARTOFACCOUNTS).')';
} }
if (!empty($limittoachartaccount)) { if (!empty($limittoachartaccount)) {
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'"; $sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
} }
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
@ -229,8 +229,8 @@ class AccountingAccount extends CommonObject
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf; global $conf;
$error = 0; $error = 0;
$now = dol_now(); $now = dol_now();
@ -318,7 +318,7 @@ class AccountingAccount extends CommonObject
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} }
} }
/** /**
* Update record * Update record
@ -366,8 +366,8 @@ class AccountingAccount extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function checkUsage() public function checkUsage()
{ {
global $langs; global $langs;
$sql = "(SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facturedet"; $sql = "(SELECT fk_code_ventilation FROM ".MAIN_DB_PREFIX."facturedet";
@ -400,8 +400,8 @@ class AccountingAccount extends CommonObject
* @param int $notrigger 0=triggers after, 1=disable triggers * @param int $notrigger 0=triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
$error = 0; $error = 0;
$result = $this->checkUsage(); $result = $this->checkUsage();
@ -436,9 +436,9 @@ class AccountingAccount extends CommonObject
} else { } else {
return -1; return -1;
} }
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
@ -446,12 +446,12 @@ class AccountingAccount extends CommonObject
* @param int $nourl 1=Disable url * @param int $nourl 1=Disable url
* @param string $moretitle Add more text to title tooltip * @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int $withcompletelabel 0=Short label (field short label), 1=Complete label (field label) * @param int $withcompletelabel 0=Short label (field short label), 1=Complete label (field label)
* @param string $option 'ledger', 'journals', 'accountcard' * @param string $option 'ledger', 'journals', 'accountcard'
* @return string String with URL * @return string String with URL
*/ */
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option = '') public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option = '')
{ {
global $langs, $conf; global $langs, $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -524,7 +524,7 @@ class AccountingAccount extends CommonObject
if ($withpicto && $withpicto != 2) $result .= ' '; if ($withpicto && $withpicto != 2) $result .= ' ';
if ($withpicto != 2) $result .= $linkstart.$label_link.$linkend; if ($withpicto != 2) $result .= $linkstart.$label_link.$linkend;
return $result; return $result;
} }
/** /**
* Information on record * Information on record
@ -532,8 +532,8 @@ class AccountingAccount extends CommonObject
* @param int $id of record * @param int $id of record
* @return void * @return void
*/ */
public function info($id) public function info($id)
{ {
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms'; $sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
$sql .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as a'; $sql .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as a';
$sql .= ' WHERE a.rowid = '.$id; $sql .= ' WHERE a.rowid = '.$id;
@ -568,18 +568,18 @@ class AccountingAccount extends CommonObject
* Deactivate an account (for status active or status reconcilable) * Deactivate an account (for status active or status reconcilable)
* *
* @param int $id Id * @param int $id Id
* @param int $mode 0=field active, 1=field reconcilable * @param int $mode 0=field active, 1=field reconcilable
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function accountDeactivate($id, $mode = 0) public function accountDeactivate($id, $mode = 0)
{ {
$result = $this->checkUsage(); $result = $this->checkUsage();
$fieldtouse = 'active'; $fieldtouse = 'active';
if ($mode == 1) if ($mode == 1)
{ {
$fieldtouse = 'reconcilable'; $fieldtouse = 'reconcilable';
} }
if ($result > 0) { if ($result > 0) {
$this->db->begin(); $this->db->begin();
@ -604,26 +604,26 @@ class AccountingAccount extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Account activated * Account activated
* *
* @param int $id Id * @param int $id Id
* @param int $mode 0=field active, 1=field reconcilable * @param int $mode 0=field active, 1=field reconcilable
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function account_activate($id, $mode = 0) public function account_activate($id, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
$this->db->begin(); $this->db->begin();
if ($mode == 0) if ($mode == 0)
{ {
$fieldtouse = 'active'; $fieldtouse = 'active';
} elseif ($mode == 1) } elseif ($mode == 1)
{ {
$fieldtouse = 'reconcilable'; $fieldtouse = 'reconcilable';
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account "; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account ";
$sql .= "SET ".$fieldtouse." = '1'"; $sql .= "SET ".$fieldtouse." = '1'";
@ -631,15 +631,15 @@ class AccountingAccount extends CommonObject
dol_syslog(get_class($this)."::account_activate ".$fieldtouse." sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::account_activate ".$fieldtouse." sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} else { } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
/** /**
@ -653,7 +653,7 @@ class AccountingAccount extends CommonObject
return $this->LibStatut($this->status, $mode); return $this->LibStatut($this->status, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
@ -663,7 +663,7 @@ class AccountingAccount extends CommonObject
*/ */
public function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
$langs->loadLangs(array("users")); $langs->loadLangs(array("users"));

View File

@ -56,29 +56,29 @@ class AccountingJournal extends CommonObject
*/ */
public $rowid; public $rowid;
/** /**
* @var string Accounting journal code * @var string Accounting journal code
*/ */
public $code; public $code;
/** /**
* @var string Accounting Journal label * @var string Accounting Journal label
*/ */
public $label; public $label;
/** /**
* @var int 1:various operations, 2:sale, 3:purchase, 4:bank, 5:expense-report, 8:inventory, 9: has-new * @var int 1:various operations, 2:sale, 3:purchase, 4:bank, 5:expense-report, 8:inventory, 9: has-new
*/ */
public $nature; public $nature;
/** /**
* @var int is active or not * @var int is active or not
*/ */
public $active; public $active;
/** /**
* @var array array of lines * @var array array of lines
*/ */
public $lines; public $lines;
/** /**
@ -86,10 +86,10 @@ class AccountingJournal extends CommonObject
* *
* @param DoliDB $db Database handle * @param DoliDB $db Database handle
*/ */
public function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
/** /**
* Load an object from database * Load an object from database
@ -155,8 +155,8 @@ class AccountingJournal extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{ {
$sql = "SELECT rowid, code, label, nature, active"; $sql = "SELECT rowid, code, label, nature, active";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
// Manage filter // Manage filter
@ -284,7 +284,7 @@ class AccountingJournal extends CommonObject
return $this->LibType($this->nature, $mode); return $this->LibType($this->nature, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return type of an accounting journal * Return type of an accounting journal
* *
@ -294,7 +294,7 @@ class AccountingJournal extends CommonObject
*/ */
public function LibType($nature, $mode = 0) public function LibType($nature, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
$langs->loadLangs(array("accountancy")); $langs->loadLangs(array("accountancy"));

View File

@ -63,24 +63,24 @@ $year_current = $year_start;
if ($action == 'validate') if ($action == 'validate')
{ {
$now = dol_now(); $now = dol_now();
// Update database // Update database
$db->begin(); $db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " SET b.date_validated = '".$db->idate($now)."'"; $sql .= " SET b.date_validated = '".$db->idate($now)."'";
$sql .= ' WHERE b.date_validated IS NULL'; $sql .= ' WHERE b.date_validated IS NULL';
dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG); dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if (!$resql1) { if (!$resql1) {
$error++; $error++;
$db->rollback(); $db->rollback();
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} else { } else {
$db->commit(); $db->commit();
} }
// End clean database // End clean database
} }
@ -135,8 +135,8 @@ if ($resql) {
while ($row = $db->fetch_row($resql)) { while ($row = $db->fetch_row($resql)) {
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
print '<td class="nowrap center">'.$row[$i].'<br><br>'; print '<td class="nowrap center">'.$row[$i].'<br><br>';
print '<input id="cb'.$row[$i].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$row[$i].'"'.($selected ? ' checked="checked"' : '').'>'; print '<input id="cb'.$row[$i].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$row[$i].'"'.($selected ? ' checked="checked"' : '').'>';
print '</td>'; print '</td>';
} }
print '<td class="valigntop"><b>'.$row[13].'</b></td>'; print '<td class="valigntop"><b>'.$row[13].'</b></td>';
} }

View File

@ -50,7 +50,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
{ {
if (!$cancel) if (!$cancel)
{ {
if ($codeventil < 0) $codeventil = 0; if ($codeventil < 0) $codeventil = 0;
$sql = " UPDATE ".MAIN_DB_PREFIX."facturedet"; $sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
$sql .= " SET fk_code_ventilation = ".$codeventil; $sql .= " SET fk_code_ventilation = ".$codeventil;
@ -60,12 +60,12 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
if (!$resql) { if (!$resql) {
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} else { } else {
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
if ($backtopage) if ($backtopage)
{ {
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit(); exit();
} }
} }
} else { } else {
header("Location: ./lines.php"); header("Location: ./lines.php");

View File

@ -45,14 +45,14 @@ $hookmanager->initHooks(array('accountancyindex'));
if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled) if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
$zone = GETPOST('areacode', 'aZ09'); $zone = GETPOST('areacode', 'aZ09');
$userid = GETPOST('userid', 'int'); $userid = GETPOST('userid', 'int');
$boxorder = GETPOST('boxorder', 'aZ09'); $boxorder = GETPOST('boxorder', 'aZ09');
$boxorder .= GETPOST('boxcombo', 'aZ09'); $boxorder .= GETPOST('boxcombo', 'aZ09');
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid); $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null); if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
} }
@ -64,11 +64,11 @@ llxHeader('', $langs->trans("AccountancyArea"));
if ($conf->accounting->enabled) if ($conf->accounting->enabled)
{ {
$step = 0; $step = 0;
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) $resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
$helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default. $helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
$showtutorial = ''; $showtutorial = '';
if (!$helpisexpanded) if (!$helpisexpanded)
@ -92,9 +92,9 @@ if ($conf->accounting->enabled)
print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy', 0, '', '', $showtutorial); print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy', 0, '', '', $showtutorial);
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
print "<br>\n"; print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
print "<br>\n"; print "<br>\n"; print "<br>\n"; print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
@ -132,9 +132,9 @@ if ($conf->accounting->enabled)
if (!empty($conf->tax->enabled)) if (!empty($conf->tax->enabled))
{ {
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>'; $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n"; print "<br>\n";
} }
/*if (! empty($conf->salaries->enabled)) /*if (! empty($conf->salaries->enabled))
{ {
@ -146,9 +146,9 @@ if ($conf->accounting->enabled)
}*/ }*/
if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>');
print "<br>\n"; print "<br>\n";
} }
/* /*
if (! empty($conf->loan->enabled)) if (! empty($conf->loan->enabled))
@ -177,7 +177,7 @@ if ($conf->accounting->enabled)
print '<br>'; print '<br>';
// Step A - E // Step A - E
print "<br>\n"; print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', ''); print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
@ -199,7 +199,7 @@ if ($conf->accounting->enabled)
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>')."\n";
print "<br>\n"; print "<br>\n";
} }
$step++; $step++;
@ -214,36 +214,36 @@ if ($conf->accounting->enabled)
print '</div>'; print '</div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
print '<div class="fichecenter fichecenterbis">'; print '<div class="fichecenter fichecenterbis">';
/* /*
* Show boxes * Show boxes
*/ */
$boxlist .= '<div class="twocolumns">'; $boxlist .= '<div class="twocolumns">';
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">'; $boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
$boxlist .= $resultboxes['boxlista']; $boxlist .= $resultboxes['boxlista'];
$boxlist .= '</div>'; $boxlist .= '</div>';
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">'; $boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
$boxlist .= $resultboxes['boxlistb']; $boxlist .= $resultboxes['boxlistb'];
$boxlist .= '</div>'; $boxlist .= '</div>';
$boxlist .= "\n"; $boxlist .= "\n";
$boxlist .= '</div>'; $boxlist .= '</div>';
print $boxlist; print $boxlist;
print '</div>'; print '</div>';
} else { } else {
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy'); print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span><br>\n";
} }

View File

@ -394,9 +394,9 @@ if ($result) {
$tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id; $tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id;
$paymentvariousstatic->fetch($paymentvariousstatic->id); $paymentvariousstatic->fetch($paymentvariousstatic->id);
$account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word $account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
$account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word $account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
$tabpay[$obj->rowid]["account_various"] = $account_various; $tabpay[$obj->rowid]["account_various"] = $account_various;
$tabtp[$obj->rowid][$account_subledger] += $obj->amount; $tabtp[$obj->rowid][$account_subledger] += $obj->amount;
} elseif ($links[$key]['type'] == 'payment_loan') { } elseif ($links[$key]['type'] == 'payment_loan') {
$paymentloanstatic->id = $links[$key]['url_id']; $paymentloanstatic->id = $links[$key]['url_id'];
$paymentloanstatic->ref = $links[$key]['url_id']; $paymentloanstatic->ref = $links[$key]['url_id'];
@ -668,7 +668,7 @@ if (!$error && $action == 'writebookkeeping') {
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_various') { } elseif ($tabtype[$key] == 'payment_various') {
$bookkeeping->subledger_account = $k; $bookkeeping->subledger_account = $k;
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $tabpay[$key]["account_various"]; $bookkeeping->numero_compte = $tabpay[$key]["account_various"];
$accountingaccount->fetch(null, $bookkeeping->numero_compte, true); $accountingaccount->fetch(null, $bookkeeping->numero_compte, true);
@ -954,8 +954,8 @@ if (empty($action) || $action == 'view') {
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); $listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
$period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); $period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$varlink = 'id_journal='.$id_journal; $varlink = 'id_journal='.$id_journal;
@ -991,11 +991,11 @@ if (empty($action) || $action == 'view') {
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
} else { } else {
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />'; if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />';
else print '<a class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>'; else print '<a class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>';
} }
print '</div>'; print '</div>';

View File

@ -110,11 +110,11 @@ if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
// Already in bookkeeping or not // Already in bookkeeping or not
if ($in_bookkeeping == 'already') if ($in_bookkeeping == 'already')
{ {
$sql .= " AND er.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')"; $sql .= " AND er.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
} }
if ($in_bookkeeping == 'notyet') if ($in_bookkeeping == 'notyet')
{ {
$sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')"; $sql .= " AND er.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='expense_report')";
} }
$sql .= " ORDER BY er.date_debut"; $sql .= " ORDER BY er.date_debut";
@ -370,8 +370,8 @@ if ($action == 'writebookkeeping') {
if ($error >= 10) if ($error >= 10)
{ {
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors'); setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
break; // Break in the foreach break; // Break in the foreach
} }
} }
} }
@ -433,48 +433,48 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print "\n"; print "\n";
foreach ($taber as $key => $val) { foreach ($taber as $key => $val) {
$date = dol_print_date($val["date"], 'day'); $date = dol_print_date($val["date"], 'day');
$userstatic->id = $tabuser[$key]['id']; $userstatic->id = $tabuser[$key]['id'];
$userstatic->name = $tabuser[$key]['name']; $userstatic->name = $tabuser[$key]['name'];
// Fees // Fees
foreach ($tabht[$key] as $k => $mt) { foreach ($tabht[$key] as $k => $mt) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print '"'.$date.'"'.$sep; print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep; print '"'.$val["ref"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($accountingaccount->label, 32).'"'.$sep; print '"'.dol_trunc($accountingaccount->label, 32).'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'; print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n"; print "\n";
} }
} }
// VAT // VAT
foreach ($tabtva[$key] as $k => $mt) { foreach ($tabtva[$key] as $k => $mt) {
if ($mt) { if ($mt) {
print '"'.$date.'"'.$sep; print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep; print '"'.$val["ref"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($langs->trans("VAT")).'"'.$sep; print '"'.dol_trunc($langs->trans("VAT")).'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'; print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n"; print "\n";
} }
} }
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
print '"'.$date.'"'.$sep; print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep; print '"'.$val["ref"].'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($userstatic->name).'"'.$sep; print '"'.dol_trunc($userstatic->name).'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'; print '"'.($mt >= 0 ? price($mt) : '').'"';
} }
print "\n"; print "\n";
} }
} }
@ -489,8 +489,8 @@ if (empty($action) || $action == 'view') {
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); $listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
$period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); $period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$varlink = 'id_journal='.$id_journal; $varlink = 'id_journal='.$id_journal;

View File

@ -719,8 +719,8 @@ if (empty($action) || $action == 'view') {
} }
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); $listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
$period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); $period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$varlink = 'id_journal='.$id_journal; $varlink = 'id_journal='.$id_journal;

View File

@ -130,7 +130,7 @@ if ($in_bookkeeping == 'already')
if ($in_bookkeeping == 'notyet') if ($in_bookkeeping == 'notyet')
{ {
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; $sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account // $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
} }
$sql .= " ORDER BY f.datef"; $sql .= " ORDER BY f.datef";
//print $sql; //print $sql;
@ -658,8 +658,8 @@ if (empty($action) || $action == 'view') {
} }
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); $listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
$period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); $period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$varlink = 'id_journal='.$id_journal; $varlink = 'id_journal='.$id_journal;

View File

@ -54,7 +54,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
{ {
if (!$cancel) if (!$cancel)
{ {
if ($codeventil < 0) $codeventil = 0; if ($codeventil < 0) $codeventil = 0;
$sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det"; $sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
$sql .= " SET fk_code_ventilation = ".$codeventil; $sql .= " SET fk_code_ventilation = ".$codeventil;
@ -64,12 +64,12 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
if (!$resql) { if (!$resql) {
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} else { } else {
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
if ($backtopage) if ($backtopage)
{ {
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit(); exit();
} }
} }
} else { } else {
header("Location: ./lines.php"); header("Location: ./lines.php");

View File

@ -50,27 +50,27 @@ $action = GETPOST('action', 'aZ09');
// //
if ($action == 'updateall') { if ($action == 'updateall') {
$db->begin(); $db->begin();
$res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0; $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
$res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity); $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
$res2 = dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity); $res2 = dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
$res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity); $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
$res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
// Use vat for invoice creation // Use vat for invoice creation
if ($conf->facture->enabled) { if ($conf->facture->enabled) {
$res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
$res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); $res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
} }
} }
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) { if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
setEventMessages('ErrorFailedToSaveDate', null, 'errors'); setEventMessages('ErrorFailedToSaveDate', null, 'errors');
$db->rollback(); $db->rollback();
} else { } else {
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
$db->commit(); $db->commit();
} }
} }
// Action to update or add a constant // Action to update or add a constant
@ -99,18 +99,18 @@ if ($action == 'update' || $action == 'add') {
// Action to enable of a submodule of the adherent module // Action to enable of a submodule of the adherent module
if ($action == 'set') { if ($action == 'set') {
$result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity); $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0) { if ($result < 0) {
print $db->error(); print $db->error();
} }
} }
// Action to disable a submodule of the adherent module // Action to disable a submodule of the adherent module
if ($action == 'unset') { if ($action == 'unset') {
$result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity); $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
if ($result < 0) { if ($result < 0) {
print $db->error(); print $db->error();
} }
} }
@ -169,7 +169,7 @@ if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty(
print '<td>'; print '<td>';
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0); print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') { if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') {
print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>'; print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
} }
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -95,7 +95,7 @@ if ($action == 'create') {
print '<div name="topofform"></div><br>'; print '<div name="topofform"></div><br>';
print load_fiche_titre($langs->trans('NewAttribute')); print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
} }
/* ************************************************************************** */ /* ************************************************************************** */
@ -107,7 +107,7 @@ if ($action == 'edit' && !empty($attrname)) {
print '<div name="topofform"></div><br>'; print '<div name="topofform"></div><br>';
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
} }
// End of page // End of page

View File

@ -54,22 +54,22 @@ if ($action == 'update') {
$payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE'); $payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE');
$forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE'); $forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE');
$res = dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT", $editamount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT", $editamount, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity);
if ($forcetype < 0) $res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity); if ($forcetype < 0) $res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity);
else { else {
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity);
} }
if (!$res > 0) $error++; if (!$res > 0) $error++;
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -97,8 +97,8 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user'); print dol_get_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user');
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
function initemail() function initemail()
{ {
if (jQuery("#MEMBER_NEWFORM_PAYONLINE").val()==\'-1\') if (jQuery("#MEMBER_NEWFORM_PAYONLINE").val()==\'-1\')
@ -127,7 +127,7 @@ if ($conf->use_javascript_ajax) {
jQuery("#MEMBER_ENABLE_PUBLIC").change(function() { initfields(); }); jQuery("#MEMBER_ENABLE_PUBLIC").change(function() { initfields(); });
jQuery("#MEMBER_NEWFORM_PAYONLINE").change(function() { initemail(); }); jQuery("#MEMBER_NEWFORM_PAYONLINE").change(function() { initemail(); });
})'; })';
print '</script>'."\n"; print '</script>'."\n";
} }

View File

@ -65,8 +65,8 @@ $result = $object->fetch($id);
if ($result > 0) { if ($result > 0) {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$adht = new AdherentType($db); $adht = new AdherentType($db);
$result = $adht->fetch($object->typeid); $result = $adht->fetch($object->typeid);
} }
@ -79,17 +79,17 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) { if (empty($reshook)) {
// Cancel // Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
$actioncode = ''; $actioncode = '';
$search_agenda_label = ''; $search_agenda_label = '';
} }
} }
@ -136,31 +136,31 @@ if ($object->id > 0) {
print dol_get_fiche_end(); print dol_get_fiche_end();
//print '<div class="tabsAction">'; //print '<div class="tabsAction">';
//print '</div>'; //print '</div>';
$newcardbutton = ''; $newcardbutton = '';
if (!empty($conf->agenda->enabled)) { if (!empty($conf->agenda->enabled)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id); $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id);
} }
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
print '<br>'; print '<br>';
$param = '&id='.$id; $param = '&id='.$id;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 1); print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 1);
// List of all actions // List of all actions
$filters = array(); $filters = array();
$filters['search_agenda_label'] = $search_agenda_label; $filters['search_agenda_label'] = $search_agenda_label;
// TODO Replace this with same code than into list.php // TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
} }
} }
// End of page // End of page

View File

@ -27,15 +27,15 @@
*/ */
abstract class ActionsAdherentCardCommon abstract class ActionsAdherentCardCommon
{ {
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
public $db; public $db;
public $dirmodule; public $dirmodule;
public $targetmodule; public $targetmodule;
public $canvas; public $canvas;
public $card; public $card;
//! Template container //! Template container
public $tpl = array(); public $tpl = array();
@ -54,52 +54,52 @@ abstract class ActionsAdherentCardCommon
/** /**
* Get object * Get object
* *
* @param int $id Object id * @param int $id Object id
* @return object Object loaded * @return object Object loaded
*/ */
public function getObject($id) public function getObject($id)
{ {
//$ret = $this->getInstanceDao(); //$ret = $this->getInstanceDao();
/*if (is_object($this->object) && method_exists($this->object,'fetch')) /*if (is_object($this->object) && method_exists($this->object,'fetch'))
{ {
if (! empty($id)) $this->object->fetch($id); if (! empty($id)) $this->object->fetch($id);
} }
else else
{*/ {*/
$object = new Adherent($this->db); $object = new Adherent($this->db);
if (!empty($id)) $object->fetch($id); if (!empty($id)) $object->fetch($id);
$this->object = $object; $this->object = $object;
//} //}
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set content of ->tpl array, to use into template * Set content of ->tpl array, to use into template
* *
* @param string $action Type of action * @param string $action Type of action
* @param int $id Id * @param int $id Id
* @return string HTML output * @return string HTML output
*/ */
public function assign_values(&$action, $id) public function assign_values(&$action, $id)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs, $user, $canvas; global $conf, $langs, $user, $canvas;
global $form, $formcompany, $objsoc; global $form, $formcompany, $objsoc;
if ($action == 'add' || $action == 'update') $this->assign_post(); if ($action == 'add' || $action == 'update') $this->assign_post();
foreach ($this->object as $key => $value) { foreach ($this->object as $key => $value) {
$this->tpl[$key] = $value; $this->tpl[$key] = $value;
} }
$this->tpl['error'] = $this->error; $this->tpl['error'] = $this->error;
$this->tpl['errors'] = $this->errors; $this->tpl['errors'] = $this->errors;
if ($action == 'create' || $action == 'edit') { if ($action == 'create' || $action == 'edit') {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript"> $this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() { jQuery("#selectcountry_id").change(function() {
@ -111,153 +111,153 @@ abstract class ActionsAdherentCardCommon
</script>'."\n"; </script>'."\n";
} }
if (is_object($objsoc) && $objsoc->id > 0) { if (is_object($objsoc) && $objsoc->id > 0) {
$this->tpl['company'] = $objsoc->getNomUrl(1); $this->tpl['company'] = $objsoc->getNomUrl(1);
$this->tpl['company_id'] = $objsoc->id; $this->tpl['company_id'] = $objsoc->id;
} else { } else {
$this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1); $this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1);
} }
// Civility // Civility
$this->tpl['select_civility'] = $formcompany->select_civility($this->object->civility_id); $this->tpl['select_civility'] = $formcompany->select_civility($this->object->civility_id);
// Predefined with third party // Predefined with third party
if ((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE')) { if ((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE')) {
if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address; if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address;
if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->zip; if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->zip;
if (dol_strlen(trim($this->object->town)) == 0) $this->object->town = $objsoc->town; if (dol_strlen(trim($this->object->town)) == 0) $this->object->town = $objsoc->town;
if (dol_strlen(trim($this->object->phone_perso)) == 0) $this->object->phone_perso = $objsoc->phone; if (dol_strlen(trim($this->object->phone_perso)) == 0) $this->object->phone_perso = $objsoc->phone;
if (dol_strlen(trim($this->object->phone_mobile)) == 0) $this->object->phone_mobile = $objsoc->phone_mobile; if (dol_strlen(trim($this->object->phone_mobile)) == 0) $this->object->phone_mobile = $objsoc->phone_mobile;
if (dol_strlen(trim($this->object->email)) == 0) $this->object->email = $objsoc->email; if (dol_strlen(trim($this->object->email)) == 0) $this->object->email = $objsoc->email;
} }
// Zip // Zip
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
// Town // Town
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
if (dol_strlen(trim($this->object->country_id)) == 0) $this->object->country_id = $objsoc->country_id; if (dol_strlen(trim($this->object->country_id)) == 0) $this->object->country_id = $objsoc->country_id;
// Country // Country
$this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id'); $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id');
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
// State // State
if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code); if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code);
else $this->tpl['select_state'] = $countrynotdefined; else $this->tpl['select_state'] = $countrynotdefined;
// Physical or Moral // Physical or Moral
$selectarray = array('0'=>$langs->trans("Physical"), '1'=>$langs->trans("Moral")); $selectarray = array('0'=>$langs->trans("Physical"), '1'=>$langs->trans("Moral"));
$this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0); $this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0);
} }
if ($action == 'view' || $action == 'edit' || $action == 'delete') { if ($action == 'view' || $action == 'edit' || $action == 'delete') {
// Emailing // Emailing
if (!empty($conf->mailing->enabled)) { if (!empty($conf->mailing->enabled)) {
$langs->load("mails"); $langs->load("mails");
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings(); $this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
} }
// Dolibarr user // Dolibarr user
if ($this->object->user_id) { if ($this->object->user_id) {
$dolibarr_user = new User($this->db); $dolibarr_user = new User($this->db);
$result = $dolibarr_user->fetch($this->object->user_id); $result = $dolibarr_user->fetch($this->object->user_id);
$this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1); $this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
} else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess"); } else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
} }
if ($action == 'view' || $action == 'delete') { if ($action == 'view' || $action == 'delete') {
$this->tpl['showrefnav'] = $form->showrefnav($this->object, 'id'); $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'id');
if ($this->object->socid > 0) { if ($this->object->socid > 0) {
$objsoc = new Societe($this->db); $objsoc = new Societe($this->db);
$objsoc->fetch($this->object->socid); $objsoc->fetch($this->object->socid);
$this->tpl['company'] = $objsoc->getNomUrl(1); $this->tpl['company'] = $objsoc->getNomUrl(1);
} else { } else {
$this->tpl['company'] = $langs->trans("AdherentNotLinkedToThirdParty"); $this->tpl['company'] = $langs->trans("AdherentNotLinkedToThirdParty");
} }
$this->tpl['civility'] = $this->object->getCivilityLabel(); $this->tpl['civility'] = $this->object->getCivilityLabel();
$this->tpl['address'] = dol_nl2br($this->object->address); $this->tpl['address'] = dol_nl2br($this->object->address);
$this->tpl['zip'] = ($this->object->zip ? $this->object->zip.'&nbsp;' : ''); $this->tpl['zip'] = ($this->object->zip ? $this->object->zip.'&nbsp;' : '');
$img = picto_from_langcode($this->object->country_code); $img = picto_from_langcode($this->object->country_code);
$this->tpl['country'] = ($img ? $img.' ' : '').$this->object->country; $this->tpl['country'] = ($img ? $img.' ' : '').$this->object->country;
$this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso, $this->object->country_code, 0, $this->object->id, 'AC_TEL'); $this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
$this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile, $this->object->country_code, 0, $this->object->id, 'AC_TEL'); $this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
$this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL'); $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
$this->tpl['visibility'] = $this->object->getmorphylib($this->object->morphy); $this->tpl['visibility'] = $this->object->getmorphylib($this->object->morphy);
$this->tpl['note'] = nl2br($this->object->note); $this->tpl['note'] = nl2br($this->object->note);
} }
if ($action == 'create_user') { if ($action == 'create_user') {
// Full firstname and lastname separated with a dot : firstname.lastname // Full firstname and lastname separated with a dot : firstname.lastname
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login = dol_buildlogin($this->object->lastname, $this->object->firstname); $login = dol_buildlogin($this->object->lastname, $this->object->firstname);
$generated_password = getRandomPassword(false); $generated_password = getRandomPassword(false);
$password = $generated_password; $password = $generated_password;
// Create a form array // Create a form array
$formquestion = array( $formquestion = array(
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login), array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login),
array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password)); array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password));
$this->tpl['action_create_user'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("CreateDolibarrLogin"), $langs->trans("ConfirmCreateAdherent"), "confirm_create_user", $formquestion, 'no'); $this->tpl['action_create_user'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("CreateDolibarrLogin"), $langs->trans("ConfirmCreateAdherent"), "confirm_create_user", $formquestion, 'no');
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Assign POST values into object * Assign POST values into object
* *
* @return string HTML output * @return string HTML output
*/ */
private function assign_post() private function assign_post()
{ {
// phpcs:enable // phpcs:enable
global $langs, $mysoc; global $langs, $mysoc;
$this->object->old_name = $_POST["old_name"]; $this->object->old_name = $_POST["old_name"];
$this->object->old_firstname = $_POST["old_firstname"]; $this->object->old_firstname = $_POST["old_firstname"];
$this->object->fk_soc = $_POST["fk_soc"]; $this->object->fk_soc = $_POST["fk_soc"];
$this->object->lastname = $_POST["lastname"]; $this->object->lastname = $_POST["lastname"];
$this->object->firstname = $_POST["firstname"]; $this->object->firstname = $_POST["firstname"];
$this->object->civility_id = $_POST["civility_id"]; $this->object->civility_id = $_POST["civility_id"];
$this->object->address = $_POST["address"]; $this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"]; $this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"]; $this->object->town = $_POST["town"];
$this->object->country_id = $_POST["country_id"] ? $_POST["country_id"] : $mysoc->country_id; $this->object->country_id = $_POST["country_id"] ? $_POST["country_id"] : $mysoc->country_id;
$this->object->state_id = $_POST["state_id"]; $this->object->state_id = $_POST["state_id"];
$this->object->phone_perso = $_POST["phone_perso"]; $this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"]; $this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->email = $_POST["email"]; $this->object->email = $_POST["email"];
$this->object->note = $_POST["note"]; $this->object->note = $_POST["note"];
$this->object->canvas = $_POST["canvas"]; $this->object->canvas = $_POST["canvas"];
// We set country_id, and country_code label of the chosen country // We set country_id, and country_code label of the chosen country
if ($this->object->country_id) { if ($this->object->country_id) {
$sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id; $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->object->country_code = $obj->code; $this->object->country_code = $obj->code;
$this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->libelle; $this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->libelle;
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
} }
} }

View File

@ -31,21 +31,21 @@ include_once DOL_DOCUMENT_ROOT.'/adherents/canvas/actions_adherentcard_common.cl
class ActionsAdherentCardDefault extends ActionsAdherentCardCommon class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
{ {
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Handler acces data base * @param DoliDB $db Handler acces data base
* @param string $dirmodule Name of directory of module * @param string $dirmodule Name of directory of module
* @param string $targetmodule Name of directory of module where canvas is stored * @param string $targetmodule Name of directory of module where canvas is stored
* @param string $canvas Name of canvas * @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas) * @param string $card Name of tab (sub-canvas)
*/ */
public function __construct($db, $dirmodule, $targetmodule, $canvas, $card) public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{ {
$this->db = $db; $this->db = $db;
$this->dirmodule = $dirmodule; $this->dirmodule = $dirmodule;
$this->targetmodule = $targetmodule; $this->targetmodule = $targetmodule;
$this->canvas = $canvas; $this->canvas = $canvas;
$this->card = $card; $this->card = $card;
} }
/** /**
@ -67,7 +67,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
return $out; return $out;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Assign custom values for canvas * Assign custom values for canvas
* *
@ -77,47 +77,47 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
*/ */
public function assign_values(&$action, $id) public function assign_values(&$action, $id)
{ {
// phpcs:enable // phpcs:enable
global $limit, $offset, $sortfield, $sortorder; global $limit, $offset, $sortfield, $sortorder;
global $conf, $db, $langs, $user; global $conf, $db, $langs, $user;
global $form; global $form;
$ret = $this->getObject($id); $ret = $this->getObject($id);
parent::assign_values($action, $id); parent::assign_values($action, $id);
$this->tpl['title'] = $this->getTitle($action); $this->tpl['title'] = $this->getTitle($action);
$this->tpl['error'] = $this->error; $this->tpl['error'] = $this->error;
$this->tpl['errors'] = $this->errors; $this->tpl['errors'] = $this->errors;
if ($action == 'view') { if ($action == 'view') {
// Card header // Card header
$head = member_prepare_head($this->object); $head = member_prepare_head($this->object);
$title = $this->getTitle($action); $title = $this->getTitle($action);
$this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'adherent'); $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'adherent');
$this->tpl['showend'] = dol_get_fiche_end(); $this->tpl['showend'] = dol_get_fiche_end();
$objsoc = new Societe($db); $objsoc = new Societe($db);
$objsoc->fetch($this->object->socid); $objsoc->fetch($this->object->socid);
$this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1); $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1);
$this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
} else { } else {
// Confirm delete contact // Confirm delete contact
if ($action == 'delete' && $user->rights->adherent->supprimer) { if ($action == 'delete' && $user->rights->adherent->supprimer) {
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1); $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1);
} }
} }
if ($action == 'list') { if ($action == 'list') {
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder); $this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Fetch datas list and save into ->list_datas * Fetch datas list and save into ->list_datas
* *
@ -129,11 +129,11 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
*/ */
public function LoadListDatas($limit, $offset, $sortfield, $sortorder) public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
//$this->getFieldList(); //$this->getFieldList();
$this->list_datas = array(); $this->list_datas = array();
} }
} }

View File

@ -118,21 +118,21 @@ if (!empty($this->control->tpl['action_delete'])) echo $this->control->tpl['acti
<?php echo $this->control->tpl['showend']; <?php echo $this->control->tpl['showend'];
if (empty($user->socid)) { if (empty($user->socid)) {
echo '<div class="tabsAction">'; echo '<div class="tabsAction">';
if ($user->rights->adherent->creer) { if ($user->rights->adherent->creer) {
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas.'">'.$langs->trans('Modify').'</a>'; echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
} }
if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) { if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) {
echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>'; echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
} }
if ($user->rights->adherent->supprimer) { if ($user->rights->adherent->supprimer) {
echo '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas.'">'.$langs->trans('Delete').'</a>'; echo '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas.'">'.$langs->trans('Delete').'</a>';
} }
echo '</div><br>'; echo '</div><br>';
} }
echo $this->control->tpl['actionstodo']; echo $this->control->tpl['actionstodo'];

View File

@ -218,7 +218,7 @@ if (empty($reshook)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$birthdate = ''; $birthdate = '';
if (GETPOST("birthday", 'int') && GETPOST("birthmonth", 'int') && GETPOST("birthyear", 'int')) if (GETPOST("birthday", 'int') && GETPOST("birthmonth", 'int') && GETPOST("birthyear", 'int'))
{ {
$birthdate = dol_mktime(12, 0, 0, GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int')); $birthdate = dol_mktime(12, 0, 0, GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int'));
} }

View File

@ -56,163 +56,163 @@ $extrafields->fetch_name_optionals_label($object->table_element);
*/ */
if ($mode == 'cardlogin' && empty($foruserlogin)) { if ($mode == 'cardlogin' && empty($foruserlogin)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"));
} }
if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) { if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
$arrayofmembers = array(); $arrayofmembers = array();
// request taking into account member with up to date subscriptions // request taking into account member with up to date subscriptions
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,"; $sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,";
$sql .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,"; $sql .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
$sql .= " t.libelle as type,"; $sql .= " t.libelle as type,";
$sql .= " c.code as country_code, c.label as country"; $sql .= " c.code as country_code, c.label as country";
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) if (!empty($extrafields->attributes[$object->table_element]['label']))
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1"; $sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
$sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND d.entity IN (".getEntity('adherent').")";
if (is_numeric($foruserid)) $sql .= " AND d.rowid=".$foruserid; if (is_numeric($foruserid)) $sql .= " AND d.rowid=".$foruserid;
if ($foruserlogin) $sql .= " AND d.login='".$db->escape($foruserlogin)."'"; if ($foruserlogin) $sql .= " AND d.login='".$db->escape($foruserlogin)."'";
$sql .= " ORDER BY d.rowid ASC"; $sql .= " ORDER BY d.rowid ASC";
dol_syslog("Search members", LOG_DEBUG); dol_syslog("Search members", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
if ($objp->country == '-') $objp->country = ''; if ($objp->country == '-') $objp->country = '';
$adherentstatic->id = $objp->rowid; $adherentstatic->id = $objp->rowid;
$adherentstatic->lastname = $objp->lastname; $adherentstatic->lastname = $objp->lastname;
$adherentstatic->firstname = $objp->firstname; $adherentstatic->firstname = $objp->firstname;
// Format extrafield so they can be parsed in function complete_substitutions_array // Format extrafield so they can be parsed in function complete_substitutions_array
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$adherentstatic->array_options = array(); $adherentstatic->array_options = array();
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$tmpkey = 'options_'.$key; $tmpkey = 'options_'.$key;
if (!empty($objp->$tmpkey)) { if (!empty($objp->$tmpkey)) {
$adherentstatic->array_options[$tmpkey] = $objp->$tmpkey; $adherentstatic->array_options[$tmpkey] = $objp->$tmpkey;
} }
//if (!empty($objp->$key)) //if (!empty($objp->$key))
// $objp->array_options[$tmpkey] = $objp->$key; // $objp->array_options[$tmpkey] = $objp->$key;
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey; //$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey;
} }
} }
// List of values to scan for a replacement // List of values to scan for a replacement
$substitutionarray = array( $substitutionarray = array(
'__ID__'=>$objp->rowid, '__ID__'=>$objp->rowid,
'__LOGIN__'=>$objp->login, '__LOGIN__'=>$objp->login,
'__FIRSTNAME__'=>$objp->firstname, '__FIRSTNAME__'=>$objp->firstname,
'__LASTNAME__'=>$objp->lastname, '__LASTNAME__'=>$objp->lastname,
'__FULLNAME__'=>$adherentstatic->getFullName($langs), '__FULLNAME__'=>$adherentstatic->getFullName($langs),
'__COMPANY__'=>$objp->company, '__COMPANY__'=>$objp->company,
'__ADDRESS__'=>$objp->address, '__ADDRESS__'=>$objp->address,
'__ZIP__'=>$objp->zip, '__ZIP__'=>$objp->zip,
'__TOWN__'=>$objp->town, '__TOWN__'=>$objp->town,
'__COUNTRY__'=>$objp->country, '__COUNTRY__'=>$objp->country,
'__COUNTRY_CODE__'=>$objp->country_code, '__COUNTRY_CODE__'=>$objp->country_code,
'__EMAIL__'=>$objp->email, '__EMAIL__'=>$objp->email,
'__BIRTH__'=>dol_print_date($objp->birth, 'day'), '__BIRTH__'=>dol_print_date($objp->birth, 'day'),
'__TYPE__'=>$objp->type, '__TYPE__'=>$objp->type,
'__YEAR__'=>$year, '__YEAR__'=>$year,
'__MONTH__'=>$month, '__MONTH__'=>$month,
'__DAY__'=>$day, '__DAY__'=>$day,
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/" '__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/"
); );
complete_substitutions_array($substitutionarray, $langs, $adherentstatic); complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
// For business cards // For business cards
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') { if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
$textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray); $textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
$textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray); $textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
$textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray); $textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
$textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray); $textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
if (is_numeric($foruserid) || $foruserlogin) { if (is_numeric($foruserid) || $foruserlogin) {
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY']; $nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
if ($nb <= 0) $nb = 1; // Protection to avoid empty page if ($nb <= 0) $nb = 1; // Protection to avoid empty page
for ($j = 0; $j < $nb; $j++) { for ($j = 0; $j < $nb; $j++) {
$arrayofmembers[] = array( $arrayofmembers[] = array(
'textleft'=>$textleft, 'textleft'=>$textleft,
'textheader'=>$textheader, 'textheader'=>$textheader,
'textfooter'=>$textfooter, 'textfooter'=>$textfooter,
'textright'=>$textright, 'textright'=>$textright,
'id'=>$objp->rowid, 'id'=>$objp->rowid,
'photo'=>$objp->photo 'photo'=>$objp->photo
); );
} }
} else { } else {
$arrayofmembers[] = array( $arrayofmembers[] = array(
'textleft'=>$textleft, 'textleft'=>$textleft,
'textheader'=>$textheader, 'textheader'=>$textheader,
'textfooter'=>$textfooter, 'textfooter'=>$textfooter,
'textright'=>$textright, 'textright'=>$textright,
'id'=>$objp->rowid, 'id'=>$objp->rowid,
'photo'=>$objp->photo 'photo'=>$objp->photo
); );
} }
} }
// For labels // For labels
if ($mode == 'label') { if ($mode == 'label') {
if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__"; if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
$textleft = make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray); $textleft = make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
$textheader = ''; $textheader = '';
$textfooter = ''; $textfooter = '';
$textright = ''; $textright = '';
$arrayofmembers[] = array('textleft'=>$textleft, $arrayofmembers[] = array('textleft'=>$textleft,
'textheader'=>$textheader, 'textheader'=>$textheader,
'textfooter'=>$textfooter, 'textfooter'=>$textfooter,
'textright'=>$textright, 'textright'=>$textright,
'id'=>$objp->rowid, 'id'=>$objp->rowid,
'photo'=>$objp->photo); 'photo'=>$objp->photo);
} }
$i++; $i++;
} }
// Build and output PDF // Build and output PDF
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') { if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
if (!count($arrayofmembers)) { if (!count($arrayofmembers)) {
$mesg = $langs->trans("ErrorRecordNotFound"); $mesg = $langs->trans("ErrorRecordNotFound");
} }
if (empty($model) || $model == '-1') { if (empty($model) || $model == '-1') {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
} }
if (!$mesg) $result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs); if (!$mesg) $result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
} elseif ($mode == 'label') { } elseif ($mode == 'label') {
if (!count($arrayofmembers)) { if (!count($arrayofmembers)) {
$mesg = $langs->trans("ErrorRecordNotFound"); $mesg = $langs->trans("ErrorRecordNotFound");
} }
if (empty($modellabel) || $modellabel == '-1') { if (empty($modellabel) || $modellabel == '-1') {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
} }
if (!$mesg) $result = doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs); if (!$mesg) $result = doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs);
} }
if ($result <= 0) { if ($result <= 0) {
dol_print_error('', $result); dol_print_error('', $result);
} }
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
if (!$mesg) { if (!$mesg) {
$db->close(); $db->close();
exit; exit;
} }
} }

View File

@ -707,7 +707,7 @@ class AdherentType extends CommonObject
*/ */
public function initAsSpecimen() public function initAsSpecimen()
{ {
global $conf, $user, $langs; global $user;
// Initialise parametres // Initialise parametres
$this->id = 0; $this->id = 0;
@ -735,46 +735,10 @@ class AdherentType extends CommonObject
*/ */
public function getMailOnValid() public function getMailOnValid()
{ {
global $conf;
if (!empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid))) { if (!empty($this->mail_valid) && trim(dol_htmlentitiesbr_decode($this->mail_valid))) {
return $this->mail_valid; return $this->mail_valid;
} }
return ''; return '';
} }
/**
* getMailOnSubscription
*
* @return string Return mail content of type or empty
*/
public function getMailOnSubscription()
{
global $conf;
// mail_subscription not defined so never used
if (!empty($this->mail_subscription) && trim(dol_htmlentitiesbr_decode($this->mail_subscription))) { // Property not yet defined
return $this->mail_subscription;
}
return '';
}
/**
* getMailOnResiliate
*
* @return string Return mail model content of type or empty
*/
public function getMailOnResiliate()
{
global $conf;
// NOTE mail_resiliate not defined so never used
if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) { // Property not yet defined
return $this->mail_resiliate;
}
return '';
}
} }

View File

@ -32,18 +32,18 @@ include_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
*/ */
class AdherentStats extends Stats class AdherentStats extends Stats
{ {
/** /**
* @var string Name of table without prefix where object is stored * @var string Name of table without prefix where object is stored
*/ */
public $table_element; public $table_element;
public $memberid; public $memberid;
public $socid; public $socid;
public $userid; public $userid;
public $from; public $from;
public $field; public $field;
public $where; public $where;
/** /**
@ -51,15 +51,15 @@ class AdherentStats extends Stats
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param int $socid Id third party * @param int $socid Id third party
* @param int $userid Id user for filter * @param int $userid Id user for filter
*/ */
public function __construct($db, $socid = 0, $userid = 0) public function __construct($db, $socid = 0, $userid = 0)
{ {
global $user, $conf; global $user, $conf;
$this->db = $db; $this->db = $db;
$this->socid = $socid; $this->socid = $socid;
$this->userid = $userid; $this->userid = $userid;
$object = new Subscription($this->db); $object = new Subscription($this->db);
@ -74,16 +74,16 @@ class AdherentStats extends Stats
if ($this->memberid) { if ($this->memberid) {
$this->where .= " AND m.rowid = ".$this->memberid; $this->where .= " AND m.rowid = ".$this->memberid;
} }
//if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid; //if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid;
} }
/** /**
* Return the number of proposition by month for a given year * Return the number of proposition by month for a given year
* *
* @param int $year Year * @param int $year Year
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
* @return array Array of nb each month * @return array Array of nb each month
*/ */
public function getNbByMonth($year, $format = 0) public function getNbByMonth($year, $format = 0)
{ {
@ -95,7 +95,7 @@ class AdherentStats extends Stats
$sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year); $sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year);
$sql .= " AND ".$this->where; $sql .= " AND ".$this->where;
$sql .= " GROUP BY dm"; $sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC'); $sql .= $this->db->order('dm', 'DESC');
return $this->_getNbByMonth($year, $sql, $format); return $this->_getNbByMonth($year, $sql, $format);
} }
@ -103,7 +103,7 @@ class AdherentStats extends Stats
/** /**
* Return the number of subscriptions by year * Return the number of subscriptions by year
* *
* @return array Array of nb each year * @return array Array of nb each year
*/ */
public function getNbByYear() public function getNbByYear()
{ {
@ -114,7 +114,7 @@ class AdherentStats extends Stats
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE ".$this->where; $sql .= " WHERE ".$this->where;
$sql .= " GROUP BY dm"; $sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC'); $sql .= $this->db->order('dm', 'DESC');
return $this->_getNbByYear($sql); return $this->_getNbByYear($sql);
} }
@ -122,9 +122,9 @@ class AdherentStats extends Stats
/** /**
* Return the number of subscriptions by month for a given year * Return the number of subscriptions by month for a given year
* *
* @param int $year Year * @param int $year Year
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
* @return array Array of amount each month * @return array Array of amount each month
*/ */
public function getAmountByMonth($year, $format = 0) public function getAmountByMonth($year, $format = 0)
{ {
@ -136,7 +136,7 @@ class AdherentStats extends Stats
$sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year); $sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year);
$sql .= " AND ".$this->where; $sql .= " AND ".$this->where;
$sql .= " GROUP BY dm"; $sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC'); $sql .= $this->db->order('dm', 'DESC');
return $this->_getAmountByMonth($year, $sql, $format); return $this->_getAmountByMonth($year, $sql, $format);
} }
@ -144,8 +144,8 @@ class AdherentStats extends Stats
/** /**
* Return average amount each month * Return average amount each month
* *
* @param int $year Year * @param int $year Year
* @return array Array of average each month * @return array Array of average each month
*/ */
public function getAverageByMonth($year) public function getAverageByMonth($year)
{ {
@ -157,7 +157,7 @@ class AdherentStats extends Stats
$sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year); $sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year);
$sql .= " AND ".$this->where; $sql .= " AND ".$this->where;
$sql .= " GROUP BY dm"; $sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC'); $sql .= $this->db->order('dm', 'DESC');
return $this->_getAverageByMonth($year, $sql); return $this->_getAverageByMonth($year, $sql);
} }
@ -177,7 +177,7 @@ class AdherentStats extends Stats
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE ".$this->where; $sql .= " WHERE ".$this->where;
$sql .= " GROUP BY year"; $sql .= " GROUP BY year";
$sql .= $this->db->order('year', 'DESC'); $sql .= $this->db->order('year', 'DESC');
return $this->_getAllByYear($sql); return $this->_getAllByYear($sql);
} }

View File

@ -98,17 +98,17 @@ class Members extends DolibarrApi
*/ */
public function getByThirdparty($thirdparty) public function getByThirdparty($thirdparty)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401); throw new RestException(401);
} }
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch('', '', $thirdparty); $result = $member->fetch('', '', $thirdparty);
if ( ! $result ) { if (!$result) {
throw new RestException(404, 'member not found'); throw new RestException(404, 'member not found');
} }
if ( ! DolibarrApi::_checkAccessToResource('adherent', $member->id)) { if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -131,23 +131,23 @@ class Members extends DolibarrApi
*/ */
public function getByThirdpartyEmail($email) public function getByThirdpartyEmail($email)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401); throw new RestException(401);
} }
$thirdparty = new Societe($this->db); $thirdparty = new Societe($this->db);
$result = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email); $result = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email);
if ( ! $result ) { if (!$result) {
throw new RestException(404, 'thirdparty not found'); throw new RestException(404, 'thirdparty not found');
} }
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch('', '', $thirdparty->id); $result = $member->fetch('', '', $thirdparty->id);
if ( ! $result ) { if (!$result) {
throw new RestException(404, 'member not found'); throw new RestException(404, 'member not found');
} }
if ( ! DolibarrApi::_checkAccessToResource('adherent', $member->id)) { if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -170,23 +170,23 @@ class Members extends DolibarrApi
*/ */
public function getByThirdpartyBarcode($barcode) public function getByThirdpartyBarcode($barcode)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->lire) { if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401); throw new RestException(401);
} }
$thirdparty = new Societe($this->db); $thirdparty = new Societe($this->db);
$result = $thirdparty->fetch('', '', '', $barcode); $result = $thirdparty->fetch('', '', '', $barcode);
if ( ! $result ) { if (!$result) {
throw new RestException(404, 'thirdparty not found'); throw new RestException(404, 'thirdparty not found');
} }
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch('', '', $thirdparty->id); $result = $member->fetch('', '', $thirdparty->id);
if ( ! $result ) { if (!$result) {
throw new RestException(404, 'member not found'); throw new RestException(404, 'member not found');
} }
if ( ! DolibarrApi::_checkAccessToResource('adherent', $member->id)) { if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }

View File

@ -27,219 +27,219 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
*/ */
class Subscriptions extends DolibarrApi class Subscriptions extends DolibarrApi
{ {
/** /**
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'fk_adherent', 'fk_adherent',
'dateh', 'dateh',
'datef', 'datef',
'amount', 'amount',
); );
/** /**
* Constructor * Constructor
*/ */
public function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
} }
/** /**
* Get properties of a subscription object * Get properties of a subscription object
* *
* Return an array with subscription informations * Return an array with subscription informations
* *
* @param int $id ID of subscription * @param int $id ID of subscription
* @return array|mixed data without useless information * @return array|mixed data without useless information
* *
* @throws RestException * @throws RestException
*/ */
public function get($id) public function get($id)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401); throw new RestException(401);
} }
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);
$result = $subscription->fetch($id); $result = $subscription->fetch($id);
if (!$result) { if (!$result) {
throw new RestException(404, 'Subscription not found'); throw new RestException(404, 'Subscription not found');
} }
return $this->_cleanObjectDatas($subscription); return $this->_cleanObjectDatas($subscription);
} }
/** /**
* List subscriptions * List subscriptions
* *
* Get a list of subscriptions * Get a list of subscriptions
* *
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @param int $limit Limit for list * @param int $limit Limit for list
* @param int $page Page number * @param int $page Page number
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')" * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')"
* @return array Array of subscription objects * @return array Array of subscription objects
* *
* @throws RestException * @throws RestException
*/ */
public function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') public function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401); throw new RestException(401);
} }
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."subscription as t"; $sql .= " FROM ".MAIN_DB_PREFIX."subscription as t";
$sql .= ' WHERE 1 = 1'; $sql .= ' WHERE 1 = 1';
// Add sql filters // Add sql filters
if ($sqlfilters) { if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
$sql .= $this->db->order($sortfield, $sortorder); $sql .= $this->db->order($sortfield, $sortorder);
if ($limit) { if ($limit) {
if ($page < 0) { if ($page < 0) {
$page = 0; $page = 0;
} }
$offset = $limit * $page; $offset = $limit * $page;
$sql .= $this->db->plimit($limit + 1, $offset); $sql .= $this->db->plimit($limit + 1, $offset);
} }
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$i = 0; $i = 0;
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
while ($i < min($limit, $num)) { while ($i < min($limit, $num)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);
if ($subscription->fetch($obj->rowid)) { if ($subscription->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($subscription); $obj_ret[] = $this->_cleanObjectDatas($subscription);
} }
$i++; $i++;
} }
} else { } else {
throw new RestException(503, 'Error when retrieve subscription list : '.$this->db->lasterror()); throw new RestException(503, 'Error when retrieve subscription list : '.$this->db->lasterror());
} }
if (!count($obj_ret)) { if (!count($obj_ret)) {
throw new RestException(404, 'No Subscription found'); throw new RestException(404, 'No Subscription found');
} }
return $obj_ret; return $obj_ret;
} }
/** /**
* Create subscription object * Create subscription object
* *
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of subscription * @return int ID of subscription
*/ */
public function post($request_data = null) public function post($request_data = null)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401); throw new RestException(401);
} }
// Check mandatory fields // Check mandatory fields
$result = $this->_validate($request_data); $result = $this->_validate($request_data);
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);
foreach ($request_data as $field => $value) { foreach ($request_data as $field => $value) {
$subscription->$field = $value; $subscription->$field = $value;
} }
if ($subscription->create(DolibarrApiAccess::$user) < 0) { if ($subscription->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, 'Error when creating subscription', array_merge(array($subscription->error), $subscription->errors)); throw new RestException(500, 'Error when creating subscription', array_merge(array($subscription->error), $subscription->errors));
} }
return $subscription->id; return $subscription->id;
} }
/** /**
* Update subscription * Update subscription
* *
* @param int $id ID of subscription to update * @param int $id ID of subscription to update
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
public function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if (!DolibarrApiAccess::$user->rights->adherent->creer) { if (!DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401); throw new RestException(401);
} }
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);
$result = $subscription->fetch($id); $result = $subscription->fetch($id);
if (!$result) { if (!$result) {
throw new RestException(404, 'Subscription not found'); throw new RestException(404, 'Subscription not found');
} }
foreach ($request_data as $field => $value) { foreach ($request_data as $field => $value) {
if ($field == 'id') continue; if ($field == 'id') continue;
$subscription->$field = $value; $subscription->$field = $value;
} }
if ($subscription->update(DolibarrApiAccess::$user) > 0) { if ($subscription->update(DolibarrApiAccess::$user) > 0) {
return $this->get($id); return $this->get($id);
} else { } else {
throw new RestException(500, $subscription->error); throw new RestException(500, $subscription->error);
} }
} }
/** /**
* Delete subscription * Delete subscription
* *
* @param int $id ID of subscription to delete * @param int $id ID of subscription to delete
* @return array * @return array
*/ */
public function delete($id) public function delete($id)
{ {
// The right to delete a subscription comes with the right to create one. // The right to delete a subscription comes with the right to create one.
if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401); throw new RestException(401);
} }
$subscription = new Subscription($this->db); $subscription = new Subscription($this->db);
$result = $subscription->fetch($id); $result = $subscription->fetch($id);
if (!$result) { if (!$result) {
throw new RestException(404, 'Subscription not found'); throw new RestException(404, 'Subscription not found');
} }
if (!$subscription->delete(DolibarrApiAccess::$user)) { if (!$subscription->delete(DolibarrApiAccess::$user)) {
throw new RestException(401, 'error when deleting subscription'); throw new RestException(401, 'error when deleting subscription');
} }
return array( return array(
'success' => array( 'success' => array(
'code' => 200, 'code' => 200,
'message' => 'subscription deleted' 'message' => 'subscription deleted'
) )
); );
} }
/** /**
* Validate fields before creating an object * Validate fields before creating an object
* *
* @param array|null $data Data to validate * @param array|null $data Data to validate
* @return array * @return array
* *
* @throws RestException * @throws RestException
*/ */
private function _validate($data) private function _validate($data)
{ {
$subscription = array(); $subscription = array();
foreach (Subscriptions::$FIELDS as $field) { foreach (Subscriptions::$FIELDS as $field) {
if (!isset($data[$field])) if (!isset($data[$field]))
throw new RestException(400, "$field field missing"); throw new RestException(400, "$field field missing");
$subscription[$field] = $data[$field]; $subscription[$field] = $data[$field];
} }
return $subscription; return $subscription;
} }
} }

View File

@ -32,435 +32,435 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
*/ */
class Subscription extends CommonObject class Subscription extends CommonObject
{ {
/** /**
* @var string ID to identify managed object * @var string ID to identify managed object
*/ */
public $element = 'subscription'; public $element = 'subscription';
/** /**
* @var string Name of table without prefix where object is stored * @var string Name of table without prefix where object is stored
*/ */
public $table_element = 'subscription'; public $table_element = 'subscription';
/** /**
* @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table * @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table
*/ */
public $ismultientitymanaged = 'fk_adherent@adherent'; public $ismultientitymanaged = 'fk_adherent@adherent';
/** /**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/ */
public $picto = 'payment'; public $picto = 'payment';
/** /**
* Date creation record (datec) * Date creation record (datec)
* *
* @var integer * @var integer
*/ */
public $datec; public $datec;
/** /**
* Date modification record (tms) * Date modification record (tms)
* *
* @var integer * @var integer
*/ */
public $datem; public $datem;
/** /**
* Subscription start date (date subscription) * Subscription start date (date subscription)
* *
* @var integer * @var integer
*/ */
public $dateh; public $dateh;
/** /**
* Subscription end date * Subscription end date
* *
* @var integer * @var integer
*/ */
public $datef; public $datef;
/** /**
* @var int ID * @var int ID
*/ */
public $fk_type; public $fk_type;
public $fk_adherent; public $fk_adherent;
public $amount; public $amount;
/** /**
* @var int ID * @var int ID
*/ */
public $fk_bank; public $fk_bank;
public $fields = array( public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
'fk_adherent' =>array('type'=>'integer', 'label'=>'Member', 'enabled'=>1, 'visible'=>-1, 'position'=>25), 'fk_adherent' =>array('type'=>'integer', 'label'=>'Member', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'dateadh' =>array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>30), 'dateadh' =>array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'datef' =>array('type'=>'datetime', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35), 'datef' =>array('type'=>'datetime', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
'subscription' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'isameasure'=>1), 'subscription' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'isameasure'=>1),
'fk_bank' =>array('type'=>'integer', 'label'=>'BankId', 'enabled'=>1, 'visible'=>-1, 'position'=>45), 'fk_bank' =>array('type'=>'integer', 'label'=>'BankId', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'note' =>array('type'=>'text', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50), 'note' =>array('type'=>'text', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'fk_type' =>array('type'=>'integer', 'label'=>'MemberType', 'enabled'=>1, 'visible'=>-1, 'position'=>55), 'fk_type' =>array('type'=>'integer', 'label'=>'MemberType', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>60), 'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>60),
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65), 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
); );
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
public function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
/** /**
* Function who permitted cretaion of the subscription * Function who permitted cretaion of the subscription
* *
* @param User $user User that create * @param User $user User that create
* @param bool $notrigger false=launch triggers after, true=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id subscription created if OK * @return int <0 if KO, Id subscription created if OK
*/ */
public function create($user, $notrigger = false) public function create($user, $notrigger = false)
{ {
global $langs; global $langs;
$error = 0; $error = 0;
$now = dol_now(); $now = dol_now();
// Check parameters // Check parameters
if ($this->datef <= $this->dateh) { if ($this->datef <= $this->dateh) {
$this->error = $langs->trans("ErrorBadValueForDate"); $this->error = $langs->trans("ErrorBadValueForDate");
return -1; return -1;
} }
if (empty($this->datec)) $this->datec = $now; if (empty($this->datec)) $this->datec = $now;
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)";
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent); $result = $member->fetch($this->fk_adherent);
if ($this->fk_type == null) { // If type not defined, we use the type of member if ($this->fk_type == null) { // If type not defined, we use the type of member
$type = $member->typeid; $type = $member->typeid;
} else { } else {
$type = $this->fk_type; $type = $this->fk_type;
} }
$sql .= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',"; $sql .= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->dateh)."',"; $sql .= " '".$this->db->idate($this->dateh)."',";
$sql .= " '".$this->db->idate($this->datef)."',"; $sql .= " '".$this->db->idate($this->datef)."',";
$sql .= " ".$this->amount.","; $sql .= " ".$this->amount.",";
$sql .= " '".$this->db->escape($this->note_public ? $this->note_public : $this->note)."')"; $sql .= " '".$this->db->escape($this->note_public ? $this->note_public : $this->note)."')";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {
$error++; $error++;
$this->errors[] = $this->db->lasterror(); $this->errors[] = $this->db->lasterror();
} }
if (!$error) { if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
$this->fk_type = $type; $this->fk_type = $type;
} }
if (!$error && !$notrigger) { if (!$error && !$notrigger) {
$this->context = array('member'=>$member); $this->context = array('member'=>$member);
// Call triggers // Call triggers
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user); $result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} else { } else {
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} }
} }
/** /**
* Method to load a subscription * Method to load a subscription
* *
* @param int $rowid Id subscription * @param int $rowid Id subscription
* @return int <0 if KO, =0 if not found, >0 if OK * @return int <0 if KO, =0 if not found, >0 if OK
*/ */
public function fetch($rowid) public function fetch($rowid)
{ {
$sql = "SELECT rowid, fk_type, fk_adherent, datec,"; $sql = "SELECT rowid, fk_type, fk_adherent, datec,";
$sql .= " tms,"; $sql .= " tms,";
$sql .= " dateadh as dateh,"; $sql .= " dateadh as dateh,";
$sql .= " datef,"; $sql .= " datef,";
$sql .= " subscription, note, fk_bank"; $sql .= " subscription, note, fk_bank";
$sql .= " FROM ".MAIN_DB_PREFIX."subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."subscription";
$sql .= " WHERE rowid=".$rowid; $sql .= " WHERE rowid=".$rowid;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
if ($this->db->num_rows($resql)) { if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->fk_type = $obj->fk_type; $this->fk_type = $obj->fk_type;
$this->fk_adherent = $obj->fk_adherent; $this->fk_adherent = $obj->fk_adherent;
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->tms); $this->datem = $this->db->jdate($obj->tms);
$this->dateh = $this->db->jdate($obj->dateh); $this->dateh = $this->db->jdate($obj->dateh);
$this->datef = $this->db->jdate($obj->datef); $this->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->subscription; $this->amount = $obj->subscription;
$this->note = $obj->note; $this->note = $obj->note;
$this->fk_bank = $obj->fk_bank; $this->fk_bank = $obj->fk_bank;
return 1; return 1;
} else { } else {
return 0; return 0;
} }
} else { } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
return -1; return -1;
} }
} }
/** /**
* Update subscription * Update subscription
* *
* @param User $user User who updated * @param User $user User who updated
* @param int $notrigger 0=Disable triggers * @param int $notrigger 0=Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function update($user, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
$error = 0; $error = 0;
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_type = ".$this->fk_type.","; $sql .= " fk_type = ".$this->fk_type.",";
$sql .= " fk_adherent = ".$this->fk_adherent.","; $sql .= " fk_adherent = ".$this->fk_adherent.",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').","; $sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').",";
$sql .= " subscription = '".price2num($this->amount)."',"; $sql .= " subscription = '".price2num($this->amount)."',";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',"; $sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',"; $sql .= " datef='".$this->db->idate($this->datef)."',";
$sql .= " datec='".$this->db->idate($this->datec)."',"; $sql .= " datec='".$this->db->idate($this->datec)."',";
$sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null'); $sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null');
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent); $result = $member->fetch($this->fk_adherent);
$result = $member->update_end_date($user); $result = $member->update_end_date($user);
if (!$error && !$notrigger) { if (!$error && !$notrigger) {
$this->context = array('member'=>$member); $this->context = array('member'=>$member);
// Call triggers // Call triggers
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user); $result = $this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user);
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
// End call triggers // End call triggers
} }
} else { } else {
$error++; $error++;
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} else { } else {
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} }
} }
/** /**
* Delete a subscription * Delete a subscription
* *
* @param User $user User that delete * @param User $user User that delete
* @param bool $notrigger false=launch triggers after, true=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
public function delete($user, $notrigger = false) public function delete($user, $notrigger = false)
{ {
$error = 0; $error = 0;
// It subscription is linked to a bank transaction, we get it // It subscription is linked to a bank transaction, we get it
if ($this->fk_bank > 0) { if ($this->fk_bank > 0) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline = new AccountLine($this->db); $accountline = new AccountLine($this->db);
$result = $accountline->fetch($this->fk_bank); $result = $accountline->fetch($this->fk_bank);
} }
$this->db->begin(); $this->db->begin();
if (!$error) { if (!$error) {
if (!$notrigger) { if (!$notrigger) {
// Call triggers // Call triggers
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user); $result = $this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user);
if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail
// End call triggers // End call triggers
} }
} }
if (!$error) { if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$num = $this->db->affected_rows($resql); $num = $this->db->affected_rows($resql);
if ($num) { if ($num) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db); $member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent); $result = $member->fetch($this->fk_adherent);
$result = $member->update_end_date($user); $result = $member->update_end_date($user);
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) { // If we found bank account line (this means this->fk_bank defined) if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) { // If we found bank account line (this means this->fk_bank defined)
$result = $accountline->delete($user); // Return false if refused because line is conciliated $result = $accountline->delete($user); // Return false if refused because line is conciliated
if ($result > 0) { if ($result > 0) {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} else { } else {
$this->error = $accountline->error; $this->error = $accountline->error;
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} else { } else {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
} else { } else {
$this->db->commit(); $this->db->commit();
return 0; return 0;
} }
} else { } else {
$error++; $error++;
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
} }
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} else { } else {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param string $option Page for link ('', 'nolink', ...) * @param string $option Page for link ('', 'nolink', ...)
* @param string $morecss Add more css on link * @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
public function getNomUrl($withpicto = 0, $notooltip = 0, $option = '', $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $notooltip = 0, $option = '', $morecss = '', $save_lastsearch_value = -1)
{ {
global $langs; global $langs;
$result = ''; $result = '';
$langs->load("members"); $langs->load("members");
$label = $langs->trans("ShowSubscription").': '.$this->ref; $label = $langs->trans("ShowSubscription").': '.$this->ref;
$url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id; $url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id;
if ($option != 'nolink') { if ($option != 'nolink') {
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
} }
$linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">'; $linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">';
$linkend = '</a>'; $linkend = '</a>';
$picto = 'payment'; $picto = 'payment';
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto != 2) $result .= $this->ref; if ($withpicto != 2) $result .= $this->ref;
$result .= $linkend; $result .= $linkend;
return $result; return $result;
} }
/** /**
* Retourne le libelle du statut d'une adhesion * Retourne le libelle du statut d'une adhesion
* *
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label * @return string Label
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return ''; return '';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
* @param int $status Id status * @param int $status Id status
* @return string Label * @return string Label
*/ */
public function LibStatut($status) public function LibStatut($status)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
$langs->load("members"); $langs->load("members");
return ''; return '';
} }
/** /**
* Load information of the subscription object * Load information of the subscription object
* *
* @param int $id Id subscription * @param int $id Id subscription
* @return void * @return void
*/ */
public function info($id) public function info($id)
{ {
$sql = 'SELECT c.rowid, c.datec,'; $sql = 'SELECT c.rowid, c.datec,';
$sql .= ' c.tms as datem'; $sql .= ' c.tms as datem';
$sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c'; $sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql .= ' WHERE c.rowid = '.$id; $sql .= ' WHERE c.rowid = '.$id;
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
if ($this->db->num_rows($result)) { if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = $this->db->jdate($obj->datem);
} }
$this->db->free($result); $this->db->free($result);
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
} }

View File

@ -86,7 +86,7 @@ $helpurl = "EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Mi
llxHeader("", $title, $helpurl); llxHeader("", $title, $helpurl);
if ($id > 0) { if ($id > 0) {
$result = $membert->fetch($object->typeid); $result = $membert->fetch($object->typeid);
if ($result > 0) { if ($result > 0) {
// Build file list // Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
@ -95,47 +95,47 @@ if ($id > 0) {
$totalsize += $file['size']; $totalsize += $file['size'];
} }
if (!empty($conf->notification->enabled)) if (!empty($conf->notification->enabled))
$langs->load("mails"); $langs->load("mails");
$head = member_prepare_head($object); $head = member_prepare_head($object);
print dol_get_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user'); print dol_get_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">'; print '<table class="border tableforfield centpercent">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
} }
// Type // Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n"; print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
// Morphy // Morphy
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>'; print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">'; /*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
print $form->showphoto('memberphoto',$object); print $form->showphoto('memberphoto',$object);
print '</td>';*/ print '</td>';*/
print '</tr>'; print '</tr>';
// Company // Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>'; print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
// Civility // Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>'; print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>'; print '</tr>';
// Number of Attached Files // Number of Attached Files
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
//Total Size Of Attached Files //Total Size Of Attached Files
@ -157,7 +157,7 @@ if ($id > 0) {
dol_print_error($db); dol_print_error($db);
} }
} else { } else {
$langs->load("errors"); $langs->load("errors");
print $langs->trans("ErrorRecordNotFound"); print $langs->trans("ErrorRecordNotFound");
} }

View File

@ -125,29 +125,29 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo
// Search contact/address // Search contact/address
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) { if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) {
$listofsearchfields['search_member'] = array('text'=>'Member'); $listofsearchfields['search_member'] = array('text'=>'Member');
} }
if (count($listofsearchfields)) { if (count($listofsearchfields)) {
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">'; print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">'; print '<table class="noborder nohover centpercent">';
$i = 0; $i = 0;
foreach ($listofsearchfields as $key => $value) { foreach ($listofsearchfields as $key => $value) {
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>'; if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>'; print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>'; if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
print '<br>'; print '<br>';
} }
} }
@ -158,53 +158,53 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">'; print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>'; print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
print '<tr><td class="center" colspan="2">'; print '<tr><td class="center" colspan="2">';
$SommeA = 0; $SommeA = 0;
$SommeB = 0; $SommeB = 0;
$SommeC = 0; $SommeC = 0;
$SommeD = 0; $SommeD = 0;
$total = 0; $total = 0;
$dataval = array(); $dataval = array();
$i = 0; $i = 0;
foreach ($AdherentType as $key => $adhtype) { foreach ($AdherentType as $key => $adhtype) {
$dataval['draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0); $dataval['draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0);
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0); $dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0);
$dataval['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0); $dataval['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0);
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0); $dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
$SommeA += isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0; $SommeA += isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0;
$SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0; $SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0;
$SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0; $SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0;
$SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0; $SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
$i++; $i++;
} }
$total = $SommeA + $SommeB + $SommeC + $SommeD; $total = $SommeA + $SommeB + $SommeC + $SommeD;
$dataseries = array(); $dataseries = array();
$dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersNotUpToDate"), round($SommeB)); $dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersNotUpToDate"), round($SommeB));
$dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersUpToDate"), round($SommeC)); $dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersUpToDate"), round($SommeC));
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SommeD)); $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SommeD));
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SommeA)); $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SommeA));
include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph(); $dolgraph = new DolGraph();
$dolgraph->SetData($dataseries); $dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, $badgeStatus6, '-'.$badgeStatus0)); $dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, $badgeStatus6, '-'.$badgeStatus0));
$dolgraph->setShowLegend(2); $dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1); $dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie')); $dolgraph->SetType(array('pie'));
$dolgraph->setHeight('200'); $dolgraph->setHeight('200');
$dolgraph->draw('idgraphstatus'); $dolgraph->draw('idgraphstatus');
print $dolgraph->show($total ? 0 : 1); print $dolgraph->show($total ? 0 : 1);
print '</td></tr>'; print '</td></tr>';
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">'; print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
print $SommeA + $SommeB + $SommeC + $SommeD; print $SommeA + $SommeB + $SommeC + $SommeD;
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
} }
print '<br>'; print '<br>';
@ -223,17 +223,17 @@ $sql .= " AND d.rowid = c.fk_adherent";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$year = dol_print_date($db->jdate($objp->dateh), "%Y"); $year = dol_print_date($db->jdate($objp->dateh), "%Y");
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription; $Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1; $Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
$tot += $objp->subscription; $tot += $objp->subscription;
$numb += 1; $numb += 1;
$i++; $i++;
} }
} }
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
@ -258,12 +258,12 @@ foreach ($Total as $key=>$value) {
break; break;
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>"; print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
print "<td class=\"right\">".$Number[$key]."</td>"; print "<td class=\"right\">".$Number[$key]."</td>";
print "<td class=\"right\">".price($value)."</td>"; print "<td class=\"right\">".price($value)."</td>";
print "<td class=\"right\">".price(price2num($value / $Number[$key], 'MT'))."</td>"; print "<td class=\"right\">".price(price2num($value / $Number[$key], 'MT'))."</td>";
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
// Total // Total

View File

@ -38,7 +38,7 @@ $action = GETPOST('action', 'aZ09');
// Protection // Protection
$socid = 0; $socid = 0;
if ($user->socid > 0) { if ($user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
} }
$object = new Adherent($db); $object = new Adherent($db);
@ -165,24 +165,24 @@ if ($result > 0) {
$search = "(".$object->_load_ldap_dn($info, 2).")"; $search = "(".$object->_load_ldap_dn($info, 2).")";
if (empty($dn)) { if (empty($dn)) {
$langs->load("errors"); $langs->load("errors");
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).'</font></td></tr>';
} else { } else {
$records = $ldap->getAttribute($dn, $search); $records = $ldap->getAttribute($dn, $search);
//print_r($records); //print_r($records);
// Show tree // Show tree
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) { if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
if (!is_array($records)) { if (!is_array($records)) {
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} else { } else {
$result = show_ldap_content($records, 0, $records['count'], true); $result = show_ldap_content($records, 0, $records['count'], true);
} }
} else { } else {
print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>'; print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
} }
} }
$ldap->unbind(); $ldap->unbind();
$ldap->close(); $ldap->close();

View File

@ -204,30 +204,30 @@ if (empty($reshook)) {
// Close // Close
if ($massaction == 'close' && $user->rights->adherent->creer) { if ($massaction == 'close' && $user->rights->adherent->creer) {
$tmpmember = new Adherent($db); $tmpmember = new Adherent($db);
$error = 0; $error = 0;
$nbclose = 0; $nbclose = 0;
$db->begin(); $db->begin();
foreach ($toselect as $idtoclose) { foreach ($toselect as $idtoclose) {
$tmpmember->fetch($idtoclose); $tmpmember->fetch($idtoclose);
$result = $tmpmember->resiliate($user); $result = $tmpmember->resiliate($user);
if ($result < 0 && !count($tmpmember->errors)) { if ($result < 0 && !count($tmpmember->errors)) {
setEventMessages($tmpmember->error, $tmpmember->errors, 'errors'); setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
} else { } else {
if ($result > 0) $nbclose++; if ($result > 0) $nbclose++;
} }
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs'); setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs');
$db->commit(); $db->commit();
} else { } else {
$db->rollback(); $db->rollback();
} }
} }
// Mass actions // Mass actions
@ -409,7 +409,7 @@ $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = ''; $newcardbutton = '';
if ($user->rights->adherent->creer) { if ($user->rights->adherent->creer) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create');
} }
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -560,7 +560,7 @@ if (!empty($arrayfields['d.email']['checked'])) {
// End of subscription date // End of subscription date
if (!empty($arrayfields['d.datefin']['checked'])) { if (!empty($arrayfields['d.datefin']['checked'])) {
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
$selectarray=array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate")); $selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
print $form->selectarray('search_filter', $selectarray, $search_filter); print $form->selectarray('search_filter', $selectarray, $search_filter);
print '</td>'; print '</td>';
} }

View File

@ -40,8 +40,8 @@ $result = restrictedArea($user, 'adherent', $id);
$object = new Adherent($db); $object = new Adherent($db);
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0) { if ($result > 0) {
$adht = new AdherentType($db); $adht = new AdherentType($db);
$result = $adht->fetch($object->typeid); $result = $adht->fetch($object->typeid);
} }
$permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
@ -75,44 +75,44 @@ if ($id) {
dol_banner_tab($object, 'id', $linkback); dol_banner_tab($object, 'id', $linkback);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
} }
// Type // Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n"; print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Morphy // Morphy
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>'; print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">'; /*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
print $form->showphoto('memberphoto',$member); print $form->showphoto('memberphoto',$member);
print '</td>';*/ print '</td>';*/
print '</tr>'; print '</tr>';
// Company // Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>'; print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
// Civility // Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>'; print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>'; print '</tr>';
print "</table>"; print "</table>";
print '</div>'; print '</div>';
$cssclass = 'titlefield'; $cssclass = 'titlefield';
$permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php $permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print dol_get_fiche_end(); print dol_get_fiche_end();
} }
// End of page // End of page

View File

@ -34,8 +34,8 @@ $mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check // Security check
if ($user->socid > 0) { if ($user->socid > 0) {
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }
$result = restrictedArea($user, 'adherent', '', '', 'cotisation'); $result = restrictedArea($user, 'adherent', '', '', 'cotisation');
@ -69,7 +69,7 @@ $sql .= " d.morphy as code";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut != -1"; // Not draft $sql .= " AND d.statut != -1"; // Not draft
$sql .= " GROUP BY d.morphy"; $sql .= " GROUP BY d.morphy";
$foundphy = $foundmor = 0; $foundphy = $foundmor = 0;
@ -100,7 +100,7 @@ $sql .= " d.morphy as code";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut >= 1"; // Active (not draft=-1, not resiliated=0) $sql .= " AND d.statut >= 1"; // Active (not draft=-1, not resiliated=0)
$sql .= " GROUP BY d.morphy"; $sql .= " GROUP BY d.morphy";
$foundphy = $foundmor = 0; $foundphy = $foundmor = 0;

View File

@ -35,8 +35,8 @@ $mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check // Security check
if ($user->socid > 0) { if ($user->socid > 0) {
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }
$result = restrictedArea($user, 'adherent', '', '', 'cotisation'); $result = restrictedArea($user, 'adherent', '', '', 'cotisation');
@ -68,129 +68,129 @@ print load_fiche_titre($title, '', 'object_group');
dol_mkdir($dir); dol_mkdir($dir);
if ($mode) { if ($mode) {
// Define sql // Define sql
if ($mode == 'memberbycountry') { if ($mode == 'memberbycountry') {
$label = $langs->trans("Country"); $label = $langs->trans("Country");
$tab = 'statscountry'; $tab = 'statscountry';
$data = array(); $data = array();
$sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label"; $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut != -1"; $sql .= " AND d.statut != -1";
$sql .= " GROUP BY c.label, c.code"; $sql .= " GROUP BY c.label, c.code";
//print $sql; //print $sql;
} }
if ($mode == 'memberbystate') { if ($mode == 'memberbystate') {
$label = $langs->trans("Country");
$label2 = $langs->trans("State");
$tab = 'statsstate';
$data = array();
$sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; //
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut != -1";
$sql .= " GROUP BY co.label, co.code, c.nom";
//print $sql;
}
if ($mode == 'memberbyregion') { //
$label = $langs->trans("Country"); $label = $langs->trans("Country");
$label2 = $langs->trans("Region"); //département $label2 = $langs->trans("State");
$tab = 'statsregion'; //onglet $tab = 'statsstate';
$data = array(); //tableau de donnée $data = array();
$sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2"; $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; //
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut != -1"; $sql .= " AND d.statut != -1";
$sql .= " GROUP BY co.label, co.code, r.nom"; //+ $sql .= " GROUP BY co.label, co.code, c.nom";
//print $sql; //print $sql;
} }
if ($mode == 'memberbytown') { if ($mode == 'memberbyregion') { //
$label = $langs->trans("Country"); $label = $langs->trans("Country");
$label2 = $langs->trans("Town"); $label2 = $langs->trans("Region"); //département
$tab = 'statstown'; $tab = 'statsregion'; //onglet
$data = array(); $data = array(); //tableau de donnée
$sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2"; $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
$sql .= " AND d.statut != -1"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql .= " GROUP BY c.label, c.code, d.town"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
//print $sql; $sql .= " AND d.statut != -1";
} $sql .= " GROUP BY co.label, co.code, r.nom"; //+
//print $sql;
}
if ($mode == 'memberbytown') {
$label = $langs->trans("Country");
$label2 = $langs->trans("Town");
$tab = 'statstown';
$langsen = new Translate('', $conf); $data = array();
$langsen->setDefaultLang('en_US'); $sql .= "SELECT COUNT(DISTINCT d.rowid) as nb, COUNT(s.rowid) as nbsubscriptions, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2";
$langsen->load("dict"); $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
//print $langsen->trans("Country"."FI");exit; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
$sql .= " AND d.statut != -1";
$sql .= " GROUP BY c.label, c.code, d.town";
//print $sql;
}
// Define $data array $langsen = new Translate('', $conf);
dol_syslog("Count member", LOG_DEBUG); $langsen->setDefaultLang('en_US');
$resql = $db->query($sql); $langsen->load("dict");
if ($resql) { //print $langsen->trans("Country"."FI");exit;
$num = $db->num_rows($resql);
$i = 0; // Define $data array
while ($i < $num) { dol_syslog("Count member", LOG_DEBUG);
$obj = $db->fetch_object($resql); $resql = $db->query($sql);
if ($mode == 'memberbycountry') { if ($resql) {
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), $num = $db->num_rows($resql);
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), $i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($mode == 'memberbycountry') {
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'code'=>$obj->code, 'code'=>$obj->code,
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate), 'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
); );
} }
if ($mode == 'memberbyregion') { //+ if ($mode == 'memberbyregion') { //+
$data[] = array( $data[] = array(
'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), 'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")), 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate), 'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
); );
} }
if ($mode == 'memberbystate') { if ($mode == 'memberbystate') {
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")), 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate), 'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
); );
} }
if ($mode == 'memberbytown') { if ($mode == 'memberbytown') {
$data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))), 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")), 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate), 'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
); );
} }
$i++; $i++;
} }
$db->free($resql); $db->free($resql);
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} }
@ -201,101 +201,101 @@ print dol_get_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
// Print title // Print title
if ($mode && !count($data)) { if ($mode && !count($data)) {
print $langs->trans("NoValidatedMemberYet").'<br>'; print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>'; print '<br>';
} else { } else {
if ($mode == 'memberbycountry') print '<span class="opacitymedium">'.$langs->trans("MembersByCountryDesc").'</span><br>'; if ($mode == 'memberbycountry') print '<span class="opacitymedium">'.$langs->trans("MembersByCountryDesc").'</span><br>';
elseif ($mode == 'memberbystate') print '<span class="opacitymedium">'.$langs->trans("MembersByStateDesc").'</span><br>'; elseif ($mode == 'memberbystate') print '<span class="opacitymedium">'.$langs->trans("MembersByStateDesc").'</span><br>';
elseif ($mode == 'memberbytown') print '<span class="opacitymedium">'.$langs->trans("MembersByTownDesc").'</span><br>'; elseif ($mode == 'memberbytown') print '<span class="opacitymedium">'.$langs->trans("MembersByTownDesc").'</span><br>';
elseif ($mode == 'memberbyregion') print '<span class="opacitymedium">'.$langs->trans("MembersByRegion").'</span><br>'; //+ elseif ($mode == 'memberbyregion') print '<span class="opacitymedium">'.$langs->trans("MembersByRegion").'</span><br>'; //+
else { else {
print '<span class="opacitymedium">'.$langs->trans("MembersStatisticsDesc").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("MembersStatisticsDesc").'</span><br>';
print '<br>'; print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbycountry">'.$langs->trans("MembersStatisticsByCountries").'</a><br>'; print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbycountry">'.$langs->trans("MembersStatisticsByCountries").'</a><br>';
print '<br>'; print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbystate">'.$langs->trans("MembersStatisticsByState").'</a><br>'; print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbystate">'.$langs->trans("MembersStatisticsByState").'</a><br>';
print '<br>'; print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbytown">'.$langs->trans("MembersStatisticsByTown").'</a><br>'; print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbytown">'.$langs->trans("MembersStatisticsByTown").'</a><br>';
print '<br>'; //+ print '<br>'; //+
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>'; //+ print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>'; //+
} }
print '<br>'; print '<br>';
} }
// Show graphics // Show graphics
if (count($arrayjs) && $mode == 'memberbycountry') { if (count($arrayjs) && $mode == 'memberbycountry') {
$color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
if (is_readable($color_file)) include_once $color_file; if (is_readable($color_file)) include_once $color_file;
// Assume we've already included the proper headers so just call our script inline // Assume we've already included the proper headers so just call our script inline
// More doc: https://developers.google.com/chart/interactive/docs/gallery/geomap?hl=fr-FR // More doc: https://developers.google.com/chart/interactive/docs/gallery/geomap?hl=fr-FR
print "\n<script type='text/javascript'>\n"; print "\n<script type='text/javascript'>\n";
print "google.load('visualization', '1', {'packages': ['geomap']});\n"; print "google.load('visualization', '1', {'packages': ['geomap']});\n";
print "google.setOnLoadCallback(drawMap);\n"; print "google.setOnLoadCallback(drawMap);\n";
print "function drawMap() {\n\tvar data = new google.visualization.DataTable();\n"; print "function drawMap() {\n\tvar data = new google.visualization.DataTable();\n";
// Get the total number of rows // Get the total number of rows
print "\tdata.addRows(".count($data).");\n"; print "\tdata.addRows(".count($data).");\n";
print "\tdata.addColumn('string', 'Country');\n"; print "\tdata.addColumn('string', 'Country');\n";
print "\tdata.addColumn('number', 'Number');\n"; print "\tdata.addColumn('number', 'Number');\n";
// loop and dump // loop and dump
$i = 0; $i = 0;
foreach ($data as $val) { foreach ($data as $val) {
$valcountry = strtoupper($val['code']); // Should be ISO-3166 code (faster) $valcountry = strtoupper($val['code']); // Should be ISO-3166 code (faster)
//$valcountry=ucfirst($val['label_en']); //$valcountry=ucfirst($val['label_en']);
if ($valcountry == 'Great Britain') { $valcountry = 'United Kingdom'; } // fix case of uk (when we use labels) if ($valcountry == 'Great Britain') { $valcountry = 'United Kingdom'; } // fix case of uk (when we use labels)
print "\tdata.setValue(".$i.", 0, \"".$valcountry."\");\n"; print "\tdata.setValue(".$i.", 0, \"".$valcountry."\");\n";
print "\tdata.setValue(".$i.", 1, ".$val['nb'].");\n"; print "\tdata.setValue(".$i.", 1, ".$val['nb'].");\n";
// Google's Geomap only supports up to 400 entries // Google's Geomap only supports up to 400 entries
if ($i >= 400) { break; } if ($i >= 400) { break; }
$i++; $i++;
} }
print "\tvar options = {};\n"; print "\tvar options = {};\n";
print "\toptions['dataMode'] = 'regions';\n"; print "\toptions['dataMode'] = 'regions';\n";
print "\toptions['showZoomOut'] = false;\n"; print "\toptions['showZoomOut'] = false;\n";
//print "\toptions['zoomOutLabel'] = '".dol_escape_js($langs->transnoentitiesnoconv("Numbers"))."';\n"; //print "\toptions['zoomOutLabel'] = '".dol_escape_js($langs->transnoentitiesnoconv("Numbers"))."';\n";
print "\toptions['width'] = ".$graphwidth.";\n"; print "\toptions['width'] = ".$graphwidth.";\n";
print "\toptions['height'] = ".$graphheight.";\n"; print "\toptions['height'] = ".$graphheight.";\n";
print "\toptions['colors'] = [0x".colorArrayToHex($theme_datacolor[1], 'BBBBBB').", 0x".colorArrayToHex($theme_datacolor[0], '444444')."];\n"; print "\toptions['colors'] = [0x".colorArrayToHex($theme_datacolor[1], 'BBBBBB').", 0x".colorArrayToHex($theme_datacolor[0], '444444')."];\n";
print "\tvar container = document.getElementById('".$mode."');\n"; print "\tvar container = document.getElementById('".$mode."');\n";
print "\tvar geomap = new google.visualization.GeoMap(container);\n"; print "\tvar geomap = new google.visualization.GeoMap(container);\n";
print "\tgeomap.draw(data, options);\n"; print "\tgeomap.draw(data, options);\n";
print "};\n"; print "};\n";
print "</script>\n"; print "</script>\n";
// print the div tag that will contain the map // print the div tag that will contain the map
print '<div class="center" id="'.$mode.'"></div>'."\n"; print '<div class="center" id="'.$mode.'"></div>'."\n";
print '<br>'; print '<br>';
} }
if ($mode) { if ($mode) {
// Print array // Print array
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="liste centpercent">'; print '<table class="liste centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$label.'</td>'; print '<td>'.$label.'</td>';
if ($label2) print '<td class="center">'.$label2.'</td>'; if ($label2) print '<td class="center">'.$label2.'</td>';
print '<td class="right">'.$langs->trans("NbOfMembers").' <span class="opacitymedium">('.$langs->trans("AllTime").')</span></td>'; print '<td class="right">'.$langs->trans("NbOfMembers").' <span class="opacitymedium">('.$langs->trans("AllTime").')</span></td>';
print '<td class="center">'.$langs->trans("LastMemberDate").'</td>'; print '<td class="center">'.$langs->trans("LastMemberDate").'</td>';
print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>'; print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
print '</tr>'; print '</tr>';
foreach ($data as $val) { foreach ($data as $val) {
$year = $val['year']; $year = $val['year'];
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$val['label'].'</td>'; print '<td>'.$val['label'].'</td>';
if ($label2) print '<td class="center">'.$val['label2'].'</td>'; if ($label2) print '<td class="center">'.$val['label2'].'</td>';
print '<td class="right">'.$val['nb'].'</td>'; print '<td class="right">'.$val['nb'].'</td>';
print '<td class="center">'.dol_print_date($val['lastdate'], 'dayhour').'</td>'; print '<td class="center">'.dol_print_date($val['lastdate'], 'dayhour').'</td>';
print '<td class="center">'.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'</td>'; print '<td class="center">'.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'</td>';
print '</tr>'; print '</tr>';
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
} }

View File

@ -36,8 +36,8 @@ $socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0;
// Security check // Security check
if ($user->socid > 0) { if ($user->socid > 0) {
$action = ''; $action = '';
$socid = $user->socid; $socid = $user->socid;
} }
$result = restrictedArea($user, 'adherent', '', '', 'cotisation'); $result = restrictedArea($user, 'adherent', '', '', 'cotisation');
@ -79,24 +79,24 @@ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscripti
$px1 = new DolGraph(); $px1 = new DolGraph();
$mesg = $px1->isGraphKo(); $mesg = $px1->isGraphKo();
if (!$mesg) { if (!$mesg) {
$px1->SetData($data); $px1->SetData($data);
$i = $startyear; $i = $startyear;
while ($i <= $endyear) { while ($i <= $endyear) {
$legend[] = $i; $legend[] = $i;
$i++; $i++;
} }
$px1->SetLegend($legend); $px1->SetLegend($legend);
$px1->SetMaxValue($px1->GetCeilMaxValue()); $px1->SetMaxValue($px1->GetCeilMaxValue());
$px1->SetMinValue(min(0, $px1->GetFloorMinValue())); $px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
$px1->SetWidth($WIDTH); $px1->SetWidth($WIDTH);
$px1->SetHeight($HEIGHT); $px1->SetHeight($HEIGHT);
$px1->SetYLabel($langs->trans("NbOfSubscriptions")); $px1->SetYLabel($langs->trans("NbOfSubscriptions"));
$px1->SetShading(3); $px1->SetShading(3);
$px1->SetHorizTickIncrement(1); $px1->SetHorizTickIncrement(1);
$px1->mode = 'depth'; $px1->mode = 'depth';
$px1->SetTitle($langs->trans("NbOfSubscriptions")); $px1->SetTitle($langs->trans("NbOfSubscriptions"));
$px1->draw($filenamenb, $fileurlnb); $px1->draw($filenamenb, $fileurlnb);
} }
// Build graphic amount of object // Build graphic amount of object
@ -110,24 +110,24 @@ $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscr
$px2 = new DolGraph(); $px2 = new DolGraph();
$mesg = $px2->isGraphKo(); $mesg = $px2->isGraphKo();
if (!$mesg) { if (!$mesg) {
$px2->SetData($data); $px2->SetData($data);
$i = $startyear; $i = $startyear;
while ($i <= $endyear) { while ($i <= $endyear) {
$legend[] = $i; $legend[] = $i;
$i++; $i++;
} }
$px2->SetLegend($legend); $px2->SetLegend($legend);
$px2->SetMaxValue($px2->GetCeilMaxValue()); $px2->SetMaxValue($px2->GetCeilMaxValue());
$px2->SetMinValue(min(0, $px2->GetFloorMinValue())); $px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
$px2->SetWidth($WIDTH); $px2->SetWidth($WIDTH);
$px2->SetHeight($HEIGHT); $px2->SetHeight($HEIGHT);
$px2->SetYLabel($langs->trans("AmountOfSubscriptions")); $px2->SetYLabel($langs->trans("AmountOfSubscriptions"));
$px2->SetShading(3); $px2->SetShading(3);
$px2->SetHorizTickIncrement(1); $px2->SetHorizTickIncrement(1);
$px2->mode = 'depth'; $px2->mode = 'depth';
$px2->SetTitle($langs->trans("AmountOfSubscriptions")); $px2->SetTitle($langs->trans("AmountOfSubscriptions"));
$px2->draw($filenameamount, $fileurlamount); $px2->draw($filenameamount, $fileurlamount);
} }
@ -171,31 +171,31 @@ print '</tr>';
$oldyear = 0; $oldyear = 0;
foreach ($data as $val) { foreach ($data as $val) {
$year = $val['year']; $year = $val['year'];
while ($oldyear > $year + 1) { // If we have empty year while ($oldyear > $year + 1) { // If we have empty year
$oldyear--; $oldyear--;
print '<tr class="oddeven" height="24">'; print '<tr class="oddeven" height="24">';
print '<td class="center">'; print '<td class="center">';
//print '<a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">'; //print '<a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">';
print $oldyear; print $oldyear;
//print '</a>'; //print '</a>';
print '</td>'; print '</td>';
print '<td class="right">0</td>'; print '<td class="right">0</td>';
print '<td class="right">0</td>'; print '<td class="right">0</td>';
print '<td class="right">0</td>'; print '<td class="right">0</td>';
print '</tr>'; print '</tr>';
} }
print '<tr class="oddeven" height="24">'; print '<tr class="oddeven" height="24">';
print '<td class="center">'; print '<td class="center">';
//print '<a href="month.php?year='.$year.'">'; //print '<a href="month.php?year='.$year.'">';
print $year; print $year;
//print '</a>'; //print '</a>';
print '</td>'; print '</td>';
print '<td class="right">'.$val['nb'].'</td>'; print '<td class="right">'.$val['nb'].'</td>';
print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>'; print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>'; print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>';
print '</tr>'; print '</tr>';
$oldyear = $year; $oldyear = $year;
} }
print '</table>'; print '</table>';
@ -208,9 +208,9 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
// Show graphs // Show graphs
print '<table class="border centpercent"><tr class="pair nohover"><td class="center">'; print '<table class="border centpercent"><tr class="pair nohover"><td class="center">';
if ($mesg) { print $mesg; } else { if ($mesg) { print $mesg; } else {
print $px1->show(); print $px1->show();
print "<br>\n"; print "<br>\n";
print $px2->show(); print $px2->show();
} }
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -550,100 +550,100 @@ if ($rowid > 0) {
} }
print '</td></tr>'; print '</td></tr>';
print "</table>\n"; print "</table>\n";
print "</div></div></div>\n"; print "</div></div></div>\n";
print '<div style="clear:both"></div>'; print '<div style="clear:both"></div>';
print dol_get_fiche_end(); print dol_get_fiche_end();
print '</form>'; print '</form>';
/* /*
* Action buttons * Action buttons
*/ */
// Button to create a new subscription if member no draft neither resiliated // Button to create a new subscription if member no draft neither resiliated
if ($user->rights->adherent->cotisation->creer) { if ($user->rights->adherent->cotisation->creer) {
if ($action != 'addsubscription' && $action != 'create_thirdparty') { if ($action != 'addsubscription' && $action != 'create_thirdparty') {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>"; if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>'; else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
print '</div>'; print '</div>';
} }
} }
/* /*
* List of subscriptions * List of subscriptions
*/ */
if ($action != 'addsubscription' && $action != 'create_thirdparty') { if ($action != 'addsubscription' && $action != 'create_thirdparty') {
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, d.fk_adherent_type as type,"; $sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, d.fk_adherent_type as type,";
$sql .= " c.rowid as crowid, c.subscription,"; $sql .= " c.rowid as crowid, c.subscription,";
$sql .= " c.datec, c.fk_type as cfk_type,"; $sql .= " c.datec, c.fk_type as cfk_type,";
$sql .= " c.dateadh as dateh,"; $sql .= " c.dateadh as dateh,";
$sql .= " c.datef,"; $sql .= " c.datef,";
$sql .= " c.fk_bank,"; $sql .= " c.fk_bank,";
$sql .= " b.rowid as bid,"; $sql .= " b.rowid as bid,";
$sql .= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number, ba.currency_code"; $sql .= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number, ba.currency_code";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid; $sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid;
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$subscriptionstatic = new Subscription($db); $subscriptionstatic = new Subscription($db);
$num = $db->num_rows($result); $num = $db->num_rows($result);
print '<table class="noborder centpercent">'."\n"; print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($conf->banque->enabled)) { if (!empty($conf->banque->enabled)) {
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
} }
print "</tr>\n"; print "</tr>\n";
$accountstatic = new Account($db); $accountstatic = new Account($db);
$adh = new Adherent($db); $adh = new Adherent($db);
$adht = new AdherentType($db); $adht = new AdherentType($db);
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$adh->id = $objp->rowid; $adh->id = $objp->rowid;
$adh->typeid = $objp->type; $adh->typeid = $objp->type;
$subscriptionstatic->ref = $objp->crowid; $subscriptionstatic->ref = $objp->crowid;
$subscriptionstatic->id = $objp->crowid; $subscriptionstatic->id = $objp->crowid;
$typeid = $objp->cfk_type; $typeid = $objp->cfk_type;
if ($typeid > 0) { if ($typeid > 0) {
$adht->fetch($typeid); $adht->fetch($typeid);
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>'; print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
print '<td class="center">'.dol_print_date($db->jdate($objp->datec), 'dayhour')."</td>\n"; print '<td class="center">'.dol_print_date($db->jdate($objp->datec), 'dayhour')."</td>\n";
print '<td class="center">'; print '<td class="center">';
if ($typeid > 0) { if ($typeid > 0) {
print $adht->getNomUrl(1); print $adht->getNomUrl(1);
} }
print '</td>'; print '</td>';
print '<td class="center">'.dol_print_date($db->jdate($objp->dateh), 'day')."</td>\n"; print '<td class="center">'.dol_print_date($db->jdate($objp->dateh), 'day')."</td>\n";
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day')."</td>\n"; print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day')."</td>\n";
print '<td class="right">'.price($objp->subscription).'</td>'; print '<td class="right">'.price($objp->subscription).'</td>';
if (!empty($conf->banque->enabled)) { if (!empty($conf->banque->enabled)) {
print '<td class="right">'; print '<td class="right">';
if ($objp->bid) { if ($objp->bid) {
@ -921,123 +921,123 @@ if ($rowid > 0) {
} }
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
} }
print '<br>'; print '<br>';
} }
print '</td></tr>'; print '</td></tr>';
// Bank account // Bank account
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("FinancialAccount").'</td><td>'; print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("FinancialAccount").'</td><td>';
$form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2); $form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2);
print "</td></tr>\n"; print "</td></tr>\n";
// Payment mode // Payment mode
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>'; print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOST('operation'), 'operation', '', 2); $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2);
print "</td></tr>\n"; print "</td></tr>\n";
// Date of payment // Date of payment
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>'; print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
print $form->selectDate(isset($paymentdate) ? $paymentdate : -1, 'payment', 0, 0, 1, 'subscription', 1, 1); print $form->selectDate(isset($paymentdate) ? $paymentdate : -1, 'payment', 0, 0, 1, 'subscription', 1, 1);
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr class="bankswitchclass2"><td>'.$langs->trans('Numero'); print '<tr class="bankswitchclass2"><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>'; print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '</td>'; print '</td>';
print '<td><input id="fieldnum_chq" name="num_chq" type="text" size="8" value="'.(!GETPOST('num_chq') ? '' : GETPOST('num_chq')).'"></td></tr>'; print '<td><input id="fieldnum_chq" name="num_chq" type="text" size="8" value="'.(!GETPOST('num_chq') ? '' : GETPOST('num_chq')).'"></td></tr>';
print '<tr class="bankswitchclass2 fieldrequireddyn"><td>'.$langs->trans('CheckTransmitter'); print '<tr class="bankswitchclass2 fieldrequireddyn"><td>'.$langs->trans('CheckTransmitter');
print ' <em>('.$langs->trans("ChequeMaker").')</em>'; print ' <em>('.$langs->trans("ChequeMaker").')</em>';
print '</td>'; print '</td>';
print '<td><input id="fieldchqemetteur" name="chqemetteur" size="32" type="text" value="'.(!GETPOST('chqemetteur') ? '' : GETPOST('chqemetteur')).'"></td></tr>'; print '<td><input id="fieldchqemetteur" name="chqemetteur" size="32" type="text" value="'.(!GETPOST('chqemetteur') ? '' : GETPOST('chqemetteur')).'"></td></tr>';
print '<tr class="bankswitchclass2"><td>'.$langs->trans('Bank'); print '<tr class="bankswitchclass2"><td>'.$langs->trans('Bank');
print ' <em>('.$langs->trans("ChequeBank").')</em>'; print ' <em>('.$langs->trans("ChequeBank").')</em>';
print '</td>'; print '</td>';
print '<td><input id="chqbank" name="chqbank" size="32" type="text" value="'.(!GETPOST('chqbank') ? '' : GETPOST('chqbank')).'"></td></tr>'; print '<td><input id="chqbank" name="chqbank" size="32" type="text" value="'.(!GETPOST('chqbank') ? '' : GETPOST('chqbank')).'"></td></tr>';
} }
} }
print '<tr><td></td><td></td></tr>'; print '<tr><td></td><td></td></tr>';
print '<tr><td>'.$langs->trans("SendAcknowledgementByMail").'</td>'; print '<tr><td>'.$langs->trans("SendAcknowledgementByMail").'</td>';
print '<td>'; print '<td>';
if (!$object->email) { if (!$object->email) {
print $langs->trans("NoEMail"); print $langs->trans("NoEMail");
} else { } else {
$adht = new AdherentType($db); $adht = new AdherentType($db);
$adht->fetch($object->typeid); $adht->fetch($object->typeid);
// Send subscription email // Send subscription email
$subject = ''; $subject = '';
$msg = ''; $msg = '';
// Send subscription email // Send subscription email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
// Set output language // Set output language
$outputlangs = new Translate('', $conf); $outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
// Load traductions files required by page // Load traductions files required by page
$outputlangs->loadLangs(array("main", "members")); $outputlangs->loadLangs(array("main", "members"));
// Get email content from template // Get email content from template
$arraydefaultmessage = null; $arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic; $subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content; $msg = $arraydefaultmessage->content;
} }
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs);
$tmp = '<input name="sendmail" type="checkbox"'.(GETPOST('sendmail', 'alpha') ? ' checked' : (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? ' checked' : '')).'>'; $tmp = '<input name="sendmail" type="checkbox"'.(GETPOST('sendmail', 'alpha') ? ' checked' : (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? ' checked' : '')).'>';
$helpcontent = ''; $helpcontent = '';
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
$helpcontent .= '<b>'.$langs->trans("MailTopic").'</b>:<br>'."\n"; $helpcontent .= '<b>'.$langs->trans("MailTopic").'</b>:<br>'."\n";
if ($subjecttosend) { if ($subjecttosend) {
$helpcontent .= $subjecttosend."\n"; $helpcontent .= $subjecttosend."\n";
} else { } else {
$langs->load("errors"); $langs->load("errors");
$helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n"; $helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n";
} }
$helpcontent .= "<br>"; $helpcontent .= "<br>";
$helpcontent .= '<b>'.$langs->trans("MailText").'</b>:<br>'; $helpcontent .= '<b>'.$langs->trans("MailText").'</b>:<br>';
if ($texttosend) { if ($texttosend) {
$helpcontent .= dol_htmlentitiesbr($texttosend)."\n"; $helpcontent .= dol_htmlentitiesbr($texttosend)."\n";
} else { } else {
$langs->load("errors"); $langs->load("errors");
$helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n"; $helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n";
} }
print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend'); print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend');
} }
print '</td></tr>'; print '</td></tr>';
print '</tbody>'; print '</tbody>';
print '</table>'; print '</table>';
print dol_get_fiche_end(); print dol_get_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">'; print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
print "\n<!-- End form subscription -->\n\n"; print "\n<!-- End form subscription -->\n\n";
} }
//print '</td></tr>'; //print '</td></tr>';
//print '</table>'; //print '</table>';
} else { } else {
$langs->load("errors"); $langs->load("errors");
print $langs->trans("ErrorRecordNotFound"); print $langs->trans("ErrorRecordNotFound");
} }
// End of page // End of page

View File

@ -110,22 +110,22 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) { if (empty($reshook)) {
// Selection of new fields // Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_type = ""; $search_type = "";
$search_ref = ""; $search_ref = "";
$search_lastname = ""; $search_lastname = "";
$search_firstname = ""; $search_firstname = "";
$search_login = ""; $search_login = "";
$search_note = ""; $search_note = "";
$search_amount = ""; $search_amount = "";
$search_account = ""; $search_account = "";
$toselect = ''; $toselect = '';
$search_array_options = array(); $search_array_options = array();
} }
} }
@ -153,8 +153,8 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = e
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid";
$sql .= " WHERE d.entity IN (".getEntity('adherent').")"; $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
if (isset($date_select) && $date_select != '') { if (isset($date_select) && $date_select != '') {
$sql .= " AND c.dateadh >= '".((int) $date_select)."-01-01 00:00:00'"; $sql .= " AND c.dateadh >= '".((int) $date_select)."-01-01 00:00:00'";
$sql .= " AND c.dateadh < '".((int) $date_select + 1)."-01-01 00:00:00'"; $sql .= " AND c.dateadh < '".((int) $date_select + 1)."-01-01 00:00:00'";
} }
if ($search_ref) { if ($search_ref) {
if (is_numeric($search_ref)) $sql .= " AND (c.rowid = ".$db->escape($search_ref).")"; if (is_numeric($search_ref)) $sql .= " AND (c.rowid = ".$db->escape($search_ref).")";
@ -181,13 +181,13 @@ $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records with no order and no limits // Count total nb of records with no order and no limits
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) $nbtotalofrecords = $db->num_rows($resql); if ($resql) $nbtotalofrecords = $db->num_rows($resql);
else dol_print_error($db); else dol_print_error($db);
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
} }
// Add limit // Add limit
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
@ -241,7 +241,7 @@ $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = ''; $newcardbutton = '';
if ($user->rights->adherent->cotisation->creer) { if ($user->rights->adherent->cotisation->creer) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1');
} }
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -409,8 +409,8 @@ while ($i < min($num, $limit)) {
$adherent->typeid = $obj->type; $adherent->typeid = $obj->type;
$typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid); $typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid);
$adht = new AdherentType($db); $adht = new AdherentType($db);
$adht->fetch($typeid); $adht->fetch($typeid);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -419,14 +419,14 @@ while ($i < min($num, $limit)) {
print '<td>'.$subscription->getNomUrl(1).'</td>'; print '<td>'.$subscription->getNomUrl(1).'</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Type // Type
if (!empty($arrayfields['d.fk_type']['checked'])) { if (!empty($arrayfields['d.fk_type']['checked'])) {
print '<td class="nowraponall">'; print '<td class="nowraponall">';
if ($typeid > 0) { if ($typeid > 0) {
print $adht->getNomUrl(1); print $adht->getNomUrl(1);
} }
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
// Lastname // Lastname

View File

@ -33,12 +33,12 @@ $langs->load("members");
$total = 0; $total = 0;
foreach ($linkedObjectBlock as $key => $objectlink) { foreach ($linkedObjectBlock as $key => $objectlink) {
echo '<tr class="oddeven">'; echo '<tr class="oddeven">';
echo '<td>'.$langs->trans("Subscription").'</td>'; echo '<td>'.$langs->trans("Subscription").'</td>';
echo '<td>'.$objectlink->getNomUrl(1).'</td>'; echo '<td>'.$objectlink->getNomUrl(1).'</td>';
echo '<td class="center"></td>'; echo '<td class="center"></td>';
echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>'; echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
echo '<td class="right">'; echo '<td class="right">';
if ($user->rights->adherent->lire) { if ($user->rights->adherent->lire) {
$total = $total + $objectlink->amount; $total = $total + $objectlink->amount;
echo price($objectlink->amount); echo price($objectlink->amount);
@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
echo '</td>'; echo '</td>';
echo '<td class="right"></td>'; echo '<td class="right"></td>';
echo '<td class="right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>'; echo '<td class="right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
echo '</tr>'; echo '</tr>';
} }
echo "<!-- END PHP TEMPLATE -->\n"; echo "<!-- END PHP TEMPLATE -->\n";

View File

@ -123,7 +123,7 @@ print dol_get_fiche_end();
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) { if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
} }
print "</div>\n"; print "</div>\n";
@ -146,27 +146,27 @@ print '</tr>';
$ldap = new Ldap(); $ldap = new Ldap();
$result = $ldap->connect_bind(); $result = $ldap->connect_bind();
if ($result > 0) { if ($result > 0) {
$info = $object->_load_ldap_info(); $info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1); $dn = $object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")"; $search = "(".$object->_load_ldap_dn($info, 2).")";
$records = $ldap->getAttribute($dn, $search); $records = $ldap->getAttribute($dn, $search);
//print_r($records); //print_r($records);
// Show tree // Show tree
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) { if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
if (!is_array($records)) { if (!is_array($records)) {
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} else { } else {
$result = show_ldap_content($records, 0, $records['count'], true); $result = show_ldap_content($records, 0, $records['count'], true);
} }
} else { } else {
print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>'; print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
} }
$ldap->unbind(); $ldap->unbind();
$ldap->close(); $ldap->close();
} else { } else {
setEventMessages($ldap->error, $ldap->errors, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
} }

View File

@ -154,9 +154,9 @@ $titre = $langs->trans("MemberType".$object->type);
// Calculate $cnt_trans // Calculate $cnt_trans
$cnt_trans = 0; $cnt_trans = 0;
if (!empty($object->multilangs)) { if (!empty($object->multilangs)) {
foreach ($object->multilangs as $key => $value) { foreach ($object->multilangs as $key => $value) {
$cnt_trans++; $cnt_trans++;
} }
} }
@ -179,10 +179,10 @@ print dol_get_fiche_end();
print "\n<div class=\"tabsAction\">\n"; print "\n<div class=\"tabsAction\">\n";
if ($action == '') { if ($action == '') {
if ($user->rights->produit->creer || $user->rights->service->creer) { if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=add&rowid='.$object->id.'">'.$langs->trans("Add").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=add&rowid='.$object->id.'">'.$langs->trans("Add").'</a>';
if ($cnt_trans > 0) print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=edit&rowid='.$object->id.'">'.$langs->trans("Update").'</a>'; if ($cnt_trans > 0) print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=edit&rowid='.$object->id.'">'.$langs->trans("Update").'</a>';
} }
} }
print "\n</div>\n"; print "\n</div>\n";
@ -262,7 +262,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
print '<table class="border centpercent">'; print '<table class="border centpercent">';
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Language').'</td><td>'; print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Language').'</td><td>';
print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1); print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>'; print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';

View File

@ -66,7 +66,7 @@ $v->setPhoneNumber($adherent->phone_pro, "TYPE=WORK;VOICE");
$v->setPhoneNumber($adherent->phone_mobile, "TYPE=CELL;VOICE"); $v->setPhoneNumber($adherent->phone_mobile, "TYPE=CELL;VOICE");
$v->setPhoneNumber($adherent->fax, "TYPE=WORK;FAX"); $v->setPhoneNumber($adherent->fax, "TYPE=WORK;FAX");
$country = $adherent->country_code ? $adherent->country : '' ; $country = $adherent->country_code ? $adherent->country : '';
$v->setAddress("", "", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country, "TYPE=WORK;POSTAL"); $v->setAddress("", "", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country, "TYPE=WORK;POSTAL");
$v->setLabel("", "", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country, "TYPE=WORK"); $v->setLabel("", "", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country, "TYPE=WORK");
@ -79,9 +79,9 @@ $v->setTitle($adherent->poste);
if ($company->id) if ($company->id)
{ {
$v->setURL($company->url, "TYPE=WORK"); $v->setURL($company->url, "TYPE=WORK");
if (! $adherent->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE"); if (!$adherent->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
if (! $adherent->fax) $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX"); if (!$adherent->fax) $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
if (! $adherent->zip) $v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL"); if (!$adherent->zip) $v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL");
// when company e-mail is empty, use only adherent e-mail // when company e-mail is empty, use only adherent e-mail
if (empty(trim($company->email))) if (empty(trim($company->email)))
@ -124,7 +124,7 @@ $db->close();
$output = $v->getVCard(); $output = $v->getVCard();
$filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf" $filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
$filenameurlencoded = dol_sanitizeFileName(urlencode($filename)); $filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
//$filename = dol_sanitizeFileName($filename); //$filename = dol_sanitizeFileName($filename);

View File

@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('admin', 'other', 'agenda')); $langs->loadLangs(array('admin', 'other', 'agenda'));
@ -86,9 +86,9 @@ if (GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') |
if ($action == "save" && empty($cancel)) if ($action == "save" && empty($cancel))
{ {
$i = 0; $i = 0;
$db->begin(); $db->begin();
foreach ($triggers as $trigger) foreach ($triggers as $trigger)
{ {
@ -102,13 +102,13 @@ if ($action == "save" && empty($cancel))
} }
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
$db->commit(); $db->commit();
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
$db->rollback(); $db->rollback();
} }
} }

View File

@ -84,9 +84,9 @@ print dol_get_fiche_end();
// Buttons // Buttons
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>"; print "</div>";
} }
@ -99,9 +99,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create') if ($action == 'create')
{ {
print '<br><div id="newattrib"></div>'; print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute')); print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
} }
/* ************************************************************************** */ /* ************************************************************************** */
@ -111,10 +111,10 @@ if ($action == 'create')
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && !empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
} }
// End of page // End of page

View File

@ -54,9 +54,9 @@ $colorlist = array('BECEDD', 'DDBECE', 'BFDDBE', 'F598B4', 'F68654', 'CBF654', '
if ($actionsave) if ($actionsave)
{ {
$db->begin(); $db->begin();
$disableext = GETPOST('AGENDA_DISABLE_EXT', 'alpha'); $disableext = GETPOST('AGENDA_DISABLE_EXT', 'alpha');
$res = dolibarr_set_const($db, 'AGENDA_DISABLE_EXT', $disableext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'AGENDA_DISABLE_EXT', $disableext, 'chaine', 0, '', $conf->entity);
$i = 1; $errorsaved = 0; $i = 1; $errorsaved = 0;
@ -103,14 +103,14 @@ if ($actionsave)
$MAXAGENDA = empty($conf->global->AGENDA_EXT_NB) ? 5 : $conf->global->AGENDA_EXT_NB; $MAXAGENDA = empty($conf->global->AGENDA_EXT_NB) ? 5 : $conf->global->AGENDA_EXT_NB;
} }
if (!$error) if (!$error)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
$db->rollback(); $db->rollback();
if (empty($errorsaved)) setEventMessages($langs->trans("Error"), null, 'errors'); if (empty($errorsaved)) setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
/* /*

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('admin', 'other', 'agenda', 'users')); $langs->loadLangs(array('admin', 'other', 'agenda', 'users'));
@ -80,49 +80,49 @@ if ($action == 'set')
$getDefaultFilter = GETPOST('AGENDA_DEFAULT_FILTER_TYPE'); $getDefaultFilter = GETPOST('AGENDA_DEFAULT_FILTER_TYPE');
$defaultfilter = (is_array($getDefaultFilter)) ? implode(',', $getDefaultFilter) : $getDefaultFilter; $defaultfilter = (is_array($getDefaultFilter)) ? implode(',', $getDefaultFilter) : $getDefaultFilter;
dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
} elseif ($action == 'specimen') // For orders } elseif ($action == 'specimen') // For orders
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->initAsSpecimen(); $commande->initAsSpecimen();
$commande->thirdparty = $specimenthirdparty; $commande->thirdparty = $specimenthirdparty;
// Search template files // Search template files
$file = ''; $classname = ''; $filefound = 0; $file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir)
{ {
$file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0); $file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) if (file_exists($file))
{ {
$filefound = 1; $filefound = 1;
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
break; break;
} }
} }
if ($filefound) if ($filefound)
{ {
require_once $file; require_once $file;
$module = new $classname($db, $commande); $module = new $classname($db, $commande);
if ($module->write_file($commande, $langs) > 0) if ($module->write_file($commande, $langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
return; return;
} else { } else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} else { } else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
// Activate a model // Activate a model
@ -135,7 +135,7 @@ elseif ($action == 'setmodel')
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
{ {
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF', $conf->entity); if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF', $conf->entity);
} }
} }
@ -194,115 +194,115 @@ $sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$i = 0; $i = 0;
$num_rows = $db->num_rows($resql); $num_rows = $db->num_rows($resql);
while ($i < $num_rows) while ($i < $num_rows)
{ {
$array = $db->fetch_array($resql); $array = $db->fetch_array($resql);
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{ {
print load_fiche_titre($langs->trans("AgendaModelModule"), '', ''); print load_fiche_titre($langs->trans("AgendaModelModule"), '', '');
print '<table class="noborder centpercent">'."\n"; print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">'."\n"; print '<tr class="liste_titre">'."\n";
print '<td width="100">'.$langs->trans("Name").'</td>'."\n"; print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
print '<td>'.$langs->trans("Description").'</td>'."\n"; print '<td>'.$langs->trans("Description").'</td>'."\n";
print '<td class="center" width="60">'.$langs->trans("Status").'</td>'."\n"; print '<td class="center" width="60">'.$langs->trans("Status").'</td>'."\n";
print '<td class="center" width="60">'.$langs->trans("Default").'</td>'."\n"; print '<td class="center" width="60">'.$langs->trans("Default").'</td>'."\n";
print '<td class="center" width="40">'.$langs->trans("ShortInfo").'</td>'; print '<td class="center" width="40">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="40">'.$langs->trans("Preview").'</td>'; print '<td class="center" width="40">'.$langs->trans("Preview").'</td>';
print '</tr>'."\n"; print '</tr>'."\n";
clearstatcache(); clearstatcache();
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir)
{ {
$dir = dol_buildpath($reldir."core/modules/action/doc"); $dir = dol_buildpath($reldir."core/modules/action/doc");
if (is_dir($dir)) if (is_dir($dir))
{ {
$handle = opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle)) !== false) while (($file = readdir($handle)) !== false)
{ {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{ {
$name = substr($file, 4, dol_strlen($file) - 16); $name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12); $classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file; require_once $dir.'/'.$file;
$module = new $classname($db, new ActionComm($db)); $module = new $classname($db, new ActionComm($db));
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
print "<td>"; print "<td>";
print (empty($module->name) ? $name : $module->name); print (empty($module->name) ? $name : $module->name);
print "</td>\n"; print "</td>\n";
print "<td>\n"; print "<td>\n";
require_once $dir.'/'.$file; require_once $dir.'/'.$file;
$module = new $classname($db, $specimenthirdparty); $module = new $classname($db, $specimenthirdparty);
if (method_exists($module, 'info')) if (method_exists($module, 'info'))
print $module->info($langs); print $module->info($langs);
else print $module->description; else print $module->description;
print "</td>\n"; print "</td>\n";
// Active // Active
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name")
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">';
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
} else { } else {
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
} }
print "</td>"; print "</td>";
} else { } else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
} }
// Default // Default
print '<td class="center">'; print '<td class="center">';
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name") if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} else { } else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
print '<td class="center">'; print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0); print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
} }
} }
closedir($handle); closedir($handle);
} }
} }
} }
print '</table><br>'; print '</table><br>';
} }
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">'; print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
@ -343,13 +343,13 @@ print '</td></tr>'."\n";
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
{ {
print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->'; print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").'</td>'."\n"; print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n"; print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right nowrap">'."\n"; print '<td class="right nowrap">'."\n";
$formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1);
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
// AGENDA_DEFAULT_FILTER_TYPE // AGENDA_DEFAULT_FILTER_TYPE
@ -359,8 +359,8 @@ print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right nowrap">'."\n"; print '<td class="right nowrap">'."\n";
$multiselect = 0; $multiselect = 0;
if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) {
// We use an option here because it adds bugs when used on agenda page "peruser" and "list" // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
$multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE)); $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
} }
$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1, $multiselect); $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1, $multiselect);
print '</td></tr>'."\n"; print '</td></tr>'."\n";

View File

@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "other", "agenda")); $langs->loadLangs(array("admin", "other", "agenda"));
@ -73,49 +73,49 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
if ($action == 'set') if ($action == 'set')
{ {
dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
} elseif ($action == 'specimen') // For orders } elseif ($action == 'specimen') // For orders
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->initAsSpecimen(); $commande->initAsSpecimen();
$commande->thirdparty = $specimenthirdparty; $commande->thirdparty = $specimenthirdparty;
// Search template files // Search template files
$file = ''; $classname = ''; $filefound = 0; $file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir)
{ {
$file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0); $file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) if (file_exists($file))
{ {
$filefound = 1; $filefound = 1;
$classname = "pdf_".$modele; $classname = "pdf_".$modele;
break; break;
} }
} }
if ($filefound) if ($filefound)
{ {
require_once $file; require_once $file;
$module = new $classname($db, $commande); $module = new $classname($db, $commande);
if ($module->write_file($commande, $langs) > 0) if ($module->write_file($commande, $langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
return; return;
} else { } else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} else { } else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
// Activate a model // Activate a model
@ -128,7 +128,7 @@ elseif ($action == 'setmodel')
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
{ {
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF', $conf->entity); if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF', $conf->entity);
} }
} }
@ -200,31 +200,31 @@ if ($conf->global->MAIN_FEATURES_LEVEL == 2)
// AGENDA REMINDER BROWSER // AGENDA REMINDER BROWSER
if ($conf->global->MAIN_FEATURES_LEVEL == 2) if ($conf->global->MAIN_FEATURES_LEVEL == 2)
{ {
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER').'</td>'."\n"; print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER').'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n"; print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n"; print '<td class="right">'."\n";
if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { if (empty($conf->global->AGENDA_REMINDER_BROWSER)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER&amp;token='.newToken().'">'.img_picto($langs->trans('Disabled'), 'switch_off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER&amp;token='.newToken().'">'.img_picto($langs->trans('Disabled'), 'switch_off').'</a>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} else { } else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER&amp;token='.newToken().'">'.img_picto($langs->trans('Enabled'), 'switch_on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER&amp;token='.newToken().'">'.img_picto($langs->trans('Enabled'), 'switch_on').'</a>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER_SOUND').'</td>'."\n"; print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER_SOUND').'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\n"; print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right">'."\n"; print '<td class="right">'."\n";
if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) { if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER_SOUND&amp;token='.newToken().'">'.img_picto($langs->trans('Disabled'), 'switch_off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER_SOUND&amp;token='.newToken().'">'.img_picto($langs->trans('Disabled'), 'switch_off').'</a>';
} else { } else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER_SOUND&amp;token='.newToken().'">'.img_picto($langs->trans('Enabled'), 'switch_on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER_SOUND&amp;token='.newToken().'">'.img_picto($langs->trans('Enabled'), 'switch_on').'</a>';
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
} }
print '</table>'; print '</table>';

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "other", "agenda")); $langs->loadLangs(array("admin", "other", "agenda"));
@ -41,23 +41,23 @@ $actionsave = GETPOST('save', 'alpha');
// Sauvegardes parametres // Sauvegardes parametres
if ($actionsave) if ($actionsave)
{ {
$i = 0; $i = 0;
$db->begin(); $db->begin();
$i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')), 'chaine', 0, '', $conf->entity); $i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')), 'chaine', 0, '', $conf->entity);
$i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha')), 'chaine', 0, '', $conf->entity); $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha')), 'chaine', 0, '', $conf->entity);
$i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha')), 'chaine', 0, '', $conf->entity); $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha')), 'chaine', 0, '', $conf->entity);
$i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')), 'chaine', 0, '', $conf->entity); $i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')), 'chaine', 0, '', $conf->entity);
if ($i >= 4) if ($i >= 4)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("SaveFailed"), null, 'errors'); setEventMessages($langs->trans("SaveFailed"), null, 'errors');
} }
} }
@ -163,7 +163,7 @@ $urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentit
$message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'vcal', $urlvcal); $message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'vcal', $urlvcal);
$message .= '<br>'; $message .= '<br>';
$urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">'; $urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
$urlical .=$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>'; $urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
$message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', $urlical); $message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', $urlical);
$message .= '<br>'; $message .= '<br>';
$urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">'; $urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';

View File

@ -81,9 +81,9 @@ print dol_get_fiche_end();
// Buttons // Buttons
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>"; print "</div>";
} }
@ -93,9 +93,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create') if ($action == 'create')
{ {
print '<br><div id="newattrib"></div>'; print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute')); print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
} }
/* /*
@ -103,10 +103,10 @@ if ($action == 'create')
*/ */
if ($action == 'edit' && !empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
} }
// End of page // End of page

View File

@ -44,11 +44,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'setbarcodeproducton') if ($action == 'setbarcodeproducton')
{ {
$barcodenumberingmodule = GETPOST('value', 'alpha'); $barcodenumberingmodule = GETPOST('value', 'alpha');
$res = dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity);
if ($barcodenumberingmodule == 'mod_barcode_product_standard' && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK)) if ($barcodenumberingmodule == 'mod_barcode_product_standard' && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK))
{ {
$res = dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity);
} }
} elseif ($action == 'setbarcodeproductoff') } elseif ($action == 'setbarcodeproductoff')
{ {
@ -76,45 +76,45 @@ if ($action == 'setcoder')
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id, 'chaine', 0, '', $conf->entity);
if ($res > 0) if ($res > 0)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'updateengine') } elseif ($action == 'updateengine')
{ {
$sql = "SELECT rowid, coder"; $sql = "SELECT rowid, coder";
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql .= " WHERE entity = ".$conf->entity; $sql .= " WHERE entity = ".$conf->entity;
$sql .= " ORDER BY code"; $sql .= " ORDER BY code";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if (GETPOST('coder'.$obj->rowid, 'alpha')) if (GETPOST('coder'.$obj->rowid, 'alpha'))
{ {
$coder = GETPOST('coder'.$obj->rowid, 'alpha'); $coder = GETPOST('coder'.$obj->rowid, 'alpha');
$code_id = $obj->rowid; $code_id = $obj->rowid;
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type"; $sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp .= " SET coder = '".$db->escape($coder)."'"; $sqlp .= " SET coder = '".$db->escape($coder)."'";
$sqlp .= " WHERE rowid = ".((int) $code_id); $sqlp .= " WHERE rowid = ".((int) $code_id);
$sqlp .= " AND entity = ".$conf->entity; $sqlp .= " AND entity = ".$conf->entity;
$upsql = $db->query($sqlp); $upsql = $db->query($sqlp);
if (!$upsql) dol_print_error($db); if (!$upsql) dol_print_error($db);
} }
$i++; $i++;
} }
} }
} }
@ -142,11 +142,11 @@ $dirbarcode = array_merge(array("/core/modules/barcode/doc/"), $conf->modules_pa
foreach ($dirbarcode as $reldir) foreach ($dirbarcode as $reldir)
{ {
$dir = dol_buildpath($reldir); $dir = dol_buildpath($reldir);
$newdir = dol_osencode($dir); $newdir = dol_osencode($dir);
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php) // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
if (!is_dir($newdir)) continue; if (!is_dir($newdir)) continue;
$handle = @opendir($newdir); $handle = @opendir($newdir);
if (is_resource($handle)) if (is_resource($handle))
@ -190,9 +190,9 @@ print load_fiche_titre($langs->trans("BarcodeEncodeModule"), '', '');
if (empty($conf->use_javascript_ajax)) if (empty($conf->use_javascript_ajax))
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="form_engine">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="form_engine">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="updateengine">'; print '<input type="hidden" name="action" value="updateengine">';
} }
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -236,11 +236,11 @@ if ($resql)
foreach ($dirbarcode as $reldir) foreach ($dirbarcode as $reldir)
{ {
$dir = dol_buildpath($reldir, 0); $dir = dol_buildpath($reldir, 0);
$newdir = dol_osencode($dir); $newdir = dol_osencode($dir);
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php) // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
if (!is_dir($newdir)) continue; if (!is_dir($newdir)) continue;
$result = @include_once $newdir.$obj->coder.'.modules.php'; $result = @include_once $newdir.$obj->coder.'.modules.php';
if ($result) break; if ($result) break;
@ -254,7 +254,7 @@ if ($resql)
if ($module->encodingIsSupported($obj->encoding)) if ($module->encodingIsSupported($obj->encoding))
{ {
// Build barcode on disk (not used, this is done to make debug easier) // Build barcode on disk (not used, this is done to make debug easier)
$result = $module->writeBarCode($obj->example, $obj->encoding, 'Y'); $result = $module->writeBarCode($obj->example, $obj->encoding, 'Y');
// Generate on the fly and output barcode with generator // Generate on the fly and output barcode with generator
$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&amp;generator='.urlencode($obj->coder).'&amp;code='.urlencode($obj->example).'&amp;encoding='.urlencode($obj->encoding); $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&amp;generator='.urlencode($obj->coder).'&amp;code='.urlencode($obj->example).'&amp;encoding='.urlencode($obj->encoding);
//print $url; //print $url;
@ -282,8 +282,8 @@ print "</table>\n";
if (empty($conf->use_javascript_ajax)) if (empty($conf->use_javascript_ajax))
{ {
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>'; print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
print '</form>'; print '</form>';
} }
print "<br>"; print "<br>";
@ -371,48 +371,48 @@ if ($conf->product->enabled)
$dir = dol_buildpath($dirroot, 0); $dir = dol_buildpath($dirroot, 0);
$handle = @opendir($dir); $handle = @opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle)) !== false) while (($file = readdir($handle)) !== false)
{ {
if (preg_match('/^mod_barcode_product_.*php$/', $file)) if (preg_match('/^mod_barcode_product_.*php$/', $file))
{ {
$file = substr($file, 0, dol_strlen($file) - 4); $file = substr($file, 0, dol_strlen($file) - 4);
try { try {
dol_include_once($dirroot.$file.'.php'); dol_include_once($dirroot.$file.'.php');
} catch (Exception $e) } catch (Exception $e)
{ {
dol_syslog($e->getMessage(), LOG_ERR); dol_syslog($e->getMessage(), LOG_ERR);
} }
$modBarCode = new $file(); $modBarCode = new $file();
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n"; print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";
print $modBarCode->info($langs); print $modBarCode->info($langs);
print '</td>'; print '</td>';
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n"; print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file")
{ {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&amp;token='.newToken().'&amp;value='.urlencode($file).'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&amp;token='.newToken().'&amp;value='.urlencode($file).'">';
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>'; print '</a></td>';
} else { } else {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducto&amp;token='.newToken().'&amp;value='.urlencode($file).'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducto&amp;token='.newToken().'&amp;value='.urlencode($file).'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>'; print '</a></td>';
} }
print '<td class="center">'; print '<td class="center">';
$s = $modBarCode->getToolTip($langs, null, -1); $s = $modBarCode->getToolTip($langs, null, -1);
print $form->textwithpicto('', $s, 1); print $form->textwithpicto('', $s, 1);
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
} }
} }
closedir($handle); closedir($handle);
} }
} }
print "</table>\n"; print "</table>\n";
} }

View File

@ -80,9 +80,9 @@ print dol_get_fiche_end();
// Buttons // Buttons
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>"; print "</div>";
} }
@ -92,9 +92,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create') if ($action == 'create')
{ {
print '<br><div id="newattrib"></div>'; print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute')); print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
} }
/* /*
@ -102,10 +102,10 @@ if ($action == 'create')
*/ */
if ($action == 'edit' && !empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
} }
// End of page // End of page

View File

@ -33,7 +33,7 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
if (! in_array('clicktodial', $conf->modules)) { if (!in_array('clicktodial', $conf->modules)) {
accessforbidden($langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module58Name"))); accessforbidden($langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module58Name")));
} }
@ -44,15 +44,15 @@ if (! in_array('clicktodial', $conf->modules)) {
if ($action == 'setvalue' && $user->admin) if ($action == 'setvalue' && $user->admin)
{ {
$result1 = dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity); $result1 = dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
$result2 = dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity); $result2 = dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
if ($result1 >= 0 && $result2 >= 0) if ($result1 >= 0 && $result2 >= 0)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -125,7 +125,7 @@ if (!empty($conf->global->CLICKTODIAL_URL))
if (GETPOST('phonefortest')) $phonefortest = GETPOST('phonefortest'); if (GETPOST('phonefortest')) $phonefortest = GETPOST('phonefortest');
print '<form action="'.$_SERVER["PHP_SELF"].'">'; print '<form action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print $langs->trans("LinkToTestClickToDial", $user->login).' : '; print $langs->trans("LinkToTestClickToDial", $user->login).' : ';
print '<input class="flat" type="text" name="phonefortest" value="'.dol_escape_htmltag($phonefortest).'">'; print '<input class="flat" type="text" name="phonefortest" value="'.dol_escape_htmltag($phonefortest).'">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("RefreshPhoneLink")).'">'; print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("RefreshPhoneLink")).'">';

View File

@ -40,14 +40,14 @@ $action = GETPOST('action', 'aZ09');
// Other parameters ACCOUNTING_* // Other parameters ACCOUNTING_*
$list = array( $list = array(
'ACCOUNTING_PRODUCT_BUY_ACCOUNT', 'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
'ACCOUNTING_SERVICE_BUY_ACCOUNT', 'ACCOUNTING_SERVICE_BUY_ACCOUNT',
'ACCOUNTING_SERVICE_SOLD_ACCOUNT', 'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
'ACCOUNTING_VAT_SOLD_ACCOUNT', 'ACCOUNTING_VAT_SOLD_ACCOUNT',
'ACCOUNTING_VAT_BUY_ACCOUNT', 'ACCOUNTING_VAT_BUY_ACCOUNT',
'ACCOUNTING_ACCOUNT_CUSTOMER', 'ACCOUNTING_ACCOUNT_CUSTOMER',
'ACCOUNTING_ACCOUNT_SUPPLIER' 'ACCOUNTING_ACCOUNT_SUPPLIER'
); );
/* /*
@ -58,52 +58,52 @@ $accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' :
if ($action == 'update') if ($action == 'update')
{ {
$error = 0; $error = 0;
$accounting_modes = array( $accounting_modes = array(
'RECETTES-DEPENSES', 'RECETTES-DEPENSES',
'CREANCES-DETTES' 'CREANCES-DETTES'
); );
$accounting_mode = GETPOST('accounting_mode', 'alpha'); $accounting_mode = GETPOST('accounting_mode', 'alpha');
if (in_array($accounting_mode, $accounting_modes)) { if (in_array($accounting_mode, $accounting_modes)) {
if (!dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) {
$error++; $error++;
} }
} else { } else {
$error++; $error++;
} }
foreach ($list as $constname) { foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++; $error++;
} }
} }
$report_include_varpay = GETPOST('ACCOUNTING_REPORTS_INCLUDE_VARPAY', 'alpha'); $report_include_varpay = GETPOST('ACCOUNTING_REPORTS_INCLUDE_VARPAY', 'alpha');
if (!empty($report_include_varpay)) if (!empty($report_include_varpay))
if ($report_include_varpay == 'yes') if ($report_include_varpay == 'yes')
if (!dolibarr_set_const($db, 'ACCOUNTING_REPORTS_INCLUDE_VARPAY', 1, 'chaine', 0, '', $conf->entity)) $error++; if (!dolibarr_set_const($db, 'ACCOUNTING_REPORTS_INCLUDE_VARPAY', 1, 'chaine', 0, '', $conf->entity)) $error++;
if ($report_include_varpay == 'no') if ($report_include_varpay == 'no')
if (!dolibarr_del_const($db, 'ACCOUNTING_REPORTS_INCLUDE_VARPAY', $conf->entity)) $error++; if (!dolibarr_del_const($db, 'ACCOUNTING_REPORTS_INCLUDE_VARPAY', $conf->entity)) $error++;
$report_include_loan = GETPOST('ACCOUNTING_REPORTS_INCLUDE_LOAN', 'alpha'); $report_include_loan = GETPOST('ACCOUNTING_REPORTS_INCLUDE_LOAN', 'alpha');
if (!empty($report_include_loan)) if (!empty($report_include_loan))
if ($report_include_loan == 'yes') if ($report_include_loan == 'yes')
if (!dolibarr_set_const($db, 'ACCOUNTING_REPORTS_INCLUDE_LOAN', 1, 'chaine', 0, '', $conf->entity)) $error++; if (!dolibarr_set_const($db, 'ACCOUNTING_REPORTS_INCLUDE_LOAN', 1, 'chaine', 0, '', $conf->entity)) $error++;
if ($report_include_loan == 'no') if ($report_include_loan == 'no')
if (!dolibarr_del_const($db, 'ACCOUNTING_REPORTS_INCLUDE_LOAN', $conf->entity)) $error++; if (!dolibarr_del_const($db, 'ACCOUNTING_REPORTS_INCLUDE_LOAN', $conf->entity)) $error++;
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
/* /*

View File

@ -155,7 +155,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp);
// Add logic to show/hide buttons // Add logic to show/hide buttons
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#updateconst").hide(); jQuery("#updateconst").hide();

View File

@ -476,7 +476,7 @@ print '</td></tr>'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("HideClosedServiceByDefault").'</td>'; print '<td>'.$langs->trans("HideClosedServiceByDefault").'</td>';
print '<td width="60" class="right">'; print '<td width="60" class="right">';
print $form->selectyesno("activate_hideClosedServiceByDefault", (! empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT)?$conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT:0), 1); print $form->selectyesno("activate_hideClosedServiceByDefault", (!empty($conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT) ? $conf->global->CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT : 0), 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/dav/dav.lib.php';
$langs->loadLangs(array("admin", "other", "agenda")); $langs->loadLangs(array("admin", "other", "agenda"));
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
// Parameters // Parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -39,8 +39,8 @@ $backtopage = GETPOST('backtopage', 'alpha');
$arrayofparameters = array( $arrayofparameters = array(
'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1), 'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2), 'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2),
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
); );
@ -95,7 +95,7 @@ if ($action == 'edit')
print '</td><td>'; print '</td><td>';
if ($key == 'DAV_ALLOW_PRIVATE_DIR') if ($key == 'DAV_ALLOW_PRIVATE_DIR')
{ {
print $langs->trans("AlwaysActive"); print $langs->trans("AlwaysActive");
} elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') } elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
{ {
print $form->selectyesno($key, $conf->global->$key, 1); print $form->selectyesno($key, $conf->global->$key, 1);
@ -130,7 +130,7 @@ if ($action == 'edit')
print '</td><td>'; print '</td><td>';
if ($key == 'DAV_ALLOW_PRIVATE_DIR') if ($key == 'DAV_ALLOW_PRIVATE_DIR')
{ {
print $langs->trans("AlwaysActive"); print $langs->trans("AlwaysActive");
} elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') } elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
{ {
print yn($conf->global->$key); print yn($conf->global->$key);

View File

@ -50,9 +50,9 @@ if ($action == 'set')
$result1 = dolibarr_set_const($db, "DEBUGBAR_LOGS_LINES_NUMBER", GETPOST('DEBUGBAR_LOGS_LINES_NUMBER', 'int'), 'chaine', 0, '', 0); $result1 = dolibarr_set_const($db, "DEBUGBAR_LOGS_LINES_NUMBER", GETPOST('DEBUGBAR_LOGS_LINES_NUMBER', 'int'), 'chaine', 0, '', 0);
$result2 = dolibarr_set_const($db, "DEBUGBAR_USE_LOG_FILE", GETPOST('DEBUGBAR_USE_LOG_FILE', 'int'), 'chaine', 0, '', 0); $result2 = dolibarr_set_const($db, "DEBUGBAR_USE_LOG_FILE", GETPOST('DEBUGBAR_USE_LOG_FILE', 'int'), 'chaine', 0, '', 0);
if ($result1 < 0 || $result2 < 0) if ($result1 < 0 || $result2 < 0)
{ {
$error++; $error++;
} }
if (!$error) if (!$error)
{ {
@ -78,8 +78,8 @@ print load_fiche_titre($langs->trans("DebugBarSetup"), $linkback, 'title_setup')
if (!function_exists('mb_check_encoding')) if (!function_exists('mb_check_encoding'))
{ {
$langs->load("errors"); $langs->load("errors");
print info_admin($langs->trans("ErrorPHPNeedModule", 'mbstring'), 0, 0, 'error'); print info_admin($langs->trans("ErrorPHPNeedModule", 'mbstring'), 0, 0, 'error');
} }
print '<br>'; print '<br>';

View File

@ -51,7 +51,7 @@ $modules = array(
'img' => 'projecttask' 'img' => 'projecttask'
) )
), ),
'propal' => array( 'propal' => array(
array( array(
'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE', 'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE',
'img' => 'propal' 'img' => 'propal'
@ -114,18 +114,18 @@ $modules = array(
'code' => 'MAIN_DELAY_EXPENSEREPORTS', 'code' => 'MAIN_DELAY_EXPENSEREPORTS',
'img' => 'trip' 'img' => 'trip'
), ),
/* TODO Enable this /* TODO Enable this
array( array(
'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY', 'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY',
'img' => 'trip' 'img' => 'trip'
)*/ )*/
), ),
'holiday' => array( 'holiday' => array(
array( array(
'code' => 'MAIN_DELAY_HOLIDAYS', 'code' => 'MAIN_DELAY_HOLIDAYS',
'img' => 'holiday' 'img' => 'holiday'
), ),
), ),
); );
$labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly")); $labelmeteo = array(0=>$langs->trans("No"), 1=>$langs->trans("Yes"), 2=>$langs->trans("OnMobileOnly"));
@ -169,15 +169,15 @@ if ($action == 'update')
foreach ($modules as $module => $delays) foreach ($modules as $module => $delays)
{ {
if (!empty($conf->$module->enabled)) if (!empty($conf->$module->enabled))
{ {
foreach ($delays as $delay) foreach ($delays as $delay)
{ {
if (GETPOST($delay['code']) != '') if (GETPOST($delay['code']) != '')
{ {
dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity);
} }
} }
} }
} }
dolibarr_set_const($db, "MAIN_DISABLE_METEO", $_POST["MAIN_DISABLE_METEO"], 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DISABLE_METEO", $_POST["MAIN_DISABLE_METEO"], 'chaine', 0, '', $conf->entity);
@ -188,8 +188,8 @@ if ($action == 'update')
if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE'; if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE';
// Update values // Update values
for ($i = 0; $i < 4; $i++) { for ($i = 0; $i < 4; $i++) {
if (isset($_POST['MAIN_METEO'.$plus.'_LEVEL'.$i])) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity); if (isset($_POST['MAIN_METEO'.$plus.'_LEVEL'.$i])) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'), 'chaine', 0, '', $conf->entity);
} }
} }
@ -209,31 +209,31 @@ print "<br>\n";
if ($action == 'edit') if ($action == 'edit')
{ {
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="form_index">'; print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="form_index">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
foreach ($modules as $module => $delays) foreach ($modules as $module => $delays)
{ {
if (!empty($conf->$module->enabled)) if (!empty($conf->$module->enabled))
{ {
foreach ($delays as $delay) foreach ($delays as $delay)
{ {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>'; print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td class="nowraponall">'; print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td class="nowraponall">';
print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>'; print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
} }
} }
} }
print '</table>'; print '</table>';
print '<br>'; print '<br>';
// Show if meteo is enabled // Show if meteo is enabled
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -246,29 +246,29 @@ if ($action == 'edit')
print '</table>'; print '</table>';
} else { } else {
/* /*
* Show parameters * Show parameters
*/ */
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
foreach ($modules as $module => $delays) foreach ($modules as $module => $delays)
{ {
if (!empty($conf->$module->enabled)) if (!empty($conf->$module->enabled))
{ {
foreach ($delays as $delay) foreach ($delays as $delay)
{ {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>'; print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>'; print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>'; print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>';
} }
} }
} }
print '</table>'; print '</table>';
print '<br>'; print '<br>';

View File

@ -87,9 +87,9 @@ print dol_get_fiche_end();
// Buttons // Buttons
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>"; print "</div>";
} }
@ -102,9 +102,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create') if ($action == 'create')
{ {
print '<br><div id="newattrib"></div>'; print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute')); print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
} }
/* ************************************************************************** */ /* ************************************************************************** */
@ -114,10 +114,10 @@ if ($action == 'create')
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && !empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
} }
// End of page // End of page

View File

@ -19,7 +19,7 @@
if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1); if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1);
if (!defined('NOTOKENRENEWAL')) { if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1); define('NOTOKENRENEWAL', 1);
} }

View File

@ -68,22 +68,22 @@ class PrestaShopWebservice
* @param string $url Root URL for the shop * @param string $url Root URL for the shop
* @param string $key Authentification key * @param string $key Authentification key
* @param mixed $debug Debug mode Activated (true) or deactivated (false) * @param mixed $debug Debug mode Activated (true) or deactivated (false)
*/ */
public function __construct($url, $key, $debug = true) public function __construct($url, $key, $debug = true)
{ {
if (!extension_loaded('curl')) if (!extension_loaded('curl'))
throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library'); throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library');
$this->url = $url; $this->url = $url;
$this->key = $key; $this->key = $key;
$this->debug = $debug; $this->debug = $debug;
$this->version = 'unknown'; $this->version = 'unknown';
} }
/** /**
* Take the status code and throw an exception if the server didn't return 200 or 201 code * Take the status code and throw an exception if the server didn't return 200 or 201 code
* *
* @param int $status_code Status code of an HTTP return * @param int $status_code Status code of an HTTP return
* @return void * @return void
*/ */
protected function checkStatusCode($status_code) protected function checkStatusCode($status_code)
{ {
@ -275,7 +275,7 @@ class PrestaShopWebservice
} }
/** /**
* Retrieve (GET) a resource * Retrieve (GET) a resource
* <p>Unique parameter must take : <br><br> * <p>Unique parameter must take : <br><br>
* 'url' => Full URL for a GET request of Webservice (ex: http://mystore.com/api/customers/1/)<br> * 'url' => Full URL for a GET request of Webservice (ex: http://mystore.com/api/customers/1/)<br>
* OR<br> * OR<br>
@ -332,7 +332,7 @@ class PrestaShopWebservice
} }
/** /**
* Head method (HEAD) a resource * Head method (HEAD) a resource
* *
* @param array $options Array representing resource for head request. * @param array $options Array representing resource for head request.
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement status_code, response

View File

@ -19,7 +19,7 @@
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
if (!class_exists('PrestaShopWebservice')) // We keep this because some modules add this lib too into a different path. This is to avoid "Cannot declare class PrestaShopWebservice" errors. if (!class_exists('PrestaShopWebservice')) // We keep this because some modules add this lib too into a different path. This is to avoid "Cannot declare class PrestaShopWebservice" errors.
{ {
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php'; include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
} }
@ -28,17 +28,17 @@ if (!class_exists('PrestaShopWebservice')) // We keep this because some modules
*/ */
class Dolistore class Dolistore
{ {
/** /**
* beginning of pagination * beginning of pagination
* @var int * @var int
*/ */
public $start; public $start;
/** /**
* end of pagination * end of pagination
* @var int * @var int
*/ */
public $end; public $end;
public $per_page; // pagination: display per page public $per_page; // pagination: display per page
public $categorie; // the current categorie public $categorie; // the current categorie
@ -79,33 +79,33 @@ class Dolistore
*/ */
public function getRemoteCategories() public function getRemoteCategories()
{ {
global $conf; global $conf;
try { try {
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api); $this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
dol_syslog("Call API with MAIN_MODULE_DOLISTORE_API_SRV = ".$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); dol_syslog("Call API with MAIN_MODULE_DOLISTORE_API_SRV = ".$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
// $conf->global->MAIN_MODULE_DOLISTORE_API_KEY is for the login of basic auth. There is no password as it is public data. // $conf->global->MAIN_MODULE_DOLISTORE_API_KEY is for the login of basic auth. There is no password as it is public data.
// Here we set the option array for the Webservice : we want categories resources // Here we set the option array for the Webservice : we want categories resources
$opt = array(); $opt = array();
$opt['resource'] = 'categories'; $opt['resource'] = 'categories';
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]'; $opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
$opt['sort'] = 'id_asc'; $opt['sort'] = 'id_asc';
// Call // Call
dol_syslog("Call API with opt = ".var_export($opt, true)); dol_syslog("Call API with opt = ".var_export($opt, true));
$xml = $this->api->get($opt); $xml = $this->api->get($opt);
$this->categories = $xml->categories->children(); $this->categories = $xml->categories->children();
} catch (PrestaShopWebserviceException $e) { } catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors // Here we are dealing with errors
$trace = $e->getTrace(); $trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) die('Bad ID'); if ($trace[0]['args'][0] == 404) die('Bad ID');
elseif ($trace[0]['args'][0] == 401) die('Bad auth key'); elseif ($trace[0]['args'][0] == 401) die('Bad auth key');
else { else {
print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'<br>'; print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'<br>';
print $e->getMessage(); print $e->getMessage();
} }
} }
} }
/** /**
@ -153,7 +153,7 @@ class Dolistore
} }
$opt['filter[id]'] = '['.implode('|', $products).']'; $opt['filter[id]'] = '['.implode('|', $products).']';
} elseif ($this->categorie != 0) { // We filter on category, so we first get list of product id in this category } elseif ($this->categorie != 0) { // We filter on category, so we first get list of product id in this category
// $opt2['url'] is set by default to $this->url.'/api/'.$options['resource']; // $opt2['url'] is set by default to $this->url.'/api/'.$options['resource'];
$opt2['resource'] = 'categories'; $opt2['resource'] = 'categories';
$opt2['id'] = $this->categorie; $opt2['id'] = $this->categorie;
@ -189,7 +189,7 @@ class Dolistore
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return tree of Dolistore categories. $this->categories must have been loaded before. * Return tree of Dolistore categories. $this->categories must have been loaded before.
* *
@ -198,7 +198,7 @@ class Dolistore
*/ */
public function get_categories($parent = 0) public function get_categories($parent = 0)
{ {
// phpcs:enable // phpcs:enable
if (!isset($this->categories)) die('not possible'); if (!isset($this->categories)) die('not possible');
if ($parent != 0) { if ($parent != 0) {
$html = '<ul>'; $html = '<ul>';
@ -235,7 +235,7 @@ class Dolistore
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of product formated for output * Return list of product formated for output
* *
@ -243,7 +243,7 @@ class Dolistore
*/ */
public function get_products() public function get_products()
{ {
// phpcs:enable // phpcs:enable
global $langs, $conf; global $langs, $conf;
$html = ""; $html = "";
$last_month = time() - (30 * 24 * 60 * 60); $last_month = time() - (30 * 24 * 60 * 60);
@ -270,7 +270,7 @@ class Dolistore
// free or pay ? // free or pay ?
if ($product->price > 0) { if ($product->price > 0) {
$price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>'; $price = '<h3>'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>'; $download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
} else { } else {
$price = '<h3>'.$langs->trans('Free').'</h3>'; $price = '<h3>'.$langs->trans('Free').'</h3>';
@ -282,12 +282,12 @@ class Dolistore
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) { if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) { if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
//compatible //compatible
$version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max, $version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
$product->dolibarr_min, $product->dolibarr_max).'</span>'; $product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = ''; $compatible = '';
} else { } else {
//never compatible, module expired //never compatible, module expired
$version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION, $version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION,
$product->dolibarr_min, $product->dolibarr_max).'</span>'; $product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = 'NotCompatible'; $compatible = 'NotCompatible';
} }
@ -306,50 +306,50 @@ class Dolistore
<td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang - 1] <td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang - 1]
.'<br/><small>'.$version.'</small></h2> .'<br/><small>'.$version.'</small></h2>
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang - 1].'</td>'; <small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang - 1].'</td>';
// do not load if display none // do not load if display none
//$html .= '<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>'; //$html .= '<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>';
$html .= '<td class="margeCote center">'.$price.'</td>'; $html .= '<td class="margeCote center">'.$price.'</td>';
$html .= '<td class="margeCote">'.$download_link.'</td>'; $html .= '<td class="margeCote">'.$download_link.'</td>';
$html .= '</tr>'; $html .= '</tr>';
} }
return $html; return $html;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get previous link * get previous link
* *
* @param string $text symbol previous * @param string $text symbol previous
* @return string html previous link * @return string html previous link
*/ */
public function get_previous_link($text = '<<') public function get_previous_link($text = '<<')
{ {
// phpcs:enable // phpcs:enable
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>'; return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get next link * get next link
* *
* @param string $text symbol next * @param string $text symbol next
* @return string html next link * @return string html next link
*/ */
public function get_next_link($text = '>>') public function get_next_link($text = '>>')
{ {
// phpcs:enable // phpcs:enable
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>'; return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get previous url * get previous url
* *
* @return string previous url * @return string previous url
*/ */
public function get_previous_url() public function get_previous_url()
{ {
// phpcs:enable // phpcs:enable
$param_array = array(); $param_array = array();
if ($this->start < $this->per_page) { if ($this->start < $this->per_page) {
$sub = 0; $sub = 0;
@ -363,17 +363,17 @@ class Dolistore
} }
$param = http_build_query($param_array); $param = http_build_query($param_array);
return $this->url."&".$param; return $this->url."&".$param;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get next url * get next url
* *
* @return string next url * @return string next url
*/ */
public function get_next_url() public function get_next_url()
{ {
// phpcs:enable // phpcs:enable
$param_array = array(); $param_array = array();
if (count($this->products) < $this->per_page) { if (count($this->products) < $this->per_page) {
$add = 0; $add = 0;
@ -389,17 +389,17 @@ class Dolistore
return $this->url."&".$param; return $this->url."&".$param;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* version compare * version compare
* *
* @param string $v1 version 1 * @param string $v1 version 1
* @param string $v2 version 2 * @param string $v2 version 2
* @return int result of compare * @return int result of compare
*/ */
public function version_compare($v1, $v2) public function version_compare($v1, $v2)
{ {
// phpcs:enable // phpcs:enable
$v1 = explode('.', $v1); $v1 = explode('.', $v1);
$v2 = explode('.', $v2); $v2 = explode('.', $v2);
$ret = 0; $ret = 0;

View File

@ -426,9 +426,9 @@ foreach ($object->fields as $key => $val)
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right'; elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
if (!empty($arrayfields['t.'.$key]['checked'])) if (!empty($arrayfields['t.'.$key]['checked']))
{ {
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
} }
} }
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@ -470,26 +470,26 @@ while ($i < ($limit ? min($num, $limit) : $num))
{ {
$cssforfield = (empty($val['css']) ? '' : $val['css']); $cssforfield = (empty($val['css']) ? '' : $val['css']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) $cssforfield .= ($cssforfield ? ' ' : '').'right'; if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) $cssforfield .= ($cssforfield ? ' ' : '').'right';
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
if (!empty($arrayfields['t.'.$key]['checked'])) if (!empty($arrayfields['t.'.$key]['checked']))
{ {
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>'; print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') print $object->getLibStatut(5); if ($key == 'status') print $object->getLibStatut(5);
else print $object->showOutputField($val, $key, $object->$key, ''); else print $object->showOutputField($val, $key, $object->$key, '');
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
if (!empty($val['isameasure'])) if (!empty($val['isameasure']))
{ {
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['val']['t.'.$key] += $object->$key; $totalarray['val']['t.'.$key] += $object->$key;
} }
} }
} }
// Extra fields // Extra fields

View File

@ -87,9 +87,9 @@ print dol_get_fiche_end();
// Buttons // Buttons
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>"; print "</div>";
} }
@ -102,9 +102,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create') if ($action == 'create')
{ {
print '<br><div id="newattrib"></div>'; print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute')); print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
} }
/* ************************************************************************** */ /* ************************************************************************** */
@ -114,10 +114,10 @@ if ($action == 'create')
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && !empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
} }
// End of page // End of page

View File

@ -61,11 +61,11 @@ if ($action == 'updateMask')
if (!$res > 0) $error++; if (!$res > 0) $error++;
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'specimen') // For fiche inter } elseif ($action == 'specimen') // For fiche inter
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@ -80,7 +80,7 @@ if ($action == 'updateMask')
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir)
{ {
$file = dol_buildpath($reldir."core/modules/expensereport/doc/pdf_".$modele.".modules.php", 0); $file = dol_buildpath($reldir."core/modules/expensereport/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) if (file_exists($file))
{ {
$filefound = 1; $filefound = 1;
@ -122,7 +122,7 @@ elseif ($action == 'set')
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
{ {
if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPENSEREPORT_ADDON_PDF', $conf->entity); if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPENSEREPORT_ADDON_PDF', $conf->entity);
} }
} }
@ -150,7 +150,7 @@ elseif ($action == 'setdoc')
dolibarr_set_const($db, "EXPENSEREPORT_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "EXPENSEREPORT_ADDON", $value, 'chaine', 0, '', $conf->entity);
} elseif ($action == 'setoptions') } elseif ($action == 'setoptions')
{ {
$db->begin(); $db->begin();
$freetext = GETPOST('EXPENSEREPORT_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string $freetext = GETPOST('EXPENSEREPORT_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
$res1 = dolibarr_set_const($db, "EXPENSEREPORT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res1 = dolibarr_set_const($db, "EXPENSEREPORT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
@ -161,13 +161,13 @@ elseif ($action == 'setdoc')
if (!$res1 > 0 || !$res2 > 0) $error++; if (!$res1 > 0 || !$res2 > 0) $error++;
if (!$error) if (!$error)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -235,13 +235,13 @@ foreach ($dirmodels as $reldir)
print $module->info(); print $module->info();
print '</td>'; print '</td>';
// Show example of numbering model // Show example of numbering model
print '<td class="nowrap">'; print '<td class="nowrap">';
$tmp = $module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>'; if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
print '<td class="center">'; print '<td class="center">';
if ($conf->global->EXPENSEREPORT_ADDON == $file) if ($conf->global->EXPENSEREPORT_ADDON == $file)
@ -261,16 +261,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip = ''; $htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($exp); $nextval = $module->getNextValue($exp);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': '; $htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) { if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval); $nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>'; $htmltooltip .= $nextval.'<br>';
} else { } else {
$htmltooltip .= $langs->trans($module->error).'<br>'; $htmltooltip .= $langs->trans($module->error).'<br>';
} }
} }
print '<td class="center">'; print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0); print $form->textwithpicto('', $htmltooltip, 1, 0);
@ -345,81 +345,81 @@ foreach ($dirmodels as $reldir)
foreach ($filelist as $file) foreach ($filelist as $file)
{ {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{ {
if (file_exists($dir.'/'.$file)) if (file_exists($dir.'/'.$file))
{ {
$name = substr($file, 4, dol_strlen($file) - 16); $name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12); $classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file; require_once $dir.'/'.$file;
$module = new $classname($db); $module = new $classname($db);
$modulequalified = 1; $modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified) if ($modulequalified)
{ {
print '<tr class="oddeven"><td width="100">'; print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name); print (empty($module->name) ? $name : $module->name);
print "</td><td>\n"; print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs); if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description; else print $module->description;
print '</td>'; print '</td>';
// Active // Active
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print "</td>"; print "</td>";
} else { } else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
} }
// Default // Default
print '<td class="center">'; print '<td class="center">';
if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name") if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} else { } else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">'; print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, -1, 0); print $form->textwithpicto('', $htmltooltip, -1, 0);
print '</td>'; print '</td>';
// Preview // Preview
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
} }
} }
} }
} }
} }
} }
@ -457,11 +457,11 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $lang
$variablename = 'EXPENSEREPORT_FREE_TEXT'; $variablename = 'EXPENSEREPORT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else { } else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";

View File

@ -55,31 +55,31 @@ $sql .= " WHERE ".$db->decrypt('name')." LIKE 'EXTERNAL_RSS_URLRSS_%'";
$result = $db->query($sql); // We can't use SELECT MAX() because EXTERNAL_RSS_URLRSS_10 is lower than EXTERNAL_RSS_URLRSS_9 $result = $db->query($sql); // We can't use SELECT MAX() because EXTERNAL_RSS_URLRSS_10 is lower than EXTERNAL_RSS_URLRSS_9
if ($result) if ($result)
{ {
while ($obj = $db->fetch_object($result)) while ($obj = $db->fetch_object($result))
{ {
preg_match('/([0-9]+)$/i', $obj->name, $reg); preg_match('/([0-9]+)$/i', $obj->name, $reg);
if ($reg[1] && $reg[1] > $lastexternalrss) $lastexternalrss = $reg[1]; if ($reg[1] && $reg[1] > $lastexternalrss) $lastexternalrss = $reg[1];
} }
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
if ($action == 'add' || GETPOST("modify")) if ($action == 'add' || GETPOST("modify"))
{ {
$external_rss_title = "external_rss_title_".GETPOST("norss", 'int'); $external_rss_title = "external_rss_title_".GETPOST("norss", 'int');
$external_rss_urlrss = "external_rss_urlrss_".GETPOST("norss", 'int'); $external_rss_urlrss = "external_rss_urlrss_".GETPOST("norss", 'int');
if (!empty($_POST[$external_rss_urlrss])) if (!empty($_POST[$external_rss_urlrss]))
{ {
$boxlabel = '(ExternalRSSInformations)'; $boxlabel = '(ExternalRSSInformations)';
//$external_rss_url = "external_rss_url_" . $_POST["norss"]; //$external_rss_url = "external_rss_url_" . $_POST["norss"];
$db->begin(); $db->begin();
if ($_POST["modify"]) if ($_POST["modify"])
{ {
// Supprime boite box_external_rss de definition des boites // Supprime boite box_external_rss de definition des boites
/* $sql = "UPDATE ".MAIN_DB_PREFIX."boxes_def"; /* $sql = "UPDATE ".MAIN_DB_PREFIX."boxes_def";
$sql.= " SET name = '".$db->escape($boxlabel)."'"; $sql.= " SET name = '".$db->escape($boxlabel)."'";
$sql.= " WHERE file ='box_external_rss.php' AND note like '".$db->escape($_POST["norss"])." %'"; $sql.= " WHERE file ='box_external_rss.php' AND note like '".$db->escape($_POST["norss"])." %'";
@ -92,56 +92,56 @@ if ($action == 'add' || GETPOST("modify"))
*/ */
} else { } else {
// Ajoute boite box_external_rss dans definition des boites // Ajoute boite box_external_rss dans definition des boites
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, note)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, note)";
$sql .= " VALUES ('box_external_rss.php','".$db->escape(GETPOST("norss", 'int').' ('.GETPOST($external_rss_title, 'alpha')).")')"; $sql .= " VALUES ('box_external_rss.php','".$db->escape(GETPOST("norss", 'int').' ('.GETPOST($external_rss_title, 'alpha')).")')";
if (!$db->query($sql)) if (!$db->query($sql))
{ {
dol_print_error($db); dol_print_error($db);
$err++; $err++;
} }
} }
$result1 = dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_".GETPOST("norss", 'int'), GETPOST($external_rss_title, 'alpha'), 'chaine', 0, '', $conf->entity); $result1 = dolibarr_set_const($db, "EXTERNAL_RSS_TITLE_".GETPOST("norss", 'int'), GETPOST($external_rss_title, 'alpha'), 'chaine', 0, '', $conf->entity);
if ($result1) $result2 = dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_".GETPOST("norss", 'int'), GETPOST($external_rss_urlrss, 'alpha'), 'chaine', 0, '', $conf->entity); if ($result1) $result2 = dolibarr_set_const($db, "EXTERNAL_RSS_URLRSS_".GETPOST("norss", 'int'), GETPOST($external_rss_urlrss, 'alpha'), 'chaine', 0, '', $conf->entity);
if ($result1 && $result2) if ($result1 && $result2)
{ {
$db->commit(); $db->commit();
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} else { } else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
} }
} }
if ($_POST["delete"]) if ($_POST["delete"])
{ {
if (GETPOST("norss", 'int')) if (GETPOST("norss", 'int'))
{ {
$db->begin(); $db->begin();
// Supprime boite box_external_rss de definition des boites // Supprime boite box_external_rss de definition des boites
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."boxes_def"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."boxes_def";
$sql .= " WHERE file = 'box_external_rss.php' AND note LIKE '".$db->escape(GETPOST("norss", 'int'))." %'"; $sql .= " WHERE file = 'box_external_rss.php' AND note LIKE '".$db->escape(GETPOST("norss", 'int'))." %'";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
$sql .= " WHERE entity = ".$conf->entity; $sql .= " WHERE entity = ".$conf->entity;
$sql .= " AND box_id = ".$obj->rowid; $sql .= " AND box_id = ".$obj->rowid;
$resql = $db->query($sql); $resql = $db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";
$sql .= " WHERE rowid = ".$obj->rowid; $sql .= " WHERE rowid = ".$obj->rowid;
$resql = $db->query($sql); $resql = $db->query($sql);
if (!$resql) if (!$resql)
@ -159,22 +159,22 @@ if ($_POST["delete"])
$db->rollback(); $db->rollback();
dol_print_error($db, "sql=".$sql); dol_print_error($db, "sql=".$sql);
exit; exit;
} }
$result1 = dolibarr_del_const($db, "EXTERNAL_RSS_TITLE_".GETPOST("norss", 'int'), $conf->entity); $result1 = dolibarr_del_const($db, "EXTERNAL_RSS_TITLE_".GETPOST("norss", 'int'), $conf->entity);
if ($result1) $result2 = dolibarr_del_const($db, "EXTERNAL_RSS_URLRSS_".GETPOST("norss", 'int'), $conf->entity); if ($result1) $result2 = dolibarr_del_const($db, "EXTERNAL_RSS_URLRSS_".GETPOST("norss", 'int'), $conf->entity);
if ($result1 && $result2) if ($result1 && $result2)
{ {
$db->commit(); $db->commit();
header("Location: external_rss.php"); header("Location: external_rss.php");
exit; exit;
} else { } else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
} }
} }
@ -242,9 +242,9 @@ if ($resql)
$idrss = $reg[1]; $idrss = $reg[1];
$keyrsstitle = "EXTERNAL_RSS_TITLE_".$idrss; $keyrsstitle = "EXTERNAL_RSS_TITLE_".$idrss;
$keyrssurl = "EXTERNAL_RSS_URLRSS_".$idrss; $keyrssurl = "EXTERNAL_RSS_URLRSS_".$idrss;
//print "x".$idrss; //print "x".$idrss;
$rssparser = new RssParser($db); $rssparser = new RssParser($db);
$result = $rssparser->parser($conf->global->$keyrssurl, 5, 300, $conf->externalrss->dir_temp); $result = $rssparser->parser($conf->global->$keyrssurl, 5, 300, $conf->externalrss->dir_temp);
print "<br>"; print "<br>";
@ -255,8 +255,8 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print "<td>".$langs->trans("RSS")." ".($i + 1)."</td>"; print "<td>".$langs->trans("RSS")." ".($i + 1)."</td>";
print '<td class="right">'; print '<td class="right">';
print '<input type="submit" class="button buttongen" name="modify" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button buttongen" name="modify" value="'.$langs->trans("Modify").'">';
print " &nbsp; "; print " &nbsp; ";
print '<input type="submit" class="button buttongen" name="delete" value="'.$langs->trans("Delete").'">'; print '<input type="submit" class="button buttongen" name="delete" value="'.$langs->trans("Delete").'">';
print '<input type="hidden" name="norss" value="'.$idrss.'">'; print '<input type="hidden" name="norss" value="'.$idrss.'">';
@ -279,8 +279,8 @@ if ($resql)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>".$langs->trans("Status")."</td>"; print "<td>".$langs->trans("Status")."</td>";
print "<td>"; print "<td>";
if ($result > 0 && empty($rss->error)) if ($result > 0 && empty($rss->error))
{ {
print '<font class="ok">'.$langs->trans("Online").'</div>'; print '<font class="ok">'.$langs->trans("Online").'</div>';
} else { } else {
print '<font class="error">'.$langs->trans("Offline"); print '<font class="error">'.$langs->trans("Offline");
@ -292,8 +292,8 @@ if ($resql)
print '</tr>'."\n"; print '</tr>'."\n";
// Logo // Logo
if ($result > 0 && empty($rss->error)) if ($result > 0 && empty($rss->error))
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>".$langs->trans("Logo")."</td>"; print "<td>".$langs->trans("Logo")."</td>";
print '<td>'; print '<td>';

View File

@ -60,8 +60,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader( llxHeader(
"", $langs->trans("BillsSetup"), "", $langs->trans("BillsSetup"),
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura' 'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
); );
$form = new Form($db); $form = new Form($db);
@ -113,10 +113,10 @@ _printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty')
_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituationFinal')); _printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituationFinal'));
$metas = array( $metas = array(
'type' => 'number', 'type' => 'number',
'step' => '0.01', 'step' => '0.01',
'min' => 0, 'min' => 0,
'max' => 100 'max' => 100
); );
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas); _printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
@ -153,10 +153,10 @@ $db->close();
*/ */
function _updateBtn() function _updateBtn()
{ {
global $langs; global $langs;
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</div>'; print '</div>';
} }
/** /**
@ -170,18 +170,18 @@ function _updateBtn()
*/ */
function _printOnOff($confkey, $title = false, $desc = '') function _printOnOff($confkey, $title = false, $desc = '')
{ {
global $langs; global $langs;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.($title ? $title : $langs->trans($confkey)); print '<td>'.($title ? $title : $langs->trans($confkey));
if (!empty($desc)) { if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>'; print '<br><small>'.$langs->trans($desc).'</small>';
} }
print '</td>'; print '</td>';
print '<td class="center" width="20">&nbsp;</td>'; print '<td class="center" width="20">&nbsp;</td>';
print '<td class="right" width="300">'; print '<td class="right" width="300">';
print ajax_constantonoff($confkey); print ajax_constantonoff($confkey);
print '</td></tr>'; print '</td></tr>';
} }
@ -199,53 +199,53 @@ function _printOnOff($confkey, $title = false, $desc = '')
*/ */
function _printInputFormPart($confkey, $title = false, $desc = '', $metas = array(), $type = 'input', $help = false) function _printInputFormPart($confkey, $title = false, $desc = '', $metas = array(), $type = 'input', $help = false)
{ {
global $langs, $conf, $db, $inputCount; global $langs, $conf, $db, $inputCount;
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1); $inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
$form = new Form($db); $form = new Form($db);
$defaultMetas = array( $defaultMetas = array(
'name' => 'value'.$inputCount 'name' => 'value'.$inputCount
); );
if ($type != 'textarea') { if ($type != 'textarea') {
$defaultMetas['type'] = 'text'; $defaultMetas['type'] = 'text';
$defaultMetas['value'] = $conf->global->{$confkey}; $defaultMetas['value'] = $conf->global->{$confkey};
} }
$metas = array_merge($defaultMetas, $metas); $metas = array_merge($defaultMetas, $metas);
$metascompil = ''; $metascompil = '';
foreach ($metas as $key => $values) { foreach ($metas as $key => $values) {
$metascompil .= ' '.$key.'="'.$values.'" '; $metascompil .= ' '.$key.'="'.$values.'" ';
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
if (!empty($help)) { if (!empty($help)) {
print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, '')); print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
} else { } else {
print $title ? $title : $langs->trans($confkey); print $title ? $title : $langs->trans($confkey);
} }
if (!empty($desc)) { if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>'; print '<br><small>'.$langs->trans($desc).'</small>';
} }
print '</td>'; print '</td>';
print '<td class="center" width="20">&nbsp;</td>'; print '<td class="center" width="20">&nbsp;</td>';
print '<td class="right" width="300">'; print '<td class="right" width="300">';
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">'; print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
print '<input type="hidden" name="action" value="setModuleOptions">'; print '<input type="hidden" name="action" value="setModuleOptions">';
if ($type == 'textarea') { if ($type == 'textarea') {
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>'; print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
} elseif ($type == 'input') { } elseif ($type == 'input') {
print '<input '.$metascompil.' />'; print '<input '.$metascompil.' />';
} else { } else {
// custom // custom
print $type; print $type;
} }
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -82,23 +82,23 @@ $picto = array(
foreach ($modules as $const => $desc) foreach ($modules as $const => $desc)
{ {
if ($action == 'activate_'.strtolower($const)) if ($action == 'activate_'.strtolower($const))
{ {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1", 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1", 'chaine', 0, '', $conf->entity);
// Si fckeditor est active dans la description produit/service, on l'active dans les formulaires // Si fckeditor est active dans la description produit/service, on l'active dans les formulaires
if ($const == 'PRODUCTDESC' && !empty($conf->global->PRODUIT_DESC_IN_FORM)) if ($const == 'PRODUCTDESC' && !empty($conf->global->PRODUIT_DESC_IN_FORM))
{ {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1", 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1", 'chaine', 0, '', $conf->entity);
} }
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
if ($action == 'disable_'.strtolower($const)) if ($action == 'disable_'.strtolower($const))
{ {
dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const, $conf->entity); dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const, $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
} }
if (GETPOST('save', 'alpha')) if (GETPOST('save', 'alpha'))
@ -115,7 +115,7 @@ if (GETPOST('save', 'alpha'))
} }
$fckeditor_test = GETPOST('formtestfield'); $fckeditor_test = GETPOST('formtestfield');
if (!empty($fckeditor_test)) { if (!empty($fckeditor_test)) {
if (!dolibarr_set_const($db, 'FCKEDITOR_TEST', $fckeditor_test, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, 'FCKEDITOR_TEST', $fckeditor_test, 'chaine', 0, '', $conf->entity)) {
$error++; $error++;
} }
@ -124,11 +124,11 @@ if (GETPOST('save', 'alpha'))
} }
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
/* /*

View File

@ -61,11 +61,11 @@ if ($action == 'updateMask')
if (!$res > 0) $error++; if (!$res > 0) $error++;
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'specimen') // For fiche inter } elseif ($action == 'specimen') // For fiche inter
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@ -78,7 +78,7 @@ if ($action == 'updateMask')
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir)
{ {
$file = dol_buildpath($reldir."core/modules/fichinter/doc/pdf_".$modele.".modules.php", 0); $file = dol_buildpath($reldir."core/modules/fichinter/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file)) if (file_exists($file))
{ {
$filefound = 1; $filefound = 1;
@ -116,7 +116,7 @@ elseif ($action == 'set')
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
{ {
if ($conf->global->FICHEINTER_ADDON_PDF == "$value") dolibarr_del_const($db, 'FICHEINTER_ADDON_PDF', $conf->entity); if ($conf->global->FICHEINTER_ADDON_PDF == "$value") dolibarr_del_const($db, 'FICHEINTER_ADDON_PDF', $conf->entity);
} }
} }
@ -150,11 +150,11 @@ elseif ($action == 'setdoc')
if (!$res > 0) $error++; if (!$res > 0) $error++;
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK') } elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK')
{ {
$draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha'); $draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha');
@ -163,11 +163,11 @@ elseif ($action == 'setdoc')
if (!$res > 0) $error++; if (!$res > 0) $error++;
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') } elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
{ {
$val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha'); $val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha');
@ -176,14 +176,14 @@ elseif ($action == 'setdoc')
if (!$res > 0) $error++; if (!$res > 0) $error++;
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') { } elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') {
$val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha'); $val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
if (!$res > 0) { if (!$res > 0) {
$error++; $error++;
@ -195,31 +195,31 @@ elseif ($action == 'setdoc')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') { } elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') {
$val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha'); $val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
if (!$res > 0) { if (!$res > 0) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') { } elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') {
$val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha'); $val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
if (!$res > 0) { if (!$res > 0) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@ -288,13 +288,13 @@ foreach ($dirmodels as $reldir)
print $module->info(); print $module->info();
print '</td>'; print '</td>';
// Show example of numbering model // Show example of numbering model
print '<td class="nowrap">'; print '<td class="nowrap">';
$tmp = $module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>'; if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
print '<td class="center">'; print '<td class="center">';
if ($conf->global->FICHEINTER_ADDON == $classname) if ($conf->global->FICHEINTER_ADDON == $classname)
@ -312,16 +312,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip = ''; $htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mysoc, $ficheinter); $nextval = $module->getNextValue($mysoc, $ficheinter);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': '; $htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) { if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval); $nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>'; $htmltooltip .= $nextval.'<br>';
} else { } else {
$htmltooltip .= $langs->trans($module->error).'<br>'; $htmltooltip .= $langs->trans($module->error).'<br>';
} }
} }
print '<td class="center">'; print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0); print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>'; print '</td>';
@ -399,83 +399,83 @@ foreach ($dirmodels as $reldir)
foreach ($filelist as $file) foreach ($filelist as $file)
{ {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{ {
if (file_exists($dir.'/'.$file)) if (file_exists($dir.'/'.$file))
{ {
$name = substr($file, 4, dol_strlen($file) - 16); $name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12); $classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file; require_once $dir.'/'.$file;
$module = new $classname($db); $module = new $classname($db);
$modulequalified = 1; $modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified) if ($modulequalified)
{ {
print '<tr class="oddeven"><td width="100">'; print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name); print (empty($module->name) ? $name : $module->name);
print "</td><td>\n"; print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs); if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description; else print $module->description;
print '</td>'; print '</td>';
// Active // Active
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print "</td>"; print "</td>";
} else { } else {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
} }
// Default // Default
print "<td align=\"center\">"; print "<td align=\"center\">";
if ($conf->global->FICHEINTER_ADDON_PDF == "$name") if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} else { } else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file; $htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); $htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); $htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); $htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">'; print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, -1, 0); print $form->textwithpicto('', $htmltooltip, -1, 0);
print '</td>'; print '</td>';
// Preview // Preview
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
} }
} }
} }
} }
} }
} }
@ -509,11 +509,11 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs
$variablename = 'FICHINTER_FREE_TEXT'; $variablename = 'FICHINTER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else { } else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();
} }
print '</td><td class="right">'; print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';

View File

@ -47,7 +47,7 @@ if ($action == 'set')
$gimcdf = GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE"); $gimcdf = GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE");
if (!$error && $gimcdf && ! preg_match('/\.(dat|mmdb)$/', $gimcdf)) { if (!$error && $gimcdf && !preg_match('/\.(dat|mmdb)$/', $gimcdf)) {
setEventMessages($langs->trans("ErrorFileMustHaveFormat", '.dat|.mmdb'), null, 'errors'); setEventMessages($langs->trans("ErrorFileMustHaveFormat", '.dat|.mmdb'), null, 'errors');
$error++; $error++;
} }

View File

@ -80,9 +80,9 @@ print dol_get_fiche_end();
// Buttons // Buttons
if ($action != 'create' && $action != 'edit') if ($action != 'create' && $action != 'edit')
{ {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>"; print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>"; print "</div>";
} }
@ -95,9 +95,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create') if ($action == 'create')
{ {
print '<br><div id="newattrib"></div>'; print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute')); print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
} }
/* ************************************************************************** */ /* ************************************************************************** */
@ -107,10 +107,10 @@ if ($action == 'create')
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'edit' && !empty($attrname)) if ($action == 'edit' && !empty($attrname))
{ {
print "<br>"; print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname)); print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
} }
// End of page // End of page

View File

@ -122,7 +122,7 @@ if ($action == 'update')
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity); else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array())))); $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity); if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity); else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity);

View File

@ -47,24 +47,24 @@ print load_fiche_titre($langs->trans("SetupArea"), '', 'tools');
if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) if (!empty($conf->global->MAIN_MOTD_SETUPPAGE))
{ {
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE); $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE);
if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) if (!empty($conf->global->MAIN_MOTD_SETUPPAGE))
{ {
$i = 0; $i = 0;
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100)
{ {
$tmp = explode('|', $reg[1]); $tmp = explode('|', $reg[1]);
if (!empty($tmp[1])) $langs->load($tmp[1]); if (!empty($tmp[1])) $langs->load($tmp[1]);
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE); $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\('.preg_quote($reg[1]).'\)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE);
$i++; $i++;
} }
print "\n<!-- Start of welcome text for setup page -->\n"; print "\n<!-- Start of welcome text for setup page -->\n";
print '<table width="100%" class="notopnoleftnoright"><tr><td>'; print '<table width="100%" class="notopnoleftnoright"><tr><td>';
print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE); print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
print '</td></tr></table><br>'; print '</td></tr></table><br>';
print "\n<!-- End of welcome text for setup page -->\n"; print "\n<!-- End of welcome text for setup page -->\n";
} }
} }
print '<span class="opacitymedium hideonsmartphone">'; print '<span class="opacitymedium hideonsmartphone">';
@ -109,7 +109,7 @@ print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))
{ {
// Show into other // Show into other
print '<span class="opacitymedium">'.$langs->trans("SetupDescription5")."</span><br>"; print '<span class="opacitymedium">'.$langs->trans("SetupDescription5")."</span><br>";
print "<br>"; print "<br>";
// Show logo // Show logo

View File

@ -61,19 +61,19 @@ if ($action == 'setvalue' && $user->admin)
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPID', GETPOST("fieldgroupid", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++; if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPID', GETPOST("fieldgroupid", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
// This one must be after the others // This one must be after the others
$valkey = ''; $valkey = '';
$key = GETPOST("key"); $key = GETPOST("key");
if ($key) $valkey = $conf->global->$key; if ($key) $valkey = $conf->global->$key;
if (!dolibarr_set_const($db, 'LDAP_KEY_GROUPS', $valkey, 'chaine', 0, '', $conf->entity)) $error++; if (!dolibarr_set_const($db, 'LDAP_KEY_GROUPS', $valkey, 'chaine', 0, '', $conf->entity)) $error++;
if (!$error) if (!$error)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
} }

View File

@ -35,8 +35,8 @@ $action = GETPOST('action', 'aZ09');
$currencycode = GETPOST('currencycode', 'alpha'); $currencycode = GETPOST('currencycode', 'alpha');
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) { if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
// When MULTICURRENCY_USE_LIMIT_BY_CURRENCY is on, we use always a defined currency code instead of '' even for default. // When MULTICURRENCY_USE_LIMIT_BY_CURRENCY is on, we use always a defined currency code instead of '' even for default.
$currencycode = (!empty($currencycode) ? $currencycode : $conf->currency); $currencycode = (!empty($currencycode) ? $currencycode : $conf->currency);
} }
$mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(!empty($currencycode) ? '_'.$currencycode : ''); $mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(!empty($currencycode) ? '_'.$currencycode : '');
@ -56,41 +56,41 @@ if ($action == 'update')
if ($_POST[$mainmaxdecimalsunit] > $MAXDEC if ($_POST[$mainmaxdecimalsunit] > $MAXDEC
|| $_POST[$mainmaxdecimalstot] > $MAXDEC || $_POST[$mainmaxdecimalstot] > $MAXDEC
|| $_POST[$mainmaxdecimalsshown] > $MAXDEC) || $_POST[$mainmaxdecimalsshown] > $MAXDEC)
{ {
$error++; $error++;
setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors'); setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
} }
if ($_POST[$mainmaxdecimalsunit].(!empty($currencycode) ? '_'.$currencycode : '') < 0 if ($_POST[$mainmaxdecimalsunit].(!empty($currencycode) ? '_'.$currencycode : '') < 0
|| $_POST[$mainmaxdecimalstot] < 0 || $_POST[$mainmaxdecimalstot] < 0
|| $_POST[$mainmaxdecimalsshown] < 0) || $_POST[$mainmaxdecimalsshown] < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors'); setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
} }
if ($valmainroundingruletot) if ($valmainroundingruletot)
{ {
if ($valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1) if ($valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1)
{ {
$langs->load("errors"); $langs->load("errors");
$error++; $error++;
setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors'); setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors');
} }
} }
if (!$error) if (!$error)
{ {
dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, $mainmaxdecimalsshown, $valmainmaxdecimalsshown, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $mainmaxdecimalsshown, $valmainmaxdecimalsshown, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, $mainroundingruletot, $valmainroundingruletot, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $mainroundingruletot, $valmainroundingruletot, 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(!empty($currencycode) ? '&currencycode='.$currencycode : '')); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(!empty($currencycode) ? '&currencycode='.$currencycode : ''));
exit; exit;
} }
} }
@ -134,67 +134,67 @@ print "<br>\n";
if ($action == 'edit') if ($action == 'edit')
{ {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) { if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
print '<input type="hidden" name="currencycode" value="'.$currencycode.'">'; print '<input type="hidden" name="currencycode" value="'.$currencycode.'">';
} }
clearstatcache(); clearstatcache();
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsunit) ? $conf->global->$mainmaxdecimalsunit : $conf->global->MAIN_MAX_DECIMALS_UNIT).'"></td></tr>'; print '</td><td><input class="flat" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsunit) ? $conf->global->$mainmaxdecimalsunit : $conf->global->MAIN_MAX_DECIMALS_UNIT).'"></td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="'.$mainmaxdecimalstot.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalstot) ? $conf->global->$mainmaxdecimalstot : $conf->global->MAIN_MAX_DECIMALS_TOT).'"></td></tr>'; print '</td><td><input class="flat" name="'.$mainmaxdecimalstot.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalstot) ? $conf->global->$mainmaxdecimalstot : $conf->global->MAIN_MAX_DECIMALS_TOT).'"></td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
print '<td><input class="flat" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsshown) ? $conf->global->$mainmaxdecimalsshown : $conf->global->MAIN_MAX_DECIMALS_SHOWN).'"></td></tr>'; print '<td><input class="flat" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsshown) ? $conf->global->$mainmaxdecimalsshown : $conf->global->MAIN_MAX_DECIMALS_SHOWN).'"></td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="'.$mainroundingruletot.'" size="3" value="'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : $conf->global->MAIN_ROUNDING_RULE_TOT).'"></td></tr>'; print '</td><td><input class="flat" name="'.$mainroundingruletot.'" size="3" value="'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : $conf->global->MAIN_ROUNDING_RULE_TOT).'"></td></tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
print '<div class="center">'; print '<div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">'; print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '</div>'; print '</div>';
print '<br>'; print '<br>';
print '</form>'; print '</form>';
print '<br>'; print '<br>';
} else { } else {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalsunit) ? $conf->global->$mainmaxdecimalsunit : $conf->global->MAIN_MAX_DECIMALS_UNIT).'</td></tr>'; print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalsunit) ? $conf->global->$mainmaxdecimalsunit : $conf->global->MAIN_MAX_DECIMALS_UNIT).'</td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalstot) ? $conf->global->$mainmaxdecimalstot : $conf->global->MAIN_MAX_DECIMALS_TOT).'</td></tr>'; print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalstot) ? $conf->global->$mainmaxdecimalstot : $conf->global->MAIN_MAX_DECIMALS_TOT).'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
print '<td align="right">'.(isset($conf->global->$mainmaxdecimalsshown) ? $conf->global->$mainmaxdecimalsshown : $conf->global->MAIN_MAX_DECIMALS_SHOWN).'</td></tr>'; print '<td align="right">'.(isset($conf->global->$mainmaxdecimalsshown) ? $conf->global->$mainmaxdecimalsshown : $conf->global->MAIN_MAX_DECIMALS_SHOWN).'</td></tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : $conf->global->MAIN_ROUNDING_RULE_TOT).'</td></tr>'; print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : $conf->global->MAIN_ROUNDING_RULE_TOT).'</td></tr>';
print '</table>'; print '</table>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit'.(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit'.(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
} }
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY))
@ -248,59 +248,59 @@ if (empty($mysoc->country_code))
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
if ($num) if ($num)
{ {
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$vat_rates[] = array('vat_rate'=>$obj->vat_rate, 'code'=>$obj->vat_code, 'localtax_rate1'=>$obj->localtax_rate1, 'locltax_rate2'=>$obj->localtax_rate2); $vat_rates[] = array('vat_rate'=>$obj->vat_rate, 'code'=>$obj->vat_code, 'localtax_rate1'=>$obj->localtax_rate1, 'locltax_rate2'=>$obj->localtax_rate2);
} }
} }
} else dol_print_error($db); } else dol_print_error($db);
if (count($vat_rates)) if (count($vat_rates))
{ {
foreach ($vat_rates as $vatarray) foreach ($vat_rates as $vatarray)
{ {
$vat = $vatarray['vat_rate']; $vat = $vatarray['vat_rate'];
for ($qty = 1; $qty <= 2; $qty++) for ($qty = 1; $qty <= 2; $qty++)
{ {
$vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : ''); $vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
$localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc); $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
$s = 10 / 3; $s = 10 / 3;
$tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU'); print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty; print " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%'; print " - ".$langs->trans("VAT").": ".$vat.'%';
print ($vatarray['code'] ? ' ('.$vatarray['code'].')' : ''); print ($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> "; print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ";
print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2]; print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2];
print "<br>\n"; print "<br>\n";
} }
} }
} else { } else {
// More examples if not specific vat rate found // More examples if not specific vat rate found
// This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10) // This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10)
// were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule. // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule.
$localtax_array = array(); $localtax_array = array();
$s = 10 / 3; $qty = 1; $vat = 10; $s = 10 / 3; $qty = 1; $vat = 10;
$tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU'); print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty; print " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%'; print " - ".$langs->trans("VAT").": ".$vat.'%';
print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n"; print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
$s = 10 / 3; $qty = 2; $vat = 10; $s = 10 / 3; $qty = 2; $vat = 10;
$tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array);
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU'); print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty; print " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%'; print " - ".$langs->trans("VAT").": ".$vat.'%';
print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n"; print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
} }
} }

View File

@ -33,7 +33,7 @@ $langs->loadLangs(array('admin', 'loan'));
// Security check // Security check
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -50,22 +50,22 @@ $list = array(
if ($action == 'update') if ($action == 'update')
{ {
$error = 0; $error = 0;
foreach ($list as $constname) { foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++; $error++;
} }
} }
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
/* /*

View File

@ -63,53 +63,53 @@ if ($action == 'update' || $action == 'add')
} }
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
// Action activation d'un sous module du module adherent // Action activation d'un sous module du module adherent
if ($action == 'set') if ($action == 'set')
{ {
$result = dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity); $result = dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity);
if ($result < 0) if ($result < 0)
{ {
dol_print_error($db); dol_print_error($db);
} }
} }
// Action desactivation d'un sous module du module adherent // Action desactivation d'un sous module du module adherent
if ($action == 'unset') if ($action == 'unset')
{ {
$result = dolibarr_del_const($db, $_GET["name"], $conf->entity); $result = dolibarr_del_const($db, $_GET["name"], $conf->entity);
if ($result < 0) if ($result < 0)
{ {
dol_print_error($db); dol_print_error($db);
} }
} }
if (($action == 'testsubscribe' || $action == 'testunsubscribe') && !empty($conf->global->ADHERENT_USE_MAILMAN)) if (($action == 'testsubscribe' || $action == 'testunsubscribe') && !empty($conf->global->ADHERENT_USE_MAILMAN))
{ {
$email = GETPOST($action.'email'); $email = GETPOST($action.'email');
if (!isValidEmail($email)) if (!isValidEmail($email))
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors'); setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors');
} else { } else {
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
$mailmanspip = new MailmanSpip($db); $mailmanspip = new MailmanSpip($db);
$object = new stdClass(); $object = new stdClass();
$object->email = $email; $object->email = $email;
$object->pass = $email; $object->pass = $email;
/*$object->element='member'; /*$object->element='member';
$object->type='Preferred Partners'; */ $object->type='Preferred Partners'; */
if ($action == 'testsubscribe') if ($action == 'testsubscribe')
{ {
$result = $mailmanspip->add_to_mailman($object); $result = $mailmanspip->add_to_mailman($object);
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
@ -117,19 +117,19 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && !empty($conf
} else { } else {
setEventMessages($langs->trans("MailmanCreationSuccess"), null); setEventMessages($langs->trans("MailmanCreationSuccess"), null);
} }
} }
if ($action == 'testunsubscribe') if ($action == 'testunsubscribe')
{ {
$result = $mailmanspip->del_to_mailman($object); $result = $mailmanspip->del_to_mailman($object);
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors'); setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors');
} else { } else {
setEventMessages($langs->trans("MailmanDeletionSuccess"), null); setEventMessages($langs->trans("MailmanDeletionSuccess"), null);
} }
} }
} }
} }
@ -149,31 +149,31 @@ $head = mailmanspip_admin_prepare_head();
if (!empty($conf->global->ADHERENT_USE_MAILMAN)) if (!empty($conf->global->ADHERENT_USE_MAILMAN))
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print dol_get_fiche_head($head, 'mailman', $langs->trans("Setup"), -1, 'user'); print dol_get_fiche_head($head, 'mailman', $langs->trans("Setup"), -1, 'user');
//$link=img_picto($langs->trans("Active"),'tick').' '; //$link=img_picto($langs->trans("Active"),'tick').' ';
$link = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unset&token='.newToken().'&value=0&name=ADHERENT_USE_MAILMAN">'; $link = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unset&token='.newToken().'&value=0&name=ADHERENT_USE_MAILMAN">';
//$link.=$langs->trans("Disable"); //$link.=$langs->trans("Disable");
$link .= img_picto($langs->trans("Activated"), 'switch_on'); $link .= img_picto($langs->trans("Activated"), 'switch_on');
$link .= '</a>'; $link .= '</a>';
// Edition des varibales globales // Edition des varibales globales
$constantes = array( $constantes = array(
'ADHERENT_MAILMAN_ADMINPW', 'ADHERENT_MAILMAN_ADMINPW',
'ADHERENT_MAILMAN_URL', 'ADHERENT_MAILMAN_URL',
'ADHERENT_MAILMAN_UNSUB_URL', 'ADHERENT_MAILMAN_UNSUB_URL',
'ADHERENT_MAILMAN_LISTS' 'ADHERENT_MAILMAN_LISTS'
); );
print load_fiche_titre($langs->trans('MailmanTitle'), $link, ''); print load_fiche_titre($langs->trans('MailmanTitle'), $link, '');
print '<br>'; print '<br>';
// JQuery activity // JQuery activity
print '<script type="text/javascript"> print '<script type="text/javascript">
var i1=0; var i1=0;
var i2=0; var i2=0;
var i3=0; var i3=0;
@ -193,48 +193,48 @@ if (!empty($conf->global->ADHERENT_USE_MAILMAN))
}); });
</script>'; </script>';
form_constantes($constantes, 2); form_constantes($constantes, 2);
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>'; print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>';
print dol_get_fiche_end(); print dol_get_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>'; print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print '</form>'; print '</form>';
} else { } else {
print dol_get_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); print dol_get_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
$link = '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value=1&name=ADHERENT_USE_MAILMAN">'; $link = '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value=1&name=ADHERENT_USE_MAILMAN">';
//$link.=img_$langs->trans("Activate") //$link.=img_$langs->trans("Activate")
$link .= img_picto($langs->trans("Disabled"), 'switch_off'); $link .= img_picto($langs->trans("Disabled"), 'switch_off');
$link .= '</a>'; $link .= '</a>';
print load_fiche_titre($langs->trans('MailmanTitle'), $link, ''); print load_fiche_titre($langs->trans('MailmanTitle'), $link, '');
print dol_get_fiche_end(); print dol_get_fiche_end();
} }
if (!empty($conf->global->ADHERENT_USE_MAILMAN)) if (!empty($conf->global->ADHERENT_USE_MAILMAN))
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'">'; print '<form action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="testsubscribe">'; print '<input type="hidden" name="action" value="testsubscribe">';
print $langs->trans("TestSubscribe").'<br>'; print $langs->trans("TestSubscribe").'<br>';
print $langs->trans("EMail").' <input type="email" class="flat" name="testsubscribeemail" value="'.GETPOST('testsubscribeemail').'"> <input class="button" type="submit" value="'.$langs->trans("Test").'"><br>'; print $langs->trans("EMail").' <input type="email" class="flat" name="testsubscribeemail" value="'.GETPOST('testsubscribeemail').'"> <input class="button" type="submit" value="'.$langs->trans("Test").'"><br>';
print '</form>'; print '</form>';
print '<form action="'.$_SERVER["PHP_SELF"].'">'; print '<form action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="testunsubscribe">'; print '<input type="hidden" name="action" value="testunsubscribe">';
print $langs->trans("TestUnSubscribe").'<br>'; print $langs->trans("TestUnSubscribe").'<br>';
print $langs->trans("EMail").' <input type="email" class="flat" name="testunsubscribeemail" value="'.GETPOST('testunsubscribeemail').'"> <input class="button" type="submit" value="'.$langs->trans("Test").'"><br>'; print $langs->trans("EMail").' <input type="email" class="flat" name="testunsubscribeemail" value="'.GETPOST('testunsubscribeemail').'"> <input class="button" type="submit" value="'.$langs->trans("Test").'"><br>';
print '</form>'; print '</form>';
} }
// End of page // End of page

View File

@ -67,18 +67,18 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
if ($action == 'update' && !$cancel) if ($action == 'update' && !$cancel)
{ {
if (! $error && ! GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml')) { if (!$error && !GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml')) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MAIN_MAIL_EMAIL_FROM")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MAIN_MAIL_EMAIL_FROM")), null, 'errors');
$action = 'edit'; $action = 'edit';
} }
if (! $error && ! isValidEmail(GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml'))) { if (!$error && !isValidEmail(GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml'))) {
$error++; $error++;
setEventMessages($langs->trans("ErrorBadEMail", GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml')), null, 'errors'); setEventMessages($langs->trans("ErrorBadEMail", GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml')), null, 'errors');
$action = 'edit'; $action = 'edit';
} }
if (! $error) { if (!$error) {
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT", 'int'), 'chaine', 0, '', $conf->entity);
@ -188,13 +188,13 @@ if ($action == 'edit')
jQuery("#smtp_server_mess").show(); jQuery("#smtp_server_mess").show();
jQuery("#smtp_port_mess").show();'; jQuery("#smtp_port_mess").show();';
} else { } else {
print ' print '
jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true); jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true);
jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true); jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true);
jQuery("#smtp_server_mess").hide(); jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();'; jQuery("#smtp_port_mess").hide();';
} }
print ' print '
} }
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\') if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\')
{ {
@ -266,7 +266,7 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").val(0); jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").val(0);
}); });
})'; })';
print '</script>'."\n"; print '</script>'."\n";
} }
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
@ -409,8 +409,8 @@ if ($action == 'edit')
print '</td></tr>'; print '</td></tr>';
} }
// TLS // TLS
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
{ {
if (function_exists('openssl_open')) if (function_exists('openssl_open'))
@ -453,20 +453,20 @@ if ($action == 'edit')
} else print yn(0).' ('.$langs->trans("NotSupported").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
// DKIM Domain // DKIM Domain
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>'; print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_DOMAIN" name="MAIN_MAIL_EMAIL_DKIM_DOMAIN" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN : ''); print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_DOMAIN" name="MAIN_MAIL_EMAIL_DKIM_DOMAIN" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN : '');
print '"></td></tr>'; print '"></td></tr>';
// DKIM Selector // DKIM Selector
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>'; print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_SELECTOR" name="MAIN_MAIL_EMAIL_DKIM_SELECTOR" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR : ''); print '<td><input class="flat" id="MAIN_MAIL_EMAIL_DKIM_SELECTOR" name="MAIN_MAIL_EMAIL_DKIM_SELECTOR" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR : '');
print '"></td></tr>'; print '"></td></tr>';
// DKIM PRIVATE KEY // DKIM PRIVATE KEY
print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>'; print '<tr class="oddeven dkim"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>';
print '<td><textarea id="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" name="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" rows="15" cols="100">'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY : '').'</textarea>'; print '<td><textarea id="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" name="MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY" rows="15" cols="100">'.(!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY : '').'</textarea>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@ -635,20 +635,20 @@ if ($action == 'edit')
} else print yn(0).' ('.$langs->trans("NotSupported").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
// Domain // Domain
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN; print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
print '</td></tr>'; print '</td></tr>';
// Selector // Selector
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR; print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
print '</td></tr>'; print '</td></tr>';
// PRIVATE KEY // PRIVATE KEY
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY; print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY;
print '</td></tr>'; print '</td></tr>';
} }
print '</table>'; print '</table>';

View File

@ -60,7 +60,7 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
if ($action == 'update' && empty($_POST["cancel"])) if ($action == 'update' && empty($_POST["cancel"]))
{ {
// Send mode parameters // Send mode parameters
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE_EMAILING", GETPOST("MAIN_MAIL_SENDMODE_EMAILING"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_SENDMODE_EMAILING", GETPOST("MAIN_MAIL_SENDMODE_EMAILING"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_EMAILING", GETPOST("MAIN_MAIL_SMTP_PORT_EMAILING"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_EMAILING", GETPOST("MAIN_MAIL_SMTP_PORT_EMAILING"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_EMAILING", GETPOST("MAIN_MAIL_SMTP_SERVER_EMAILING"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_EMAILING", GETPOST("MAIN_MAIL_SMTP_SERVER_EMAILING"), 'chaine', 0, '', $conf->entity);
@ -382,22 +382,22 @@ if ($action == 'edit')
} else print yn(0).' ('.$langs->trans("NotSupported").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print dol_get_fiche_end(); print dol_get_fiche_end();
print '<br><div class="center">'; print '<br><div class="center">';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">'; print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} else { } else {
print dol_get_fiche_head($head, 'common_emailing', '', -1); print dol_get_fiche_head($head, 'common_emailing', '', -1);
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@ -478,10 +478,10 @@ if ($action == 'edit')
print dol_get_fiche_end(); print dol_get_fiche_end();
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{ {
print '<br>'; print '<br>';
/* /*
// Warning 1 // Warning 1
if ($linuxlike) if ($linuxlike)
{ {
@ -491,12 +491,12 @@ if ($action == 'edit')
print info_admin($langs->trans("SendmailOptionNotComplete")); print info_admin($langs->trans("SendmailOptionNotComplete"));
} }
}*/ }*/
// Warning 2 // Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA")); print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
} }
// Buttons for actions // Buttons for actions
print '<div class="tabsAction">'; print '<div class="tabsAction">';
@ -527,8 +527,8 @@ if ($action == 'edit')
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && !in_array($action, array('testconnect', 'test', 'testhtml'))) if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && !in_array($action, array('testconnect', 'test', 'testhtml')))
{ {
$text = $langs->trans("WarningPHPMail"); $text = $langs->trans("WarningPHPMail");
print info_admin($text); print info_admin($text);
} }
// Run the test to connect // Run the test to connect
@ -556,7 +556,7 @@ if ($action == 'edit')
// Show email send test form // Show email send test form
if ($action == 'test' || $action == 'testhtml') if ($action == 'test' || $action == 'testhtml')
{ {
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>'; print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend")); print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend"));
print dol_get_fiche_head(''); print dol_get_fiche_head('');
@ -592,7 +592,7 @@ if ($action == 'edit')
$formmail->param["returnurl"] = $_SERVER["PHP_SELF"]; $formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
// Init list of files // Init list of files
if (GETPOST("mode") == 'init') if (GETPOST("mode") == 'init')
{ {
$formmail->clear_attached_files(); $formmail->clear_attached_files();
} }

View File

@ -274,7 +274,7 @@ if (empty($reshook))
if (GETPOST($keycode) == '' && $keycode != 'langcode') $sql .= "null"; // langcode must be '' if not defined so the unique key that include lang will work if (GETPOST($keycode) == '' && $keycode != 'langcode') $sql .= "null"; // langcode must be '' if not defined so the unique key that include lang will work
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'fk_user') { elseif ($keycode == 'fk_user') {
if (! $user->admin) { // A non admin user can only edit its own template if (!$user->admin) { // A non admin user can only edit its own template
$sql .= " ".((int) $user->id); $sql .= " ".((int) $user->id);
} else { } else {
$sql .= " ".((int) GETPOST($keycode, 'fk_user')); $sql .= " ".((int) GETPOST($keycode, 'fk_user'));
@ -333,7 +333,7 @@ if (empty($reshook))
if (GETPOST($keycode) == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && !GETPOST($keycode))) $sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work if (GETPOST($keycode) == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && !GETPOST($keycode))) $sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'fk_user') { elseif ($keycode == 'fk_user') {
if (! $user->admin) { // A non admin user can only edit its own template if (!$user->admin) { // A non admin user can only edit its own template
$sql .= " ".((int) $user->id); $sql .= " ".((int) $user->id);
} else { } else {
$sql .= " ".((int) GETPOST($keycode, 'fk_user')); $sql .= " ".((int) GETPOST($keycode, 'fk_user'));
@ -350,7 +350,7 @@ if (empty($reshook))
} }
$sql .= " WHERE ".$rowidcol." = ".((int) $rowid); $sql .= " WHERE ".$rowidcol." = ".((int) $rowid);
if (! $user->admin) { // A non admin user can only edit its own template if (!$user->admin) { // A non admin user can only edit its own template
$sql .= " AND fk_user = ".$user->id; $sql .= " AND fk_user = ".$user->id;
} }
//print $sql;exit; //print $sql;exit;
@ -371,7 +371,7 @@ if (empty($reshook))
$rowidcol = "rowid"; $rowidcol = "rowid";
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."=".((int) $rowid); $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."=".((int) $rowid);
if (! $user->admin) { // A non admin user can only edit its own template if (!$user->admin) { // A non admin user can only edit its own template
$sql .= " AND fk_user = ".$user->id; $sql .= " AND fk_user = ".$user->id;
} }
dol_syslog("delete", LOG_DEBUG); dol_syslog("delete", LOG_DEBUG);
@ -493,7 +493,7 @@ if ($action == 'view') {
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); } if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); } if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Code"); } if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Code"); }
if ($fieldlist[$field] == 'type_template') { $valuetoshow = $langs->trans("TypeOfTemplate"); $align="center"; } if ($fieldlist[$field] == 'type_template') { $valuetoshow = $langs->trans("TypeOfTemplate"); $align = "center"; }
if ($fieldlist[$field] == 'private') { $align = 'center'; } if ($fieldlist[$field] == 'private') { $align = 'center'; }
if ($fieldlist[$field] == 'position') { $align = 'center'; } if ($fieldlist[$field] == 'position') { $align = 'center'; }
@ -795,13 +795,13 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
} else { } else {
if ($obj->module) { if ($obj->module) {
$tempmodulekey = $obj->module; $tempmodulekey = $obj->module;
if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) { if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
$i++; $i++;
continue; continue;
} }
} }
$keyforobj = 'type_template'; $keyforobj = 'type_template';
if (!in_array($obj->$keyforobj, array_keys($elementList))) if (!in_array($obj->$keyforobj, array_keys($elementList)))
{ {

View File

@ -60,7 +60,7 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
if ($action == 'update' && empty($_POST["cancel"])) if ($action == 'update' && empty($_POST["cancel"]))
{ {
// Send mode parameters // Send mode parameters
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE_TICKET", GETPOST("MAIN_MAIL_SENDMODE_TICKET"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_SENDMODE_TICKET", GETPOST("MAIN_MAIL_SENDMODE_TICKET"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_TICKET", GETPOST("MAIN_MAIL_SMTP_PORT_TICKET"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_TICKET", GETPOST("MAIN_MAIL_SMTP_PORT_TICKET"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_TICKET", GETPOST("MAIN_MAIL_SMTP_SERVER_TICKET"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_TICKET", GETPOST("MAIN_MAIL_SMTP_SERVER_TICKET"), 'chaine', 0, '', $conf->entity);
@ -359,22 +359,22 @@ if ($action == 'edit')
} else print yn(0).' ('.$langs->trans("NotSupported").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print dol_get_fiche_end(); print dol_get_fiche_end();
print '<br><div class="center">'; print '<br><div class="center">';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">'; print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} else { } else {
print dol_get_fiche_head($head, 'common_ticket', '', -1); print dol_get_fiche_head($head, 'common_ticket', '', -1);
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@ -444,10 +444,10 @@ if ($action == 'edit')
print dol_get_fiche_end(); print dol_get_fiche_end();
if ($conf->global->MAIN_MAIL_SENDMODE_TICKET == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) if ($conf->global->MAIN_MAIL_SENDMODE_TICKET == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{ {
print '<br>'; print '<br>';
/* /*
// Warning 1 // Warning 1
if ($linuxlike) if ($linuxlike)
{ {
@ -457,12 +457,12 @@ if ($action == 'edit')
print info_admin($langs->trans("SendmailOptionNotComplete")); print info_admin($langs->trans("SendmailOptionNotComplete"));
} }
}*/ }*/
// Warning 2 // Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA")); print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
} }
// Buttons for actions // Buttons for actions
print '<div class="tabsAction">'; print '<div class="tabsAction">';
@ -493,8 +493,8 @@ if ($action == 'edit')
if ($conf->global->MAIN_MAIL_SENDMODE_TICKET == 'mail' && !in_array($action, array('testconnect', 'test', 'testhtml'))) if ($conf->global->MAIN_MAIL_SENDMODE_TICKET == 'mail' && !in_array($action, array('testconnect', 'test', 'testhtml')))
{ {
$text = $langs->trans("WarningPHPMail"); $text = $langs->trans("WarningPHPMail");
print info_admin($text); print info_admin($text);
} }
// Run the test to connect // Run the test to connect
@ -522,7 +522,7 @@ if ($action == 'edit')
// Show email send test form // Show email send test form
if ($action == 'test' || $action == 'testhtml') if ($action == 'test' || $action == 'testhtml')
{ {
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>'; print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend")); print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend"));
print dol_get_fiche_head(''); print dol_get_fiche_head('');
@ -558,7 +558,7 @@ if ($action == 'edit')
$formmail->param["returnurl"] = $_SERVER["PHP_SELF"]; $formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
// Init list of files // Init list of files
if (GETPOST("mode") == 'init') if (GETPOST("mode") == 'init')
{ {
$formmail->clear_attached_files(); $formmail->clear_attached_files();
} }

View File

@ -38,8 +38,8 @@ $dirsmartphone = array();
$dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']); $dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
foreach ($dirmenus as $dirmenu) foreach ($dirmenus as $dirmenu)
{ {
$dirstandard[] = $dirmenu.'standard'; $dirstandard[] = $dirmenu.'standard';
$dirsmartphone[] = $dirmenu.'smartphone'; $dirsmartphone[] = $dirmenu.'smartphone';
} }
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -244,13 +244,13 @@ if ($action == 'delete')
$result = $db->query($sql); $result = $db->query($sql);
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".GETPOST('menuId', 'int'), $langs->trans("DeleteMenu"), $langs->trans("ConfirmDeleteMenu", $obj->title), "confirm_delete"); print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".GETPOST('menuId', 'int'), $langs->trans("DeleteMenu"), $langs->trans("ConfirmDeleteMenu", $obj->title), "confirm_delete");
} }
$newcardbutton = ''; $newcardbutton = '';
if ($user->admin) if ($user->admin)
{ {
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&action=create&menu_handler='.urlencode($menu_handler).'&backtopage='.urlencode($_SERVER['PHP_SELF'])); $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&action=create&menu_handler='.urlencode($menu_handler).'&backtopage='.urlencode($_SERVER['PHP_SELF']));
} }
print '<form name="newmenu" class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'">'; print '<form name="newmenu" class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'">';
@ -297,7 +297,7 @@ if ($conf->use_javascript_ajax)
//il faut d'abord declarer un element racine de l'arbre //il faut d'abord declarer un element racine de l'arbre
$data[] = array('rowid'=>0, 'fk_menu'=>-1, 'title'=>"racine", 'mainmenu'=>'', 'leftmenu'=>'', 'fk_mainmenu'=>'', 'fk_leftmenu'=>''); $data[] = array('rowid'=>0, 'fk_menu'=>-1, 'title'=>"racine", 'mainmenu'=>'', 'leftmenu'=>'', 'fk_mainmenu'=>'', 'fk_leftmenu'=>'');
//puis tous les elements enfants //puis tous les elements enfants
@ -337,16 +337,16 @@ if ($conf->use_javascript_ajax)
$data[] = array( $data[] = array(
'rowid'=>$menu['rowid'], 'rowid'=>$menu['rowid'],
'module'=>$menu['module'], 'module'=>$menu['module'],
'fk_menu'=>$menu['fk_menu'], 'fk_menu'=>$menu['fk_menu'],
'title'=>$titre, 'title'=>$titre,
'mainmenu'=>$menu['mainmenu'], 'mainmenu'=>$menu['mainmenu'],
'leftmenu'=>$menu['leftmenu'], 'leftmenu'=>$menu['leftmenu'],
'fk_mainmenu'=>$menu['fk_mainmenu'], 'fk_mainmenu'=>$menu['fk_mainmenu'],
'fk_leftmenu'=>$menu['fk_leftmenu'], 'fk_leftmenu'=>$menu['fk_leftmenu'],
'position'=>$menu['position'], 'position'=>$menu['position'],
'entry'=>$entry, 'entry'=>$entry,
'buttons'=>$buttons 'buttons'=>$buttons
); );
$i++; $i++;
} }
@ -369,36 +369,36 @@ if ($conf->use_javascript_ajax)
// Process remaining records (records that are not linked to root by any path) // Process remaining records (records that are not linked to root by any path)
$remainingdata = array(); $remainingdata = array();
foreach ($data as $datar) foreach ($data as $datar)
{ {
if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue; if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue;
$remainingdata[] = $datar; $remainingdata[] = $datar;
} }
if (count($remainingdata)) if (count($remainingdata))
{ {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("NotTopTreeMenuPersonalized").'</td>'; print '<td>'.$langs->trans("NotTopTreeMenuPersonalized").'</td>';
print '<td class="right"></td>'; print '<td class="right"></td>';
print '</tr>'; print '</tr>';
print '<tr>'; print '<tr>';
print '<td colspan="2">'; print '<td colspan="2">';
foreach ($remainingdata as $datar) foreach ($remainingdata as $datar)
{ {
$father = array('rowid'=>$datar['rowid'], 'title'=>"???", 'mainmenu'=>$datar['fk_mainmenu'], 'leftmenu'=>$datar['fk_leftmenu'], 'fk_mainmenu'=>'', 'fk_leftmenu'=>''); $father = array('rowid'=>$datar['rowid'], 'title'=>"???", 'mainmenu'=>$datar['fk_mainmenu'], 'leftmenu'=>$datar['fk_leftmenu'], 'fk_mainmenu'=>'', 'fk_leftmenu'=>'');
//print 'Start with rowid='.$datar['rowid'].' mainmenu='.$father ['mainmenu'].' leftmenu='.$father ['leftmenu'].'<br>'."\n"; //print 'Start with rowid='.$datar['rowid'].' mainmenu='.$father ['mainmenu'].' leftmenu='.$father ['leftmenu'].'<br>'."\n";
tree_recur($data, $father, 0, 'iddivjstree'.$datar['rowid'], 1, 1); tree_recur($data, $father, 0, 'iddivjstree'.$datar['rowid'], 1, 1);
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
} }
print '</div>'; print '</div>';

View File

@ -91,106 +91,106 @@ foreach ($modulesdir as $dir)
while (($file = readdir($handle)) !== false) while (($file = readdir($handle)) !== false)
{ {
//print "$i ".$file."\n<br>"; //print "$i ".$file."\n<br>";
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{ {
$modName = substr($file, 0, dol_strlen($file) - 10); $modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName) if ($modName)
{ {
if (!empty($modNameLoaded[$modName])) if (!empty($modNameLoaded[$modName]))
{ {
$mesg = "Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>"; $mesg = "Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
setEventMessages($mesg, null, 'warnings'); setEventMessages($mesg, null, 'warnings');
dol_syslog($mesg, LOG_ERR); dol_syslog($mesg, LOG_ERR);
continue; continue;
} }
try { try {
$res = include_once $dir.$file; $res = include_once $dir.$file;
if (class_exists($modName)) if (class_exists($modName))
{ {
try { try {
$objMod = new $modName($db); $objMod = new $modName($db);
$modNameLoaded[$modName] = $dir; $modNameLoaded[$modName] = $dir;
if (!$objMod->numero > 0 && $modName != 'modUser') if (!$objMod->numero > 0 && $modName != 'modUser')
{ {
dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR); dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
} }
$j = $objMod->numero; $j = $objMod->numero;
$modulequalified = 1; $modulequalified = 1;
// We discard modules according to features level (PS: if module is activated we always show it) // We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified = 0; if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified = 0;
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified = 0; if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified = 0;
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified = 0; if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified = 0;
// We discard modules according to property disabled // We discard modules according to property disabled
//if (! empty($objMod->hidden)) $modulequalified=0; //if (! empty($objMod->hidden)) $modulequalified=0;
if ($modulequalified > 0) if ($modulequalified > 0)
{ {
$publisher = dol_escape_htmltag($objMod->getPublisher()); $publisher = dol_escape_htmltag($objMod->getPublisher());
$external = ($objMod->isCoreOrExternalModule() == 'external'); $external = ($objMod->isCoreOrExternalModule() == 'external');
if ($external) if ($external)
{ {
if ($publisher) if ($publisher)
{ {
$arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher; $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
} else { } else {
$arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers"); $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
} }
} }
ksort($arrayofnatures); ksort($arrayofnatures);
} }
// Define array $categ with categ with at least one qualified module // Define array $categ with categ with at least one qualified module
if ($modulequalified > 0) if ($modulequalified > 0)
{ {
$modules[$i] = $objMod; $modules[$i] = $objMod;
$filename[$i] = $modName; $filename[$i] = $modName;
// Gives the possibility to the module, to provide his own family info and position of this family // Gives the possibility to the module, to provide his own family info and position of this family
if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) { if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
if (!is_array($familyinfo)) $familyinfo = array(); if (!is_array($familyinfo)) $familyinfo = array();
$familyinfo = array_merge($familyinfo, $objMod->familyinfo); $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
$familykey = key($objMod->familyinfo); $familykey = key($objMod->familyinfo);
} else { } else {
$familykey = $objMod->family; $familykey = $objMod->family;
} }
$moduleposition = ($objMod->module_position ? $objMod->module_position : '50'); $moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external')) if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external'))
{ {
$moduleposition = '80'; // External modules at end by default $moduleposition = '80'; // External modules at end by default
} }
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
$dirmod[$i] = $dir; $dirmod[$i] = $dir;
//print $i.'-'.$dirmod[$i].'<br>'; //print $i.'-'.$dirmod[$i].'<br>';
// Set categ[$i] // Set categ[$i]
$specialstring = 'unknown'; $specialstring = 'unknown';
if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring = 'expdev'; if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring = 'expdev';
if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories
else $categ[$specialstring] = 1; else $categ[$specialstring] = 1;
$j++; $j++;
$i++; $i++;
} else dol_syslog("Module ".get_class($objMod)." not qualified"); } else dol_syslog("Module ".get_class($objMod)." not qualified");
} catch (Exception $e) } catch (Exception $e)
{ {
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
} }
} else { } else {
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>"; print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
} }
} catch (Exception $e) } catch (Exception $e)
{ {
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
} }
} }
} }
} }
closedir($handle); closedir($handle);
} else { } else {
@ -208,16 +208,16 @@ unset($objMod);
$i = 0; $i = 0;
foreach ($orders as $tmpkey => $tmpvalue) foreach ($orders as $tmpkey => $tmpvalue)
{ {
$tmpMod = $modules[$tmpkey]; $tmpMod = $modules[$tmpkey];
if ($tmpMod->numero == $id) if ($tmpMod->numero == $id)
{ {
$key = $i; $key = $i;
$modName = $filename[$tmpkey]; $modName = $filename[$tmpkey];
$dirofmodule = $dirmod[$tmpkey]; $dirofmodule = $dirmod[$tmpkey];
$objMod = $tmpMod; $objMod = $tmpMod;
break; break;
} }
$i++; $i++;
} }
$value = $orders[$key]; $value = $orders[$key];
$tab = explode('_', $value); $tab = explode('_', $value);
@ -296,7 +296,7 @@ $versiontrans .= $objMod->getVersion(1);
$imginfo = "info"; $imginfo = "info";
if ($objMod->isCoreOrExternalModule() == 'external') if ($objMod->isCoreOrExternalModule() == 'external')
{ {
$imginfo = "info_black"; $imginfo = "info_black";
} }
// Define text of description of module // Define text of description of module
@ -304,138 +304,138 @@ $text = '';
if ($mode == 'desc') if ($mode == 'desc')
{ {
if ($moduledesc) $text .= '<br>'.$moduledesc.'<br><br><br>'; if ($moduledesc) $text .= '<br>'.$moduledesc.'<br><br><br>';
$text .= '<span class="opacitymedium">'.$langs->trans("Version").':</span> '.$version; $text .= '<span class="opacitymedium">'.$langs->trans("Version").':</span> '.$version;
$moduledescriptorfile = get_class($objMod).'.class.php'; $moduledescriptorfile = get_class($objMod).'.class.php';
$text .= '<br><span class="opacitymedium">'.$langs->trans("DescriptorFile").':</span> '.$moduledescriptorfile; $text .= '<br><span class="opacitymedium">'.$langs->trans("DescriptorFile").':</span> '.$moduledescriptorfile;
$textexternal = ''; $textexternal = '';
if ($objMod->isCoreOrExternalModule() == 'external') if ($objMod->isCoreOrExternalModule() == 'external')
{ {
$textexternal .= '<br><span class="opacitymedium">'.$langs->trans("Origin").':</span> '.$langs->trans("ExternalModule").' - '.$langs->trans("InstalledInto", $dirofmodule); $textexternal .= '<br><span class="opacitymedium">'.$langs->trans("Origin").':</span> '.$langs->trans("ExternalModule").' - '.$langs->trans("InstalledInto", $dirofmodule);
if ($objMod->editor_name != 'dolibarr') $textexternal .= '<br><span class="opacitymedium">'.$langs->trans("Publisher").':</span> '.(empty($objMod->editor_name) ? $langs->trans("Unknown") : $objMod->editor_name); if ($objMod->editor_name != 'dolibarr') $textexternal .= '<br><span class="opacitymedium">'.$langs->trans("Publisher").':</span> '.(empty($objMod->editor_name) ? $langs->trans("Unknown") : $objMod->editor_name);
$editor_url = $objMod->editor_url; $editor_url = $objMod->editor_url;
if (!preg_match('/^http/', $editor_url)) $editor_url = 'http://'.$editor_url; if (!preg_match('/^http/', $editor_url)) $editor_url = 'http://'.$editor_url;
if (!empty($objMod->editor_url) && !preg_match('/dolibarr\.org/i', $objMod->editor_url)) $textexternal .= ($objMod->editor_name != 'dolibarr' ? ' - ' : '').img_picto('', 'globe').' <a href="'.$editor_url.'" target="_blank">'.$objMod->editor_url.'</a>'; if (!empty($objMod->editor_url) && !preg_match('/dolibarr\.org/i', $objMod->editor_url)) $textexternal .= ($objMod->editor_name != 'dolibarr' ? ' - ' : '').img_picto('', 'globe').' <a href="'.$editor_url.'" target="_blank">'.$objMod->editor_url.'</a>';
$text .= $textexternal; $text .= $textexternal;
$text .= '<br>'; $text .= '<br>';
} else { } else {
$text .= '<br><span class="opacitymedium">'.$langs->trans("Origin").':</span> '.$langs->trans("Core").'<br>'; $text .= '<br><span class="opacitymedium">'.$langs->trans("Origin").':</span> '.$langs->trans("Core").'<br>';
} }
$moduledesclong = $objMod->getDescLong(); $moduledesclong = $objMod->getDescLong();
if ($moduledesclong) $text .= '<br><hr><div class="moduledesclong">'.$moduledesclong.'<div>'; if ($moduledesclong) $text .= '<br><hr><div class="moduledesclong">'.$moduledesclong.'<div>';
} }
if ($mode == 'feature') if ($mode == 'feature')
{ {
$text .= '<br><strong>'.$langs->trans("DependsOn").':</strong> '; $text .= '<br><strong>'.$langs->trans("DependsOn").':</strong> ';
if (count($objMod->depends)) $text .= join(',', $objMod->depends); if (count($objMod->depends)) $text .= join(',', $objMod->depends);
else $text .= $langs->trans("None"); else $text .= $langs->trans("None");
$text .= '<br><strong>'.$langs->trans("RequiredBy").':</strong> '; $text .= '<br><strong>'.$langs->trans("RequiredBy").':</strong> ';
if (count($objMod->requiredby)) $text .= join(',', $objMod->requiredby); if (count($objMod->requiredby)) $text .= join(',', $objMod->requiredby);
else $text .= $langs->trans("None"); else $text .= $langs->trans("None");
$text .= '<br><br>'; $text .= '<br><br>';
$text .= '<br><strong>'.$langs->trans("AddDataTables").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddDataTables").':</strong> ';
$sqlfiles = dol_dir_list(dol_buildpath($moduledir.'/sql/'), 'files', 0, 'llx.*\.sql', array('\.key\.sql', '\.sql\.back')); $sqlfiles = dol_dir_list(dol_buildpath($moduledir.'/sql/'), 'files', 0, 'llx.*\.sql', array('\.key\.sql', '\.sql\.back'));
if (count($sqlfiles) > 0) if (count($sqlfiles) > 0)
{ {
$text .= $langs->trans("Yes").' ('; $text .= $langs->trans("Yes").' (';
$i = 0; $i = 0;
foreach ($sqlfiles as $val) foreach ($sqlfiles as $val)
{ {
$text .= ($i ? ', ' : '').preg_replace('/\.sql$/', '', preg_replace('/llx_/', '', $val['name'])); $text .= ($i ? ', ' : '').preg_replace('/\.sql$/', '', preg_replace('/llx_/', '', $val['name']));
$i++; $i++;
} }
$text .= ')'; $text .= ')';
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddDictionaries").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib'])) if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
{ {
$i = 0; $i = 0;
foreach ($objMod->dictionaries['tablib'] as $val) foreach ($objMod->dictionaries['tablib'] as $val)
{ {
$text .= ($i ? ', ' : '').$val; $text .= ($i ? ', ' : '').$val;
$i++; $i++;
} }
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddData").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddData").':</strong> ';
$filedata = dol_buildpath($moduledir.'/sql/data.sql'); $filedata = dol_buildpath($moduledir.'/sql/data.sql');
if (dol_is_file($filedata)) if (dol_is_file($filedata))
{ {
$text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql)'; $text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql)';
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs)) if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
{ {
$i = 0; $i = 0;
foreach ($objMod->tabs as $val) foreach ($objMod->tabs as $val)
{ {
if (is_array($val)) $val = $val['data']; if (is_array($val)) $val = $val['data'];
if (is_string($val)) if (is_string($val))
{ {
$tmp = explode(':', $val, 3); $tmp = explode(':', $val, 3);
$text .= ($i ? ', ' : '').$tmp[0].':'.$tmp[1]; $text .= ($i ? ', ' : '').$tmp[0].':'.$tmp[1];
$i++; $i++;
} }
} }
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddModels").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddModels").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models']) if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
{ {
$text .= $langs->trans("Yes"); $text .= $langs->trans("Yes");
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddSubstitutions").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions']) if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
{ {
$text .= $langs->trans("Yes"); $text .= $langs->trans("Yes");
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs)) if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
{ {
$i = 0; $i = 0;
foreach ($objMod->cronjobs as $val) foreach ($objMod->cronjobs as $val)
{ {
$text .= ($i ? ', ' : '').($val['label']); $text .= ($i ? ', ' : '').($val['label']);
$i++; $i++;
} }
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddTriggers").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
$moreinfoontriggerfile = ''; $moreinfoontriggerfile = '';
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{ {
$yesno = 'Yes'; $yesno = 'Yes';
} else { } else {
$yesno = 'No'; $yesno = 'No';
} }
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
$interfaces = new Interfaces($db); $interfaces = new Interfaces($db);
$triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() == 'external') ? '/'.$moduledir : '').'/core/triggers')); $triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() == 'external') ? '/'.$moduledir : '').'/core/triggers'));
foreach ($triggers as $triggercursor) foreach ($triggers as $triggercursor)
{ {
if ($triggercursor['module'] == $moduledir) if ($triggercursor['module'] == $moduledir)
@ -445,110 +445,110 @@ if ($mode == 'feature')
} }
} }
$text .= $langs->trans($yesno).$moreinfoontriggerfile; $text .= $langs->trans($yesno).$moreinfoontriggerfile;
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddBoxes").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
{ {
$i = 0; $i = 0;
foreach ($objMod->boxes as $val) foreach ($objMod->boxes as $val)
{ {
$text .= ($i ? ', ' : '').($val['file'] ? $val['file'] : $val[0]); $text .= ($i ? ', ' : '').($val['file'] ? $val['file'] : $val[0]);
$i++; $i++;
} }
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddHooks").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddHooks").':</strong> ';
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks'])) if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
{ {
$i = 0; $i = 0;
foreach ($objMod->module_parts['hooks'] as $key => $val) foreach ($objMod->module_parts['hooks'] as $key => $val)
{ {
if ($key === 'entity') continue; if ($key === 'entity') continue;
// For special values // For special values
if ($key === 'data') if ($key === 'data')
{ {
if (is_array($val)) if (is_array($val))
{ {
foreach ($val as $value) foreach ($val as $value)
{ {
$text .= ($i ? ', ' : '').($value); $text .= ($i ? ', ' : '').($value);
$i++; $i++;
} }
continue; continue;
} }
} }
$text .= ($i ? ', ' : '').($val); $text .= ($i ? ', ' : '').($val);
$i++; $i++;
} }
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddPermissions").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddPermissions").':</strong> ';
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights)) if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
{ {
$i = 0; $i = 0;
foreach ($objMod->rights as $val) foreach ($objMod->rights as $val)
{ {
$text .= ($i ? ', ' : '').($val[1]); $text .= ($i ? ', ' : '').($val[1]);
$i++; $i++;
} }
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddMenus").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddMenus").':</strong> ';
if (isset($objMod->menu) && !empty($objMod->menu)) // objMod can be an array or just an int 1 if (isset($objMod->menu) && !empty($objMod->menu)) // objMod can be an array or just an int 1
{ {
$text .= $langs->trans("Yes"); $text .= $langs->trans("Yes");
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddExportProfiles").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label)) if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
{ {
$i = 0; $i = 0;
foreach ($objMod->export_label as $val) foreach ($objMod->export_label as $val)
{ {
$text .= ($i ? ', ' : '').($val); $text .= ($i ? ', ' : '').($val);
$i++; $i++;
} }
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddImportProfiles").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label)) if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
{ {
$i = 0; $i = 0;
foreach ($objMod->import_label as $val) foreach ($objMod->import_label as $val)
{ {
$text .= ($i ? ', ' : '').($val); $text .= ($i ? ', ' : '').($val);
$i++; $i++;
} }
} else $text .= $langs->trans("No"); } else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> '; $text .= '<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
$text .= $langs->trans("DetectionNotPossible"); $text .= $langs->trans("DetectionNotPossible");
} }
if ($mode == 'changelog') if ($mode == 'changelog')
{ {
$changelog = $objMod->getChangeLog(); $changelog = $objMod->getChangeLog();
if ($changelog) $text .= '<div class="moduledesclong">'.$changelog.'<div>'; if ($changelog) $text .= '<div class="moduledesclong">'.$changelog.'<div>';
else $text .= '<div class="moduledesclong">'.$langs->trans("NotAvailable").'</div>'; else $text .= '<div class="moduledesclong">'.$langs->trans("NotAvailable").'</div>';
} }
print $text; print $text;

Some files were not shown because too many files have changed in this diff Show More