Merge pull request #15236 from Dolibarr/scrutinizer-patch-1

Scrutinizer Auto-Fixes
This commit is contained in:
Laurent Destailleur 2020-10-31 15:01:59 +01:00 committed by GitHub
commit fcdd1b4169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1173 changed files with 82247 additions and 82252 deletions

View File

@ -65,12 +65,12 @@ if (!$sortfield) $sortfield = "aa.account_number";
if (!$sortorder) $sortorder = "ASC";
$arrayfields = array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), '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.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), '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($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
{
$search_account = "";
$search_label = "";
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_label = "";
$search_labelshort = "";
$search_accountparent = "";
$search_pcgtype = "";
$search_pcgtype = "";
$search_array_options = array();
}
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
{
if ($chartofaccounts > 0)
{
}
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
{
if ($chartofaccounts > 0)
{
// 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 .= ' 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)) {
$error++;
}
} else {
$error++;
}
}
if (!dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
$error++;
}
} else {
$error++;
}
}
if ($action == 'disable') {
if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int');
$result = $accounting->accountDeactivate($id, $mode);
}
if ($action == 'disable') {
if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int');
$result = $accounting->accountDeactivate($id, $mode);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
} elseif ($action == 'enable') {
if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int');
$result = $accounting->account_activate($id, $mode);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
} elseif ($action == 'enable') {
if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int');
$result = $accounting->account_activate($id, $mode);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}
}
@ -273,9 +273,9 @@ if ($resql)
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if (!empty($conf->use_javascript_ajax))
{
print '<!-- Add javascript to reload page when we click "Change plan" -->
if (!empty($conf->use_javascript_ajax))
{
print '<!-- Add javascript to reload page when we click "Change plan" -->
<script type="text/javascript">
$(document).ready(function () {
$("#change_chart").on("click", function (e) {
@ -285,7 +285,7 @@ if ($resql)
});
});
</script>';
}
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
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="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
print $langs->trans("Selectchartofaccounts")." : ";
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 .= " 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 .= " WHERE a.active = 1";
dol_syslog('accountancy/admin/account.php $sql='.$sql);
print $sql;
$resqlchart = $db->query($sql);
if ($resqlchart) {
$numbis = $db->num_rows($resqlchart);
$i = 0;
while ($i < $numbis) {
$obj = $db->fetch_object($resqlchart);
print $langs->trans("Selectchartofaccounts")." : ";
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 .= " 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 .= " WHERE a.active = 1";
dol_syslog('accountancy/admin/account.php $sql='.$sql);
print $sql;
$resqlchart = $db->query($sql);
if ($resqlchart) {
$numbis = $db->num_rows($resqlchart);
$i = 0;
while ($i < $numbis) {
$obj = $db->fetch_object($resqlchart);
print '<option value="'.$obj->rowid.'"';
print ($pcgver == $obj->rowid) ? ' selected' : '';
print '>'.$obj->pcg_version.' - '.$obj->label.' - ('.$obj->country_code.')</option>';
print '<option value="'.$obj->rowid.'"';
print ($pcgver == $obj->rowid) ? ' selected' : '';
print '>'.$obj->pcg_version.' - '.$obj->label.' - ('.$obj->country_code.')</option>';
$i++;
}
} else dol_print_error($db);
print "</select>";
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")).'">';
$i++;
}
} else dol_print_error($db);
print "</select>";
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 '<br>';
print '<br>';
print '<br>';
$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 = '';
$massactionbutton = '';
$moreforfilter = '';
$massactionbutton = '';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Line for search fields
print '<tr class="liste_titre_filter">';
@ -358,7 +358,7 @@ if ($resql)
print '</td>';
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.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);
@ -422,7 +422,7 @@ if ($resql)
print '<!-- obj->account_parent = '.$obj->account_parent.' obj->rowid2 = '.$obj->rowid2.' -->';
$accountparent->id = $obj->rowid2;
$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 "</td>\n";
if (!$i) $totalarray['nbfield']++;

View File

@ -472,13 +472,13 @@ if ($id)
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
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>';
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {
print $valuetoshow;
}
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>';
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {
print $valuetoshow;
}
print '</td>';
}
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');
} elseif ($res < 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$action = "create";
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$action = "create";
}
if (!$error)
{
setEventMessages("RecordCreatedSuccessfully", null, 'mesgs');
$urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1);
header("Location: ".$urltogo);
exit;
setEventMessages("RecordCreatedSuccessfully", null, 'mesgs');
$urltogo = $backtopage ? $backtopage : dol_buildpath('/accountancy/admin/account.php', 1);
header("Location: ".$urltogo);
exit;
}
}
} elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) {
@ -158,15 +158,15 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
$result = $object->update($user);
if ($result > 0) {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo);
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo);
exit();
} else {
$mesg = $object->error;
}
} else {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo);
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"]."?id=".$id);
header("Location: ".$urltogo);
exit();
}
} 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(
'ACCOUNTING_RESULT_PROFIT',
'ACCOUNTING_RESULT_LOSS'
'ACCOUNTING_RESULT_PROFIT',
'ACCOUNTING_RESULT_LOSS'
);
/*
@ -48,17 +48,17 @@ $list_account_main = array(
*/
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 (!dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) {
$error++;
}
} else {
$error++;
}
if (!empty($defaultjournal)) {
if (!dolibarr_set_const($db, 'ACCOUNTING_CLOSURE_DEFAULT_JOURNAL', $defaultjournal, 'chaine', 0, '', $conf->entity)) {
$error++;
}
} else {
$error++;
}
foreach ($list_account_main as $constname) {
$constvalue = GETPOST($constname, 'alpha');
@ -99,20 +99,20 @@ print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">';
foreach ($list_account_main as $key) {
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
$keydesc = $key.'_Desc';
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
$keydesc = $key.'_Desc';
$htmltext = $langs->trans($keydesc);
print '<td class="fieldrequired" width="50%">';
print $form->textwithpicto($label, $htmltext);
print '</td>';
// Value
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 '</td>';
print '</tr>';
$htmltext = $langs->trans($keydesc);
print '<td class="fieldrequired" width="50%">';
print $form->textwithpicto($label, $htmltext);
print '</td>';
// Value
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 '</td>';
print '</tr>';
}
// Journal

View File

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

View File

@ -113,7 +113,7 @@ if ($result)
$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');

View File

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

View File

@ -42,7 +42,7 @@ if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if (!$user->rights->accounting->bind->write)
accessforbidden();
accessforbidden();
// search & action GETPOST
$action = GETPOST('action', 'aZ09');
@ -100,14 +100,14 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
// 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
{
$search_ref = '';
$search_label = '';
$search_desc = '';
$search_ref = '';
$search_label = '';
$search_desc = '';
$search_vat = '';
$search_onsell = '';
$search_onpurchase = '';
$search_current_account = '';
$search_current_account_valid = '-1';
$search_onsell = '';
$search_onpurchase = '';
$search_current_account = '';
$search_current_account_valid = '-1';
}
// Sales or Purchase mode ?
@ -117,8 +117,8 @@ if ($action == 'update') {
$accounting_product_modes = array(
'ACCOUNTANCY_SELL',
'ACCOUNTANCY_SELL_INTRA',
'ACCOUNTANCY_SELL_EXPORT',
'ACCOUNTANCY_SELL_INTRA',
'ACCOUNTANCY_SELL_EXPORT',
'ACCOUNTANCY_BUY',
'ACCOUNTANCY_BUY_INTRA',
'ACCOUNTANCY_BUY_EXPORT'
@ -172,22 +172,22 @@ if ($action == 'update') {
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
$sql .= " SET accountancy_code_sell = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$sql .= " SET accountancy_code_sell_intra = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
$sql .= " SET accountancy_code_sell_export = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$sql .= " SET accountancy_code_sell_intra = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
$sql .= " SET accountancy_code_sell_export = ".$accounting->account_number;
}
$sql .= " WHERE rowid = ".((int) $productid);
dol_syslog("/accountancy/admin/productaccount.php sql=".$sql, LOG_DEBUG);
if ($db->query($sql))
{
$ok++;
$db->commit();
$ok++;
$db->commit();
} else {
$ko++;
$db->rollback();
$ko++;
$db->rollback();
}
}
@ -253,7 +253,7 @@ $sql .= " aa.rowid as aaid";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
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')
{
$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').')';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy", $search_current_account);
}
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
if (strlen(trim($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);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell", $search_current_account);
}
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_intra", $search_current_account);
}
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_intra", $search_current_account);
}
} else {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_export", $search_current_account);
}
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell_export", $search_current_account);
}
}
if ($search_current_account_valid == 'withoutvalidaccount')
{
@ -301,7 +301,7 @@ if ($search_current_account_valid == 'withoutvalidaccount')
}
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
if (strlen(trim($search_ref))) {
@ -324,13 +324,13 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
}
$sql .= $db->plimit($limit + 1, $offset);
@ -342,32 +342,32 @@ if ($result)
$num = $db->num_rows($result);
$i = 0;
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_ref > 0) $param .= "&search_desc=".urlencode($search_ref);
if ($search_label > 0) $param .= "&search_desc=".urlencode($search_label);
if ($search_desc > 0) $param .= "&search_desc=".urlencode($search_desc);
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_ref > 0) $param .= "&search_desc=".urlencode($search_ref);
if ($search_label > 0) $param .= "&search_desc=".urlencode($search_label);
if ($search_desc > 0) $param .= "&search_desc=".urlencode($search_desc);
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_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 ($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 ($accounting_product_mode) $param .= '&accounting_product_mode='.urlencode($accounting_product_mode);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
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 '<span class="opacitymedium">'.$langs->trans("InitAccountancyDesc").'</span><br>';
print '<br>';
// Select mode
// Select mode
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Options').'</td><td>'.$langs->trans('Description').'</td>';
@ -377,13 +377,13 @@ if ($result)
print "</td></tr>\n";
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 '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
print "</td></tr>\n";
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></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 '<td>'.$langs->trans('OptionModeProductSellExportDesc');
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 '<td>'.$langs->trans('OptionModeProductSellExportDesc');
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 '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
if ($mysoc->isInEEC())
@ -405,8 +405,8 @@ if ($result)
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$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").'">';
//print '<br><div class="center">'.$buttonsave.'</div>';
$buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="'.$langs->trans("Save").'">';
//print '<br><div class="center">'.$buttonsave.'</div>';
$texte = $langs->trans("ListOfProductsServices");
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_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);
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 ');
// On sell / On purchase
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_export";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_sell_export";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
@ -475,8 +475,8 @@ if ($result)
$product_static = new Product($db);
$i = 0;
while ($i < min($num, $limit))
{
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
// 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_id = $aarowid_prodsell;
} 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_id = $aarowid_prodsell_intra;
$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;
} 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_id = $aarowid_prodsell_export;
} else {
$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;
} else {
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell;
}
@ -560,11 +560,11 @@ if ($result)
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC))
{
// TODO ADJUST DESCRIPTION SIZE
// print '<td class="left">' . $obj->description . '</td>';
// 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;
print '<td>'.nl2br(dol_trunc($obj->description, $trunclength)).'</td>';
// TODO ADJUST DESCRIPTION SIZE
// print '<td class="left">' . $obj->description . '</td>';
// 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;
print '<td>'.nl2br(dol_trunc($obj->description, $trunclength)).'</td>';
}
// VAT
@ -581,30 +581,30 @@ if ($result)
// Current accounting account
print '<td class="left">';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print length_accountg($obj->accountancy_code_buy);
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
print length_accountg($obj->accountancy_code_buy);
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_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"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_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"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print length_accountg($obj->accountancy_code_sell);
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_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"));
print length_accountg($obj->accountancy_code_buy_intra);
if ($obj->accountancy_code_buy_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_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"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print length_accountg($obj->accountancy_code_sell);
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_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"));
} else {
print length_accountg($obj->accountancy_code_sell_export);
if ($obj->accountancy_code_sell_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
}
print length_accountg($obj->accountancy_code_sell_export);
if ($obj->accountancy_code_sell_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
}
print '</td>';
// New account to set
$defaultvalue = '';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
// Accounting account buy
// Accounting account buy
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
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 '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
// Accounting account sell intra (In EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
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 '</td>';
} else {
// Accounting account sell export (Out of EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_export);
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 '</td>';
}
// Accounting account sell intra (In EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
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 '</td>';
} else {
// Accounting account sell export (Out of EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_export);
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 '</td>';
}
// Checkbox select
print '<td class="center">';

View File

@ -274,11 +274,11 @@ if ($action != 'export_csv')
$sous_total_credit = 0;
$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 .= " 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 .= " GROUP BY t.numero_compte";
@ -292,12 +292,12 @@ if ($action != 'export_csv')
foreach ($object->lines as $line)
{
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
} else {
$accounting_account = length_accountg($line->numero_compte);
}
$accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
} else {
$accounting_account = length_accountg($line->numero_compte);
}
$link = '';
$total_debit += $line->debit;

View File

@ -114,12 +114,12 @@ if ($action == "confirm_update") {
$object->credit = $credit;
if (floatval($debit) != 0.0) {
$object->montant = $debit; // deprecated
$object->montant = $debit; // deprecated
$object->amount = $debit;
$object->sens = 'D';
}
if (floatval($credit) != 0.0) {
$object->montant = $credit; // deprecated
$object->montant = $credit; // deprecated
$object->amount = $credit;
$object->sens = 'C';
}
@ -175,13 +175,13 @@ if ($action == "confirm_update") {
$object->fk_docdet = (int) GETPOST('fk_docdet', 'int');
if (floatval($debit) != 0.0) {
$object->montant = $debit; // deprecated
$object->montant = $debit; // deprecated
$object->amount = $debit;
$object->sens = 'D';
}
if (floatval($credit) != 0.0) {
$object->montant = $credit; // deprecated
$object->montant = $credit; // deprecated
$object->amount = $credit;
$object->sens = 'C';
}
@ -245,7 +245,7 @@ if ($action == "confirm_update") {
$object->journal_label = $journal_label;
$object->fk_doc = 0;
$object->fk_docdet = 0;
$object->montant = 0; // deprecated
$object->montant = 0; // deprecated
$object->amount = 0;
$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.date_creation'=>array('label'=>$langs->trans("DateCreation"), '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']);
@ -176,145 +176,145 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
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
{
$search_mvt_num = '';
$search_doc_type = '';
$search_doc_ref = '';
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_accountancy_aux_code = '';
$search_accountancy_aux_code_start = '';
$search_accountancy_aux_code_end = '';
$search_mvt_label = '';
$search_direction = '';
$search_ledger_code = '';
$search_date_start = '';
$search_date_end = '';
$search_date_creation_start = '';
$search_date_creation_end = '';
$search_date_modification_start = '';
$search_date_modification_end = '';
$search_date_export_start = '';
$search_date_export_end = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
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_doc_type = '';
$search_doc_ref = '';
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_accountancy_aux_code = '';
$search_accountancy_aux_code_start = '';
$search_accountancy_aux_code_end = '';
$search_mvt_label = '';
$search_direction = '';
$search_ledger_code = '';
$search_date_start = '';
$search_date_end = '';
$search_date_creation_start = '';
$search_date_creation_end = '';
$search_date_modification_start = '';
$search_date_modification_end = '';
$search_date_export_start = '';
$search_date_export_end = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
$search_not_reconciled = '';
}
}
// Must be after the remove filter action, before the export.
$param = '';
$filter = array();
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $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']);
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $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']);
}
if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $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']);
}
if (!empty($search_doc_type)) {
$filter['t.doc_type'] = $search_doc_type;
$param .= '&search_doc_type='.urlencode($search_doc_type);
}
if (!empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref='.urlencode($search_doc_ref);
}
if (!empty($search_accountancy_code)) {
$filter['t.numero_compte'] = $search_accountancy_code;
$param .= '&search_accountancy_code='.urlencode($search_accountancy_code);
}
if (!empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
}
if (!empty($search_accountancy_aux_code)) {
$filter['t.subledger_account'] = $search_accountancy_aux_code;
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
}
if (!empty($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);
}
if (!empty($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);
}
if (!empty($search_mvt_label)) {
$filter['t.label_operation'] = $search_mvt_label;
$param .= '&search_mvt_label='.urlencode($search_mvt_label);
}
if (!empty($search_direction)) {
$filter['t.sens'] = $search_direction;
$param .= '&search_direction='.urlencode($search_direction);
}
if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
$param .= '&search_ledger_code='.urlencode($search_ledger_code);
}
if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num='.urlencode($search_mvt_num);
}
if (!empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $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']);
}
if (!empty($search_date_creation_end)) {
$filter['t.date_creation<='] = $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']);
}
if (!empty($search_date_modification_start)) {
$filter['t.tms>='] = $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']);
}
if (!empty($search_date_modification_end)) {
$filter['t.tms<='] = $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']);
}
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $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']);
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $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']);
}
if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit;
$param .= '&search_debit='.urlencode($search_debit);
}
if (!empty($search_credit)) {
$filter['t.credit'] = $search_credit;
$param .= '&search_credit='.urlencode($search_credit);
}
if (!empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code;
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
}
// Must be after the remove filter action, before the export.
$param = '';
$filter = array();
if (!empty($search_date_start)) {
$filter['t.doc_date>='] = $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']);
}
if (!empty($search_date_end)) {
$filter['t.doc_date<='] = $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']);
}
if (!empty($search_doc_date)) {
$filter['t.doc_date'] = $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']);
}
if (!empty($search_doc_type)) {
$filter['t.doc_type'] = $search_doc_type;
$param .= '&search_doc_type='.urlencode($search_doc_type);
}
if (!empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref='.urlencode($search_doc_ref);
}
if (!empty($search_accountancy_code)) {
$filter['t.numero_compte'] = $search_accountancy_code;
$param .= '&search_accountancy_code='.urlencode($search_accountancy_code);
}
if (!empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
}
if (!empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
}
if (!empty($search_accountancy_aux_code)) {
$filter['t.subledger_account'] = $search_accountancy_aux_code;
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
}
if (!empty($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);
}
if (!empty($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);
}
if (!empty($search_mvt_label)) {
$filter['t.label_operation'] = $search_mvt_label;
$param .= '&search_mvt_label='.urlencode($search_mvt_label);
}
if (!empty($search_direction)) {
$filter['t.sens'] = $search_direction;
$param .= '&search_direction='.urlencode($search_direction);
}
if (!empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code;
$param .= '&search_ledger_code='.urlencode($search_ledger_code);
}
if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num='.urlencode($search_mvt_num);
}
if (!empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $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']);
}
if (!empty($search_date_creation_end)) {
$filter['t.date_creation<='] = $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']);
}
if (!empty($search_date_modification_start)) {
$filter['t.tms>='] = $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']);
}
if (!empty($search_date_modification_end)) {
$filter['t.tms<='] = $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']);
}
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $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']);
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $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']);
}
if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit;
$param .= '&search_debit='.urlencode($search_debit);
}
if (!empty($search_credit)) {
$filter['t.credit'] = $search_credit;
$param .= '&search_credit='.urlencode($search_credit);
}
if (!empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code;
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
}
if (!empty($search_not_reconciled)) {
$filter['t.reconciled_option'] = $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');
} else {
// Export files
// Export files
$accountancyexport = new AccountancyExport($db);
$accountancyexport->export($object->lines, $formatexportset);
if (!empty($accountancyexport->errors))
{
setEventMessages('', $accountancyexport->errors, 'errors');
} else {
// Specify as export : update field date_export
$error = 0;
$db->begin();
if (!empty($accountancyexport->errors))
{
setEventMessages('', $accountancyexport->errors, 'errors');
} else {
// Specify as export : update field date_export
$error = 0;
$db->begin();
if (is_array($object->lines))
{
foreach ($object->lines as $movement)
{
$now = dol_now();
if (is_array($object->lines))
{
foreach ($object->lines as $movement)
{
$now = dol_now();
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET date_export = '".$db->idate($now)."'";
$sql .= " WHERE rowid = ".$movement->id;
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET date_export = '".$db->idate($now)."'";
$sql .= " WHERE rowid = ".$movement->id;
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
$result = $db->query($sql);
if (!$result)
{
$error++;
break;
}
}
}
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
$result = $db->query($sql);
if (!$result)
{
$error++;
break;
}
}
}
if (!$error)
{
$db->commit();
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
} else {
$error++;
$db->rollback();
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
}
}
if (!$error)
{
$db->commit();
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
} else {
$error++;
$db->rollback();
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
}
}
exit;
}
}
@ -629,9 +629,9 @@ else $buttonLabel = $langs->trans("ExportList");
// Button re-export
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 {
$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>';
@ -791,14 +791,14 @@ if (!empty($arrayfields['t.tms']['checked']))
// Date export
if (!empty($arrayfields['t.date_export']['checked']))
{
print '<td class="liste_titre center">';
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 '</div>';
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 '</div>';
print '</td>';
print '<td class="liste_titre center">';
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 '</div>';
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 '</div>';
print '</td>';
}
// Action column
print '<td class="liste_titre center">';
@ -854,7 +854,7 @@ while ($i < min($num, $limit))
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
$line->montant = $obj->amount; // deprecated
$line->montant = $obj->amount; // deprecated
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
@ -893,65 +893,65 @@ while ($i < min($num, $limit))
// Document ref
if (!empty($arrayfields['t.doc_ref']['checked']))
{
if ($line->doc_type == 'customer_invoice')
{
$langs->loadLangs(array('bills'));
if ($line->doc_type == 'customer_invoice')
{
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$objectstatic = new Facture($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'facture';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$objectstatic = new Facture($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'facture';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'supplier_invoice')
{
$langs->loadLangs(array('bills'));
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} elseif ($line->doc_type == 'supplier_invoice')
{
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$objectstatic = new FactureFournisseur($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'invoice_supplier';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$objectstatic = new FactureFournisseur($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'invoice_supplier';
$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);
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
} elseif ($line->doc_type == 'expense_report')
{
$langs->loadLangs(array('trips'));
$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);
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
} elseif ($line->doc_type == 'expense_report')
{
$langs->loadLangs(array('trips'));
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$objectstatic = new ExpenseReport($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'expensereport';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$objectstatic = new ExpenseReport($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'expensereport';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} else {
// Other type
}
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} else {
// Other type
}
print '<td class="nowrap">';
print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref
print '<td class="nobordernopadding nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref
print '<td class="nobordernopadding nowrap">';
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 $documentlink;
} else {
print $line->doc_ref;
}
print '</td></tr></table>';
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 $documentlink;
} else {
print $line->doc_ref;
}
print '</td></tr></table>';
print "</td>\n";
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
}
@ -1065,9 +1065,9 @@ print '</div>';
// TODO Replace this with mass delete action
if ($user->rights->accounting->mouvements->supprimer_tous) {
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 '</div>';
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 '</div>';
}
print '</form>';

View File

@ -138,7 +138,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
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
{
@ -172,55 +172,55 @@ if (empty($reshook))
if (!empty($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)) {
$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)) {
$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)) {
$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)) {
$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)) {
$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)) {
$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)) {
$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)) {
$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)) {
$filter['t.sens'] = $search_direction;
$param .= '&search_direction=' . urlencode($search_direction);
$param .= '&search_direction='.urlencode($search_direction);
}
if (!empty($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)) {
$filter['t.debit'] = $search_debit;
$param .= '&search_debit=' . urlencode($search_debit);
$param .= '&search_debit='.urlencode($search_debit);
}
if (!empty($search_credit)) {
$filter['t.credit'] = $search_credit;
$param .= '&search_credit=' . urlencode($search_credit);
$param .= '&search_credit='.urlencode($search_credit);
}
if (!empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code;
@ -426,7 +426,7 @@ print '<tr class="liste_titre_filter">';
// Code journal
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
if (!empty($arrayfields['t.doc_date']['checked'])) {
@ -446,19 +446,19 @@ if (!empty($arrayfields['t.piece_num']['checked']))
}
// Ref document
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
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
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
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
if (!empty($arrayfields['t.lettering_code']['checked']))
@ -534,7 +534,7 @@ while ($i < min($num, $limit))
$balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0 )
if ($balance > 0)
{
print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit);
@ -665,7 +665,7 @@ while ($i < min($num, $limit))
if (!empty($arrayfields['t.label_operation']['checked'])) {
// Affiche un lien vers la facture client/fournisseur
$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']++;
}
@ -680,7 +680,7 @@ while ($i < min($num, $limit))
// Amount credit
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['pos'][$totalarray['nbfield']] = 'totalcredit';
$totalarray['val']['totalcredit'] += $line->credit;
@ -733,7 +733,7 @@ print '</tr>';
$balance = $sous_total_debit - $sous_total_credit;
print '<tr class="liste_total">';
print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
if ($balance > 0 )
if ($balance > 0)
{
print '<td class="nowraponall right">';
print price($sous_total_debit - $sous_total_credit);

View File

@ -195,17 +195,17 @@ dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEB
if ($resql) {
$i = 0;
$param = "&socid=".$socid;
$param = "&socid=".$socid;
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.'">';
$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 '<div class="div-table-responsive-no-min">';
print '<table class="liste centpercent">'."\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="liste centpercent">'."\n";
/*
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("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("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
print "</tr>\n";
$solde = 0;
$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($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
@ -265,20 +265,20 @@ if ($resql) {
print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
// Journal
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
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><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit();
print '</a></td>'."\n";
} else {
print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>';
}
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><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit();
print '</a></td>'."\n";
} else {
print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>';
}
print "</tr>\n";
}
@ -299,9 +299,9 @@ if ($resql) {
print "</table>";
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print $letteringbutton;
print '</div>';
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print $letteringbutton;
print '</div>';
print "</form>";
$db->free($resql);

View File

@ -193,17 +193,17 @@ if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = "&socid=".$socid;
$param = "&socid=".$socid;
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.'">';
$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 '<table class="liste centpercent">'."\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="liste centpercent">'."\n";
/*
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("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("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
print "</tr>\n";
$solde = 0;
@ -261,21 +261,21 @@ if ($resql) {
print '<td class="nowrap right">'.price($obj->credit).'</td>';
print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
// Journal
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
// Journal
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $obj->code_journal);
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '<td class="center">'.$journaltoshow.'</td>';
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><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit();
print '</a></td>'."\n";
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
print img_edit();
print '</a></td>'."\n";
} else {
print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>';
}
print '<td class="center">'.$obj->lettering_code.'</td>';
print '<td></td>';
}
print "</tr>\n";
}
@ -296,9 +296,9 @@ if ($resql) {
print "</table>";
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print '<div class="tabsAction tabsActionNoBottom">'."\n";
print $letteringbutton;
print '</div>';
print '</div>';
print "</form>";
$db->free($resql);

View File

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

View File

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

View File

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

View File

@ -74,35 +74,35 @@ class AccountingAccount extends CommonObject
public $rowid;
/**
* Date creation record (datec)
*
* @var integer
*/
public $datec;
* Date creation record (datec)
*
* @var integer
*/
public $datec;
/**
* @var string pcg version
*/
* @var string pcg version
*/
public $fk_pcg_version;
/**
* @var string pcg type
*/
/**
* @var string pcg type
*/
public $pcg_type;
/**
* @var string account number
*/
/**
* @var string account number
*/
public $account_number;
/**
* @var int ID parent account
*/
/**
* @var int ID parent account
*/
public $account_parent;
/**
* @var int ID category account
*/
/**
* @var int ID category account
*/
public $account_category;
/**
@ -110,10 +110,10 @@ class AccountingAccount extends CommonObject
*/
public $status;
/**
* @var string Label of account
*/
public $label;
/**
* @var string Label of account
*/
public $label;
/**
* @var string Label short of account
@ -121,19 +121,19 @@ class AccountingAccount extends CommonObject
public $labelshort;
/**
* @var int ID
*/
public $fk_user_author;
* @var int ID
*/
public $fk_user_author;
/**
* @var int ID
*/
public $fk_user_modif;
/**
* @var int ID
*/
public $fk_user_modif;
/**
* @var int active (duplicate with status)
*/
public $active;
public $active;
/**
* @var int reconcilable
@ -145,13 +145,13 @@ class AccountingAccount extends CommonObject
*
* @param DoliDB $db Database handle
*/
public function __construct($db)
{
public function __construct($db)
{
global $conf;
$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
}
}
/**
* 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).
* @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;
@ -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).')';
}
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);
@ -229,8 +229,8 @@ class AccountingAccount extends CommonObject
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
public function create($user, $notrigger = 0)
{
public function create($user, $notrigger = 0)
{
global $conf;
$error = 0;
$now = dol_now();
@ -318,7 +318,7 @@ class AccountingAccount extends CommonObject
$this->db->commit();
return $this->id;
}
}
}
/**
* Update record
@ -366,8 +366,8 @@ class AccountingAccount extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
public function checkUsage()
{
public function checkUsage()
{
global $langs;
$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
* @return int <0 if KO, >0 if OK
*/
public function delete($user, $notrigger = 0)
{
public function delete($user, $notrigger = 0)
{
$error = 0;
$result = $this->checkUsage();
@ -436,9 +436,9 @@ class AccountingAccount extends CommonObject
} else {
return -1;
}
}
}
/**
/**
* Return clicable name (with picto eventually)
*
* @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 string $moretitle Add more text to title 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 string $option 'ledger', 'journals', 'accountcard'
* @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;
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 != 2) $result .= $linkstart.$label_link.$linkend;
return $result;
}
}
/**
* Information on record
@ -532,8 +532,8 @@ class AccountingAccount extends CommonObject
* @param int $id of record
* @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 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as a';
$sql .= ' WHERE a.rowid = '.$id;
@ -568,18 +568,18 @@ class AccountingAccount extends CommonObject
* Deactivate an account (for status active or status reconcilable)
*
* @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
*/
public function accountDeactivate($id, $mode = 0)
{
public function accountDeactivate($id, $mode = 0)
{
$result = $this->checkUsage();
$fieldtouse = 'active';
if ($mode == 1)
{
if ($mode == 1)
{
$fieldtouse = 'reconcilable';
}
}
if ($result > 0) {
$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
*
* @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
*/
public function account_activate($id, $mode = 0)
{
// phpcs:enable
public function account_activate($id, $mode = 0)
{
// phpcs:enable
$this->db->begin();
if ($mode == 0)
{
$fieldtouse = 'active';
} elseif ($mode == 1)
{
$fieldtouse = 'reconcilable';
}
if ($mode == 0)
{
$fieldtouse = 'active';
} elseif ($mode == 1)
{
$fieldtouse = 'reconcilable';
}
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account ";
$sql .= "SET ".$fieldtouse." = '1'";
@ -631,15 +631,15 @@ class AccountingAccount extends CommonObject
dol_syslog(get_class($this)."::account_activate ".$fieldtouse." sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
if ($result) {
$this->db->commit();
return 1;
} else {
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;
}
}
}
}
/**
@ -653,7 +653,7 @@ class AccountingAccount extends CommonObject
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
*
@ -663,7 +663,7 @@ class AccountingAccount extends CommonObject
*/
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
// phpcs:enable
global $langs;
$langs->loadLangs(array("users"));

View File

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

View File

@ -63,24 +63,24 @@ $year_current = $year_start;
if ($action == 'validate')
{
$now = dol_now();
$now = dol_now();
// Update database
$db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " SET b.date_validated = '".$db->idate($now)."'";
$sql .= ' WHERE b.date_validated IS NULL';
// Update database
$db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " SET b.date_validated = '".$db->idate($now)."'";
$sql .= ' WHERE b.date_validated IS NULL';
dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG);
$resql = $db->query($sql);
if (!$resql1) {
$error++;
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors');
} else {
$db->commit();
}
// End clean database
dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG);
$resql = $db->query($sql);
if (!$resql1) {
$error++;
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors');
} else {
$db->commit();
}
// End clean database
}
@ -135,8 +135,8 @@ if ($resql) {
while ($row = $db->fetch_row($resql)) {
for ($i = 1; $i <= 12; $i++) {
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 '</td>';
print '<input id="cb'.$row[$i].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$row[$i].'"'.($selected ? ' checked="checked"' : '').'>';
print '</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 ($codeventil < 0) $codeventil = 0;
if ($codeventil < 0) $codeventil = 0;
$sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
$sql .= " SET fk_code_ventilation = ".$codeventil;
@ -60,12 +60,12 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
if (!$resql) {
setEventMessages($db->lasterror(), null, 'errors');
} else {
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
if ($backtopage)
{
header("Location: ".$backtopage);
exit();
}
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
if ($backtopage)
{
header("Location: ".$backtopage);
exit();
}
}
} else {
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)
{
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
$zone = GETPOST('areacode', 'aZ09');
$userid = GETPOST('userid', 'int');
$boxorder = GETPOST('boxorder', 'aZ09');
$boxorder .= GETPOST('boxcombo', 'aZ09');
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
$zone = GETPOST('areacode', 'aZ09');
$userid = GETPOST('userid', 'int');
$boxorder = GETPOST('boxorder', 'aZ09');
$boxorder .= GETPOST('boxcombo', 'aZ09');
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
}
@ -64,11 +64,11 @@ llxHeader('', $langs->trans("AccountancyArea"));
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 = '';
if (!$helpisexpanded)
@ -92,9 +92,9 @@ if ($conf->accounting->enabled)
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 "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
print "<br>\n"; print "<br>\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))
{
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n";
}
/*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.
{
$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 "<br>\n";
$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 "<br>\n";
}
/*
if (! empty($conf->loan->enabled))
@ -177,7 +177,7 @@ if ($conf->accounting->enabled)
print '<br>';
// Step A - E
// Step A - E
print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
@ -199,7 +199,7 @@ if ($conf->accounting->enabled)
{
$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 "<br>\n";
print "<br>\n";
}
$step++;
@ -214,36 +214,36 @@ if ($conf->accounting->enabled)
print '</div>';
print '<div class="clearboth"></div>';
print '<div class="clearboth"></div>';
print '<div class="fichecenter fichecenterbis">';
print '<div class="fichecenter fichecenterbis">';
/*
/*
* 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 .= "\n";
$boxlist .= '</div>';
$boxlist .= "\n";
$boxlist .= '</div>';
$boxlist .= '</div>';
print $boxlist;
print $boxlist;
print '</div>';
print '</div>';
} 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";
}

View File

@ -394,9 +394,9 @@ if ($result) {
$tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id;
$paymentvariousstatic->fetch($paymentvariousstatic->id);
$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
$tabpay[$obj->rowid]["account_various"] = $account_various;
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
$account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
$tabpay[$obj->rowid]["account_various"] = $account_various;
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
} elseif ($links[$key]['type'] == 'payment_loan') {
$paymentloanstatic->id = $links[$key]['url_id'];
$paymentloanstatic->ref = $links[$key]['url_id'];
@ -668,7 +668,7 @@ if (!$error && $action == 'writebookkeeping') {
$bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_various') {
$bookkeeping->subledger_account = $k;
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $tabpay[$key]["account_various"];
$accountingaccount->fetch(null, $bookkeeping->numero_compte, true);
@ -954,8 +954,8 @@ if (empty($action) || $action == 'view') {
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$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 .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$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);
$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 (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-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").'" />';
|| ($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").'" />';
} else {
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>';
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>';
}
print '</div>';

View File

@ -110,11 +110,11 @@ if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
// Already in bookkeeping or not
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')
{
$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";
@ -370,8 +370,8 @@ if ($action == 'writebookkeeping') {
if ($error >= 10)
{
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
break; // Break in the foreach
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped"), null, 'errors');
break; // Break in the foreach
}
}
}
@ -433,48 +433,48 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print "\n";
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->name = $tabuser[$key]['name'];
$userstatic->id = $tabuser[$key]['id'];
$userstatic->name = $tabuser[$key]['name'];
// Fees
foreach ($tabht[$key] as $k => $mt) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true);
if ($mt) {
print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($accountingaccount->label, 32).'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n";
}
}
// VAT
foreach ($tabtva[$key] as $k => $mt) {
if ($mt) {
print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($langs->trans("VAT")).'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n";
}
}
// Fees
foreach ($tabht[$key] as $k => $mt) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true);
if ($mt) {
print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($accountingaccount->label, 32).'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n";
}
}
// VAT
foreach ($tabtva[$key] as $k => $mt) {
if ($mt) {
print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($langs->trans("VAT")).'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n";
}
}
// Third party
foreach ($tabttc[$key] as $k => $mt) {
print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($userstatic->name).'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"';
}
print "\n";
// Third party
foreach ($tabttc[$key] as $k => $mt) {
print '"'.$date.'"'.$sep;
print '"'.$val["ref"].'"'.$sep;
print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
print '"'.dol_trunc($userstatic->name).'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
print '"'.($mt >= 0 ? price($mt) : '').'"';
}
print "\n";
}
}
@ -489,8 +489,8 @@ if (empty($action) || $action == 'view') {
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$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 .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$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);
$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"));
$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 = $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);
$varlink = 'id_journal='.$id_journal;

View File

@ -130,7 +130,7 @@ if ($in_bookkeeping == 'already')
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 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";
//print $sql;
@ -658,8 +658,8 @@ if (empty($action) || $action == 'view') {
}
$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 .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
$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);
$varlink = 'id_journal='.$id_journal;

View File

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

View File

@ -50,27 +50,27 @@ $action = GETPOST('action', 'aZ09');
//
if ($action == 'updateall') {
$db->begin();
$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);
$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);
$res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
// Use vat for invoice creation
if ($conf->facture->enabled) {
$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);
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);
}
}
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
$db->rollback();
} else {
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
$db->commit();
}
$db->begin();
$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);
$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);
$res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
// Use vat for invoice creation
if ($conf->facture->enabled) {
$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);
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);
}
}
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
$db->rollback();
} else {
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
$db->commit();
}
}
// 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
if ($action == 'set') {
$result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0) {
print $db->error();
}
$result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0) {
print $db->error();
}
}
// Action to disable a submodule of the adherent module
if ($action == 'unset') {
$result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
if ($result < 0) {
print $db->error();
}
$result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
if ($result < 0) {
print $db->error();
}
}
@ -169,7 +169,7 @@ if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty(
print '<td>';
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') {
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 "</tr>\n";

View File

@ -95,7 +95,7 @@ if ($action == 'create') {
print '<div name="topofform"></div><br>';
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 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

View File

@ -54,22 +54,22 @@ if ($action == 'update') {
$payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE');
$forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE');
$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_EDITAMOUNT", $editamount, '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);
else {
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, '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_EDITAMOUNT", $editamount, '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);
else {
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) $error++;
if (!$res > 0) $error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
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');
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () {
print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () {
function initemail()
{
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_NEWFORM_PAYONLINE").change(function() { initemail(); });
})';
print '</script>'."\n";
print '</script>'."\n";
}

View File

@ -65,8 +65,8 @@ $result = $object->fetch($id);
if ($result > 0) {
$object->fetch_thirdparty();
$adht = new AdherentType($db);
$result = $adht->fetch($object->typeid);
$adht = new AdherentType($db);
$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 (empty($reshook)) {
// Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
// Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
// 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
// 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
$actioncode = '';
$search_agenda_label = '';
}
$search_agenda_label = '';
}
}
@ -136,31 +136,31 @@ if ($object->id > 0) {
print dol_get_fiche_end();
//print '<div class="tabsAction">';
//print '</div>';
//print '<div class="tabsAction">';
//print '</div>';
$newcardbutton = '';
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);
}
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);
}
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
print '<br>';
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
print '<br>';
$param = '&id='.$id;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
$param = '&id='.$id;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
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
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
// TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
// TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
}
// End of page

View File

@ -27,15 +27,15 @@
*/
abstract class ActionsAdherentCardCommon
{
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* @var DoliDB Database handler.
*/
public $db;
public $dirmodule;
public $targetmodule;
public $canvas;
public $card;
public $dirmodule;
public $targetmodule;
public $canvas;
public $card;
//! Template container
public $tpl = array();
@ -54,52 +54,52 @@ abstract class ActionsAdherentCardCommon
/**
* Get object
* Get object
*
* @param int $id Object id
* @return object Object loaded
*/
public function getObject($id)
{
//$ret = $this->getInstanceDao();
* @param int $id Object id
* @return object Object loaded
*/
public function getObject($id)
{
//$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);
}
else
{*/
$object = new Adherent($this->db);
if (!empty($id)) $object->fetch($id);
$this->object = $object;
//}
}
$object = new Adherent($this->db);
if (!empty($id)) $object->fetch($id);
$this->object = $object;
//}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set content of ->tpl array, to use into template
*
* @param string $action Type of action
* @param int $id Id
* @return string HTML output
*/
public function assign_values(&$action, $id)
{
// phpcs:enable
global $conf, $langs, $user, $canvas;
global $form, $formcompany, $objsoc;
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set content of ->tpl array, to use into template
*
* @param string $action Type of action
* @param int $id Id
* @return string HTML output
*/
public function assign_values(&$action, $id)
{
// phpcs:enable
global $conf, $langs, $user, $canvas;
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) {
$this->tpl[$key] = $value;
}
foreach ($this->object as $key => $value) {
$this->tpl[$key] = $value;
}
$this->tpl['error'] = $this->error;
$this->tpl['errors'] = $this->errors;
$this->tpl['error'] = $this->error;
$this->tpl['errors'] = $this->errors;
if ($action == 'create' || $action == 'edit') {
if ($conf->use_javascript_ajax) {
if ($action == 'create' || $action == 'edit') {
if ($conf->use_javascript_ajax) {
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
@ -111,153 +111,153 @@ abstract class ActionsAdherentCardCommon
</script>'."\n";
}
if (is_object($objsoc) && $objsoc->id > 0) {
$this->tpl['company'] = $objsoc->getNomUrl(1);
$this->tpl['company_id'] = $objsoc->id;
} else {
$this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1);
}
if (is_object($objsoc) && $objsoc->id > 0) {
$this->tpl['company'] = $objsoc->getNomUrl(1);
$this->tpl['company_id'] = $objsoc->id;
} else {
$this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1);
}
// Civility
$this->tpl['select_civility'] = $formcompany->select_civility($this->object->civility_id);
// Civility
$this->tpl['select_civility'] = $formcompany->select_civility($this->object->civility_id);
// Predefined with third party
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->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->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->email)) == 0) $this->object->email = $objsoc->email;
}
// Predefined with third party
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->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->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->email)) == 0) $this->object->email = $objsoc->email;
}
// Zip
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
// Zip
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
// Town
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
// Town
$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
$this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id');
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
// Country
$this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id');
$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
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;
// State
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;
// Physical or Moral
$selectarray = array('0'=>$langs->trans("Physical"), '1'=>$langs->trans("Moral"));
$this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0);
}
// Physical or Moral
$selectarray = array('0'=>$langs->trans("Physical"), '1'=>$langs->trans("Moral"));
$this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0);
}
if ($action == 'view' || $action == 'edit' || $action == 'delete') {
// Emailing
if (!empty($conf->mailing->enabled)) {
if ($action == 'view' || $action == 'edit' || $action == 'delete') {
// Emailing
if (!empty($conf->mailing->enabled)) {
$langs->load("mails");
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
}
// Dolibarr user
if ($this->object->user_id) {
// Dolibarr user
if ($this->object->user_id) {
$dolibarr_user = new User($this->db);
$result = $dolibarr_user->fetch($this->object->user_id);
$this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
} else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
}
}
if ($action == 'view' || $action == 'delete') {
$this->tpl['showrefnav'] = $form->showrefnav($this->object, 'id');
if ($action == 'view' || $action == 'delete') {
$this->tpl['showrefnav'] = $form->showrefnav($this->object, 'id');
if ($this->object->socid > 0) {
$objsoc = new Societe($this->db);
if ($this->object->socid > 0) {
$objsoc = new Societe($this->db);
$objsoc->fetch($this->object->socid);
$this->tpl['company'] = $objsoc->getNomUrl(1);
} else {
$this->tpl['company'] = $langs->trans("AdherentNotLinkedToThirdParty");
}
$objsoc->fetch($this->object->socid);
$this->tpl['company'] = $objsoc->getNomUrl(1);
} else {
$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);
$this->tpl['country'] = ($img ? $img.' ' : '').$this->object->country;
$img = picto_from_langcode($this->object->country_code);
$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_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['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['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') {
// Full firstname and lastname separated with a dot : firstname.lastname
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login = dol_buildlogin($this->object->lastname, $this->object->firstname);
if ($action == 'create_user') {
// Full firstname and lastname separated with a dot : firstname.lastname
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login = dol_buildlogin($this->object->lastname, $this->object->firstname);
$generated_password = getRandomPassword(false);
$password = $generated_password;
$generated_password = getRandomPassword(false);
$password = $generated_password;
// Create a form array
$formquestion = array(
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login),
array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password));
// Create a form array
$formquestion = array(
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login),
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
/**
* Assign POST values into object
*
* @return string HTML output
*/
private function assign_post()
{
// phpcs:enable
global $langs, $mysoc;
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Assign POST values into object
*
* @return string HTML output
*/
private function assign_post()
{
// phpcs:enable
global $langs, $mysoc;
$this->object->old_name = $_POST["old_name"];
$this->object->old_firstname = $_POST["old_firstname"];
$this->object->old_name = $_POST["old_name"];
$this->object->old_firstname = $_POST["old_firstname"];
$this->object->fk_soc = $_POST["fk_soc"];
$this->object->lastname = $_POST["lastname"];
$this->object->firstname = $_POST["firstname"];
$this->object->civility_id = $_POST["civility_id"];
$this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
$this->object->country_id = $_POST["country_id"] ? $_POST["country_id"] : $mysoc->country_id;
$this->object->state_id = $_POST["state_id"];
$this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->email = $_POST["email"];
$this->object->note = $_POST["note"];
$this->object->canvas = $_POST["canvas"];
$this->object->fk_soc = $_POST["fk_soc"];
$this->object->lastname = $_POST["lastname"];
$this->object->firstname = $_POST["firstname"];
$this->object->civility_id = $_POST["civility_id"];
$this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
$this->object->country_id = $_POST["country_id"] ? $_POST["country_id"] : $mysoc->country_id;
$this->object->state_id = $_POST["state_id"];
$this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->email = $_POST["email"];
$this->object->note = $_POST["note"];
$this->object->canvas = $_POST["canvas"];
// We set country_id, and country_code label of the chosen country
if ($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);
if ($resql) {
$obj = $this->db->fetch_object($resql);
// We set country_id, and country_code label of the chosen country
if ($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);
if ($resql) {
$obj = $this->db->fetch_object($resql);
$this->object->country_code = $obj->code;
$this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->libelle;
} else {
dol_print_error($this->db);
}
}
}
$this->object->country_code = $obj->code;
$this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->libelle;
} else {
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
{
/**
* Constructor
*
* @param DoliDB $db Handler acces data base
* @param string $dirmodule Name of directory of module
* @param string $targetmodule Name of directory of module where canvas is stored
* @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas)
* Constructor
*
* @param DoliDB $db Handler acces data base
* @param string $dirmodule Name of directory of module
* @param string $targetmodule Name of directory of module where canvas is stored
* @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas)
*/
public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{
$this->db = $db;
$this->dirmodule = $dirmodule;
$this->targetmodule = $targetmodule;
$this->canvas = $canvas;
$this->card = $card;
$this->db = $db;
$this->dirmodule = $dirmodule;
$this->targetmodule = $targetmodule;
$this->canvas = $canvas;
$this->card = $card;
}
/**
@ -67,7 +67,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Assign custom values for canvas
*
@ -77,47 +77,47 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
*/
public function assign_values(&$action, $id)
{
// phpcs:enable
// phpcs:enable
global $limit, $offset, $sortfield, $sortorder;
global $conf, $db, $langs, $user;
global $form;
$ret = $this->getObject($id);
parent::assign_values($action, $id);
parent::assign_values($action, $id);
$this->tpl['title'] = $this->getTitle($action);
$this->tpl['error'] = $this->error;
$this->tpl['errors'] = $this->errors;
$this->tpl['title'] = $this->getTitle($action);
$this->tpl['error'] = $this->error;
$this->tpl['errors'] = $this->errors;
if ($action == 'view') {
// Card header
$head = member_prepare_head($this->object);
$title = $this->getTitle($action);
// Card header
$head = member_prepare_head($this->object);
$title = $this->getTitle($action);
$this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'adherent');
$this->tpl['showend'] = dol_get_fiche_end();
$this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'adherent');
$this->tpl['showend'] = dol_get_fiche_end();
$objsoc = new Societe($db);
$objsoc->fetch($this->object->socid);
$objsoc = new Societe($db);
$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);
} else {
$this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
} else {
// Confirm delete contact
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);
}
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);
}
}
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
*
@ -129,11 +129,11 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
*/
public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{
// phpcs:enable
// phpcs:enable
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'];
if (empty($user->socid)) {
echo '<div class="tabsAction">';
echo '<div class="tabsAction">';
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>';
}
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>';
}
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>';
}
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>';
}
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>';
}
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 '</div><br>';
echo '</div><br>';
}
echo $this->control->tpl['actionstodo'];

View File

@ -218,7 +218,7 @@ if (empty($reshook)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$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'));
}

View File

@ -56,163 +56,163 @@ $extrafields->fetch_name_optionals_label($object->table_element);
*/
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) {
$arrayofmembers = array();
$arrayofmembers = array();
// 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 .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
$sql .= " t.libelle as type,";
$sql .= " c.code as country_code, c.label as country";
// Add fields from extrafields
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 : '');
$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";
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 .= " AND d.entity IN (".getEntity('adherent').")";
if (is_numeric($foruserid)) $sql .= " AND d.rowid=".$foruserid;
if ($foruserlogin) $sql .= " AND d.login='".$db->escape($foruserlogin)."'";
$sql .= " ORDER BY d.rowid ASC";
// 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 .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
$sql .= " t.libelle as type,";
$sql .= " c.code as country_code, c.label as country";
// Add fields from extrafields
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 : '');
$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";
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 .= " AND d.entity IN (".getEntity('adherent').")";
if (is_numeric($foruserid)) $sql .= " AND d.rowid=".$foruserid;
if ($foruserlogin) $sql .= " AND d.login='".$db->escape($foruserlogin)."'";
$sql .= " ORDER BY d.rowid ASC";
dol_syslog("Search members", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
dol_syslog("Search members", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
if ($objp->country == '-') $objp->country = '';
if ($objp->country == '-') $objp->country = '';
$adherentstatic->id = $objp->rowid;
$adherentstatic->lastname = $objp->lastname;
$adherentstatic->firstname = $objp->firstname;
$adherentstatic->id = $objp->rowid;
$adherentstatic->lastname = $objp->lastname;
$adherentstatic->firstname = $objp->firstname;
// 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'])) {
$adherentstatic->array_options = array();
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$tmpkey = 'options_'.$key;
if (!empty($objp->$tmpkey)) {
$adherentstatic->array_options[$tmpkey] = $objp->$tmpkey;
}
//if (!empty($objp->$key))
// $objp->array_options[$tmpkey] = $objp->$key;
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey;
}
}
// 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'])) {
$adherentstatic->array_options = array();
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$tmpkey = 'options_'.$key;
if (!empty($objp->$tmpkey)) {
$adherentstatic->array_options[$tmpkey] = $objp->$tmpkey;
}
//if (!empty($objp->$key))
// $objp->array_options[$tmpkey] = $objp->$key;
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey;
}
}
// List of values to scan for a replacement
$substitutionarray = array(
'__ID__'=>$objp->rowid,
'__LOGIN__'=>$objp->login,
'__FIRSTNAME__'=>$objp->firstname,
'__LASTNAME__'=>$objp->lastname,
'__FULLNAME__'=>$adherentstatic->getFullName($langs),
'__COMPANY__'=>$objp->company,
'__ADDRESS__'=>$objp->address,
'__ZIP__'=>$objp->zip,
'__TOWN__'=>$objp->town,
'__COUNTRY__'=>$objp->country,
'__COUNTRY_CODE__'=>$objp->country_code,
'__EMAIL__'=>$objp->email,
'__BIRTH__'=>dol_print_date($objp->birth, 'day'),
'__TYPE__'=>$objp->type,
'__YEAR__'=>$year,
'__MONTH__'=>$month,
'__DAY__'=>$day,
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/"
);
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
// List of values to scan for a replacement
$substitutionarray = array(
'__ID__'=>$objp->rowid,
'__LOGIN__'=>$objp->login,
'__FIRSTNAME__'=>$objp->firstname,
'__LASTNAME__'=>$objp->lastname,
'__FULLNAME__'=>$adherentstatic->getFullName($langs),
'__COMPANY__'=>$objp->company,
'__ADDRESS__'=>$objp->address,
'__ZIP__'=>$objp->zip,
'__TOWN__'=>$objp->town,
'__COUNTRY__'=>$objp->country,
'__COUNTRY_CODE__'=>$objp->country_code,
'__EMAIL__'=>$objp->email,
'__BIRTH__'=>dol_print_date($objp->birth, 'day'),
'__TYPE__'=>$objp->type,
'__YEAR__'=>$year,
'__MONTH__'=>$month,
'__DAY__'=>$day,
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/"
);
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
// For business cards
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
$textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
$textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
$textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
$textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
// For business cards
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
$textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
$textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
$textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
$textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
if (is_numeric($foruserid) || $foruserlogin) {
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
if ($nb <= 0) $nb = 1; // Protection to avoid empty page
if (is_numeric($foruserid) || $foruserlogin) {
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
if ($nb <= 0) $nb = 1; // Protection to avoid empty page
for ($j = 0; $j < $nb; $j++) {
$arrayofmembers[] = array(
'textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
'id'=>$objp->rowid,
'photo'=>$objp->photo
);
}
} else {
$arrayofmembers[] = array(
'textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
'id'=>$objp->rowid,
'photo'=>$objp->photo
);
}
}
for ($j = 0; $j < $nb; $j++) {
$arrayofmembers[] = array(
'textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
'id'=>$objp->rowid,
'photo'=>$objp->photo
);
}
} else {
$arrayofmembers[] = array(
'textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
'id'=>$objp->rowid,
'photo'=>$objp->photo
);
}
}
// For labels
if ($mode == 'label') {
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);
$textheader = '';
$textfooter = '';
$textright = '';
// For labels
if ($mode == 'label') {
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);
$textheader = '';
$textfooter = '';
$textright = '';
$arrayofmembers[] = array('textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
'id'=>$objp->rowid,
'photo'=>$objp->photo);
}
$arrayofmembers[] = array('textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
'id'=>$objp->rowid,
'photo'=>$objp->photo);
}
$i++;
}
$i++;
}
// Build and output PDF
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
if (!count($arrayofmembers)) {
$mesg = $langs->trans("ErrorRecordNotFound");
}
if (empty($model) || $model == '-1') {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
}
if (!$mesg) $result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
} elseif ($mode == 'label') {
if (!count($arrayofmembers)) {
$mesg = $langs->trans("ErrorRecordNotFound");
}
if (empty($modellabel) || $modellabel == '-1') {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
}
if (!$mesg) $result = doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs);
}
// Build and output PDF
if (empty($mode) || $mode == 'card' || $mode == 'cardlogin') {
if (!count($arrayofmembers)) {
$mesg = $langs->trans("ErrorRecordNotFound");
}
if (empty($model) || $model == '-1') {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
}
if (!$mesg) $result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
} elseif ($mode == 'label') {
if (!count($arrayofmembers)) {
$mesg = $langs->trans("ErrorRecordNotFound");
}
if (empty($modellabel) || $modellabel == '-1') {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
}
if (!$mesg) $result = doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs);
}
if ($result <= 0) {
dol_print_error('', $result);
}
} else {
dol_print_error($db);
}
if ($result <= 0) {
dol_print_error('', $result);
}
} else {
dol_print_error($db);
}
if (!$mesg) {
$db->close();
exit;
}
if (!$mesg) {
$db->close();
exit;
}
}

View File

@ -32,18 +32,18 @@ include_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
*/
class AdherentStats extends Stats
{
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element;
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element;
public $memberid;
public $socid;
public $userid;
public $memberid;
public $socid;
public $userid;
public $from;
public $field;
public $where;
public $from;
public $field;
public $where;
/**
@ -51,15 +51,15 @@ class AdherentStats extends Stats
*
* @param DoliDB $db Database handler
* @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)
{
global $user, $conf;
$this->db = $db;
$this->socid = $socid;
$this->userid = $userid;
$this->socid = $socid;
$this->userid = $userid;
$object = new Subscription($this->db);
@ -74,16 +74,16 @@ class AdherentStats extends Stats
if ($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
*
* @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
* @return array Array of nb each month
* @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
* @return array Array of nb each month
*/
public function getNbByMonth($year, $format = 0)
{
@ -95,7 +95,7 @@ class AdherentStats extends Stats
$sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year);
$sql .= " AND ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
$sql .= $this->db->order('dm', 'DESC');
return $this->_getNbByMonth($year, $sql, $format);
}
@ -103,7 +103,7 @@ class AdherentStats extends Stats
/**
* Return the number of subscriptions by year
*
* @return array Array of nb each year
* @return array Array of nb each year
*/
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";
$sql .= " WHERE ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
$sql .= $this->db->order('dm', 'DESC');
return $this->_getNbByYear($sql);
}
@ -122,9 +122,9 @@ class AdherentStats extends Stats
/**
* Return the number of subscriptions by month for a given 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
* @return array Array of amount each month
* @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
* @return array Array of amount each month
*/
public function getAmountByMonth($year, $format = 0)
{
@ -136,7 +136,7 @@ class AdherentStats extends Stats
$sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year);
$sql .= " AND ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
$sql .= $this->db->order('dm', 'DESC');
return $this->_getAmountByMonth($year, $sql, $format);
}
@ -144,8 +144,8 @@ class AdherentStats extends Stats
/**
* Return average amount each month
*
* @param int $year Year
* @return array Array of average each month
* @param int $year Year
* @return array Array of average each month
*/
public function getAverageByMonth($year)
{
@ -157,7 +157,7 @@ class AdherentStats extends Stats
$sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year);
$sql .= " AND ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
$sql .= $this->db->order('dm', 'DESC');
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";
$sql .= " WHERE ".$this->where;
$sql .= " GROUP BY year";
$sql .= $this->db->order('year', 'DESC');
$sql .= $this->db->order('year', 'DESC');
return $this->_getAllByYear($sql);
}

View File

@ -94,17 +94,17 @@ class Members extends DolibarrApi
*/
public function getByThirdparty($thirdparty)
{
if (! DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401);
}
$member = new Adherent($this->db);
$result = $member->fetch('', '', $thirdparty);
if ( ! $result ) {
if (!$result) {
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);
}
@ -127,23 +127,23 @@ class Members extends DolibarrApi
*/
public function getByThirdpartyEmail($email)
{
if (! DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401);
}
$thirdparty = new Societe($this->db);
$result = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email);
if ( ! $result ) {
if (!$result) {
throw new RestException(404, 'thirdparty not found');
}
$member = new Adherent($this->db);
$result = $member->fetch('', '', $thirdparty->id);
if ( ! $result ) {
if (!$result) {
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);
}
@ -166,23 +166,23 @@ class Members extends DolibarrApi
*/
public function getByThirdpartyBarcode($barcode)
{
if (! DolibarrApiAccess::$user->rights->adherent->lire) {
if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401);
}
$thirdparty = new Societe($this->db);
$result = $thirdparty->fetch('', '', '', $barcode);
if ( ! $result ) {
if (!$result) {
throw new RestException(404, 'thirdparty not found');
}
$member = new Adherent($this->db);
$result = $member->fetch('', '', $thirdparty->id);
if ( ! $result ) {
if (!$result) {
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);
}

View File

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

View File

@ -32,435 +32,435 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
*/
class Subscription extends CommonObject
{
/**
* @var string ID to identify managed object
*/
public $element = 'subscription';
/**
* @var string ID to identify managed object
*/
public $element = 'subscription';
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element = 'subscription';
/**
* @var string Name of table without prefix where object is stored
*/
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
*/
public $ismultientitymanaged = 'fk_adherent@adherent';
/**
* @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';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'payment';
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'payment';
/**
* Date creation record (datec)
*
* @var integer
*/
public $datec;
/**
* Date creation record (datec)
*
* @var integer
*/
public $datec;
/**
* Date modification record (tms)
*
* @var integer
*/
public $datem;
/**
* Date modification record (tms)
*
* @var integer
*/
public $datem;
/**
* Subscription start date (date subscription)
*
* @var integer
*/
public $dateh;
/**
* Subscription start date (date subscription)
*
* @var integer
*/
public $dateh;
/**
* Subscription end date
*
* @var integer
*/
public $datef;
/**
* Subscription end date
*
* @var integer
*/
public $datef;
/**
* @var int ID
*/
public $fk_type;
public $fk_adherent;
/**
* @var int ID
*/
public $fk_type;
public $fk_adherent;
public $amount;
public $amount;
/**
* @var int ID
*/
public $fk_bank;
/**
* @var int ID
*/
public $fk_bank;
public $fields = array(
'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),
'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),
'dateadh' =>array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'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),
'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),
'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_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
);
public $fields = array(
'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),
'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),
'dateadh' =>array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'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),
'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),
'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_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
);
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
/**
* Function who permitted cretaion of the subscription
*
* @param User $user User that create
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id subscription created if OK
*/
public function create($user, $notrigger = false)
{
global $langs;
/**
* Function who permitted cretaion of the subscription
*
* @param User $user User that create
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id subscription created if OK
*/
public function create($user, $notrigger = false)
{
global $langs;
$error = 0;
$error = 0;
$now = dol_now();
$now = dol_now();
// Check parameters
if ($this->datef <= $this->dateh) {
$this->error = $langs->trans("ErrorBadValueForDate");
return -1;
}
if (empty($this->datec)) $this->datec = $now;
// Check parameters
if ($this->datef <= $this->dateh) {
$this->error = $langs->trans("ErrorBadValueForDate");
return -1;
}
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';
$member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent);
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent);
if ($this->fk_type == null) { // If type not defined, we use the type of member
$type = $member->typeid;
} else {
$type = $this->fk_type;
}
$sql .= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->dateh)."',";
$sql .= " '".$this->db->idate($this->datef)."',";
$sql .= " ".$this->amount.",";
$sql .= " '".$this->db->escape($this->note_public ? $this->note_public : $this->note)."')";
if ($this->fk_type == null) { // If type not defined, we use the type of member
$type = $member->typeid;
} else {
$type = $this->fk_type;
}
$sql .= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->dateh)."',";
$sql .= " '".$this->db->idate($this->datef)."',";
$sql .= " ".$this->amount.",";
$sql .= " '".$this->db->escape($this->note_public ? $this->note_public : $this->note)."')";
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = $this->db->lasterror();
}
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = $this->db->lasterror();
}
if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
$this->fk_type = $type;
}
if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
$this->fk_type = $type;
}
if (!$error && !$notrigger) {
$this->context = array('member'=>$member);
// Call triggers
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
if (!$error && !$notrigger) {
$this->context = array('member'=>$member);
// Call triggers
$result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return $this->id;
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return $this->id;
}
}
/**
* Method to load a subscription
*
* @param int $rowid Id subscription
* @return int <0 if KO, =0 if not found, >0 if OK
*/
public function fetch($rowid)
{
$sql = "SELECT rowid, fk_type, fk_adherent, datec,";
$sql .= " tms,";
$sql .= " dateadh as dateh,";
$sql .= " datef,";
$sql .= " subscription, note, fk_bank";
$sql .= " FROM ".MAIN_DB_PREFIX."subscription";
$sql .= " WHERE rowid=".$rowid;
/**
* Method to load a subscription
*
* @param int $rowid Id subscription
* @return int <0 if KO, =0 if not found, >0 if OK
*/
public function fetch($rowid)
{
$sql = "SELECT rowid, fk_type, fk_adherent, datec,";
$sql .= " tms,";
$sql .= " dateadh as dateh,";
$sql .= " datef,";
$sql .= " subscription, note, fk_bank";
$sql .= " FROM ".MAIN_DB_PREFIX."subscription";
$sql .= " WHERE rowid=".$rowid;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->fk_type = $obj->fk_type;
$this->fk_adherent = $obj->fk_adherent;
$this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->tms);
$this->dateh = $this->db->jdate($obj->dateh);
$this->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->subscription;
$this->note = $obj->note;
$this->fk_bank = $obj->fk_bank;
return 1;
} else {
return 0;
}
} else {
$this->error = $this->db->lasterror();
return -1;
}
}
$this->fk_type = $obj->fk_type;
$this->fk_adherent = $obj->fk_adherent;
$this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->tms);
$this->dateh = $this->db->jdate($obj->dateh);
$this->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->subscription;
$this->note = $obj->note;
$this->fk_bank = $obj->fk_bank;
return 1;
} else {
return 0;
}
} else {
$this->error = $this->db->lasterror();
return -1;
}
}
/**
* Update subscription
*
* @param User $user User who updated
* @param int $notrigger 0=Disable triggers
* @return int <0 if KO, >0 if OK
*/
public function update($user, $notrigger = 0)
{
$error = 0;
/**
* Update subscription
*
* @param User $user User who updated
* @param int $notrigger 0=Disable triggers
* @return int <0 if KO, >0 if OK
*/
public function update($user, $notrigger = 0)
{
$error = 0;
$this->db->begin();
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_type = ".$this->fk_type.",";
$sql .= " fk_adherent = ".$this->fk_adherent.",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').",";
$sql .= " subscription = '".price2num($this->amount)."',";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',";
$sql .= " datec='".$this->db->idate($this->datec)."',";
$sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null');
$sql .= " WHERE rowid = ".$this->id;
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_type = ".$this->fk_type.",";
$sql .= " fk_adherent = ".$this->fk_adherent.",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').",";
$sql .= " subscription = '".price2num($this->amount)."',";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',";
$sql .= " datec='".$this->db->idate($this->datec)."',";
$sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null');
$sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent);
$result = $member->update_end_date($user);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent);
$result = $member->update_end_date($user);
if (!$error && !$notrigger) {
$this->context = array('member'=>$member);
// Call triggers
$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
// End call triggers
}
} else {
$error++;
$this->error = $this->db->lasterror();
}
if (!$error && !$notrigger) {
$this->context = array('member'=>$member);
// Call triggers
$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
// End call triggers
}
} else {
$error++;
$this->error = $this->db->lasterror();
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return $this->id;
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return $this->id;
}
}
/**
* Delete a subscription
*
* @param User $user User that delete
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function delete($user, $notrigger = false)
{
$error = 0;
/**
* Delete a subscription
*
* @param User $user User that delete
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function delete($user, $notrigger = false)
{
$error = 0;
// It subscription is linked to a bank transaction, we get it
if ($this->fk_bank > 0) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline = new AccountLine($this->db);
$result = $accountline->fetch($this->fk_bank);
}
// It subscription is linked to a bank transaction, we get it
if ($this->fk_bank > 0) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline = new AccountLine($this->db);
$result = $accountline->fetch($this->fk_bank);
}
$this->db->begin();
$this->db->begin();
if (!$error) {
if (!$notrigger) {
// Call triggers
$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
// End call triggers
}
}
if (!$error) {
if (!$notrigger) {
// Call triggers
$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
// End call triggers
}
}
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->affected_rows($resql);
if ($num) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent);
$result = $member->update_end_date($user);
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->affected_rows($resql);
if ($num) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$result = $member->fetch($this->fk_adherent);
$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
if ($result > 0) {
$this->db->commit();
return 1;
} else {
$this->error = $accountline->error;
$this->db->rollback();
return -1;
}
} else {
$this->db->commit();
return 1;
}
} else {
$this->db->commit();
return 0;
}
} else {
$error++;
$this->error = $this->db->lasterror();
}
}
if ($result > 0) {
$this->db->commit();
return 1;
} else {
$this->error = $accountline->error;
$this->db->rollback();
return -1;
}
} else {
$this->db->commit();
return 1;
}
} else {
$this->db->commit();
return 0;
}
} else {
$error++;
$this->error = $this->db->lasterror();
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return 1;
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit();
return 1;
}
}
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $notooltip 1=Disable tooltip
* @param string $option Page for link ('', 'nolink', ...)
* @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
* @return string Chaine avec URL
*/
public function getNomUrl($withpicto = 0, $notooltip = 0, $option = '', $morecss = '', $save_lastsearch_value = -1)
{
global $langs;
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $notooltip 1=Disable tooltip
* @param string $option Page for link ('', 'nolink', ...)
* @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
* @return string Chaine avec URL
*/
public function getNomUrl($withpicto = 0, $notooltip = 0, $option = '', $morecss = '', $save_lastsearch_value = -1)
{
global $langs;
$result = '';
$result = '';
$langs->load("members");
$label = $langs->trans("ShowSubscription").': '.$this->ref;
$langs->load("members");
$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') {
// Add param to save lastsearch_values or not
$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 ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
}
if ($option != 'nolink') {
// Add param to save lastsearch_values or not
$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 ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
}
$linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">';
$linkend = '</a>';
$linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">';
$linkend = '</a>';
$picto = 'payment';
$picto = 'payment';
$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 != 2) $result .= $this->ref;
$result .= $linkend;
$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 != 2) $result .= $this->ref;
$result .= $linkend;
return $result;
}
return $result;
}
/**
* 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
* @return string Label
*/
public function getLibStatut($mode = 0)
{
return '';
}
/**
* 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
* @return string Label
*/
public function getLibStatut($mode = 0)
{
return '';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
* @param int $status Id status
* @return string Label
*/
public function LibStatut($status)
{
// phpcs:enable
global $langs;
$langs->load("members");
return '';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi le libelle d'un statut donne
*
* @param int $status Id status
* @return string Label
*/
public function LibStatut($status)
{
// phpcs:enable
global $langs;
$langs->load("members");
return '';
}
/**
* Load information of the subscription object
*
* @param int $id Id subscription
* @return void
*/
public function info($id)
{
$sql = 'SELECT c.rowid, c.datec,';
$sql .= ' c.tms as datem';
$sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql .= ' WHERE c.rowid = '.$id;
/**
* Load information of the subscription object
*
* @param int $id Id subscription
* @return void
*/
public function info($id)
{
$sql = 'SELECT c.rowid, c.datec,';
$sql .= ' c.tms as datem';
$sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql .= ' WHERE c.rowid = '.$id;
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
}
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
}
$this->db->free($result);
} else {
dol_print_error($this->db);
}
}
$this->db->free($result);
} else {
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);
if ($id > 0) {
$result = $membert->fetch($object->typeid);
$result = $membert->fetch($object->typeid);
if ($result > 0) {
// Build file list
$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'];
}
if (!empty($conf->notification->enabled))
if (!empty($conf->notification->enabled))
$langs->load("mails");
$head = member_prepare_head($object);
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">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
// Login
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>';
}
// Login
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>';
}
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
// Morphy
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%">';
// Morphy
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 $form->showphoto('memberphoto',$object);
print '</td>';*/
print '</tr>';
print '</tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
// Number of Attached Files
// Number of Attached Files
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
//Total Size Of Attached Files
@ -157,7 +157,7 @@ if ($id > 0) {
dol_print_error($db);
}
} else {
$langs->load("errors");
$langs->load("errors");
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
// Search contact/address
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) {
$listofsearchfields['search_member'] = array('text'=>'Member');
}
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) {
$listofsearchfields['search_member'] = array('text'=>'Member');
}
if (count($listofsearchfields)) {
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
$i = 0;
foreach ($listofsearchfields as $key => $value) {
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
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>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>';
$i++;
}
print '</table>';
print '</div>';
print '</form>';
print '<br>';
}
if (count($listofsearchfields)) {
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
$i = 0;
foreach ($listofsearchfields as $key => $value) {
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
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>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>';
$i++;
}
print '</table>';
print '</div>';
print '</form>';
print '<br>';
}
}
@ -158,53 +158,53 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel
if ($conf->use_javascript_ajax) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
print '<tr><td class="center" colspan="2">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
print '<tr><td class="center" colspan="2">';
$SommeA = 0;
$SommeB = 0;
$SommeC = 0;
$SommeD = 0;
$total = 0;
$dataval = array();
$i = 0;
foreach ($AdherentType as $key => $adhtype) {
$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['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0);
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
$SommeA += isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0;
$SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0;
$SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0;
$SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
$i++;
}
$total = $SommeA + $SommeB + $SommeC + $SommeD;
$dataseries = array();
$dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersNotUpToDate"), round($SommeB));
$dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersUpToDate"), round($SommeC));
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SommeD));
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SommeA));
$SommeA = 0;
$SommeB = 0;
$SommeC = 0;
$SommeD = 0;
$total = 0;
$dataval = array();
$i = 0;
foreach ($AdherentType as $key => $adhtype) {
$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['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0);
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
$SommeA += isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0;
$SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0;
$SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0;
$SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
$i++;
}
$total = $SommeA + $SommeB + $SommeC + $SommeD;
$dataseries = array();
$dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersNotUpToDate"), round($SommeB));
$dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersUpToDate"), round($SommeC));
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SommeD));
$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';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, $badgeStatus6, '-'.$badgeStatus0));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->setHeight('200');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($total ? 0 : 1);
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, $badgeStatus6, '-'.$badgeStatus0));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->setHeight('200');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($total ? 0 : 1);
print '</td></tr>';
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
print $SommeA + $SommeB + $SommeC + $SommeD;
print '</td></tr>';
print '</table>';
print '</div>';
print '</td></tr>';
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
print $SommeA + $SommeB + $SommeC + $SommeD;
print '</td></tr>';
print '</table>';
print '</div>';
}
print '<br>';
@ -223,17 +223,17 @@ $sql .= " AND d.rowid = c.fk_adherent";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$year = dol_print_date($db->jdate($objp->dateh), "%Y");
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
$tot += $objp->subscription;
$numb += 1;
$i++;
}
$num = $db->num_rows($result);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$year = dol_print_date($db->jdate($objp->dateh), "%Y");
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
$tot += $objp->subscription;
$numb += 1;
$i++;
}
}
print '<div class="div-table-responsive-no-min">';
@ -258,12 +258,12 @@ foreach ($Total as $key=>$value) {
break;
}
print '<tr class="oddeven">';
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
print "<td class=\"right\">".$Number[$key]."</td>";
print "<td class=\"right\">".price($value)."</td>";
print "<td class=\"right\">".price(price2num($value / $Number[$key], 'MT'))."</td>";
print "</tr>\n";
$i++;
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
print "<td class=\"right\">".$Number[$key]."</td>";
print "<td class=\"right\">".price($value)."</td>";
print "<td class=\"right\">".price(price2num($value / $Number[$key], 'MT'))."</td>";
print "</tr>\n";
$i++;
}
// Total

View File

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

View File

@ -204,30 +204,30 @@ if (empty($reshook)) {
// Close
if ($massaction == 'close' && $user->rights->adherent->creer) {
$tmpmember = new Adherent($db);
$error = 0;
$nbclose = 0;
$tmpmember = new Adherent($db);
$error = 0;
$nbclose = 0;
$db->begin();
$db->begin();
foreach ($toselect as $idtoclose) {
$tmpmember->fetch($idtoclose);
$result = $tmpmember->resiliate($user);
foreach ($toselect as $idtoclose) {
$tmpmember->fetch($idtoclose);
$result = $tmpmember->resiliate($user);
if ($result < 0 && !count($tmpmember->errors)) {
setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
} else {
if ($result > 0) $nbclose++;
}
}
if ($result < 0 && !count($tmpmember->errors)) {
setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
} else {
if ($result > 0) $nbclose++;
}
}
if (!$error) {
setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs');
if (!$error) {
setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs');
$db->commit();
} else {
$db->rollback();
}
$db->commit();
} else {
$db->rollback();
}
}
// Mass actions
@ -409,7 +409,7 @@ $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = '';
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"].'">';
@ -560,7 +560,7 @@ if (!empty($arrayfields['d.email']['checked'])) {
// End of subscription date
if (!empty($arrayfields['d.datefin']['checked'])) {
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 '</td>';
}

View File

@ -40,8 +40,8 @@ $result = restrictedArea($user, 'adherent', $id);
$object = new Adherent($db);
$result = $object->fetch($id);
if ($result > 0) {
$adht = new AdherentType($db);
$result = $adht->fetch($object->typeid);
$adht = new AdherentType($db);
$result = $adht->fetch($object->typeid);
}
$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);
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">';
// Login
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>';
}
// Login
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>';
}
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Morphy
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%">';
// Morphy
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 $form->showphoto('memberphoto',$member);
print '</td>';*/
print '</tr>';
print '</tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
print "</table>";
print "</table>";
print '</div>';
print '</div>';
$cssclass = 'titlefield';
$permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
$cssclass = 'titlefield';
$permission = $user->rights->adherent->creer; // Used by the include of 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

View File

@ -34,8 +34,8 @@ $mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check
if ($user->socid > 0) {
$action = '';
$socid = $user->socid;
$action = '';
$socid = $user->socid;
}
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
@ -69,7 +69,7 @@ $sql .= " d.morphy as code";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$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"; // Not draft
$sql .= " AND d.statut != -1"; // Not draft
$sql .= " GROUP BY d.morphy";
$foundphy = $foundmor = 0;
@ -100,7 +100,7 @@ $sql .= " d.morphy as code";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
$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"; // Active (not draft=-1, not resiliated=0)
$sql .= " AND d.statut >= 1"; // Active (not draft=-1, not resiliated=0)
$sql .= " GROUP BY d.morphy";
$foundphy = $foundmor = 0;

View File

@ -35,8 +35,8 @@ $mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check
if ($user->socid > 0) {
$action = '';
$socid = $user->socid;
$action = '';
$socid = $user->socid;
}
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
@ -68,129 +68,129 @@ print load_fiche_titre($title, '', 'object_group');
dol_mkdir($dir);
if ($mode) {
// Define sql
if ($mode == 'memberbycountry') {
$label = $langs->trans("Country");
$tab = 'statscountry';
// Define sql
if ($mode == 'memberbycountry') {
$label = $langs->trans("Country");
$tab = 'statscountry';
$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 .= " 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."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";
//print $sql;
}
$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 .= " 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."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";
//print $sql;
}
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");
$label2 = $langs->trans("Region"); //département
$tab = 'statsregion'; //onglet
$label2 = $langs->trans("State");
$tab = 'statsstate';
$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, co.code, co.label, r.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, r.nom"; //+
//print $sql;
}
if ($mode == 'memberbytown') {
$label = $langs->trans("Country");
$label2 = $langs->trans("Town");
$tab = 'statstown';
$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");
$label2 = $langs->trans("Region"); //département
$tab = 'statsregion'; //onglet
$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, d.town as label2";
$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."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;
}
$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, co.code, co.label, r.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, r.nom"; //+
//print $sql;
}
if ($mode == 'memberbytown') {
$label = $langs->trans("Country");
$label2 = $langs->trans("Town");
$tab = 'statstown';
$langsen = new Translate('', $conf);
$langsen->setDefaultLang('en_US');
$langsen->load("dict");
//print $langsen->trans("Country"."FI");exit;
$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, d.town as label2";
$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."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
dol_syslog("Count member", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$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"))),
$langsen = new Translate('', $conf);
$langsen->setDefaultLang('en_US');
$langsen->load("dict");
//print $langsen->trans("Country"."FI");exit;
// Define $data array
dol_syslog("Count member", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$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,
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
if ($mode == 'memberbyregion') { //+
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
if ($mode == 'memberbyregion') { //+
$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"))),
'label2'=>($obj->label2 ? $obj->label2 : $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"))),
'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
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"))),
'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")),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
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"))),
'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")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
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"))),
'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")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
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"))),
'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")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
$i++;
}
$db->free($resql);
} else {
dol_print_error($db);
}
$i++;
}
$db->free($resql);
} else {
dol_print_error($db);
}
}
@ -201,101 +201,101 @@ print dol_get_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
// Print title
if ($mode && !count($data)) {
print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>';
print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>';
} else {
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 == 'memberbytown') print '<span class="opacitymedium">'.$langs->trans("MembersByTownDesc").'</span><br>';
elseif ($mode == 'memberbyregion') print '<span class="opacitymedium">'.$langs->trans("MembersByRegion").'</span><br>'; //+
else {
print '<span class="opacitymedium">'.$langs->trans("MembersStatisticsDesc").'</span><br>';
print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbycountry">'.$langs->trans("MembersStatisticsByCountries").'</a><br>';
print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbystate">'.$langs->trans("MembersStatisticsByState").'</a><br>';
print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbytown">'.$langs->trans("MembersStatisticsByTown").'</a><br>';
print '<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 == 'memberbytown') print '<span class="opacitymedium">'.$langs->trans("MembersByTownDesc").'</span><br>';
elseif ($mode == 'memberbyregion') print '<span class="opacitymedium">'.$langs->trans("MembersByRegion").'</span><br>'; //+
else {
print '<span class="opacitymedium">'.$langs->trans("MembersStatisticsDesc").'</span><br>';
print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbycountry">'.$langs->trans("MembersStatisticsByCountries").'</a><br>';
print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbystate">'.$langs->trans("MembersStatisticsByState").'</a><br>';
print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbytown">'.$langs->trans("MembersStatisticsByTown").'</a><br>';
print '<br>'; //+
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbyregion">'.$langs->trans("MembersStatisticsByRegion").'</a><br>'; //+
}
print '<br>';
}
print '<br>';
}
// Show graphics
if (count($arrayjs) && $mode == 'memberbycountry') {
$color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
if (is_readable($color_file)) include_once $color_file;
$color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
if (is_readable($color_file)) include_once $color_file;
// 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
print "\n<script type='text/javascript'>\n";
print "google.load('visualization', '1', {'packages': ['geomap']});\n";
print "google.setOnLoadCallback(drawMap);\n";
print "function drawMap() {\n\tvar data = new google.visualization.DataTable();\n";
// 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
print "\n<script type='text/javascript'>\n";
print "google.load('visualization', '1', {'packages': ['geomap']});\n";
print "google.setOnLoadCallback(drawMap);\n";
print "function drawMap() {\n\tvar data = new google.visualization.DataTable();\n";
// Get the total number of rows
print "\tdata.addRows(".count($data).");\n";
print "\tdata.addColumn('string', 'Country');\n";
print "\tdata.addColumn('number', 'Number');\n";
// Get the total number of rows
print "\tdata.addRows(".count($data).");\n";
print "\tdata.addColumn('string', 'Country');\n";
print "\tdata.addColumn('number', 'Number');\n";
// loop and dump
$i = 0;
foreach ($data as $val) {
$valcountry = strtoupper($val['code']); // Should be ISO-3166 code (faster)
//$valcountry=ucfirst($val['label_en']);
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.", 1, ".$val['nb'].");\n";
// Google's Geomap only supports up to 400 entries
if ($i >= 400) { break; }
$i++;
}
// loop and dump
$i = 0;
foreach ($data as $val) {
$valcountry = strtoupper($val['code']); // Should be ISO-3166 code (faster)
//$valcountry=ucfirst($val['label_en']);
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.", 1, ".$val['nb'].");\n";
// Google's Geomap only supports up to 400 entries
if ($i >= 400) { break; }
$i++;
}
print "\tvar options = {};\n";
print "\toptions['dataMode'] = 'regions';\n";
print "\toptions['showZoomOut'] = false;\n";
//print "\toptions['zoomOutLabel'] = '".dol_escape_js($langs->transnoentitiesnoconv("Numbers"))."';\n";
print "\toptions['width'] = ".$graphwidth.";\n";
print "\toptions['height'] = ".$graphheight.";\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 geomap = new google.visualization.GeoMap(container);\n";
print "\tgeomap.draw(data, options);\n";
print "};\n";
print "</script>\n";
print "\tvar options = {};\n";
print "\toptions['dataMode'] = 'regions';\n";
print "\toptions['showZoomOut'] = false;\n";
//print "\toptions['zoomOutLabel'] = '".dol_escape_js($langs->transnoentitiesnoconv("Numbers"))."';\n";
print "\toptions['width'] = ".$graphwidth.";\n";
print "\toptions['height'] = ".$graphheight.";\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 geomap = new google.visualization.GeoMap(container);\n";
print "\tgeomap.draw(data, options);\n";
print "};\n";
print "</script>\n";
// print the div tag that will contain the map
print '<div class="center" id="'.$mode.'"></div>'."\n";
print '<br>';
// print the div tag that will contain the map
print '<div class="center" id="'.$mode.'"></div>'."\n";
print '<br>';
}
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 '<table class="liste centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$label.'</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="center">'.$langs->trans("LastMemberDate").'</td>';
print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
print '</tr>';
print '<tr class="liste_titre">';
print '<td>'.$label.'</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="center">'.$langs->trans("LastMemberDate").'</td>';
print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
print '</tr>';
foreach ($data as $val) {
$year = $val['year'];
print '<tr class="oddeven">';
print '<td>'.$val['label'].'</td>';
if ($label2) print '<td class="center">'.$val['label2'].'</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['lastsubscriptiondate'], 'dayhour').'</td>';
print '</tr>';
}
foreach ($data as $val) {
$year = $val['year'];
print '<tr class="oddeven">';
print '<td>'.$val['label'].'</td>';
if ($label2) print '<td class="center">'.$val['label2'].'</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['lastsubscriptiondate'], 'dayhour').'</td>';
print '</tr>';
}
print '</table>';
print '</div>';
print '</table>';
print '</div>';
}

View File

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

View File

@ -550,100 +550,100 @@ if ($rowid > 0) {
}
print '</td></tr>';
print "</table>\n";
print "</table>\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
*/
// Button to create a new subscription if member no draft neither resiliated
if ($user->rights->adherent->cotisation->creer) {
if ($action != 'addsubscription' && $action != 'create_thirdparty') {
print '<div class="tabsAction">';
// Button to create a new subscription if member no draft neither resiliated
if ($user->rights->adherent->cotisation->creer) {
if ($action != 'addsubscription' && $action != 'create_thirdparty') {
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>";
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$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>';
print '</div>';
}
}
print '</div>';
}
}
/*
/*
* List of subscriptions
*/
if ($action != 'addsubscription' && $action != 'create_thirdparty') {
$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.datec, c.fk_type as cfk_type,";
$sql .= " c.dateadh as dateh,";
$sql .= " c.datef,";
$sql .= " c.fk_bank,";
$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 .= " 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_account as ba ON b.fk_account = ba.rowid";
$sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid;
if ($action != 'addsubscription' && $action != 'create_thirdparty') {
$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.datec, c.fk_type as cfk_type,";
$sql .= " c.dateadh as dateh,";
$sql .= " c.datef,";
$sql .= " c.fk_bank,";
$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 .= " 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_account as ba ON b.fk_account = ba.rowid";
$sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid;
$sql .= $db->order($sortfield, $sortorder);
$result = $db->query($sql);
if ($result) {
$subscriptionstatic = new Subscription($db);
$result = $db->query($sql);
if ($result) {
$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_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('Type', $_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('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($conf->banque->enabled)) {
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
}
print "</tr>\n";
print '<tr class="liste_titre">';
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('Type', $_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('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($conf->banque->enabled)) {
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
}
print "</tr>\n";
$accountstatic = new Account($db);
$adh = new Adherent($db);
$adht = new AdherentType($db);
$accountstatic = new Account($db);
$adh = new Adherent($db);
$adht = new AdherentType($db);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$adh->id = $objp->rowid;
$adh->typeid = $objp->type;
$adh->id = $objp->rowid;
$adh->typeid = $objp->type;
$subscriptionstatic->ref = $objp->crowid;
$subscriptionstatic->id = $objp->crowid;
$subscriptionstatic->ref = $objp->crowid;
$subscriptionstatic->id = $objp->crowid;
$typeid = $objp->cfk_type;
if ($typeid > 0) {
$adht->fetch($typeid);
}
$typeid = $objp->cfk_type;
if ($typeid > 0) {
$adht->fetch($typeid);
}
print '<tr class="oddeven">';
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
print '<td class="center">'.dol_print_date($db->jdate($objp->datec), 'dayhour')."</td>\n";
print '<td class="center">';
if ($typeid > 0) {
print $adht->getNomUrl(1);
}
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->datef), 'day')."</td>\n";
print '<td class="right">'.price($objp->subscription).'</td>';
print '<tr class="oddeven">';
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
print '<td class="center">'.dol_print_date($db->jdate($objp->datec), 'dayhour')."</td>\n";
print '<td class="center">';
if ($typeid > 0) {
print $adht->getNomUrl(1);
}
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->datef), 'day')."</td>\n";
print '<td class="right">'.price($objp->subscription).'</td>';
if (!empty($conf->banque->enabled)) {
print '<td class="right">';
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 '<br>';
}
print '</td></tr>';
print '<br>';
}
print '</td></tr>';
// Bank account
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("FinancialAccount").'</td><td>';
$form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2);
print "</td></tr>\n";
// Bank account
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("FinancialAccount").'</td><td>';
$form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2);
print "</td></tr>\n";
// Payment mode
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOST('operation'), 'operation', '', 2);
print "</td></tr>\n";
// Payment mode
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
$form->select_types_paiements(GETPOST('operation'), 'operation', '', 2);
print "</td></tr>\n";
// Date of payment
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 "</td></tr>\n";
// Date of payment
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 "</td></tr>\n";
print '<tr class="bankswitchclass2"><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
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 '<tr class="bankswitchclass2"><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
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 '<tr class="bankswitchclass2 fieldrequireddyn"><td>'.$langs->trans('CheckTransmitter');
print ' <em>('.$langs->trans("ChequeMaker").')</em>';
print '</td>';
print '<td><input id="fieldchqemetteur" name="chqemetteur" size="32" type="text" value="'.(!GETPOST('chqemetteur') ? '' : GETPOST('chqemetteur')).'"></td></tr>';
print '<tr class="bankswitchclass2 fieldrequireddyn"><td>'.$langs->trans('CheckTransmitter');
print ' <em>('.$langs->trans("ChequeMaker").')</em>';
print '</td>';
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 ' <em>('.$langs->trans("ChequeBank").')</em>';
print '</td>';
print '<td><input id="chqbank" name="chqbank" size="32" type="text" value="'.(!GETPOST('chqbank') ? '' : GETPOST('chqbank')).'"></td></tr>';
}
}
print '<tr class="bankswitchclass2"><td>'.$langs->trans('Bank');
print ' <em>('.$langs->trans("ChequeBank").')</em>';
print '</td>';
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 '<td>';
if (!$object->email) {
print $langs->trans("NoEMail");
} else {
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
print '<tr><td>'.$langs->trans("SendAcknowledgementByMail").'</td>';
print '<td>';
if (!$object->email) {
print $langs->trans("NoEMail");
} else {
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
// Send subscription email
$subject = '';
$msg = '';
// Send subscription email
$subject = '';
$msg = '';
// Send subscription email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "members"));
// Get email content from template
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
// Send subscription email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "members"));
// Get email content from template
$arraydefaultmessage = null;
$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) {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs);
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $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' : '')).'>';
$helpcontent = '';
$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("MailTopic").'</b>:<br>'."\n";
if ($subjecttosend) {
$helpcontent .= $subjecttosend."\n";
} else {
$langs->load("errors");
$helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n";
}
$helpcontent .= "<br>";
$helpcontent .= '<b>'.$langs->trans("MailText").'</b>:<br>';
if ($texttosend) {
$helpcontent .= dol_htmlentitiesbr($texttosend)."\n";
} else {
$langs->load("errors");
$helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n";
}
print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend');
}
print '</td></tr>';
print '</tbody>';
print '</table>';
$tmp = '<input name="sendmail" type="checkbox"'.(GETPOST('sendmail', 'alpha') ? ' checked' : (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? ' checked' : '')).'>';
$helpcontent = '';
$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("MailTopic").'</b>:<br>'."\n";
if ($subjecttosend) {
$helpcontent .= $subjecttosend."\n";
} else {
$langs->load("errors");
$helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n";
}
$helpcontent .= "<br>";
$helpcontent .= '<b>'.$langs->trans("MailText").'</b>:<br>';
if ($texttosend) {
$helpcontent .= dol_htmlentitiesbr($texttosend)."\n";
} else {
$langs->load("errors");
$helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n";
}
print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend');
}
print '</td></tr>';
print '</tbody>';
print '</table>';
print dol_get_fiche_end();
print dol_get_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
print '</form>';
print "\n<!-- End form subscription -->\n\n";
}
print "\n<!-- End form subscription -->\n\n";
}
//print '</td></tr>';
//print '</table>';
//print '</td></tr>';
//print '</table>';
} else {
$langs->load("errors");
print $langs->trans("ErrorRecordNotFound");
$langs->load("errors");
print $langs->trans("ErrorRecordNotFound");
}
// 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 (empty($reshook)) {
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// 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
// 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
$search_type = "";
$search_ref = "";
$search_lastname = "";
$search_firstname = "";
$search_login = "";
$search_note = "";
$search_amount = "";
$search_account = "";
$toselect = '';
$search_array_options = array();
}
$search_ref = "";
$search_lastname = "";
$search_firstname = "";
$search_login = "";
$search_note = "";
$search_amount = "";
$search_account = "";
$toselect = '';
$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 .= " WHERE d.entity IN (".getEntity('adherent').")";
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 + 1)."-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'";
}
if ($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
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql);
if ($resql) $nbtotalofrecords = $db->num_rows($resql);
else dol_print_error($db);
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$resql = $db->query($sql);
if ($resql) $nbtotalofrecords = $db->num_rows($resql);
else dol_print_error($db);
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
$offset = 0;
}
}
// Add limit
$sql .= $db->plimit($limit + 1, $offset);
@ -241,7 +241,7 @@ $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = '';
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"].'">';
@ -409,8 +409,8 @@ while ($i < min($num, $limit)) {
$adherent->typeid = $obj->type;
$typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid);
$adht = new AdherentType($db);
$adht->fetch($typeid);
$adht = new AdherentType($db);
$adht->fetch($typeid);
print '<tr class="oddeven">';
@ -419,14 +419,14 @@ while ($i < min($num, $limit)) {
print '<td>'.$subscription->getNomUrl(1).'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Type
if (!empty($arrayfields['d.fk_type']['checked'])) {
print '<td class="nowraponall">';
if ($typeid > 0) {
print $adht->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
// Type
if (!empty($arrayfields['d.fk_type']['checked'])) {
print '<td class="nowraponall">';
if ($typeid > 0) {
print $adht->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Lastname

View File

@ -33,12 +33,12 @@ $langs->load("members");
$total = 0;
foreach ($linkedObjectBlock as $key => $objectlink) {
echo '<tr class="oddeven">';
echo '<td>'.$langs->trans("Subscription").'</td>';
echo '<td>'.$objectlink->getNomUrl(1).'</td>';
echo '<td class="center"></td>';
echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
echo '<td class="right">';
echo '<tr class="oddeven">';
echo '<td>'.$langs->trans("Subscription").'</td>';
echo '<td>'.$objectlink->getNomUrl(1).'</td>';
echo '<td class="center"></td>';
echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
echo '<td class="right">';
if ($user->rights->adherent->lire) {
$total = $total + $objectlink->amount;
echo price($objectlink->amount);
@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
echo '</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 '</tr>';
echo '</tr>';
}
echo "<!-- END PHP TEMPLATE -->\n";

View File

@ -123,7 +123,7 @@ print dol_get_fiche_end();
print '<div class="tabsAction">';
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";
@ -146,27 +146,27 @@ print '</tr>';
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result > 0) {
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")";
$info = $object->_load_ldap_info();
$dn = $object->_load_ldap_dn($info, 1);
$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
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
if (!is_array($records)) {
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} else {
$result = show_ldap_content($records, 0, $records['count'], true);
}
} else {
print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
}
// Show tree
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
if (!is_array($records)) {
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} else {
$result = show_ldap_content($records, 0, $records['count'], true);
}
} else {
print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
}
$ldap->unbind();
$ldap->close();
$ldap->unbind();
$ldap->close();
} else {
setEventMessages($ldap->error, $ldap->errors, 'errors');
}

View File

@ -154,9 +154,9 @@ $titre = $langs->trans("MemberType".$object->type);
// Calculate $cnt_trans
$cnt_trans = 0;
if (!empty($object->multilangs)) {
foreach ($object->multilangs as $key => $value) {
$cnt_trans++;
}
foreach ($object->multilangs as $key => $value) {
$cnt_trans++;
}
}
@ -179,10 +179,10 @@ print dol_get_fiche_end();
print "\n<div class=\"tabsAction\">\n";
if ($action == '') {
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>';
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 ($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>';
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";
@ -262,7 +262,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
print '<table class="border centpercent">';
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 '<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>';

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->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->setLabel("", "", $adherent->address, $adherent->town, $adherent->state, $adherent->zip, $country, "TYPE=WORK");
@ -79,9 +79,9 @@ $v->setTitle($adherent->poste);
if ($company->id)
{
$v->setURL($company->url, "TYPE=WORK");
if (! $adherent->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
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->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
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");
// when company e-mail is empty, use only adherent e-mail
if (empty(trim($company->email)))
@ -124,7 +124,7 @@ $db->close();
$output = $v->getVCard();
$filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
$filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
$filenameurlencoded = dol_sanitizeFileName(urlencode($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';
if (!$user->admin)
accessforbidden();
accessforbidden();
// Load translation files required by the page
$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))
{
$i = 0;
$i = 0;
$db->begin();
$db->begin();
foreach ($triggers as $trigger)
{
@ -102,13 +102,13 @@ if ($action == "save" && empty($cancel))
}
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
$db->commit();
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
$db->rollback();
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
$db->commit();
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
$db->rollback();
}
}

View File

@ -84,9 +84,9 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -99,9 +99,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
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))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
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

View File

@ -54,9 +54,9 @@ $colorlist = array('BECEDD', 'DDBECE', 'BFDDBE', 'F598B4', 'F68654', 'CBF654', '
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);
$i = 1; $errorsaved = 0;
@ -103,14 +103,14 @@ if ($actionsave)
$MAXAGENDA = empty($conf->global->AGENDA_EXT_NB) ? 5 : $conf->global->AGENDA_EXT_NB;
}
if (!$error)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
if (empty($errorsaved)) setEventMessages($langs->trans("Error"), null, 'errors');
}
if (!$error)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
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';
if (!$user->admin)
accessforbidden();
accessforbidden();
// Load translation files required by the page
$langs->loadLangs(array('admin', 'other', 'agenda', 'users'));
@ -80,49 +80,49 @@ if ($action == 'set')
$getDefaultFilter = GETPOST('AGENDA_DEFAULT_FILTER_TYPE');
$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_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_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_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
} elseif ($action == 'specimen') // For orders
{
$modele = GETPOST('module', 'alpha');
$modele = GETPOST('module', 'alpha');
$commande = new CommandeFournisseur($db);
$commande->initAsSpecimen();
$commande->thirdparty = $specimenthirdparty;
$commande = new CommandeFournisseur($db);
$commande->initAsSpecimen();
$commande->thirdparty = $specimenthirdparty;
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
if ($filefound)
{
require_once $file;
$module = new $classname($db, $commande);
$module = new $classname($db, $commande);
if ($module->write_file($commande, $langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
if ($module->write_file($commande, $langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Activate a model
@ -135,7 +135,7 @@ elseif ($action == 'setmodel')
$ret = delDocumentModel($value, $type);
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);
if ($resql)
{
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
} else {
dol_print_error($db);
dol_print_error($db);
}
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 '<tr class="liste_titre">'."\n";
print '<td width="100">'.$langs->trans("Name").'</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("Default").'</td>'."\n";
print '<td class="center" width="40">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="40">'.$langs->trans("Preview").'</td>';
print '</tr>'."\n";
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">'."\n";
print '<td width="100">'.$langs->trans("Name").'</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("Default").'</td>'."\n";
print '<td class="center" width="40">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="40">'.$langs->trans("Preview").'</td>';
print '</tr>'."\n";
clearstatcache();
clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/action/doc");
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/action/doc");
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db, new ActionComm($db));
require_once $dir.'/'.$file;
$module = new $classname($db, new ActionComm($db));
print '<tr class="oddeven">'."\n";
print "<td>";
print (empty($module->name) ? $name : $module->name);
print "</td>\n";
print "<td>\n";
require_once $dir.'/'.$file;
$module = new $classname($db, $specimenthirdparty);
if (method_exists($module, 'info'))
print $module->info($langs);
else print $module->description;
print "</td>\n";
print '<tr class="oddeven">'."\n";
print "<td>";
print (empty($module->name) ? $name : $module->name);
print "</td>\n";
print "<td>\n";
require_once $dir.'/'.$file;
$module = new $classname($db, $specimenthirdparty);
if (method_exists($module, 'info'))
print $module->info($langs);
else print $module->description;
print "</td>\n";
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
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 img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
} else {
print img_picto($langs->trans("Enabled"), 'switch_on');
}
print "</td>";
} else {
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 "</td>";
}
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
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 img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
} else {
print img_picto($langs->trans("Enabled"), 'switch_on');
}
print "</td>";
} else {
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 "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"), 'on');
} 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 '</td>';
// Default
print '<td class="center">';
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"), 'on');
} 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 '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$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><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>';
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$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><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>';
print '</td>';
print "</tr>\n";
}
}
closedir($handle);
}
}
}
print '</table><br>';
print "</tr>\n";
}
}
closedir($handle);
}
}
}
print '</table><br>';
}
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
@ -343,13 +343,13 @@ print '</td></tr>'."\n";
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\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);
print '</td></tr>'."\n";
print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").'</td>'."\n";
print '<td class="center">&nbsp;</td>'."\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);
print '</td></tr>'."\n";
}
// AGENDA_DEFAULT_FILTER_TYPE
@ -359,8 +359,8 @@ print '<td class="center">&nbsp;</td>'."\n";
print '<td class="right nowrap">'."\n";
$multiselect = 0;
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"
$multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
// 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));
}
$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";

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

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (!$user->admin)
accessforbidden();
accessforbidden();
// Load translation files required by the page
$langs->loadLangs(array("admin", "other", "agenda"));
@ -41,23 +41,23 @@ $actionsave = GETPOST('save', 'alpha');
// Sauvegardes parametres
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_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, 'AGENDA_EXPORT_FIX_TZ', trim(GETPOST('AGENDA_EXPORT_FIX_TZ', '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_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);
if ($i >= 4)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($langs->trans("SaveFailed"), null, 'errors');
}
if ($i >= 4)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
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 .= '<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 .=$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 .= '<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">';

View File

@ -81,9 +81,9 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -93,9 +93,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
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))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
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

View File

@ -44,11 +44,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
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);
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')
{
@ -76,45 +76,45 @@ if ($action == 'setcoder')
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id, 'chaine', 0, '', $conf->entity);
if ($res > 0)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'updateengine')
{
$sql = "SELECT rowid, coder";
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql .= " WHERE entity = ".$conf->entity;
$sql .= " ORDER BY code";
$sql = "SELECT rowid, coder";
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql .= " WHERE entity = ".$conf->entity;
$sql .= " ORDER BY code";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
while ($i < $num)
{
$obj = $db->fetch_object($resql);
if (GETPOST('coder'.$obj->rowid, 'alpha'))
{
$coder = GETPOST('coder'.$obj->rowid, 'alpha');
$code_id = $obj->rowid;
if (GETPOST('coder'.$obj->rowid, 'alpha'))
{
$coder = GETPOST('coder'.$obj->rowid, 'alpha');
$code_id = $obj->rowid;
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp .= " SET coder = '".$db->escape($coder)."'";
$sqlp .= " WHERE rowid = ".((int) $code_id);
$sqlp .= " AND entity = ".$conf->entity;
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp .= " SET coder = '".$db->escape($coder)."'";
$sqlp .= " WHERE rowid = ".((int) $code_id);
$sqlp .= " AND entity = ".$conf->entity;
$upsql = $db->query($sqlp);
if (!$upsql) dol_print_error($db);
}
$upsql = $db->query($sqlp);
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)
{
$dir = dol_buildpath($reldir);
$newdir = dol_osencode($dir);
$dir = dol_buildpath($reldir);
$newdir = dol_osencode($dir);
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
if (!is_dir($newdir)) continue;
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
if (!is_dir($newdir)) continue;
$handle = @opendir($newdir);
if (is_resource($handle))
@ -190,9 +190,9 @@ print load_fiche_titre($langs->trans("BarcodeEncodeModule"), '', '');
if (empty($conf->use_javascript_ajax))
{
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="form_engine">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="updateengine">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="form_engine">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="updateengine">';
}
print '<table class="noborder centpercent">';
@ -236,11 +236,11 @@ if ($resql)
foreach ($dirbarcode as $reldir)
{
$dir = dol_buildpath($reldir, 0);
$newdir = dol_osencode($dir);
$dir = dol_buildpath($reldir, 0);
$newdir = dol_osencode($dir);
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
if (!is_dir($newdir)) continue;
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
if (!is_dir($newdir)) continue;
$result = @include_once $newdir.$obj->coder.'.modules.php';
if ($result) break;
@ -254,7 +254,7 @@ if ($resql)
if ($module->encodingIsSupported($obj->encoding))
{
// 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
$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;
@ -282,8 +282,8 @@ print "</table>\n";
if (empty($conf->use_javascript_ajax))
{
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
print '</form>';
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
print '</form>';
}
print "<br>";
@ -371,48 +371,48 @@ if ($conf->product->enabled)
$dir = dol_buildpath($dirroot, 0);
$handle = @opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if (preg_match('/^mod_barcode_product_.*php$/', $file))
{
$file = substr($file, 0, dol_strlen($file) - 4);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if (preg_match('/^mod_barcode_product_.*php$/', $file))
{
$file = substr($file, 0, dol_strlen($file) - 4);
try {
dol_include_once($dirroot.$file.'.php');
} catch (Exception $e)
{
dol_syslog($e->getMessage(), LOG_ERR);
}
try {
dol_include_once($dirroot.$file.'.php');
} catch (Exception $e)
{
dol_syslog($e->getMessage(), LOG_ERR);
}
$modBarCode = new $file();
$modBarCode = new $file();
print '<tr class="oddeven">';
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";
print $modBarCode->info($langs);
print '</td>';
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
print '<tr class="oddeven">';
print '<td>'.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)."</td><td>\n";
print $modBarCode->info($langs);
print '</td>';
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
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 img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
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 '</a></td>';
}
print '<td class="center">';
$s = $modBarCode->getToolTip($langs, null, -1);
print $form->textwithpicto('', $s, 1);
print '</td>';
print "</tr>\n";
}
}
closedir($handle);
}
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 img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
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 '</a></td>';
}
print '<td class="center">';
$s = $modBarCode->getToolTip($langs, null, -1);
print $form->textwithpicto('', $s, 1);
print '</td>';
print "</tr>\n";
}
}
closedir($handle);
}
}
print "</table>\n";
}

View File

@ -80,9 +80,9 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -92,9 +92,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
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))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
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

View File

@ -33,7 +33,7 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'aZ09');
if (! in_array('clicktodial', $conf->modules)) {
if (!in_array('clicktodial', $conf->modules)) {
accessforbidden($langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module58Name")));
}
@ -44,15 +44,15 @@ if (! in_array('clicktodial', $conf->modules)) {
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);
$result2 = dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), '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);
if ($result1 >= 0 && $result2 >= 0)
{
if ($result1 >= 0 && $result2 >= 0)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -125,7 +125,7 @@ if (!empty($conf->global->CLICKTODIAL_URL))
if (GETPOST('phonefortest')) $phonefortest = GETPOST('phonefortest');
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 '<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")).'">';

View File

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

View File

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

View File

@ -476,7 +476,7 @@ print '</td></tr>'."\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("HideClosedServiceByDefault").'</td>';
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 '</tr>';

View File

@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/dav/dav.lib.php';
$langs->loadLangs(array("admin", "other", "agenda"));
if (!$user->admin)
accessforbidden();
accessforbidden();
// Parameters
$action = GETPOST('action', 'aZ09');
@ -39,8 +39,8 @@ $backtopage = GETPOST('backtopage', 'alpha');
$arrayofparameters = array(
'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2),
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2),
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
);
@ -95,7 +95,7 @@ if ($action == 'edit')
print '</td><td>';
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')
{
print $form->selectyesno($key, $conf->global->$key, 1);
@ -130,7 +130,7 @@ if ($action == 'edit')
print '</td><td>';
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')
{
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);
$result2 = dolibarr_set_const($db, "DEBUGBAR_USE_LOG_FILE", GETPOST('DEBUGBAR_USE_LOG_FILE', 'int'), 'chaine', 0, '', 0);
if ($result1 < 0 || $result2 < 0)
{
$error++;
}
{
$error++;
}
if (!$error)
{
@ -78,8 +78,8 @@ print load_fiche_titre($langs->trans("DebugBarSetup"), $linkback, 'title_setup')
if (!function_exists('mb_check_encoding'))
{
$langs->load("errors");
print info_admin($langs->trans("ErrorPHPNeedModule", 'mbstring'), 0, 0, 'error');
$langs->load("errors");
print info_admin($langs->trans("ErrorPHPNeedModule", 'mbstring'), 0, 0, 'error');
}
print '<br>';

View File

@ -51,7 +51,7 @@ $modules = array(
'img' => 'projecttask'
)
),
'propal' => array(
'propal' => array(
array(
'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE',
'img' => 'propal'
@ -114,18 +114,18 @@ $modules = array(
'code' => 'MAIN_DELAY_EXPENSEREPORTS',
'img' => 'trip'
),
/* TODO Enable this
/* TODO Enable this
array(
'code' => 'MAIN_DELAY_EXPENSEREPORTS_TO_PAY',
'img' => 'trip'
)*/
),
'holiday' => array(
array(
'code' => 'MAIN_DELAY_HOLIDAYS',
'img' => 'holiday'
),
),
'holiday' => array(
array(
'code' => 'MAIN_DELAY_HOLIDAYS',
'img' => 'holiday'
),
),
);
$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)
{
if (!empty($conf->$module->enabled))
{
foreach ($delays as $delay)
{
if (GETPOST($delay['code']) != '')
{
dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity);
}
}
}
{
foreach ($delays as $delay)
{
if (GETPOST($delay['code']) != '')
{
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);
@ -188,8 +188,8 @@ if ($action == 'update')
if (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE';
// Update values
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')
{
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="form_index">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="form_index">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
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 '<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>';
foreach ($modules as $module => $delays)
{
if (!empty($conf->$module->enabled))
{
foreach ($delays as $delay)
{
foreach ($modules as $module => $delays)
{
if (!empty($conf->$module->enabled))
{
foreach ($delays as $delay)
{
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
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 '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
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 '</table>';
print '</table>';
print '<br>';
print '<br>';
// Show if meteo is enabled
print '<table class="noborder centpercent">';
@ -246,29 +246,29 @@ if ($action == 'edit')
print '</table>';
} else {
/*
/*
* Show parameters
*/
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)
{
if (!empty($conf->$module->enabled))
{
foreach ($delays as $delay)
{
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>';
}
}
}
foreach ($modules as $module => $delays)
{
if (!empty($conf->$module->enabled))
{
foreach ($delays as $delay)
{
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0);
print '<tr class="oddeven">';
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>';
}
}
}
print '</table>';
print '</table>';
print '<br>';

View File

@ -87,9 +87,9 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -102,9 +102,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
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))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
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

View File

@ -19,7 +19,7 @@
if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1);
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 $key Authentification key
* @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'))
throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library');
$this->url = $url;
$this->key = $key;
$this->debug = $debug;
$this->version = 'unknown';
}
}
/**
* 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
* @return void
* @return void
*/
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>
* 'url' => Full URL for a GET request of Webservice (ex: http://mystore.com/api/customers/1/)<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.
* @return SimpleXMLElement status_code, response

View File

@ -19,7 +19,7 @@
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.
{
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
{
/**
* beginning of pagination
* @var int
*/
public $start;
/**
* beginning of pagination
* @var int
*/
public $start;
/**
* end of pagination
* @var int
*/
public $end;
/**
* end of pagination
* @var int
*/
public $end;
public $per_page; // pagination: display per page
public $categorie; // the current categorie
@ -79,33 +79,33 @@ class Dolistore
*/
public function getRemoteCategories()
{
global $conf;
global $conf;
try {
$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);
// $conf->global->MAIN_MODULE_DOLISTORE_API_KEY is for the login of basic auth. There is no password as it is public data.
try {
$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);
// $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
$opt = array();
$opt['resource'] = 'categories';
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
$opt['sort'] = 'id_asc';
// Here we set the option array for the Webservice : we want categories resources
$opt = array();
$opt['resource'] = 'categories';
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
$opt['sort'] = 'id_asc';
// Call
dol_syslog("Call API with opt = ".var_export($opt, true));
$xml = $this->api->get($opt);
$this->categories = $xml->categories->children();
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) die('Bad ID');
elseif ($trace[0]['args'][0] == 401) die('Bad auth key');
else {
print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'<br>';
print $e->getMessage();
}
}
// Call
dol_syslog("Call API with opt = ".var_export($opt, true));
$xml = $this->api->get($opt);
$this->categories = $xml->categories->children();
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) die('Bad ID');
elseif ($trace[0]['args'][0] == 401) die('Bad auth key');
else {
print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'<br>';
print $e->getMessage();
}
}
}
/**
@ -153,7 +153,7 @@ class Dolistore
}
$opt['filter[id]'] = '['.implode('|', $products).']';
} 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['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.
*
@ -198,7 +198,7 @@ class Dolistore
*/
public function get_categories($parent = 0)
{
// phpcs:enable
// phpcs:enable
if (!isset($this->categories)) die('not possible');
if ($parent != 0) {
$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
*
@ -243,7 +243,7 @@ class Dolistore
*/
public function get_products()
{
// phpcs:enable
// phpcs:enable
global $langs, $conf;
$html = "";
$last_month = time() - (30 * 24 * 60 * 60);
@ -270,7 +270,7 @@ class Dolistore
// free or pay ?
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>';
} else {
$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_max, DOL_VERSION) >= 0) {
//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>';
$compatible = '';
} else {
//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>';
$compatible = 'NotCompatible';
}
@ -306,50 +306,50 @@ class Dolistore
<td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang - 1]
.'<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>';
// do not load if display none
//$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">'.$download_link.'</td>';
$html .= '</tr>';
}
return $html;
}
// do not load if display none
//$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">'.$download_link.'</td>';
$html .= '</tr>';
}
return $html;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get previous link
*
* @param string $text symbol previous
* @return string html previous link
*/
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get previous link
*
* @param string $text symbol previous
* @return string html previous link
*/
public function get_previous_link($text = '<<')
{
// phpcs:enable
// phpcs:enable
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get next link
*
* @param string $text symbol next
* @return string html next link
*/
public function get_next_link($text = '>>')
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get next link
*
* @param string $text symbol next
* @return string html next link
*/
public function get_next_link($text = '>>')
{
// phpcs:enable
// phpcs:enable
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get previous url
*
* @return string previous url
*/
public function get_previous_url()
{
// phpcs:enable
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get previous url
*
* @return string previous url
*/
public function get_previous_url()
{
// phpcs:enable
$param_array = array();
if ($this->start < $this->per_page) {
$sub = 0;
@ -363,17 +363,17 @@ class Dolistore
}
$param = http_build_query($param_array);
return $this->url."&".$param;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get next url
*
* @return string next url
*/
public function get_next_url()
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* get next url
*
* @return string next url
*/
public function get_next_url()
{
// phpcs:enable
// phpcs:enable
$param_array = array();
if (count($this->products) < $this->per_page) {
$add = 0;
@ -389,17 +389,17 @@ class Dolistore
return $this->url."&".$param;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* version compare
*
* @param string $v1 version 1
* @param string $v2 version 2
* @return int result of compare
*/
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* version compare
*
* @param string $v1 version 1
* @param string $v2 version 2
* @return int result of compare
*/
public function version_compare($v1, $v2)
{
// phpcs:enable
// phpcs:enable
$v1 = explode('.', $v1);
$v2 = explode('.', $v2);
$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('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
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
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']);
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';
elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
if (in_array($val['type'], array('timestamp'))) $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($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
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 (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') print $object->getLibStatut(5);
else print $object->showOutputField($val, $key, $object->$key, '');
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!empty($val['isameasure']))
{
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['val']['t.'.$key] += $object->$key;
}
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') print $object->getLibStatut(5);
else print $object->showOutputField($val, $key, $object->$key, '');
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!empty($val['isameasure']))
{
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['val']['t.'.$key] += $object->$key;
}
}
}
// Extra fields

View File

@ -87,9 +87,9 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -102,9 +102,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
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))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
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

View File

@ -61,11 +61,11 @@ if ($action == 'updateMask')
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen') // For fiche inter
{
$modele = GETPOST('module', 'alpha');
@ -80,7 +80,7 @@ if ($action == 'updateMask')
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
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))
{
$filefound = 1;
@ -122,7 +122,7 @@ elseif ($action == 'set')
$ret = delDocumentModel($value, $type);
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);
} elseif ($action == 'setoptions')
{
$db->begin();
$db->begin();
$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);
@ -161,13 +161,13 @@ elseif ($action == 'setdoc')
if (!$res1 > 0 || !$res2 > 0) $error++;
if (!$error)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -235,13 +235,13 @@ foreach ($dirmodels as $reldir)
print $module->info();
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->EXPENSEREPORT_ADDON == $file)
@ -261,16 +261,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($exp);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
@ -345,81 +345,81 @@ foreach ($dirmodels as $reldir)
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
$modulequalified = 1;
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 ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
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 img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print "</td>";
} else {
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 "</td>";
}
// Active
if (in_array($name, $def))
{
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 img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print "</td>";
} else {
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 "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"), 'on');
} 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 '</td>';
// Default
print '<td class="center">';
if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"), 'on');
} 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 '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$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><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$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("PaymentConditions").': '.yn($module->option_condreg, 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);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, -1, 0);
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$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><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$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("PaymentConditions").': '.yn($module->option_condreg, 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);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, -1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print '</tr>';
}
}
}
}
print '</tr>';
}
}
}
}
}
}
}
@ -457,11 +457,11 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $lang
$variablename = 'EXPENSEREPORT_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 {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
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
if ($result)
{
while ($obj = $db->fetch_object($result))
{
preg_match('/([0-9]+)$/i', $obj->name, $reg);
if ($reg[1] && $reg[1] > $lastexternalrss) $lastexternalrss = $reg[1];
}
while ($obj = $db->fetch_object($result))
{
preg_match('/([0-9]+)$/i', $obj->name, $reg);
if ($reg[1] && $reg[1] > $lastexternalrss) $lastexternalrss = $reg[1];
}
} else {
dol_print_error($db);
dol_print_error($db);
}
if ($action == 'add' || GETPOST("modify"))
{
$external_rss_title = "external_rss_title_".GETPOST("norss", 'int');
$external_rss_urlrss = "external_rss_urlrss_".GETPOST("norss", 'int');
$external_rss_title = "external_rss_title_".GETPOST("norss", 'int');
$external_rss_urlrss = "external_rss_urlrss_".GETPOST("norss", 'int');
if (!empty($_POST[$external_rss_urlrss]))
{
$boxlabel = '(ExternalRSSInformations)';
//$external_rss_url = "external_rss_url_" . $_POST["norss"];
if (!empty($_POST[$external_rss_urlrss]))
{
$boxlabel = '(ExternalRSSInformations)';
//$external_rss_url = "external_rss_url_" . $_POST["norss"];
$db->begin();
$db->begin();
if ($_POST["modify"])
{
// 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.= " WHERE file ='box_external_rss.php' AND note like '".$db->escape($_POST["norss"])." %'";
@ -92,56 +92,56 @@ if ($action == 'add' || GETPOST("modify"))
*/
} else {
// 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')).")')";
if (!$db->query($sql))
{
dol_print_error($db);
$err++;
}
if (!$db->query($sql))
{
dol_print_error($db);
$err++;
}
}
$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)
{
$db->commit();
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
$db->rollback();
dol_print_error($db);
}
}
if ($result1 && $result2)
{
$db->commit();
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
$db->rollback();
dol_print_error($db);
}
}
}
if ($_POST["delete"])
{
if (GETPOST("norss", 'int'))
{
$db->begin();
if (GETPOST("norss", 'int'))
{
$db->begin();
// Supprime boite box_external_rss de definition des boites
$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 = "SELECT rowid FROM ".MAIN_DB_PREFIX."boxes_def";
$sql .= " WHERE file = 'box_external_rss.php' AND note LIKE '".$db->escape(GETPOST("norss", 'int'))." %'";
$resql = $db->query($sql);
if ($resql)
{
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
$sql .= " WHERE entity = ".$conf->entity;
$sql .= " AND box_id = ".$obj->rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
$sql .= " WHERE entity = ".$conf->entity;
$sql .= " AND box_id = ".$obj->rowid;
$resql = $db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";
$sql .= " WHERE rowid = ".$obj->rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";
$sql .= " WHERE rowid = ".$obj->rowid;
$resql = $db->query($sql);
if (!$resql)
@ -159,22 +159,22 @@ if ($_POST["delete"])
$db->rollback();
dol_print_error($db, "sql=".$sql);
exit;
}
}
$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)
{
$db->commit();
header("Location: external_rss.php");
exit;
} else {
$db->rollback();
dol_print_error($db);
}
}
if ($result1 && $result2)
{
$db->commit();
header("Location: external_rss.php");
exit;
} else {
$db->rollback();
dol_print_error($db);
}
}
}
@ -242,9 +242,9 @@ if ($resql)
$idrss = $reg[1];
$keyrsstitle = "EXTERNAL_RSS_TITLE_".$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);
print "<br>";
@ -255,8 +255,8 @@ if ($resql)
print '<tr class="liste_titre">';
print "<td>".$langs->trans("RSS")." ".($i + 1)."</td>";
print '<td class="right">';
print '<input type="submit" class="button buttongen" name="modify" value="'.$langs->trans("Modify").'">';
print '<td class="right">';
print '<input type="submit" class="button buttongen" name="modify" value="'.$langs->trans("Modify").'">';
print " &nbsp; ";
print '<input type="submit" class="button buttongen" name="delete" value="'.$langs->trans("Delete").'">';
print '<input type="hidden" name="norss" value="'.$idrss.'">';
@ -279,8 +279,8 @@ if ($resql)
print '<tr class="oddeven">';
print "<td>".$langs->trans("Status")."</td>";
print "<td>";
if ($result > 0 && empty($rss->error))
{
if ($result > 0 && empty($rss->error))
{
print '<font class="ok">'.$langs->trans("Online").'</div>';
} else {
print '<font class="error">'.$langs->trans("Offline");
@ -292,8 +292,8 @@ if ($resql)
print '</tr>'."\n";
// Logo
if ($result > 0 && empty($rss->error))
{
if ($result > 0 && empty($rss->error))
{
print '<tr class="oddeven">';
print "<td>".$langs->trans("Logo")."</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']);
llxHeader(
"", $langs->trans("BillsSetup"),
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
"", $langs->trans("BillsSetup"),
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
);
$form = new Form($db);
@ -113,10 +113,10 @@ _printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty')
_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituationFinal'));
$metas = array(
'type' => 'number',
'step' => '0.01',
'min' => 0,
'max' => 100
'type' => 'number',
'step' => '0.01',
'min' => 0,
'max' => 100
);
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
@ -153,10 +153,10 @@ $db->close();
*/
function _updateBtn()
{
global $langs;
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</div>';
global $langs;
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</div>';
}
/**
@ -170,18 +170,18 @@ function _updateBtn()
*/
function _printOnOff($confkey, $title = false, $desc = '')
{
global $langs;
global $langs;
print '<tr class="oddeven">';
print '<td>'.($title ? $title : $langs->trans($confkey));
if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>';
}
print '</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="right" width="300">';
print ajax_constantonoff($confkey);
print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.($title ? $title : $langs->trans($confkey));
if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>';
}
print '</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="right" width="300">';
print ajax_constantonoff($confkey);
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)
{
global $langs, $conf, $db, $inputCount;
global $langs, $conf, $db, $inputCount;
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
$form = new Form($db);
$inputCount = empty($inputCount) ? 1 : ($inputCount + 1);
$form = new Form($db);
$defaultMetas = array(
'name' => 'value'.$inputCount
);
$defaultMetas = array(
'name' => 'value'.$inputCount
);
if ($type != 'textarea') {
$defaultMetas['type'] = 'text';
$defaultMetas['value'] = $conf->global->{$confkey};
}
if ($type != 'textarea') {
$defaultMetas['type'] = 'text';
$defaultMetas['value'] = $conf->global->{$confkey};
}
$metas = array_merge($defaultMetas, $metas);
$metascompil = '';
foreach ($metas as $key => $values) {
$metascompil .= ' '.$key.'="'.$values.'" ';
}
$metas = array_merge($defaultMetas, $metas);
$metascompil = '';
foreach ($metas as $key => $values) {
$metascompil .= ' '.$key.'="'.$values.'" ';
}
print '<tr class="oddeven">';
print '<td>';
print '<tr class="oddeven">';
print '<td>';
if (!empty($help)) {
print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
} else {
print $title ? $title : $langs->trans($confkey);
}
if (!empty($help)) {
print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
} else {
print $title ? $title : $langs->trans($confkey);
}
if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>';
}
if (!empty($desc)) {
print '<br><small>'.$langs->trans($desc).'</small>';
}
print '</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="right" width="300">';
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
print '</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="right" width="300">';
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
print '<input type="hidden" name="action" value="setModuleOptions">';
if ($type == 'textarea') {
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
print '<input type="hidden" name="action" value="setModuleOptions">';
if ($type == 'textarea') {
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
} elseif ($type == 'input') {
print '<input '.$metascompil.' />';
} else {
print '<input '.$metascompil.' />';
} else {
// custom
print $type;
}
print '</td></tr>';
}
print '</td></tr>';
}

View File

@ -82,23 +82,23 @@ $picto = array(
foreach ($modules as $const => $desc)
{
if ($action == 'activate_'.strtolower($const))
{
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
if ($const == 'PRODUCTDESC' && !empty($conf->global->PRODUIT_DESC_IN_FORM))
{
dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1", 'chaine', 0, '', $conf->entity);
}
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
if ($action == 'disable_'.strtolower($const))
{
dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const, $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
if ($action == 'activate_'.strtolower($const))
{
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
if ($const == 'PRODUCTDESC' && !empty($conf->global->PRODUIT_DESC_IN_FORM))
{
dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1", 'chaine', 0, '', $conf->entity);
}
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
if ($action == 'disable_'.strtolower($const))
{
dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const, $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
}
if (GETPOST('save', 'alpha'))
@ -115,7 +115,7 @@ if (GETPOST('save', 'alpha'))
}
$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)) {
$error++;
}
@ -124,11 +124,11 @@ if (GETPOST('save', 'alpha'))
}
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*

View File

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

View File

@ -47,7 +47,7 @@ if ($action == 'set')
$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');
$error++;
}

View File

@ -80,9 +80,9 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -95,9 +95,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
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))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
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

View File

@ -122,7 +122,7 @@ if ($action == 'update')
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $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);
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))
{
$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))
{
$i = 0;
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100)
{
$tmp = explode('|', $reg[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);
$i++;
}
$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))
{
$i = 0;
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100)
{
$tmp = explode('|', $reg[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);
$i++;
}
print "\n<!-- Start of welcome text for setup page -->\n";
print '<table width="100%" class="notopnoleftnoright"><tr><td>';
print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
print '</td></tr></table><br>';
print "\n<!-- End 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 dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
print '</td></tr></table><br>';
print "\n<!-- End of welcome text for setup page -->\n";
}
}
print '<span class="opacitymedium hideonsmartphone">';
@ -109,7 +109,7 @@ print $hookmanager->resPrint;
if (empty($reshook))
{
// Show into other
print '<span class="opacitymedium">'.$langs->trans("SetupDescription5")."</span><br>";
print '<span class="opacitymedium">'.$langs->trans("SetupDescription5")."</span><br>";
print "<br>";
// 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++;
// This one must be after the others
$valkey = '';
$key = GETPOST("key");
if ($key) $valkey = $conf->global->$key;
if (!dolibarr_set_const($db, 'LDAP_KEY_GROUPS', $valkey, 'chaine', 0, '', $conf->entity)) $error++;
$valkey = '';
$key = GETPOST("key");
if ($key) $valkey = $conf->global->$key;
if (!dolibarr_set_const($db, 'LDAP_KEY_GROUPS', $valkey, 'chaine', 0, '', $conf->entity)) $error++;
if (!$error)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
dol_print_error($db);
}
if (!$error)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
dol_print_error($db);
}
}

View File

@ -35,8 +35,8 @@ $action = GETPOST('action', 'aZ09');
$currencycode = GETPOST('currencycode', 'alpha');
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.
$currencycode = (!empty($currencycode) ? $currencycode : $conf->currency);
// 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);
}
$mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(!empty($currencycode) ? '_'.$currencycode : '');
@ -56,41 +56,41 @@ if ($action == 'update')
if ($_POST[$mainmaxdecimalsunit] > $MAXDEC
|| $_POST[$mainmaxdecimalstot] > $MAXDEC
|| $_POST[$mainmaxdecimalsshown] > $MAXDEC)
{
$error++;
setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
}
{
$error++;
setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
}
if ($_POST[$mainmaxdecimalsunit].(!empty($currencycode) ? '_'.$currencycode : '') < 0
|| $_POST[$mainmaxdecimalstot] < 0
|| $_POST[$mainmaxdecimalsshown] < 0)
{
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
}
if ($_POST[$mainmaxdecimalsunit].(!empty($currencycode) ? '_'.$currencycode : '') < 0
|| $_POST[$mainmaxdecimalstot] < 0
|| $_POST[$mainmaxdecimalsshown] < 0)
{
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
}
if ($valmainroundingruletot)
{
if ($valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1)
{
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors');
}
}
if ($valmainroundingruletot)
{
if ($valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1)
{
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors');
}
}
if (!$error)
{
dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, $mainmaxdecimalsshown, $valmainmaxdecimalsshown, 'chaine', 0, '', $conf->entity);
if (!$error)
{
dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, '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, $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 : ''));
exit;
}
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(!empty($currencycode) ? '&currencycode='.$currencycode : ''));
exit;
}
}
@ -134,67 +134,67 @@ print "<br>\n";
if ($action == 'edit')
{
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
print '<input type="hidden" name="currencycode" value="'.$currencycode.'">';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
print '<input type="hidden" name="currencycode" value="'.$currencycode.'">';
}
clearstatcache();
clearstatcache();
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
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 '<tr class="oddeven"><td>';
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 '<tr class="oddeven"><td>';
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 '<tr class="oddeven"><td>';
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 '<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 '<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 '<tr class="oddeven"><td>';
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 '<tr class="oddeven"><td>';
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 '</table>';
print '</table>';
print '<br>';
print '<div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '<br>';
print '<div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '<br>';
print '</form>';
print '<br>';
print '</form>';
print '<br>';
} else {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
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 '<tr class="oddeven"><td>';
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 '<tr class="oddeven"><td>';
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 '<tr class="oddeven"><td>';
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 '<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 '<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 '<tr class="oddeven"><td>';
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 '<tr class="oddeven"><td>';
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 '</table>';
print '</table>';
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit'.(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
print '</div>';
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit'.(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
print '</div>';
}
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);
if ($resql)
{
$num = $db->num_rows($resql);
if ($num)
{
for ($i = 0; $i < $num; $i++)
{
$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);
}
}
$num = $db->num_rows($resql);
if ($num)
{
for ($i = 0; $i < $num; $i++)
{
$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);
}
}
} else dol_print_error($db);
if (count($vat_rates))
{
foreach ($vat_rates as $vatarray)
{
$vat = $vatarray['vat_rate'];
for ($qty = 1; $qty <= 2; $qty++)
{
$vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
foreach ($vat_rates as $vatarray)
{
$vat = $vatarray['vat_rate'];
for ($qty = 1; $qty <= 2; $qty++)
{
$vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
$localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
$localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc);
$s = 10 / 3;
$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 " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%';
print ($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
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 "<br>\n";
}
}
$s = 10 / 3;
$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 " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%';
print ($vatarray['code'] ? ' ('.$vatarray['code'].')' : '');
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 "<br>\n";
}
}
} else {
// 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)
// were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule.
// 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)
// 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;
$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 " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%';
print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
$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);
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%';
print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
$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);
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%';
print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
$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);
print '<span class="opacitymedium">'.$langs->trans("UnitPriceOfProduct").":</span> ".price2num($s, 'MU');
print " x ".$langs->trans("Quantity").": ".$qty;
print " - ".$langs->trans("VAT").": ".$vat.'%';
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
if (!$user->admin)
accessforbidden();
accessforbidden();
$action = GETPOST('action', 'aZ09');
@ -50,22 +50,22 @@ $list = array(
if ($action == 'update')
{
$error = 0;
$error = 0;
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*

View File

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

View File

@ -67,18 +67,18 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
if ($action == 'update' && !$cancel)
{
if (! $error && ! GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml')) {
if (!$error && !GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MAIN_MAIL_EMAIL_FROM")), null, 'errors');
$action = 'edit';
}
if (! $error && ! isValidEmail(GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml'))) {
if (!$error && !isValidEmail(GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml'))) {
$error++;
setEventMessages($langs->trans("ErrorBadEMail", GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml')), null, 'errors');
$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_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);
@ -188,13 +188,13 @@ if ($action == 'edit')
jQuery("#smtp_server_mess").show();
jQuery("#smtp_port_mess").show();';
} else {
print '
print '
jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true);
jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true);
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();';
}
print '
}
print '
}
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\')
{
@ -266,7 +266,7 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").val(0);
});
})';
print '</script>'."\n";
print '</script>'."\n";
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
@ -409,8 +409,8 @@ if ($action == 'edit')
print '</td></tr>';
}
// TLS
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
// TLS
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 (function_exists('openssl_open'))
@ -453,20 +453,20 @@ if ($action == 'edit')
} else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>';
// DKIM Domain
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></tr>';
// DKIM Domain
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></tr>';
// DKIM Selector
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></tr>';
// DKIM Selector
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></tr>';
// DKIM PRIVATE KEY
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></tr>';
// DKIM PRIVATE KEY
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></tr>';
print '</table>';
@ -635,20 +635,20 @@ if ($action == 'edit')
} else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>';
// Domain
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
print '</td></tr>';
// Domain
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
print '</td></tr>';
// Selector
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
print '</td></tr>';
// Selector
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
print '</td></tr>';
// PRIVATE KEY
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></tr>';
// PRIVATE KEY
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></tr>';
}
print '</table>';

View File

@ -60,7 +60,7 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
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_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);
@ -382,22 +382,22 @@ if ($action == 'edit')
} else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>';
print '</table>';
print '</table>';
print dol_get_fiche_end();
print dol_get_fiche_end();
print '<br><div class="center">';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '<br><div class="center">';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
} 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 "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
print "<br>\n";
print '<table class="noborder centpercent">';
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();
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
print '<br>';
/*
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
print '<br>';
/*
// Warning 1
if ($linuxlike)
{
@ -491,12 +491,12 @@ if ($action == 'edit')
print info_admin($langs->trans("SendmailOptionNotComplete"));
}
}*/
// Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
// Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
// Buttons for actions
// Buttons for actions
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')))
{
$text = $langs->trans("WarningPHPMail");
print info_admin($text);
$text = $langs->trans("WarningPHPMail");
print info_admin($text);
}
// Run the test to connect
@ -556,7 +556,7 @@ if ($action == 'edit')
// Show email send test form
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 dol_get_fiche_head('');
@ -592,7 +592,7 @@ if ($action == 'edit')
$formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
// Init list of files
if (GETPOST("mode") == 'init')
if (GETPOST("mode") == 'init')
{
$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
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') {
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);
} else {
$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
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') {
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);
} else {
$sql .= " ".((int) GETPOST($keycode, 'fk_user'));
@ -350,7 +350,7 @@ if (empty($reshook))
}
$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;
}
//print $sql;exit;
@ -371,7 +371,7 @@ if (empty($reshook))
$rowidcol = "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;
}
dol_syslog("delete", LOG_DEBUG);
@ -493,7 +493,7 @@ if ($action == 'view') {
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
if ($fieldlist[$field] == 'code') { $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] == 'position') { $align = 'center'; }
@ -795,13 +795,13 @@ if ($resql)
print "</tr>\n";
} else {
if ($obj->module) {
$tempmodulekey = $obj->module;
if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
$i++;
continue;
}
}
if ($obj->module) {
$tempmodulekey = $obj->module;
if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
$i++;
continue;
}
}
$keyforobj = 'type_template';
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"]))
{
// 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_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);
@ -359,22 +359,22 @@ if ($action == 'edit')
} else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>';
print '</table>';
print '</table>';
print dol_get_fiche_end();
print dol_get_fiche_end();
print '<br><div class="center">';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '<br><div class="center">';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
} 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 "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
print "<br>\n";
print '<table class="noborder centpercent">';
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();
if ($conf->global->MAIN_MAIL_SENDMODE_TICKET == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
print '<br>';
/*
if ($conf->global->MAIN_MAIL_SENDMODE_TICKET == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
print '<br>';
/*
// Warning 1
if ($linuxlike)
{
@ -457,12 +457,12 @@ if ($action == 'edit')
print info_admin($langs->trans("SendmailOptionNotComplete"));
}
}*/
// Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
// Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
// Buttons for actions
// Buttons for actions
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')))
{
$text = $langs->trans("WarningPHPMail");
print info_admin($text);
$text = $langs->trans("WarningPHPMail");
print info_admin($text);
}
// Run the test to connect
@ -522,7 +522,7 @@ if ($action == 'edit')
// Show email send test form
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 dol_get_fiche_head('');
@ -558,7 +558,7 @@ if ($action == 'edit')
$formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
// Init list of files
if (GETPOST("mode") == 'init')
if (GETPOST("mode") == 'init')
{
$formmail->clear_attached_files();
}

View File

@ -38,8 +38,8 @@ $dirsmartphone = array();
$dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
foreach ($dirmenus as $dirmenu)
{
$dirstandard[] = $dirmenu.'standard';
$dirsmartphone[] = $dirmenu.'smartphone';
$dirstandard[] = $dirmenu.'standard';
$dirsmartphone[] = $dirmenu.'smartphone';
}
$action = GETPOST('action', 'aZ09');
@ -244,13 +244,13 @@ if ($action == 'delete')
$result = $db->query($sql);
$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 = '';
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"].'">';
@ -297,7 +297,7 @@ if ($conf->use_javascript_ajax)
//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
@ -337,16 +337,16 @@ if ($conf->use_javascript_ajax)
$data[] = array(
'rowid'=>$menu['rowid'],
'module'=>$menu['module'],
'module'=>$menu['module'],
'fk_menu'=>$menu['fk_menu'],
'title'=>$titre,
'mainmenu'=>$menu['mainmenu'],
'mainmenu'=>$menu['mainmenu'],
'leftmenu'=>$menu['leftmenu'],
'fk_mainmenu'=>$menu['fk_mainmenu'],
'fk_leftmenu'=>$menu['fk_leftmenu'],
'position'=>$menu['position'],
'position'=>$menu['position'],
'entry'=>$entry,
'buttons'=>$buttons
'buttons'=>$buttons
);
$i++;
}
@ -369,36 +369,36 @@ if ($conf->use_javascript_ajax)
// Process remaining records (records that are not linked to root by any path)
$remainingdata = array();
$remainingdata = array();
foreach ($data as $datar)
{
if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue;
$remainingdata[] = $datar;
if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue;
$remainingdata[] = $datar;
}
if (count($remainingdata))
{
print '<table class="noborder centpercent">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("NotTopTreeMenuPersonalized").'</td>';
print '<td class="right"></td>';
print '</tr>';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("NotTopTreeMenuPersonalized").'</td>';
print '<td class="right"></td>';
print '</tr>';
print '<tr>';
print '<td colspan="2">';
foreach ($remainingdata as $datar)
{
$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";
tree_recur($data, $father, 0, 'iddivjstree'.$datar['rowid'], 1, 1);
}
print '<tr>';
print '<td colspan="2">';
foreach ($remainingdata as $datar)
{
$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";
tree_recur($data, $father, 0, 'iddivjstree'.$datar['rowid'], 1, 1);
}
print '</td>';
print '</td>';
print '</tr>';
print '</tr>';
print '</table>';
print '</table>';
}
print '</div>';

View File

@ -91,106 +91,106 @@ foreach ($modulesdir as $dir)
while (($file = readdir($handle)) !== false)
{
//print "$i ".$file."\n<br>";
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);
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);
if ($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>";
setEventMessages($mesg, null, 'warnings');
dol_syslog($mesg, LOG_ERR);
if ($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>";
setEventMessages($mesg, null, 'warnings');
dol_syslog($mesg, LOG_ERR);
continue;
}
}
try {
$res = include_once $dir.$file;
if (class_exists($modName))
try {
$res = include_once $dir.$file;
if (class_exists($modName))
{
try {
$objMod = new $modName($db);
$objMod = new $modName($db);
$modNameLoaded[$modName] = $dir;
if (!$objMod->numero > 0 && $modName != 'modUser')
{
dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
}
if (!$objMod->numero > 0 && $modName != 'modUser')
{
dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
}
$j = $objMod->numero;
$modulequalified = 1;
$modulequalified = 1;
// 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)));
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;
// 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)));
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 (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
//if (! empty($objMod->hidden)) $modulequalified=0;
// We discard modules according to property disabled
//if (! empty($objMod->hidden)) $modulequalified=0;
if ($modulequalified > 0)
{
$publisher = dol_escape_htmltag($objMod->getPublisher());
$external = ($objMod->isCoreOrExternalModule() == 'external');
if ($external)
{
if ($publisher)
{
$arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
} else {
$arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
}
}
ksort($arrayofnatures);
}
if ($modulequalified > 0)
{
$publisher = dol_escape_htmltag($objMod->getPublisher());
$external = ($objMod->isCoreOrExternalModule() == 'external');
if ($external)
{
if ($publisher)
{
$arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
} else {
$arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
}
}
ksort($arrayofnatures);
}
// Define array $categ with categ with at least one qualified module
if ($modulequalified > 0)
{
$modules[$i] = $objMod;
$filename[$i] = $modName;
// Define array $categ with categ with at least one qualified module
if ($modulequalified > 0)
{
$modules[$i] = $objMod;
$filename[$i] = $modName;
// 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($familyinfo)) $familyinfo = array();
$familyinfo = array_merge($familyinfo, $objMod->familyinfo);
$familykey = key($objMod->familyinfo);
} else {
$familykey = $objMod->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($familyinfo)) $familyinfo = array();
$familyinfo = array_merge($familyinfo, $objMod->familyinfo);
$familykey = key($objMod->familyinfo);
} else {
$familykey = $objMod->family;
}
$moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external'))
{
$moduleposition = '80'; // External modules at end by default
}
$moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external'))
{
$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
$dirmod[$i] = $dir;
//print $i.'-'.$dirmod[$i].'<br>';
// Set categ[$i]
$specialstring = 'unknown';
if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring = 'expdev';
if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories
else $categ[$specialstring] = 1;
$j++;
$i++;
} else dol_syslog("Module ".get_class($objMod)." not qualified");
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
$dirmod[$i] = $dir;
//print $i.'-'.$dirmod[$i].'<br>';
// Set categ[$i]
$specialstring = 'unknown';
if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring = 'expdev';
if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories
else $categ[$specialstring] = 1;
$j++;
$i++;
} else dol_syslog("Module ".get_class($objMod)." not qualified");
} 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 {
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
}
} 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);
} else {
@ -208,16 +208,16 @@ unset($objMod);
$i = 0;
foreach ($orders as $tmpkey => $tmpvalue)
{
$tmpMod = $modules[$tmpkey];
if ($tmpMod->numero == $id)
{
$key = $i;
$modName = $filename[$tmpkey];
$dirofmodule = $dirmod[$tmpkey];
$objMod = $tmpMod;
break;
}
$i++;
$tmpMod = $modules[$tmpkey];
if ($tmpMod->numero == $id)
{
$key = $i;
$modName = $filename[$tmpkey];
$dirofmodule = $dirmod[$tmpkey];
$objMod = $tmpMod;
break;
}
$i++;
}
$value = $orders[$key];
$tab = explode('_', $value);
@ -296,7 +296,7 @@ $versiontrans .= $objMod->getVersion(1);
$imginfo = "info";
if ($objMod->isCoreOrExternalModule() == 'external')
{
$imginfo = "info_black";
$imginfo = "info_black";
}
// Define text of description of module
@ -304,138 +304,138 @@ $text = '';
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';
$text .= '<br><span class="opacitymedium">'.$langs->trans("DescriptorFile").':</span> '.$moduledescriptorfile;
$moduledescriptorfile = get_class($objMod).'.class.php';
$text .= '<br><span class="opacitymedium">'.$langs->trans("DescriptorFile").':</span> '.$moduledescriptorfile;
$textexternal = '';
if ($objMod->isCoreOrExternalModule() == 'external')
{
$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);
$editor_url = $objMod->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>';
$text .= $textexternal;
$text .= '<br>';
} else {
$text .= '<br><span class="opacitymedium">'.$langs->trans("Origin").':</span> '.$langs->trans("Core").'<br>';
}
$textexternal = '';
if ($objMod->isCoreOrExternalModule() == 'external')
{
$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);
$editor_url = $objMod->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>';
$text .= $textexternal;
$text .= '<br>';
} else {
$text .= '<br><span class="opacitymedium">'.$langs->trans("Origin").':</span> '.$langs->trans("Core").'<br>';
}
$moduledesclong = $objMod->getDescLong();
if ($moduledesclong) $text .= '<br><hr><div class="moduledesclong">'.$moduledesclong.'<div>';
$moduledesclong = $objMod->getDescLong();
if ($moduledesclong) $text .= '<br><hr><div class="moduledesclong">'.$moduledesclong.'<div>';
}
if ($mode == 'feature')
{
$text .= '<br><strong>'.$langs->trans("DependsOn").':</strong> ';
if (count($objMod->depends)) $text .= join(',', $objMod->depends);
$text .= '<br><strong>'.$langs->trans("DependsOn").':</strong> ';
if (count($objMod->depends)) $text .= join(',', $objMod->depends);
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);
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'));
if (count($sqlfiles) > 0)
{
$text .= $langs->trans("Yes").' (';
$i = 0;
foreach ($sqlfiles as $val)
{
$text .= ($i ? ', ' : '').preg_replace('/\.sql$/', '', preg_replace('/llx_/', '', $val['name']));
$i++;
}
$text .= ')';
} else $text .= $langs->trans("No");
if (count($sqlfiles) > 0)
{
$text .= $langs->trans("Yes").' (';
$i = 0;
foreach ($sqlfiles as $val)
{
$text .= ($i ? ', ' : '').preg_replace('/\.sql$/', '', preg_replace('/llx_/', '', $val['name']));
$i++;
}
$text .= ')';
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
{
$i = 0;
foreach ($objMod->dictionaries['tablib'] as $val)
{
$text .= ($i ? ', ' : '').$val;
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
{
$i = 0;
foreach ($objMod->dictionaries['tablib'] as $val)
{
$text .= ($i ? ', ' : '').$val;
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddData").':</strong> ';
$filedata = dol_buildpath($moduledir.'/sql/data.sql');
if (dol_is_file($filedata))
{
$text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql)';
} else $text .= $langs->trans("No");
$text .= '<br><strong>'.$langs->trans("AddData").':</strong> ';
$filedata = dol_buildpath($moduledir.'/sql/data.sql');
if (dol_is_file($filedata))
{
$text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql)';
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
{
$i = 0;
foreach ($objMod->tabs as $val)
{
if (is_array($val)) $val = $val['data'];
if (is_string($val))
{
$tmp = explode(':', $val, 3);
$text .= ($i ? ', ' : '').$tmp[0].':'.$tmp[1];
$i++;
}
}
} else $text .= $langs->trans("No");
$text .= '<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
{
$i = 0;
foreach ($objMod->tabs as $val)
{
if (is_array($val)) $val = $val['data'];
if (is_string($val))
{
$tmp = explode(':', $val, 3);
$text .= ($i ? ', ' : '').$tmp[0].':'.$tmp[1];
$i++;
}
}
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddModels").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
{
$text .= $langs->trans("Yes");
} else $text .= $langs->trans("No");
$text .= '<br><strong>'.$langs->trans("AddModels").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
{
$text .= $langs->trans("Yes");
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
{
$text .= $langs->trans("Yes");
} else $text .= $langs->trans("No");
$text .= '<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
{
$text .= $langs->trans("Yes");
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
{
$i = 0;
foreach ($objMod->cronjobs as $val)
{
$text .= ($i ? ', ' : '').($val['label']);
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
{
$i = 0;
foreach ($objMod->cronjobs as $val)
{
$text .= ($i ? ', ' : '').($val['label']);
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
$moreinfoontriggerfile = '';
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{
$yesno = 'Yes';
} else {
$yesno = 'No';
}
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
$interfaces = new Interfaces($db);
$triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() == 'external') ? '/'.$moduledir : '').'/core/triggers'));
$text .= '<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
$moreinfoontriggerfile = '';
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{
$yesno = 'Yes';
} else {
$yesno = 'No';
}
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
$interfaces = new Interfaces($db);
$triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() == 'external') ? '/'.$moduledir : '').'/core/triggers'));
foreach ($triggers as $triggercursor)
{
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> ';
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
{
$i = 0;
foreach ($objMod->boxes as $val)
{
$text .= ($i ? ', ' : '').($val['file'] ? $val['file'] : $val[0]);
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
{
$i = 0;
foreach ($objMod->boxes as $val)
{
$text .= ($i ? ', ' : '').($val['file'] ? $val['file'] : $val[0]);
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddHooks").':</strong> ';
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
{
$i = 0;
foreach ($objMod->module_parts['hooks'] as $key => $val)
{
if ($key === 'entity') continue;
$text .= '<br><strong>'.$langs->trans("AddHooks").':</strong> ';
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
{
$i = 0;
foreach ($objMod->module_parts['hooks'] as $key => $val)
{
if ($key === 'entity') continue;
// For special values
if ($key === 'data')
{
if (is_array($val))
{
foreach ($val as $value)
{
$text .= ($i ? ', ' : '').($value);
$i++;
}
// For special values
if ($key === 'data')
{
if (is_array($val))
{
foreach ($val as $value)
{
$text .= ($i ? ', ' : '').($value);
$i++;
}
continue;
}
}
continue;
}
}
$text .= ($i ? ', ' : '').($val);
$i++;
}
} else $text .= $langs->trans("No");
$text .= ($i ? ', ' : '').($val);
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddPermissions").':</strong> ';
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
{
$i = 0;
foreach ($objMod->rights as $val)
{
$text .= ($i ? ', ' : '').($val[1]);
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br><strong>'.$langs->trans("AddPermissions").':</strong> ';
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
{
$i = 0;
foreach ($objMod->rights as $val)
{
$text .= ($i ? ', ' : '').($val[1]);
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddMenus").':</strong> ';
if (isset($objMod->menu) && !empty($objMod->menu)) // objMod can be an array or just an int 1
{
$text .= $langs->trans("Yes");
} else $text .= $langs->trans("No");
$text .= '<br><strong>'.$langs->trans("AddMenus").':</strong> ';
if (isset($objMod->menu) && !empty($objMod->menu)) // objMod can be an array or just an int 1
{
$text .= $langs->trans("Yes");
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
{
$i = 0;
foreach ($objMod->export_label as $val)
{
$text .= ($i ? ', ' : '').($val);
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
{
$i = 0;
foreach ($objMod->export_label as $val)
{
$text .= ($i ? ', ' : '').($val);
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
{
$i = 0;
foreach ($objMod->import_label as $val)
{
$text .= ($i ? ', ' : '').($val);
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
{
$i = 0;
foreach ($objMod->import_label as $val)
{
$text .= ($i ? ', ' : '').($val);
$i++;
}
} else $text .= $langs->trans("No");
$text .= '<br>';
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
$text .= $langs->trans("DetectionNotPossible");
$text .= '<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
$text .= $langs->trans("DetectionNotPossible");
}
if ($mode == 'changelog')
{
$changelog = $objMod->getChangeLog();
if ($changelog) $text .= '<div class="moduledesclong">'.$changelog.'<div>';
else $text .= '<div class="moduledesclong">'.$langs->trans("NotAvailable").'</div>';
$changelog = $objMod->getChangeLog();
if ($changelog) $text .= '<div class="moduledesclong">'.$changelog.'<div>';
else $text .= '<div class="moduledesclong">'.$langs->trans("NotAvailable").'</div>';
}
print $text;

View File

@ -28,7 +28,7 @@
* \brief Page to activate/disable all modules
*/
if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
if (!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
@ -404,7 +404,7 @@ foreach ($modulesdir as $dir)
$familyposition = (empty($familyinfo[$familykey]['position']) ? 0 : $familyinfo[$familykey]['position']);
$listOfOfficialModuleGroups = array('hr', 'technic', 'interface', 'technic', 'portal', 'financial', 'crm', 'base', 'products', 'srm', 'ecm', 'projects', 'other');
if ($external && ! in_array($familykey, $listOfOfficialModuleGroups))
if ($external && !in_array($familykey, $listOfOfficialModuleGroups))
{
// If module is extern and into a custom group (not into an official predefined one), it must appear at end (custom groups should not be before official groups).
if (is_numeric($familyposition)) {

View File

@ -80,9 +80,9 @@ print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
@ -92,9 +92,9 @@ if ($action != 'create' && $action != 'edit')
if ($action == 'create')
{
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))
{
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
print "<br>";
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

View File

@ -34,7 +34,7 @@ $langs->loadLangs(array('admin', 'multicurrency'));
// Access control
if (!$user->admin) {
accessforbidden();
accessforbidden();
}
// Parameters
@ -52,9 +52,9 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
$value = GETPOST($code, 'alpha');
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -63,9 +63,9 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
$code = $reg[1];
if (dolibarr_del_const($db, $code, 0) > 0)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -132,17 +132,17 @@ if ($action == 'add_currency')
}
} elseif ($action == 'setapilayer')
{
if (GETPOSTISSET('modify_apilayer'))
{
dolibarr_set_const($db, 'MULTICURRENCY_APP_ID', GETPOST('MULTICURRENCY_APP_ID', 'alpha'));
dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha'));
//dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha'));
} else {
$result = MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID);
if ($result > 0) {
setEventMessages($langs->trans("CurrencyRateSyncSucceed"), null, "mesgs");
}
}
if (GETPOSTISSET('modify_apilayer'))
{
dolibarr_set_const($db, 'MULTICURRENCY_APP_ID', GETPOST('MULTICURRENCY_APP_ID', 'alpha'));
dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha'));
//dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha'));
} else {
$result = MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID);
if ($result > 0) {
setEventMessages($langs->trans("CurrencyRateSyncSucceed"), null, "mesgs");
}
}
}
@ -189,10 +189,10 @@ print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE").'</td>';
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE');
print ajax_constantonoff('MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE", $arrval, $conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE);
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE", $arrval, $conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE);
}
print '</td></tr>';
@ -201,26 +201,26 @@ print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useOriginTx").'</td>';
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MULTICURRENCY_USE_ORIGIN_TX');
print ajax_constantonoff('MULTICURRENCY_USE_ORIGIN_TX');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MULTICURRENCY_USE_ORIGIN_TX", $arrval, $conf->global->MULTICURRENCY_USE_ORIGIN_TX);
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MULTICURRENCY_USE_ORIGIN_TX", $arrval, $conf->global->MULTICURRENCY_USE_ORIGIN_TX);
}
print '</td></tr>';
// Online payment with currency on document. This option should be on by default.
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT").'</td>';
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT", $arrval, $conf->global->MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT);
}
print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT").'</td>';
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT", $arrval, $conf->global->MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT);
}
print '</td></tr>';
}
/* TODO uncomment when the functionality will integrated
@ -258,9 +258,9 @@ print '<br>';
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
{
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" id="form_sync">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setapilayer">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" id="form_sync">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setapilayer">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';

View File

@ -61,8 +61,8 @@ if ($action == 'settemplates')
$triggername = $reg[1];
$constvalue = GETPOST($key, 'alpha');
$consttype = 'emailtemplate:xxx';
$tmparray=explode(':', $constvalue);
if (! empty($tmparray[0]) && ! empty($tmparray[1])) {
$tmparray = explode(':', $constvalue);
if (!empty($tmparray[0]) && !empty($tmparray[1])) {
$constvalue = $tmparray[0];
$consttype = 'emailtemplate:'.$tmparray[1];
//var_dump($constvalue);
@ -96,19 +96,19 @@ if ($action == 'setvalue' && $user->admin)
$db->begin();
$result = dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", GETPOST("email_from", "restricthtml"), 'chaine', 0, '', $conf->entity);
if ($result < 0) $error++;
if ($result < 0) $error++;
if (!$error)
{
$db->commit();
if (!$error)
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors');
}
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -116,50 +116,50 @@ if ($action == 'setfixednotif' && $user->admin)
{
$db->begin();
if (!$error && is_array($_POST))
{
$reg = array();
foreach ($_POST as $key => $val)
{
if (!preg_match('/^NOTIF_(.*)_key$/', $key, $reg)) continue;
if (!$error && is_array($_POST))
{
$reg = array();
foreach ($_POST as $key => $val)
{
if (!preg_match('/^NOTIF_(.*)_key$/', $key, $reg)) continue;
$newval = '';
$newkey = '';
$newval = '';
$newkey = '';
$shortkey = preg_replace('/_key$/', '', $key);
//print $shortkey.'<br>';
$shortkey = preg_replace('/_key$/', '', $key);
//print $shortkey.'<br>';
if (preg_match('/^NOTIF_(.*)_old_(.*)_key/', $key, $reg))
{
if (preg_match('/^NOTIF_(.*)_old_(.*)_key/', $key, $reg))
{
dolibarr_del_const($db, 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.$reg[2], $conf->entity);
$newkey = 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount'));
$newval = GETPOST($shortkey.'_key');
//print $newkey.' - '.$newval.'<br>';
} elseif (preg_match('/^NOTIF_(.*)_new_key/', $key, $reg))
{
// Add a new entry
$newkey = 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount'));
$newval = GETPOST($shortkey.'_key');
}
} elseif (preg_match('/^NOTIF_(.*)_new_key/', $key, $reg))
{
// Add a new entry
$newkey = 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount'));
$newval = GETPOST($shortkey.'_key');
}
if ($newkey && $newval)
{
if ($newkey && $newval)
{
$result = dolibarr_set_const($db, $newkey, $newval, 'chaine', 0, '', $conf->entity);
}
}
}
}
}
}
if (!$error)
{
$db->commit();
{
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors');
}
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -318,66 +318,66 @@ print "</tr>\n";
foreach ($listofnotifiedevents as $notifiedevent)
{
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
// Special cases
if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder');
elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal');
elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill');
elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order');
if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder');
elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal');
elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill');
elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order');
elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention');
elseif ($notifiedevent['elementtype'] == 'shipping') $elementLabel = $langs->trans('Shipping');
elseif ($notifiedevent['elementtype'] == 'expensereport') $elementLabel = $langs->trans('ExpenseReport');
print '<tr class="oddeven">';
print '<td>'.$elementLabel.'</td>';
print '<td>'.$notifiedevent['code'].'</td>';
print '<td>'.$label.'</td>';
print '<td>';
// Notification with threshold
foreach ($conf->global as $key => $val)
{
print '<tr class="oddeven">';
print '<td>'.$elementLabel.'</td>';
print '<td>'.$notifiedevent['code'].'</td>';
print '<td>'.$label.'</td>';
print '<td>';
// Notification with threshold
foreach ($conf->global as $key => $val)
{
if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) continue;
$param = 'NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_'.$reg[1];
$value = GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key') ?GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key', 'alpha') : $conf->global->$param;
$param = 'NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_'.$reg[1];
$value = GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key') ?GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key', 'alpha') : $conf->global->$param;
$s = '<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key" value="'.dol_escape_htmltag($value).'">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
$arrayemail = explode(',', $value);
$s = '<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key" value="'.dol_escape_htmltag($value).'">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
$arrayemail = explode(',', $value);
$showwarning = 0;
foreach ($arrayemail as $keydet => $valuedet)
{
$valuedet = trim($valuedet);
if (!empty($valuedet) && !isValidEmail($valuedet, 1)) $showwarning++;
}
if ((!empty($conf->global->$param)) && $showwarning) $s .= ' '.img_warning($langs->trans("ErrorBadEMail"));
print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
if ((!empty($conf->global->$param)) && $showwarning) $s .= ' '.img_warning($langs->trans("ErrorBadEMail"));
print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
print '<br>';
}
// New entry input fields
$s = '<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_new_key" value="">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
print '</td>';
}
// New entry input fields
$s = '<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_new_key" value="">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
print '</td>';
print '<td>';
// Notification with threshold
foreach ($conf->global as $key => $val)
{
print '<td>';
// Notification with threshold
foreach ($conf->global as $key => $val)
{
if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) continue;
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_amount" value="'.dol_escape_htmltag($reg[1]).'">';
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_amount" value="'.dol_escape_htmltag($reg[1]).'">';
print '<br>';
}
// New entry input fields
}
// New entry input fields
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_new_amount" value="">';
print '</td>';
print '<td>';
print '<td>';
// TODO Add link to show message content
print '</td>';
print '</tr>';
print '</td>';
print '</tr>';
}
print '</table>';

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