mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
parent
04199f686d
commit
8744f6ab7b
|
|
@ -29,18 +29,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|||
|
||||
$langs->load("admin");
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="date";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) $sortfield = "date";
|
||||
if (empty($page) || $page == -1) { $page = 0; }
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
|
||||
if (! $user->admin)
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
|
|
@ -52,33 +52,33 @@ if ($action == 'delete')
|
|||
{
|
||||
if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha')))
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret=dol_delete_file($file, 1);
|
||||
$file = $conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret = dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret=dol_delete_file($file, 1);
|
||||
$file = $conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret = dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
}
|
||||
$action='';
|
||||
$action = '';
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
$label=$db::LABEL;
|
||||
$type=$db->type;
|
||||
$label = $db::LABEL;
|
||||
$type = $db->type;
|
||||
//var_dump($db);
|
||||
|
||||
$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
$help_url = 'EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
llxHeader('', '', $help_url);
|
||||
|
||||
print '<script type="text/javascript">
|
||||
|
|
@ -141,9 +141,9 @@ print '<br>';
|
|||
|
||||
print '<div id="backupdatabaseleft" class="fichehalfleft" >';
|
||||
|
||||
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
|
||||
print load_fiche_titre($title ? $title : $langs->trans("BackupDumpWizard"));
|
||||
|
||||
print '<table width="100%" class="'.($useinecm?'nobordernopadding':'liste').' nohover">';
|
||||
print '<table width="100%" class="'.($useinecm ? 'nobordernopadding' : 'liste').' nohover">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
|
||||
|
|
@ -186,11 +186,11 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||
print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
|
||||
{
|
||||
$fullpathofmysqldump=$db->getPathOfDump();
|
||||
$fullpathofmysqldump = $db->getPathOfDump();
|
||||
}
|
||||
else
|
||||
{
|
||||
$fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||
$fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
|
||||
|
|
@ -203,7 +203,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||
|
||||
print '</div>';
|
||||
|
||||
if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
|
|
@ -242,7 +242,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||
print '</legend>';
|
||||
print '<input type="checkbox" name="drop"'.(((! isset($_GET["drop"]) && ! isset($_POST["drop"])) || GETPOST('drop'))?' checked':'').' id="checkbox_dump_drop" />';
|
||||
print '<input type="checkbox" name="drop"'.(((!isset($_GET["drop"]) && !isset($_POST["drop"])) || GETPOST('drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
|
|
@ -293,7 +293,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||
|
||||
print '</div>';
|
||||
if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
|
|
@ -303,7 +303,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||
|
||||
print '<br>';
|
||||
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
|
||||
print '<input type="checkbox" name="nobin_drop"'.((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':''.' id="checkbox_dump_drop" />';
|
||||
print '<input type="checkbox" name="nobin_drop"'.((!isset($_GET["nobin_drop"]) && !isset($_POST["nobin_drop"])) || GETPOST('nobin_drop')) ? ' checked' : ''.' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
|
|
@ -338,11 +338,11 @@ if (in_array($type, array('pgsql'))) {
|
|||
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
|
||||
$fullpathofpgdump=$db->getPathOfDump();
|
||||
$fullpathofpgdump = $db->getPathOfDump();
|
||||
}
|
||||
else
|
||||
{
|
||||
$fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||
$fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
|
||||
|
|
@ -391,27 +391,27 @@ print '<legend>'.$langs->trans("Destination").'</legend> -->';
|
|||
print '<br>';
|
||||
print '<label for="filename_template">'.$langs->trans("FileNameToGenerate").'</label>';
|
||||
print '<br>';
|
||||
$prefix='dump';
|
||||
$ext='.sql';
|
||||
$prefix = 'dump';
|
||||
$ext = '.sql';
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
$prefix='mysqldump';
|
||||
$ext='sql';
|
||||
$prefix = 'mysqldump';
|
||||
$ext = 'sql';
|
||||
}
|
||||
//if ($label == 'PostgreSQL') {
|
||||
// $prefix='pg_dump';
|
||||
// $ext='dump';
|
||||
//}
|
||||
if (in_array($type, array('pgsql'))) {
|
||||
$prefix='pg_dump';
|
||||
$ext='sql';
|
||||
$prefix = 'pg_dump';
|
||||
$ext = 'sql';
|
||||
}
|
||||
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
|
||||
$file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
|
||||
print '<input type="text" name="filename_template" style="width: 90%" id="filename_template" value="'.$file.'" />';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Define compressions array
|
||||
$compression=array();
|
||||
$compression = array();
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
$compression['gz'] = array(
|
||||
'function' => 'gzopen',
|
||||
|
|
@ -488,7 +488,7 @@ print '<input type="hidden" name="page_y" value="'.GETPOST('page_y', 'int').'">'
|
|||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
if (! empty($_SESSION["commandbackuplastdone"]))
|
||||
if (!empty($_SESSION["commandbackuplastdone"]))
|
||||
{
|
||||
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||
print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n";
|
||||
|
|
@ -500,11 +500,11 @@ if (! empty($_SESSION["commandbackuplastdone"]))
|
|||
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||
print $_SESSION["commandbackupresult"];
|
||||
|
||||
$_SESSION["commandbackuplastdone"]='';
|
||||
$_SESSION["commandbackuptorun"]='';
|
||||
$_SESSION["commandbackupresult"]='';
|
||||
$_SESSION["commandbackuplastdone"] = '';
|
||||
$_SESSION["commandbackuptorun"] = '';
|
||||
$_SESSION["commandbackupresult"] = '';
|
||||
}
|
||||
if (! empty($_SESSION["commandbackuptorun"]))
|
||||
if (!empty($_SESSION["commandbackuptorun"]))
|
||||
{
|
||||
print '<br><font class="warning">'.$langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser", $dolibarr_main_db_user, $dolibarr_main_db_user).':</font><br>'."\n";
|
||||
print '<textarea id="commandbackuptoruntext" rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuptorun"].'</textarea><br>'."\n";
|
||||
|
|
@ -513,9 +513,9 @@ if (! empty($_SESSION["commandbackuptorun"]))
|
|||
|
||||
//print $paramclear;
|
||||
|
||||
$_SESSION["commandbackuplastdone"]='';
|
||||
$_SESSION["commandbackuptorun"]='';
|
||||
$_SESSION["commandbackupresult"]='';
|
||||
$_SESSION["commandbackuplastdone"] = '';
|
||||
$_SESSION["commandbackuptorun"] = '';
|
||||
$_SESSION["commandbackupresult"] = '';
|
||||
}
|
||||
|
||||
print "</div> <!-- end div center button -->\n";
|
||||
|
|
@ -529,8 +529,8 @@ print "</div> <!-- end div fichehalfleft -->\n";
|
|||
print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
|
||||
print '<div class="ficheaddleft">';
|
||||
|
||||
$filearray=dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
|
||||
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||
$filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||
print '<br>';
|
||||
|
||||
print '</div>';
|
||||
|
|
|
|||
|
|
@ -217,12 +217,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||
$search_type = '';
|
||||
$search_country = '';
|
||||
$search_type_thirdparty = '';
|
||||
$search_date_start='';
|
||||
$search_date_end='';
|
||||
$search_dateend_start='';
|
||||
$search_dateend_end='';
|
||||
$search_datedelivery_start='';
|
||||
$search_datedelivery_end='';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_dateend_start = '';
|
||||
$search_dateend_end = '';
|
||||
$search_datedelivery_start = '';
|
||||
$search_datedelivery_end = '';
|
||||
$search_availability = '';
|
||||
$viewstatut = '';
|
||||
$object_statut = '';
|
||||
|
|
@ -338,13 +338,13 @@ if ($viewstatut != '' && $viewstatut != '-1')
|
|||
{
|
||||
$sql .= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')';
|
||||
}
|
||||
if ($search_date_start) $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'";
|
||||
if ($search_date_end) $sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'";
|
||||
if ($search_dateend_start) $sql .= " AND p.fin_validite >= '" . $db->idate($search_dateend_start) . "'";
|
||||
if ($search_dateend_end) $sql .= " AND p.fin_validite <= '" . $db->idate($search_dateend_end) . "'";
|
||||
if ($search_datedelivery_start) $sql .= " AND p.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'";
|
||||
if ($search_datedelivery_end) $sql .= " AND p.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'";
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale);
|
||||
if ($search_date_start) $sql .= " AND p.datep >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND p.datep <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_dateend_start) $sql .= " AND p.fin_validite >= '".$db->idate($search_dateend_start)."'";
|
||||
if ($search_dateend_end) $sql .= " AND p.fin_validite <= '".$db->idate($search_dateend_end)."'";
|
||||
if ($search_datedelivery_start) $sql .= " AND p.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
|
||||
if ($search_datedelivery_end) $sql .= " AND p.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$db->escape($search_user);
|
||||
|
|
@ -599,12 +599,12 @@ if ($resql)
|
|||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -613,12 +613,12 @@ if ($resql)
|
|||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_dateend_start?$search_dateend_start:-1, 'search_dateend_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_dateend_end?$search_dateend_end:-1, 'search_dateend_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -627,12 +627,12 @@ if ($resql)
|
|||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,10 +195,10 @@ if (empty($reshook))
|
|||
$search_total_ht = '';
|
||||
$search_total_vat = '';
|
||||
$search_total_ttc = '';
|
||||
$search_dateorder_start ='';
|
||||
$search_dateorder_end ='';
|
||||
$search_datedelivery_start ='';
|
||||
$search_datedelivery_end ='';
|
||||
$search_dateorder_start = '';
|
||||
$search_dateorder_end = '';
|
||||
$search_datedelivery_start = '';
|
||||
$search_datedelivery_end = '';
|
||||
$search_project_ref = '';
|
||||
$search_project = '';
|
||||
$viewstatut = '';
|
||||
|
|
@ -308,10 +308,10 @@ if ($viewstatut <> '')
|
|||
}
|
||||
}
|
||||
|
||||
if ($search_dateorder_start) $sql .= " AND c.date_commande >= '" . $db->idate($search_dateorder_start) . "'";
|
||||
if ($search_dateorder_end) $sql .= " AND c.date_commande <= '" . $db->idate($search_dateorder_end) . "'";
|
||||
if ($search_datedelivery_start) $sql .= " AND c.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'";
|
||||
if ($search_datedelivery_end) $sql .= " AND c.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'";
|
||||
if ($search_dateorder_start) $sql .= " AND c.date_commande >= '".$db->idate($search_dateorder_start)."'";
|
||||
if ($search_dateorder_end) $sql .= " AND c.date_commande <= '".$db->idate($search_dateorder_end)."'";
|
||||
if ($search_datedelivery_start) $sql .= " AND c.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
|
||||
if ($search_datedelivery_end) $sql .= " AND c.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||
|
|
@ -646,12 +646,12 @@ if ($resql)
|
|||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_dateorder_start?$search_dateorder_start:-1, 'search_dateorder_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1, 'search_dateorder_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_dateorder_end?$search_dateorder_end:-1, 'search_dateorder_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1, 'search_dateorder_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -659,12 +659,12 @@ if ($resql)
|
|||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -826,7 +826,7 @@ if ($resql)
|
|||
{
|
||||
print '<td class="nowrap">';
|
||||
|
||||
$generic_commande->getLinesArray(); // This set ->lines
|
||||
$generic_commande->getLinesArray(); // This set ->lines
|
||||
|
||||
print $generic_commande->getNomUrl(1, ($viewstatut != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,16 +31,16 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta","banks","bills","accountancy"));
|
||||
$langs->loadLangs(array("compta", "banks", "bills", "accountancy"));
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid", "int");
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'banque', '', '', '');
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$search_ref = GETPOST('search_ref', 'int');
|
||||
$search_user = GETPOST('search_user', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
|
|
@ -61,38 +61,38 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or
|
|||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield="v.datep,v.rowid";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (!$sortfield) $sortfield = "v.datep,v.rowid";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
|
||||
$filtre=GETPOST("filtre", 'alpha');
|
||||
$filtre = GETPOST("filtre", 'alpha');
|
||||
|
||||
if (! GETPOST('typeid'))
|
||||
if (!GETPOST('typeid'))
|
||||
{
|
||||
$newfiltre=str_replace('filtre=', '', $filtre);
|
||||
$filterarray=explode('-', $newfiltre);
|
||||
foreach($filterarray as $val)
|
||||
$newfiltre = str_replace('filtre=', '', $filtre);
|
||||
$filterarray = explode('-', $newfiltre);
|
||||
foreach ($filterarray as $val)
|
||||
{
|
||||
$part=explode(':', $val);
|
||||
if ($part[0] == 'v.fk_typepayment') $typeid=$part[1];
|
||||
$part = explode(':', $val);
|
||||
if ($part[0] == 'v.fk_typepayment') $typeid = $part[1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$typeid=GETPOST('typeid');
|
||||
$typeid = GETPOST('typeid');
|
||||
}
|
||||
|
||||
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_date_start='';
|
||||
$search_date_end='';
|
||||
$search_amount_deb="";
|
||||
$search_amount_cred="";
|
||||
$search_account='';
|
||||
$search_ref = "";
|
||||
$search_label = "";
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_amount_deb = "";
|
||||
$search_amount_cred = "";
|
||||
$search_account = '';
|
||||
$search_accountancy_account = '';
|
||||
$search_accountancy_subledger = '';
|
||||
$typeid="";
|
||||
$typeid = "";
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -107,62 +107,62 @@ $variousstatic = new PaymentVarious($db);
|
|||
$accountstatic = new Account($db);
|
||||
|
||||
$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account,";
|
||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||
$sql.= " pst.code as payment_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
|
||||
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||
$sql .= " pst.code as payment_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql .= " WHERE v.entity IN (".getEntity('payment_various').")";
|
||||
|
||||
// Search criteria
|
||||
if ($search_ref) $sql.= " AND v.rowid=".$db->escape($search_ref);
|
||||
if ($search_label) $sql.= natural_search(array('v.label'), $search_label);
|
||||
if ($search_date_start) $sql.= " AND v.datep >= '" . $db->idate($search_date_start) . "'";
|
||||
if ($search_date_end) $sql.= " AND v.datep <= '" . $db->idate($search_date_end) . "'";
|
||||
if ($search_amount_deb) $sql.= natural_search("v.amount", $search_amount_deb, 1);
|
||||
if ($search_amount_cred) $sql.= natural_search("v.amount", $search_amount_cred, 1);
|
||||
if ($search_account > 0) $sql.= " AND b.fk_account=".$db->escape($search_account);
|
||||
if ($search_accountancy_account > 0) $sql.= " AND v.accountancy_code=".$db->escape($search_accountancy_account);
|
||||
if ($search_accountancy_subledger > 0) $sql.= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
|
||||
if ($typeid > 0) $sql.= " AND v.fk_typepayment=".$typeid;
|
||||
if ($search_ref) $sql .= " AND v.rowid=".$db->escape($search_ref);
|
||||
if ($search_label) $sql .= natural_search(array('v.label'), $search_label);
|
||||
if ($search_date_start) $sql .= " AND v.datep >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND v.datep <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_amount_deb) $sql .= natural_search("v.amount", $search_amount_deb, 1);
|
||||
if ($search_amount_cred) $sql .= natural_search("v.amount", $search_amount_cred, 1);
|
||||
if ($search_account > 0) $sql .= " AND b.fk_account=".$db->escape($search_account);
|
||||
if ($search_accountancy_account > 0) $sql .= " AND v.accountancy_code=".$db->escape($search_accountancy_account);
|
||||
if ($search_accountancy_subledger > 0) $sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
|
||||
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
|
||||
if ($filtre) {
|
||||
$filtre=str_replace(":", "=", $filtre);
|
||||
$filtre = str_replace(":", "=", $filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
$totalnboflines = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$total = 0 ;
|
||||
$total = 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) $param.='&search_ref='.urlencode($search_ref);
|
||||
if ($search_label) $param.='&search_label='.urlencode($search_label);
|
||||
if ($search_date_start) $param.='&search_date_start='.urlencode($search_date_start);
|
||||
if ($search_date_end) $param.='&search_date_end='.urlencode($search_date_end);
|
||||
if ($typeid > 0) $param.='&typeid='.urlencode($typeid);
|
||||
if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb);
|
||||
if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred);
|
||||
if ($search_account > 0) $param.='&search_amount='.urlencode($search_account);
|
||||
if ($search_accountancy_account > 0) $param.='&search_accountancy_account='.urlencode($search_accountancy_account);
|
||||
if ($search_accountancy_subledger > 0) $param.='&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
|
||||
$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) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
||||
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
|
||||
if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb);
|
||||
if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
|
||||
if ($search_account > 0) $param .= '&search_amount='.urlencode($search_account);
|
||||
if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account);
|
||||
if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
|
||||
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->banque->modifier)
|
||||
|
|
@ -198,12 +198,12 @@ if ($result)
|
|||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
|
@ -227,14 +227,14 @@ if ($result)
|
|||
// Accounting account
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array (), 1, 1, 'maxwidth200');
|
||||
print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
|
||||
// Subledger account
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, array (), 1, 1, 'maxwidth200');
|
||||
print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, array(), 1, 1, 'maxwidth200');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -246,7 +246,7 @@ if ($result)
|
|||
print '<td class="liste_titre right"><input name="search_amount_cred" class="flat" type="text" size="8" value="'.$search_amount_cred.'"></td>';
|
||||
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
|
|
@ -258,9 +258,9 @@ if ($result)
|
|||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (! empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (!empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
|
|
@ -279,19 +279,19 @@ if ($result)
|
|||
|
||||
// Ref
|
||||
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Label payment
|
||||
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Date payment
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Type
|
||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Account
|
||||
if (!empty($conf->banque->enabled))
|
||||
|
|
@ -316,7 +316,7 @@ if ($result)
|
|||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Accounting account
|
||||
|
|
@ -325,14 +325,14 @@ if ($result)
|
|||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||
|
||||
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Accounting subledger account
|
||||
if (! empty($conf->accounting->enabled))
|
||||
if (!empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<td>' . length_accounta($obj->subledger_account) . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td>'.length_accounta($obj->subledger_account).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Debit
|
||||
|
|
@ -342,8 +342,8 @@ if ($result)
|
|||
print price($obj->amount);
|
||||
$totalarray['val']['total_deb'] += $obj->amount;
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_deb';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
|
||||
print '</td>';
|
||||
|
||||
// Credit
|
||||
|
|
@ -353,12 +353,12 @@ if ($result)
|
|||
print price($obj->amount);
|
||||
$totalarray['val']['total_cred'] += $obj->amount;
|
||||
}
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred';
|
||||
print '</td>' ;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_cred';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -480,10 +480,10 @@ if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape(
|
|||
if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms);
|
||||
if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source);
|
||||
if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source);
|
||||
if ($search_date_start) $sql .= " AND f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
if ($search_date_end) $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
if ($search_datelimit_start) $sql .= " AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) . "'";
|
||||
if ($search_datelimit_end) $sql .= " AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) . "'";
|
||||
if ($search_date_start) $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_datelimit_start) $sql .= " AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start)."'";
|
||||
if ($search_datelimit_end) $sql .= " AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end)."'";
|
||||
if ($option == 'late') $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".(int) $search_sale;
|
||||
if ($search_user > 0)
|
||||
|
|
@ -752,12 +752,12 @@ if ($resql)
|
|||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -766,12 +766,12 @@ if ($resql)
|
|||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_datelimit_start?$search_datelimit_start:-1, 'search_datelimit_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_datelimit_end?$search_datelimit_end:-1, 'search_datelimit_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1135,7 +1135,7 @@ class DolGraph
|
|||
public function total()
|
||||
{
|
||||
$value = 0;
|
||||
foreach($this->data as $valarray) // Loop on each x
|
||||
foreach ($this->data as $valarray) // Loop on each x
|
||||
{
|
||||
$value += $valarray[1];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5910,7 +5910,7 @@ class Form
|
|||
//var_dump($objecttmp->filter);
|
||||
$prefixforautocompletemode = $objecttmp->element;
|
||||
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode = 'company';
|
||||
if ($prefixforautocompletemode == 'product') $prefixforautocompletemode='produit';
|
||||
if ($prefixforautocompletemode == 'product') $prefixforautocompletemode = 'produit';
|
||||
$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
||||
|
||||
dol_syslog(get_class($this)."::selectForForms object->filter=".$objecttmp->filter, LOG_DEBUG);
|
||||
|
|
@ -7864,7 +7864,7 @@ class Form
|
|||
*/
|
||||
public function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
|
||||
{
|
||||
global $user,$conf,$langs;
|
||||
global $user, $conf, $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
|
|
@ -7873,16 +7873,16 @@ class Form
|
|||
$usertofilter = $user;
|
||||
}
|
||||
|
||||
$out='';
|
||||
$out = '';
|
||||
|
||||
$hideunselectables = false;
|
||||
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
if (!empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
|
||||
if (empty($projectsListId))
|
||||
{
|
||||
if (empty($usertofilter->rights->projet->all->lire))
|
||||
{
|
||||
$projectstatic=new Project($this->db);
|
||||
$projectstatic = new Project($this->db);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter, 0, 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -7890,37 +7890,37 @@ class Form
|
|||
// Search all projects
|
||||
$sql = 'SELECT f.rowid, f.ref as fref, "nolabel" as flabel, p.rowid as pid, f.ref,
|
||||
p.title, p.fk_soc, p.fk_statut, p.public,';
|
||||
$sql.= ' s.nom as name';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
|
||||
$sql.= ' '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql.= " WHERE p.entity IN (".getEntity('project').")";
|
||||
$sql.= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
|
||||
$sql .= ' s.nom as name';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
|
||||
$sql .= ' '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
|
||||
//if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||
//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||
//if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
||||
$sql.= " GROUP BY f.ref ORDER BY p.ref, f.ref ASC";
|
||||
$sql .= " GROUP BY f.ref ORDER BY p.ref, f.ref ASC";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Use select2 selector
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||
$out.=$comboenhancement;
|
||||
$morecss='minwidth200imp maxwidth500';
|
||||
$out .= $comboenhancement;
|
||||
$morecss = 'minwidth200imp maxwidth500';
|
||||
}
|
||||
|
||||
if (empty($option_only)) {
|
||||
$out.= '<select class="valignmiddle flat'.($morecss?' '.$morecss:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
}
|
||||
if (! empty($show_empty)) {
|
||||
$out.= '<option value="0" class="optiongrey">';
|
||||
if (! is_numeric($show_empty)) $out.=$show_empty;
|
||||
else $out.=' ';
|
||||
$out.= '</option>';
|
||||
if (!empty($show_empty)) {
|
||||
$out .= '<option value="0" class="optiongrey">';
|
||||
if (!is_numeric($show_empty)) $out .= $show_empty;
|
||||
else $out .= ' ';
|
||||
$out .= '</option>';
|
||||
}
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
|
@ -7946,57 +7946,57 @@ class Form
|
|||
|
||||
if ($showproject == 'all')
|
||||
{
|
||||
$labeltoshow.=dol_trunc($obj->ref, 18); // Invoice ref
|
||||
if ($obj->name) $labeltoshow.=' - '.$obj->name; // Soc name
|
||||
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
|
||||
if ($obj->name) $labeltoshow .= ' - '.$obj->name; // Soc name
|
||||
|
||||
$disabled=0;
|
||||
$disabled = 0;
|
||||
if ($obj->fk_statut == Project::STATUS_DRAFT)
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("Draft");
|
||||
$disabled = 1;
|
||||
$labeltoshow .= ' - '.$langs->trans("Draft");
|
||||
}
|
||||
elseif ($obj->fk_statut == Project::STATUS_CLOSED)
|
||||
{
|
||||
if ($discard_closed == 2) $disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("Closed");
|
||||
if ($discard_closed == 2) $disabled = 1;
|
||||
$labeltoshow .= ' - '.$langs->trans("Closed");
|
||||
}
|
||||
elseif ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
|
||||
$disabled = 1;
|
||||
$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($selected) && $selected == $obj->rowid)
|
||||
{
|
||||
$out.= '<option value="'.$obj->rowid.'" selected';
|
||||
$out .= '<option value="'.$obj->rowid.'" selected';
|
||||
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
|
||||
$out.= '>'.$labeltoshow.'</option>';
|
||||
$out .= '>'.$labeltoshow.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($hideunselectables && $disabled && ($selected != $obj->rowid))
|
||||
{
|
||||
$resultat='';
|
||||
$resultat = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultat='<option value="'.$obj->rowid.'"';
|
||||
if ($disabled) $resultat.=' disabled';
|
||||
$resultat = '<option value="'.$obj->rowid.'"';
|
||||
if ($disabled) $resultat .= ' disabled';
|
||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
|
||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||
$resultat.='>';
|
||||
$resultat.=$labeltoshow;
|
||||
$resultat.='</option>';
|
||||
$resultat .= '>';
|
||||
$resultat .= $labeltoshow;
|
||||
$resultat .= '</option>';
|
||||
}
|
||||
$out.= $resultat;
|
||||
$out .= $resultat;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
if (empty($option_only)) {
|
||||
$out.= '</select>';
|
||||
$out .= '</select>';
|
||||
}
|
||||
|
||||
print $out;
|
||||
|
|
|
|||
|
|
@ -493,7 +493,7 @@ class Utils
|
|||
}
|
||||
|
||||
// Clean old files
|
||||
if (! $errormsg && $keeplastnfiles > 0)
|
||||
if (!$errormsg && $keeplastnfiles > 0)
|
||||
{
|
||||
$tmpfiles = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '(\.err|\.old|\.sav)$', 'date', SORT_DESC);
|
||||
$i = 0;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -219,7 +219,7 @@ class modAgenda extends DolibarrModules
|
|||
);
|
||||
$r++;
|
||||
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=0',
|
||||
'type'=>'left',
|
||||
'titre'=>'Actions',
|
||||
|
|
@ -233,7 +233,7 @@ class modAgenda extends DolibarrModules
|
|||
'user'=>2,
|
||||
);
|
||||
$r++;
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=1',
|
||||
'type'=>'left',
|
||||
'titre'=>'NewAction',
|
||||
|
|
@ -248,7 +248,7 @@ class modAgenda extends DolibarrModules
|
|||
);
|
||||
$r++;
|
||||
// Calendar
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=1',
|
||||
'type'=>'left',
|
||||
'titre'=>'Calendar',
|
||||
|
|
@ -262,7 +262,7 @@ class modAgenda extends DolibarrModules
|
|||
'user'=>2
|
||||
);
|
||||
$r++;
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=3',
|
||||
'type'=>'left',
|
||||
'titre'=>'MenuToDoMyActions',
|
||||
|
|
@ -276,7 +276,7 @@ class modAgenda extends DolibarrModules
|
|||
'user'=>2
|
||||
);
|
||||
$r++;
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=3',
|
||||
'type'=>'left',
|
||||
'titre'=>'MenuDoneMyActions',
|
||||
|
|
@ -290,7 +290,7 @@ class modAgenda extends DolibarrModules
|
|||
'user'=>2
|
||||
);
|
||||
$r++;
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=3',
|
||||
'type'=>'left',
|
||||
'titre'=>'MenuToDoActions',
|
||||
|
|
@ -304,7 +304,7 @@ class modAgenda extends DolibarrModules
|
|||
'user'=>2
|
||||
);
|
||||
$r++;
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=3',
|
||||
'type'=>'left',
|
||||
'titre'=>'MenuDoneActions',
|
||||
|
|
@ -320,7 +320,7 @@ class modAgenda extends DolibarrModules
|
|||
|
||||
// List
|
||||
$r++;
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=1',
|
||||
'type'=>'left',
|
||||
'titre'=>'List',
|
||||
|
|
@ -334,7 +334,7 @@ class modAgenda extends DolibarrModules
|
|||
'user'=>2
|
||||
);
|
||||
$r++;
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=8',
|
||||
'type'=>'left',
|
||||
'titre'=>'MenuToDoMyActions',
|
||||
|
|
@ -348,7 +348,7 @@ class modAgenda extends DolibarrModules
|
|||
'user'=>2
|
||||
);
|
||||
$r++;
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=8',
|
||||
'type'=>'left',
|
||||
'titre'=>'MenuDoneMyActions',
|
||||
|
|
@ -362,7 +362,7 @@ class modAgenda extends DolibarrModules
|
|||
'user'=>2
|
||||
);
|
||||
$r++;
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=8',
|
||||
'type'=>'left',
|
||||
'titre'=>'MenuToDoActions',
|
||||
|
|
@ -376,7 +376,7 @@ class modAgenda extends DolibarrModules
|
|||
'user'=>2
|
||||
);
|
||||
$r++;
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=8',
|
||||
'type'=>'left',
|
||||
'titre'=>'MenuDoneActions',
|
||||
|
|
@ -391,7 +391,7 @@ class modAgenda extends DolibarrModules
|
|||
);
|
||||
$r++;
|
||||
// Reports
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu'=>'r=1',
|
||||
'type'=>'left',
|
||||
'titre'=>'Reportings',
|
||||
|
|
@ -406,7 +406,7 @@ class modAgenda extends DolibarrModules
|
|||
);
|
||||
$r++;
|
||||
// Categories
|
||||
$this->menu[$r]=array(
|
||||
$this->menu[$r] = array(
|
||||
'fk_menu' => 'r=1',
|
||||
'type' => 'left',
|
||||
'titre' => 'Categories',
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
* \brief Fichier de description et activation du module Utilisateur
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
/**
|
||||
* Class to describe and enable module User
|
||||
|
|
@ -45,7 +45,7 @@ class modUser extends DolibarrModules
|
|||
$this->db = $db;
|
||||
$this->numero = 0;
|
||||
|
||||
$this->family = "hr"; // Family for module (or "base" if core module)
|
||||
$this->family = "hr"; // Family for module (or "base" if core module)
|
||||
$this->module_position = '05';
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||
|
|
@ -55,7 +55,7 @@ class modUser extends DolibarrModules
|
|||
$this->version = 'dolibarr';
|
||||
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
$this->picto='group';
|
||||
$this->picto = 'group';
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array("/users/temp");
|
||||
|
|
@ -64,28 +64,28 @@ class modUser extends DolibarrModules
|
|||
$this->config_page_url = array("user.php");
|
||||
|
||||
// Dependencies
|
||||
$this->hidden = false; // A condition to hide module
|
||||
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||
$this->phpmin = array(5,4); // Minimum version of PHP required by module
|
||||
$this->langfiles = array("main","users","companies","members","salaries","hrm");
|
||||
$this->always_enabled = true; // Can't be disabled
|
||||
$this->hidden = false; // A condition to hide module
|
||||
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||
$this->phpmin = array(5, 4); // Minimum version of PHP required by module
|
||||
$this->langfiles = array("main", "users", "companies", "members", "salaries", "hrm");
|
||||
$this->always_enabled = true; // Can't be disabled
|
||||
|
||||
// Constants
|
||||
$this->const = array();
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array(
|
||||
0=>array('file'=>'box_lastlogin.php','enabledbydefaulton'=>'Home'),
|
||||
1=>array('file'=>'box_birthdays.php','enabledbydefaulton'=>'Home')
|
||||
0=>array('file'=>'box_lastlogin.php', 'enabledbydefaulton'=>'Home'),
|
||||
1=>array('file'=>'box_birthdays.php', 'enabledbydefaulton'=>'Home')
|
||||
);
|
||||
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'user';
|
||||
$this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled)
|
||||
$r=0;
|
||||
$this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled)
|
||||
$r = 0;
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 251;
|
||||
|
|
@ -140,7 +140,7 @@ class modUser extends DolibarrModules
|
|||
$this->rights[$r][1] = 'Consulter ses propres permissions';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][5] = 'readperms';
|
||||
|
||||
$r++;
|
||||
|
|
@ -164,7 +164,7 @@ class modUser extends DolibarrModules
|
|||
$this->rights[$r][1] = 'Modifier ses propres permissions';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][5] = 'writeperms';
|
||||
|
||||
$r++;
|
||||
|
|
@ -172,7 +172,7 @@ class modUser extends DolibarrModules
|
|||
$this->rights[$r][1] = 'Consulter les groupes';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][5] = 'read';
|
||||
|
||||
$r++;
|
||||
|
|
@ -180,7 +180,7 @@ class modUser extends DolibarrModules
|
|||
$this->rights[$r][1] = 'Consulter les permissions des groupes';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][5] = 'readperms';
|
||||
|
||||
$r++;
|
||||
|
|
@ -188,7 +188,7 @@ class modUser extends DolibarrModules
|
|||
$this->rights[$r][1] = 'Creer/modifier les groupes et leurs permissions';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][5] = 'write';
|
||||
|
||||
$r++;
|
||||
|
|
@ -196,7 +196,7 @@ class modUser extends DolibarrModules
|
|||
$this->rights[$r][1] = 'Supprimer ou desactiver les groupes';
|
||||
$this->rights[$r][2] = 'd';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][4] = 'group_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
|
||||
$this->rights[$r][5] = 'delete';
|
||||
|
||||
$r++;
|
||||
|
|
@ -209,118 +209,118 @@ class modUser extends DolibarrModules
|
|||
|
||||
|
||||
// Menus
|
||||
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
||||
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
||||
|
||||
|
||||
// Exports
|
||||
$r=0;
|
||||
$r = 0;
|
||||
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='List of users and attributes';
|
||||
$this->export_permission[$r]=array(array("user","user","export"));
|
||||
$this->export_fields_array[$r]=array(
|
||||
'u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.employee'=>"Employee",'u.job'=>"PostOrFunction",'u.gender'=>"Gender",
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = 'List of users and attributes';
|
||||
$this->export_permission[$r] = array(array("user", "user", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'u.rowid'=>"Id", 'u.login'=>"Login", 'u.lastname'=>"Lastname", 'u.firstname'=>"Firstname", 'u.employee'=>"Employee", 'u.job'=>"PostOrFunction", 'u.gender'=>"Gender",
|
||||
'u.accountancy_code'=>"UserAccountancyCode",
|
||||
'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
|
||||
'u.office_phone'=>'Phone','u.user_mobile'=>"Mobile",'u.office_fax'=>'Fax',
|
||||
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature',
|
||||
'u.fk_user'=>'HierarchicalResponsible','u.thm'=>'THM','u.tjm'=>'TJM','u.weeklyhours'=>'WeeklyHours',
|
||||
'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey',
|
||||
'u.address'=>"Address", 'u.zip'=>"Zip", 'u.town'=>"Town",
|
||||
'u.office_phone'=>'Phone', 'u.user_mobile'=>"Mobile", 'u.office_fax'=>'Fax',
|
||||
'u.email'=>"Email", 'u.note'=>"Note", 'u.signature'=>'Signature',
|
||||
'u.fk_user'=>'HierarchicalResponsible', 'u.thm'=>'THM', 'u.tjm'=>'TJM', 'u.weeklyhours'=>'WeeklyHours',
|
||||
'u.dateemployment'=>'DateEmployment', 'u.salary'=>'Salary', 'u.color'=>'Color', 'u.api_key'=>'ApiKey',
|
||||
'u.birth'=>'BirthdayDate',
|
||||
'u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",
|
||||
'u.admin'=>"Administrator",'u.statut'=>'Status','u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion',
|
||||
'u.fk_socpeople'=>"IdContact",'u.fk_soc'=>"IdCompany",'u.fk_member'=>"MemberId"
|
||||
'u.datec'=>"DateCreation", 'u.tms'=>"DateLastModification",
|
||||
'u.admin'=>"Administrator", 'u.statut'=>'Status', 'u.datelastlogin'=>'LastConnexion', 'u.datepreviouslogin'=>'PreviousConnexion',
|
||||
'u.fk_socpeople'=>"IdContact", 'u.fk_soc'=>"IdCompany", 'u.fk_member'=>"MemberId"
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'u.rowid'=>'Numeric', 'u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.employee'=>'Boolean','u.job'=>'Text',
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'u.rowid'=>'Numeric', 'u.login'=>"Text", 'u.lastname'=>"Text", 'u.firstname'=>"Text", 'u.employee'=>'Boolean', 'u.job'=>'Text',
|
||||
'u.accountancy_code'=>'Text',
|
||||
'u.address'=>"Text",'u.zip'=>"Text",'u.town'=>"Text",
|
||||
'u.office_phone'=>'Text','u.user_mobile'=>'Text','u.office_fax'=>'Text',
|
||||
'u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date',
|
||||
'u.address'=>"Text", 'u.zip'=>"Text", 'u.town'=>"Text",
|
||||
'u.office_phone'=>'Text', 'u.user_mobile'=>'Text', 'u.office_fax'=>'Text',
|
||||
'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.datelastlogin'=>'Date',
|
||||
'u.fk_user'=>"List:user:login",
|
||||
'u.birth'=>'Date',
|
||||
'u.datepreviouslogin'=>'Date','u.fk_soc'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:firstname"
|
||||
'u.datepreviouslogin'=>'Date', 'u.fk_soc'=>"List:societe:nom:rowid", 'u.fk_member'=>"List:adherent:firstname"
|
||||
);
|
||||
$this->export_entities_array[$r]=array(
|
||||
'u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.employee'=>'user','u.job'=>'user','u.gender'=>'user',
|
||||
$this->export_entities_array[$r] = array(
|
||||
'u.rowid'=>"user", 'u.login'=>"user", 'u.lastname'=>"user", 'u.firstname'=>"user", 'u.employee'=>'user', 'u.job'=>'user', 'u.gender'=>'user',
|
||||
'u.accountancy_code'=>'user',
|
||||
'u.address'=>"user",'u.zip'=>"user",'u.town'=>"user",
|
||||
'u.office_phone'=>'user','u.user_mobile'=>'user','u.office_fax'=>'user',
|
||||
'u.email'=>'user','u.note'=>"user",'u.signature'=>'user',
|
||||
'u.fk_user'=>'user','u.thm'=>'user','u.tjm'=>'user','u.weeklyhours'=>'user',
|
||||
'u.dateemployment'=>'user','u.salary'=>'user','u.color'=>'user','u.api_key'=>'user',
|
||||
'u.address'=>"user", 'u.zip'=>"user", 'u.town'=>"user",
|
||||
'u.office_phone'=>'user', 'u.user_mobile'=>'user', 'u.office_fax'=>'user',
|
||||
'u.email'=>'user', 'u.note'=>"user", 'u.signature'=>'user',
|
||||
'u.fk_user'=>'user', 'u.thm'=>'user', 'u.tjm'=>'user', 'u.weeklyhours'=>'user',
|
||||
'u.dateemployment'=>'user', 'u.salary'=>'user', 'u.color'=>'user', 'u.api_key'=>'user',
|
||||
'u.birth'=>'user',
|
||||
'u.datec'=>"user",'u.tms'=>"user",
|
||||
'u.admin'=>"user",'u.statut'=>'user','u.datelastlogin'=>'user','u.datepreviouslogin'=>'user',
|
||||
'u.fk_socpeople'=>"contact",'u.fk_soc'=>"company",'u.fk_member'=>"member"
|
||||
'u.datec'=>"user", 'u.tms'=>"user",
|
||||
'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user',
|
||||
'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member"
|
||||
);
|
||||
if (empty($conf->adherent->enabled))
|
||||
{
|
||||
unset($this->export_fields_array[$r]['u.fk_member']);
|
||||
unset($this->export_entities_array[$r]['u.fk_member']);
|
||||
}
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
|
||||
$this->export_sql_end[$r] .=' WHERE u.entity IN ('.getEntity('user').')';
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u';
|
||||
$this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')';
|
||||
|
||||
// Imports
|
||||
$r=0;
|
||||
$r = 0;
|
||||
|
||||
// Import list of users attributes
|
||||
$r++;
|
||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->import_label[$r]='ImportDataset_user_1';
|
||||
$this->import_icon[$r]='user';
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('u'=>MAIN_DB_PREFIX.'user','extra'=>MAIN_DB_PREFIX.'user_extrafields'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r]=array(
|
||||
'u.login'=>"Login*",'u.lastname'=>"Name*",'u.firstname'=>"Firstname",'u.employee'=>"Employee*",'u.job'=>"PostOrFunction",'u.gender'=>"Gender",
|
||||
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->import_label[$r] = 'ImportDataset_user_1';
|
||||
$this->import_icon[$r] = 'user';
|
||||
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r] = array('u'=>MAIN_DB_PREFIX.'user', 'extra'=>MAIN_DB_PREFIX.'user_extrafields'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r] = array(
|
||||
'u.login'=>"Login*", 'u.lastname'=>"Name*", 'u.firstname'=>"Firstname", 'u.employee'=>"Employee*", 'u.job'=>"PostOrFunction", 'u.gender'=>"Gender",
|
||||
'u.accountancy_code'=>"UserAccountancyCode",
|
||||
'u.pass_crypted'=>"Password",'u.admin'=>"Administrator",'u.fk_soc'=>"Company*",'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
|
||||
'u.fk_state'=>"StateId",'u.fk_country'=>"CountryCode",
|
||||
'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",
|
||||
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature',
|
||||
'u.fk_user'=>'HierarchicalResponsible','u.thm'=>'THM','u.tjm'=>'TJM','u.weeklyhours'=>'WeeklyHours',
|
||||
'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey',
|
||||
'u.pass_crypted'=>"Password", 'u.admin'=>"Administrator", 'u.fk_soc'=>"Company*", 'u.address'=>"Address", 'u.zip'=>"Zip", 'u.town'=>"Town",
|
||||
'u.fk_state'=>"StateId", 'u.fk_country'=>"CountryCode",
|
||||
'u.office_phone'=>"Phone", 'u.user_mobile'=>"Mobile", 'u.office_fax'=>"Fax",
|
||||
'u.email'=>"Email", 'u.note'=>"Note", 'u.signature'=>'Signature',
|
||||
'u.fk_user'=>'HierarchicalResponsible', 'u.thm'=>'THM', 'u.tjm'=>'TJM', 'u.weeklyhours'=>'WeeklyHours',
|
||||
'u.dateemployment'=>'DateEmployment', 'u.salary'=>'Salary', 'u.color'=>'Color', 'u.api_key'=>'ApiKey',
|
||||
'u.birth'=>'BirthdayDate',
|
||||
'u.datec'=>"DateCreation",
|
||||
'u.statut'=>'Status'
|
||||
);
|
||||
// Add extra fields
|
||||
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
|
||||
$resql=$this->db->query($sql);
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$fieldname='extra.'.$obj->name;
|
||||
$fieldlabel=ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
|
||||
$fieldname = 'extra.'.$obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r]=array('u.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'user'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
'u.fk_state'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/cstate.class.php','class'=>'Cstate','method'=>'fetch','dict'=>'DictionaryState'),
|
||||
'u.fk_country'=>array('rule'=>'fetchidfromcodeid','classfile'=>'/core/class/ccountry.class.php','class'=>'Ccountry','method'=>'fetch','dict'=>'DictionaryCountry'),
|
||||
$this->import_fieldshidden_array[$r] = array('u.fk_user_creat'=>'user->id', 'extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'user'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'u.fk_state'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/cstate.class.php', 'class'=>'Cstate', 'method'=>'fetch', 'dict'=>'DictionaryState'),
|
||||
'u.fk_country'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/ccountry.class.php', 'class'=>'Ccountry', 'method'=>'fetch', 'dict'=>'DictionaryCountry'),
|
||||
'u.salary'=>array('rule'=>'numeric')
|
||||
);
|
||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||
$this->import_regex_array[$r]=array(
|
||||
$this->import_regex_array[$r] = array(
|
||||
'u.employee'=>'^[0|1]',
|
||||
'u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$',
|
||||
'u.dateemployment'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
|
||||
'u.birth'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array(
|
||||
$this->import_examplevalues_array[$r] = array(
|
||||
'u.lastname'=>"Doe", 'u.firstname'=>'John', 'u.login'=>'jdoe', 'u.employee'=>'0 or 1',
|
||||
'u.fk_soc'=>'0 (internal user) or company name (external user)', 'u.datec'=>dol_print_date(dol_now(), '%Y-%m-%d'), 'u.address'=>"61 jump street",
|
||||
'u.zip'=>"123456",'u.town'=>"Big town",'u.fk_country'=>'US, FR, DE...','u.office_phone'=>"0101010101",'u.office_fax'=>"0101010102",
|
||||
'u.email'=>"test@mycompany.com",'u.salary'=>"10000",'u.note'=>"This is an example of note for record",'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00",
|
||||
'u.zip'=>"123456", 'u.town'=>"Big town", 'u.fk_country'=>'US, FR, DE...', 'u.office_phone'=>"0101010101", 'u.office_fax'=>"0101010102",
|
||||
'u.email'=>"test@mycompany.com", 'u.salary'=>"10000", 'u.note'=>"This is an example of note for record", 'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00",
|
||||
'u.statut'=>"0 (closed) or 1 (active)",
|
||||
);
|
||||
$this->import_updatekeys_array[$r]=array('u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>'Login');
|
||||
$this->import_updatekeys_array[$r] = array('u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>'Login');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -242,10 +242,10 @@ if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdp
|
|||
if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp);
|
||||
if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv);
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_datedelivery_start) $sql .= " AND e.date_delivery >= '" . $db->idate($search_datedelivery_start) . "'";
|
||||
if ($search_datedelivery_end) $sql .= " AND e.date_delivery <= '" . $db->idate($search_datedelivery_end) . "'";
|
||||
if ($search_datereceipt_start) $sql .= " AND l.date_delivery >= '" . $db->idate($search_datereceipt_start) . "'";
|
||||
if ($search_datereceipt_end) $sql .= " AND l.date_delivery <= '" . $db->idate($search_datereceipt_end) . "'";
|
||||
if ($search_datedelivery_start) $sql .= " AND e.date_delivery >= '".$db->idate($search_datedelivery_start)."'";
|
||||
if ($search_datedelivery_end) $sql .= " AND e.date_delivery <= '".$db->idate($search_datedelivery_end)."'";
|
||||
if ($search_datereceipt_start) $sql .= " AND l.date_delivery >= '".$db->idate($search_datereceipt_start)."'";
|
||||
if ($search_datereceipt_end) $sql .= " AND l.date_delivery <= '".$db->idate($search_datereceipt_end)."'";
|
||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
|
||||
// Add where from extra fields
|
||||
|
|
@ -409,12 +409,12 @@ if ($resql)
|
|||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_delivery_start?$search_delivery_start:-1, 'search_delivery_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_delivery_start ? $search_delivery_start : -1, 'search_delivery_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_delivery_end?$search_delivery_end:-1, 'search_delivery_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_delivery_end ? $search_delivery_end : -1, 'search_delivery_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -430,12 +430,12 @@ if ($resql)
|
|||
// Date received
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_receipt_start?$search_receipt_start:-1, 'search_receipt_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_receipt_start ? $search_receipt_start : -1, 'search_receipt_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_receipt_end?$search_receipt_end:-1, 'search_receipt_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_receipt_end ? $search_receipt_end : -1, 'search_receipt_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,27 +35,27 @@ class Export
|
|||
*/
|
||||
public $db;
|
||||
|
||||
public $array_export_code=array(); // Tableau de "idmodule_numlot"
|
||||
public $array_export_module=array(); // Tableau de "nom de modules"
|
||||
public $array_export_label=array(); // Tableau de "libelle de lots"
|
||||
public $array_export_sql_start=array(); // Tableau des "requetes sql"
|
||||
public $array_export_sql_end=array(); // Tableau des "requetes sql"
|
||||
public $array_export_sql_order=array(); // Tableau des "requetes sql"
|
||||
public $array_export_code = array(); // Tableau de "idmodule_numlot"
|
||||
public $array_export_module = array(); // Tableau de "nom de modules"
|
||||
public $array_export_label = array(); // Tableau de "libelle de lots"
|
||||
public $array_export_sql_start = array(); // Tableau des "requetes sql"
|
||||
public $array_export_sql_end = array(); // Tableau des "requetes sql"
|
||||
public $array_export_sql_order = array(); // Tableau des "requetes sql"
|
||||
|
||||
public $array_export_fields=array(); // Tableau des listes de champ+libelle a exporter
|
||||
public $array_export_TypeFields=array(); // Tableau des listes de champ+Type de filtre
|
||||
public $array_export_FilterValue=array(); // Tableau des listes de champ+Valeur a filtrer
|
||||
public $array_export_entities=array(); // Tableau des listes de champ+alias a exporter
|
||||
public $array_export_dependencies=array(); // array of list of entities that must take care of the DISTINCT if a field is added into export
|
||||
public $array_export_special=array(); // array of special operations to do on field
|
||||
public $array_export_examplevalues=array(); // array with examples for fields
|
||||
public $array_export_help=array(); // array with tooltip help for fields
|
||||
public $array_export_fields = array(); // Tableau des listes de champ+libelle a exporter
|
||||
public $array_export_TypeFields = array(); // Tableau des listes de champ+Type de filtre
|
||||
public $array_export_FilterValue = array(); // Tableau des listes de champ+Valeur a filtrer
|
||||
public $array_export_entities = array(); // Tableau des listes de champ+alias a exporter
|
||||
public $array_export_dependencies = array(); // array of list of entities that must take care of the DISTINCT if a field is added into export
|
||||
public $array_export_special = array(); // array of special operations to do on field
|
||||
public $array_export_examplevalues = array(); // array with examples for fields
|
||||
public $array_export_help = array(); // array with tooltip help for fields
|
||||
|
||||
// To store export modules
|
||||
public $hexa; // List of fields in the export profile
|
||||
public $hexafiltervalue; // List of search criteria in the export profile
|
||||
public $hexa; // List of fields in the export profile
|
||||
public $hexafiltervalue; // List of search criteria in the export profile
|
||||
public $datatoexport;
|
||||
public $model_name; // Name of export profile
|
||||
public $model_name; // Name of export profile
|
||||
|
||||
public $sqlusedforexport;
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ class Export
|
|||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db=$db;
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -82,35 +82,35 @@ class Export
|
|||
public function load_arrays($user, $filter = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs,$conf,$mysoc;
|
||||
global $langs, $conf, $mysoc;
|
||||
|
||||
dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter);
|
||||
|
||||
$i=0;
|
||||
$i = 0;
|
||||
|
||||
// Define list of modules directories into modulesdir
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
|
||||
foreach($modulesdir as $dir)
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
// Search available exports
|
||||
$handle=@opendir(dol_osencode($dir));
|
||||
$handle = @opendir(dol_osencode($dir));
|
||||
if (is_resource($handle))
|
||||
{
|
||||
// Search module files
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i", $file, $reg))
|
||||
{
|
||||
$modulename=$reg[1];
|
||||
$modulename = $reg[1];
|
||||
|
||||
// Defined if module is enabled
|
||||
$enabled=true;
|
||||
$part=strtolower(preg_replace('/^mod/i', '', $modulename));
|
||||
if ($part == 'propale') $part='propal';
|
||||
if (empty($conf->$part->enabled)) $enabled=false;
|
||||
$enabled = true;
|
||||
$part = strtolower(preg_replace('/^mod/i', '', $modulename));
|
||||
if ($part == 'propale') $part = 'propal';
|
||||
if (empty($conf->$part->enabled)) $enabled = false;
|
||||
|
||||
if ($enabled)
|
||||
{
|
||||
|
|
@ -122,32 +122,32 @@ class Export
|
|||
|
||||
if (isset($module->export_code) && is_array($module->export_code))
|
||||
{
|
||||
foreach($module->export_code as $r => $value)
|
||||
foreach ($module->export_code as $r => $value)
|
||||
{
|
||||
//print $i.'-'.$filter.'-'.$modulename.'-'.join(',',$module->export_code).'<br>';
|
||||
if ($filter && ($filter != $module->export_code[$r])) continue;
|
||||
|
||||
// Test if condition to show are ok
|
||||
if (! empty($module->export_enabled[$r]) && ! verifCond($module->export_enabled[$r])) continue;
|
||||
if (!empty($module->export_enabled[$r]) && !verifCond($module->export_enabled[$r])) continue;
|
||||
|
||||
// Test if permissions are ok
|
||||
$bool=true;
|
||||
$bool = true;
|
||||
if (isset($module->export_permission))
|
||||
{
|
||||
foreach($module->export_permission[$r] as $val)
|
||||
foreach ($module->export_permission[$r] as $val)
|
||||
{
|
||||
$perm=$val;
|
||||
$perm = $val;
|
||||
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
||||
if (! empty($perm[2]))
|
||||
if (!empty($perm[2]))
|
||||
{
|
||||
$bool=$user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
|
||||
$bool = $user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
|
||||
}
|
||||
else
|
||||
{
|
||||
$bool=$user->rights->{$perm[0]}->{$perm[1]};
|
||||
$bool = $user->rights->{$perm[0]}->{$perm[1]};
|
||||
}
|
||||
if ($perm[0]=='user' && $user->admin) $bool=true;
|
||||
if (! $bool) break;
|
||||
if ($perm[0] == 'user' && $user->admin) $bool = true;
|
||||
if (!$bool) break;
|
||||
}
|
||||
}
|
||||
//print $bool." $perm[0]"."<br>";
|
||||
|
|
@ -156,47 +156,47 @@ class Export
|
|||
// if ($bool)
|
||||
// {
|
||||
// Charge fichier lang en rapport
|
||||
$langtoload=$module->getLangFilesArray();
|
||||
$langtoload = $module->getLangFilesArray();
|
||||
if (is_array($langtoload))
|
||||
{
|
||||
foreach($langtoload as $key)
|
||||
foreach ($langtoload as $key)
|
||||
{
|
||||
$langs->load($key);
|
||||
}
|
||||
}
|
||||
|
||||
// Module
|
||||
$this->array_export_module[$i]=$module;
|
||||
$this->array_export_module[$i] = $module;
|
||||
// Permission
|
||||
$this->array_export_perms[$i]=$bool;
|
||||
$this->array_export_perms[$i] = $bool;
|
||||
// Icon
|
||||
$this->array_export_icon[$i]=(isset($module->export_icon[$r])?$module->export_icon[$r]:$module->picto);
|
||||
$this->array_export_icon[$i] = (isset($module->export_icon[$r]) ? $module->export_icon[$r] : $module->picto);
|
||||
// Code du dataset export
|
||||
$this->array_export_code[$i]=$module->export_code[$r];
|
||||
$this->array_export_code[$i] = $module->export_code[$r];
|
||||
// Libelle du dataset export
|
||||
$this->array_export_label[$i]=$module->getExportDatasetLabel($r);
|
||||
$this->array_export_label[$i] = $module->getExportDatasetLabel($r);
|
||||
// Tableau des champ a exporter (cle=champ, valeur=libelle)
|
||||
$this->array_export_fields[$i]=$module->export_fields_array[$r];
|
||||
$this->array_export_fields[$i] = $module->export_fields_array[$r];
|
||||
// Tableau des champs a filtrer (cle=champ, valeur1=type de donnees) on verifie que le module a des filtres
|
||||
$this->array_export_TypeFields[$i]=(isset($module->export_TypeFields_array[$r])?$module->export_TypeFields_array[$r]:'');
|
||||
$this->array_export_TypeFields[$i] = (isset($module->export_TypeFields_array[$r]) ? $module->export_TypeFields_array[$r] : '');
|
||||
// Tableau des entites a exporter (cle=champ, valeur=entite)
|
||||
$this->array_export_entities[$i]=$module->export_entities_array[$r];
|
||||
$this->array_export_entities[$i] = $module->export_entities_array[$r];
|
||||
// Tableau des entites qui requiert abandon du DISTINCT (cle=entite, valeur=champ id child records)
|
||||
$this->array_export_dependencies[$i]=(! empty($module->export_dependencies_array[$r])?$module->export_dependencies_array[$r]:'');
|
||||
$this->array_export_dependencies[$i] = (!empty($module->export_dependencies_array[$r]) ? $module->export_dependencies_array[$r] : '');
|
||||
// Tableau des operations speciales sur champ
|
||||
$this->array_export_special[$i]=(! empty($module->export_special_array[$r])?$module->export_special_array[$r]:'');
|
||||
$this->array_export_special[$i] = (!empty($module->export_special_array[$r]) ? $module->export_special_array[$r] : '');
|
||||
// Array of examples
|
||||
$this->array_export_examplevalues[$i]=$module->export_examplevalues_array[$r];
|
||||
$this->array_export_examplevalues[$i] = $module->export_examplevalues_array[$r];
|
||||
// Array of help tooltips
|
||||
$this->array_export_help[$i]=(! empty($module->export_help_array[$r])?$module->export_help_array[$r]:'');
|
||||
$this->array_export_help[$i] = (!empty($module->export_help_array[$r]) ? $module->export_help_array[$r] : '');
|
||||
|
||||
// Requete sql du dataset
|
||||
$this->array_export_sql_start[$i]=$module->export_sql_start[$r];
|
||||
$this->array_export_sql_end[$i]=$module->export_sql_end[$r];
|
||||
$this->array_export_sql_order[$i]=$module->export_sql_order[$r];
|
||||
$this->array_export_sql_start[$i] = $module->export_sql_start[$r];
|
||||
$this->array_export_sql_end[$i] = $module->export_sql_end[$r];
|
||||
$this->array_export_sql_order[$i] = $module->export_sql_order[$r];
|
||||
//$this->array_export_sql[$i]=$module->export_sql[$r];
|
||||
|
||||
dol_syslog(get_class($this)."::load_arrays loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".(! empty($module->export_fields_code[$r])?count($module->export_fields_code[$r]):''));
|
||||
dol_syslog(get_class($this)."::load_arrays loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".(!empty($module->export_fields_code[$r]) ?count($module->export_fields_code[$r]) : ''));
|
||||
$i++;
|
||||
// }
|
||||
}
|
||||
|
|
@ -226,42 +226,42 @@ class Export
|
|||
{
|
||||
// phpcs:enable
|
||||
// Build the sql request
|
||||
$sql=$this->array_export_sql_start[$indice];
|
||||
$i=0;
|
||||
$sql = $this->array_export_sql_start[$indice];
|
||||
$i = 0;
|
||||
|
||||
//print_r($array_selected);
|
||||
foreach ($this->array_export_fields[$indice] as $key => $value)
|
||||
{
|
||||
if (! array_key_exists($key, $array_selected)) continue; // Field not selected
|
||||
if (preg_match('/^none\./', $key)) continue; // A field that must not appears into SQL
|
||||
if ($i > 0) $sql.=', ';
|
||||
if (!array_key_exists($key, $array_selected)) continue; // Field not selected
|
||||
if (preg_match('/^none\./', $key)) continue; // A field that must not appears into SQL
|
||||
if ($i > 0) $sql .= ', ';
|
||||
else $i++;
|
||||
|
||||
if (strpos($key, ' as ')===false) {
|
||||
$newfield=$key.' as '.str_replace(array('.', '-','(',')'), '_', $key);
|
||||
if (strpos($key, ' as ') === false) {
|
||||
$newfield = $key.' as '.str_replace(array('.', '-', '(', ')'), '_', $key);
|
||||
} else {
|
||||
$newfield=$key;
|
||||
$newfield = $key;
|
||||
}
|
||||
|
||||
$sql.=$newfield;
|
||||
$sql .= $newfield;
|
||||
}
|
||||
$sql.=$this->array_export_sql_end[$indice];
|
||||
$sql .= $this->array_export_sql_end[$indice];
|
||||
|
||||
// Add the WHERE part. Filtering into sql if a filtering array is provided
|
||||
if (is_array($array_filterValue) && !empty($array_filterValue))
|
||||
{
|
||||
$sqlWhere='';
|
||||
$sqlWhere = '';
|
||||
// Loop on each condition to add
|
||||
foreach ($array_filterValue as $key => $value)
|
||||
{
|
||||
if (preg_match('/GROUP_CONCAT/i', $key)) continue;
|
||||
if ($value != '') $sqlWhere.=" and ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]);
|
||||
if ($value != '') $sqlWhere .= " and ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]);
|
||||
}
|
||||
$sql.=$sqlWhere;
|
||||
$sql .= $sqlWhere;
|
||||
}
|
||||
|
||||
// Add the order
|
||||
$sql.=$this->array_export_sql_order[$indice];
|
||||
$sql .= $this->array_export_sql_order[$indice];
|
||||
|
||||
// Add the HAVING part.
|
||||
if (is_array($array_filterValue) && !empty($array_filterValue))
|
||||
|
|
@ -269,7 +269,7 @@ class Export
|
|||
// Loop on each condition to add
|
||||
foreach ($array_filterValue as $key => $value)
|
||||
{
|
||||
if (preg_match('/GROUP_CONCAT/i', $key) and $value != '') $sql.=" HAVING ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]);
|
||||
if (preg_match('/GROUP_CONCAT/i', $key) and $value != '') $sql .= " HAVING ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -293,25 +293,25 @@ class Export
|
|||
// build the input field on depend of the type of file
|
||||
switch ($InfoFieldList[0]) {
|
||||
case 'Text':
|
||||
if (! (strpos($ValueField, '%') === false))
|
||||
$szFilterQuery.=" ".$NameField." LIKE '".$ValueField."'";
|
||||
if (!(strpos($ValueField, '%') === false))
|
||||
$szFilterQuery .= " ".$NameField." LIKE '".$ValueField."'";
|
||||
else
|
||||
$szFilterQuery.=" ".$NameField." = '".$ValueField."'";
|
||||
$szFilterQuery .= " ".$NameField." = '".$ValueField."'";
|
||||
break;
|
||||
case 'Date':
|
||||
if (strpos($ValueField, "+") > 0)
|
||||
{
|
||||
// mode plage
|
||||
$ValueArray = explode("+", $ValueField);
|
||||
$szFilterQuery ="(".$this->conditionDate($NameField, trim($ValueArray[0]), ">=");
|
||||
$szFilterQuery.=" AND ".$this->conditionDate($NameField, trim($ValueArray[1]), "<=").")";
|
||||
$szFilterQuery = "(".$this->conditionDate($NameField, trim($ValueArray[0]), ">=");
|
||||
$szFilterQuery .= " AND ".$this->conditionDate($NameField, trim($ValueArray[1]), "<=").")";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_numeric(substr($ValueField, 0, 1)))
|
||||
$szFilterQuery=$this->conditionDate($NameField, trim($ValueField), "=");
|
||||
$szFilterQuery = $this->conditionDate($NameField, trim($ValueField), "=");
|
||||
else
|
||||
$szFilterQuery=$this->conditionDate($NameField, trim(substr($ValueField, 1)), substr($ValueField, 0, 1));
|
||||
$szFilterQuery = $this->conditionDate($NameField, trim(substr($ValueField, 1)), substr($ValueField, 0, 1));
|
||||
}
|
||||
break;
|
||||
case 'Duree':
|
||||
|
|
@ -322,29 +322,29 @@ class Export
|
|||
{
|
||||
// mode plage
|
||||
$ValueArray = explode("+", $ValueField);
|
||||
$szFilterQuery ="(".$NameField.">=".$ValueArray[0];
|
||||
$szFilterQuery.=" AND ".$NameField."<=".$ValueArray[1].")";
|
||||
$szFilterQuery = "(".$NameField.">=".$ValueArray[0];
|
||||
$szFilterQuery .= " AND ".$NameField."<=".$ValueArray[1].")";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_numeric(substr($ValueField, 0, 1)))
|
||||
$szFilterQuery=" ".$NameField."=".$ValueField;
|
||||
$szFilterQuery = " ".$NameField."=".$ValueField;
|
||||
else
|
||||
$szFilterQuery=" ".$NameField.substr($ValueField, 0, 1).substr($ValueField, 1);
|
||||
$szFilterQuery = " ".$NameField.substr($ValueField, 0, 1).substr($ValueField, 1);
|
||||
}
|
||||
break;
|
||||
case 'Boolean':
|
||||
$szFilterQuery=" ".$NameField."=".(is_numeric($ValueField) ? $ValueField : ($ValueField =='yes' ? 1: 0) );
|
||||
$szFilterQuery = " ".$NameField."=".(is_numeric($ValueField) ? $ValueField : ($ValueField == 'yes' ? 1 : 0));
|
||||
break;
|
||||
case 'Status':
|
||||
case 'List':
|
||||
if (is_numeric($ValueField))
|
||||
$szFilterQuery=" ".$NameField."=".$ValueField;
|
||||
$szFilterQuery = " ".$NameField."=".$ValueField;
|
||||
else {
|
||||
if (! (strpos($ValueField, '%') === false))
|
||||
$szFilterQuery=" ".$NameField." LIKE '".$ValueField."'";
|
||||
if (!(strpos($ValueField, '%') === false))
|
||||
$szFilterQuery = " ".$NameField." LIKE '".$ValueField."'";
|
||||
else
|
||||
$szFilterQuery=" ".$NameField." = '".$ValueField."'";
|
||||
$szFilterQuery = " ".$NameField." = '".$ValueField."'";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -365,9 +365,9 @@ class Export
|
|||
public function conditionDate($Field, $Value, $Sens)
|
||||
{
|
||||
// TODO date_format is forbidden, not performant and not portable. Use instead BETWEEN
|
||||
if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$Sens." '".$Value."'";
|
||||
elseif (strlen($Value)==6) $Condition=" date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'";
|
||||
else $Condition=" date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value;
|
||||
if (strlen($Value) == 4) $Condition = " date_format(".$Field.",'%Y') ".$Sens." '".$Value."'";
|
||||
elseif (strlen($Value) == 6) $Condition = " date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'";
|
||||
else $Condition = " date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value;
|
||||
return $Condition;
|
||||
}
|
||||
|
||||
|
|
@ -383,9 +383,9 @@ class Export
|
|||
public function build_filterField($TypeField, $NameField, $ValueField)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$szFilterField='';
|
||||
$szFilterField = '';
|
||||
$InfoFieldList = explode(":", $TypeField);
|
||||
|
||||
// build the input field on depend of the type of file
|
||||
|
|
@ -393,31 +393,31 @@ class Export
|
|||
{
|
||||
case 'Text':
|
||||
case 'Date':
|
||||
$szFilterField='<input type="text" name="'.$NameField.'" value="'.$ValueField.'">';
|
||||
$szFilterField = '<input type="text" name="'.$NameField.'" value="'.$ValueField.'">';
|
||||
break;
|
||||
case 'Duree':
|
||||
case 'Numeric':
|
||||
case 'Number':
|
||||
// Must be a string text to allow to use comparison strings like "<= 999"
|
||||
$szFilterField='<input type="text" size="6" name="'.$NameField.'" value="'.$ValueField.'">';
|
||||
$szFilterField = '<input type="text" size="6" name="'.$NameField.'" value="'.$ValueField.'">';
|
||||
break;
|
||||
case 'Status':
|
||||
$szFilterField='<input type="number" size="6" name="'.$NameField.'" value="'.$ValueField.'">';
|
||||
$szFilterField = '<input type="number" size="6" name="'.$NameField.'" value="'.$ValueField.'">';
|
||||
break;
|
||||
case 'Boolean':
|
||||
$szFilterField='<select name="'.$NameField.'" class="flat">';
|
||||
$szFilterField.='<option ';
|
||||
if ($ValueField=='') $szFilterField.=' selected ';
|
||||
$szFilterField.=' value=""> </option>';
|
||||
$szFilterField = '<select name="'.$NameField.'" class="flat">';
|
||||
$szFilterField .= '<option ';
|
||||
if ($ValueField == '') $szFilterField .= ' selected ';
|
||||
$szFilterField .= ' value=""> </option>';
|
||||
|
||||
$szFilterField.='<option ';
|
||||
if ($ValueField=='yes' || $ValueField == '1') $szFilterField.=' selected ';
|
||||
$szFilterField.=' value="1">'.yn(1).'</option>';
|
||||
$szFilterField .= '<option ';
|
||||
if ($ValueField == 'yes' || $ValueField == '1') $szFilterField .= ' selected ';
|
||||
$szFilterField .= ' value="1">'.yn(1).'</option>';
|
||||
|
||||
$szFilterField.='<option ';
|
||||
if ($ValueField=='no' || $ValueField=='0') $szFilterField.=' selected ';
|
||||
$szFilterField.=' value="0">'.yn(0).'</option>';
|
||||
$szFilterField.="</select>";
|
||||
$szFilterField .= '<option ';
|
||||
if ($ValueField == 'no' || $ValueField == '0') $szFilterField .= ' selected ';
|
||||
$szFilterField .= ' value="0">'.yn(0).'</option>';
|
||||
$szFilterField .= "</select>";
|
||||
break;
|
||||
case 'List':
|
||||
// 0 : Type du champ
|
||||
|
|
@ -426,23 +426,23 @@ class Export
|
|||
// 3 : Name of field with key (if it is not "rowid"). Used this field as key for combo list.
|
||||
// 4 : Name of element for getEntity().
|
||||
|
||||
if (! empty($InfoFieldList[3]))
|
||||
$keyList=$InfoFieldList[3];
|
||||
if (!empty($InfoFieldList[3]))
|
||||
$keyList = $InfoFieldList[3];
|
||||
else
|
||||
$keyList='rowid';
|
||||
$sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3])?'':', '.$InfoFieldList[3].' as code');
|
||||
if ($InfoFieldList[1] == 'c_stcomm') $sql = 'SELECT id as id, '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3])?'':', '.$InfoFieldList[3].' as code');
|
||||
$keyList = 'rowid';
|
||||
$sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3]) ? '' : ', '.$InfoFieldList[3].' as code');
|
||||
if ($InfoFieldList[1] == 'c_stcomm') $sql = 'SELECT id as id, '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3]) ? '' : ', '.$InfoFieldList[3].' as code');
|
||||
if ($InfoFieldList[1] == 'c_country') $sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label, code as code';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[1];
|
||||
if (! empty($InfoFieldList[4])) {
|
||||
$sql.= ' WHERE entity IN ('.getEntity($InfoFieldList[4]).')';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[1];
|
||||
if (!empty($InfoFieldList[4])) {
|
||||
$sql .= ' WHERE entity IN ('.getEntity($InfoFieldList[4]).')';
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$szFilterField='<select class="flat" name="'.$NameField.'">';
|
||||
$szFilterField.='<option value="0"> </option>';
|
||||
$szFilterField = '<select class="flat" name="'.$NameField.'">';
|
||||
$szFilterField .= '<option value="0"> </option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
|
|
@ -458,30 +458,30 @@ class Export
|
|||
continue;
|
||||
}
|
||||
//var_dump($InfoFieldList[1]);
|
||||
$labeltoshow=dol_trunc($obj->label, 18);
|
||||
$labeltoshow = dol_trunc($obj->label, 18);
|
||||
if ($InfoFieldList[1] == 'c_stcomm')
|
||||
{
|
||||
$langs->load("companies");
|
||||
$labeltoshow=(($langs->trans("StatusProspect".$obj->id) != "StatusProspect".$obj->id)?$langs->trans("StatusProspect".$obj->id):$obj->label);
|
||||
$labeltoshow = (($langs->trans("StatusProspect".$obj->id) != "StatusProspect".$obj->id) ? $langs->trans("StatusProspect".$obj->id) : $obj->label);
|
||||
}
|
||||
if ($InfoFieldList[1] == 'c_country')
|
||||
{
|
||||
//var_dump($sql);
|
||||
$langs->load("dict");
|
||||
$labeltoshow=(($langs->trans("Country".$obj->code) != "Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label);
|
||||
$labeltoshow = (($langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label);
|
||||
}
|
||||
if (!empty($ValueField) && $ValueField == $obj->rowid)
|
||||
{
|
||||
$szFilterField.='<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
|
||||
$szFilterField .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$szFilterField.='<option value="'.$obj->rowid.'" >'.$labeltoshow.'</option>';
|
||||
$szFilterField .= '<option value="'.$obj->rowid.'" >'.$labeltoshow.'</option>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$szFilterField.="</select>";
|
||||
$szFilterField .= "</select>";
|
||||
|
||||
$this->db->free($resql);
|
||||
}
|
||||
|
|
@ -502,12 +502,12 @@ class Export
|
|||
{
|
||||
global $langs;
|
||||
|
||||
$szMsg='';
|
||||
$szMsg = '';
|
||||
$InfoFieldList = explode(":", $TypeField);
|
||||
// build the input field on depend of the type of file
|
||||
switch ($InfoFieldList[0]) {
|
||||
case 'Text':
|
||||
$szMsg= $langs->trans('ExportStringFilter');
|
||||
$szMsg = $langs->trans('ExportStringFilter');
|
||||
break;
|
||||
case 'Date':
|
||||
$szMsg = $langs->trans('ExportDateFilter');
|
||||
|
|
@ -542,37 +542,37 @@ class Export
|
|||
public function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs,$mysoc;
|
||||
global $conf, $langs, $mysoc;
|
||||
|
||||
$indice=0;
|
||||
$indice = 0;
|
||||
asort($array_selected);
|
||||
|
||||
dol_syslog(get_class($this)."::".__FUNCTION__." ".$model.", ".$datatoexport.", ".implode(",", $array_selected));
|
||||
|
||||
// Check parameters or context properties
|
||||
if (empty($this->array_export_fields) || ! is_array($this->array_export_fields))
|
||||
if (empty($this->array_export_fields) || !is_array($this->array_export_fields))
|
||||
{
|
||||
$this->error="ErrorBadParameter";
|
||||
$this->error = "ErrorBadParameter";
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Creation of class to export using model ExportXXX
|
||||
$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/";
|
||||
$dir = DOL_DOCUMENT_ROOT."/core/modules/export/";
|
||||
$file = "export_".$model.".modules.php";
|
||||
$classname = "Export".$model;
|
||||
require_once $dir.$file;
|
||||
$objmodel = new $classname($this->db);
|
||||
|
||||
if (! empty($sqlquery)) $sql = $sqlquery;
|
||||
if (!empty($sqlquery)) $sql = $sqlquery;
|
||||
else
|
||||
{
|
||||
// Define value for indice from $datatoexport
|
||||
$foundindice=0;
|
||||
foreach($this->array_export_code as $key => $dataset)
|
||||
$foundindice = 0;
|
||||
foreach ($this->array_export_code as $key => $dataset)
|
||||
{
|
||||
if ($datatoexport == $dataset)
|
||||
{
|
||||
$indice=$key;
|
||||
$indice = $key;
|
||||
$foundindice++;
|
||||
//print "Found indice = ".$indice." for dataset=".$datatoexport."\n";
|
||||
break;
|
||||
|
|
@ -580,31 +580,31 @@ class Export
|
|||
}
|
||||
if (empty($foundindice))
|
||||
{
|
||||
$this->error="ErrorBadParameter can't find dataset ".$datatoexport." into preload arrays this->array_export_code";
|
||||
$this->error = "ErrorBadParameter can't find dataset ".$datatoexport." into preload arrays this->array_export_code";
|
||||
return -1;
|
||||
}
|
||||
$sql=$this->build_sql($indice, $array_selected, $array_filterValue);
|
||||
$sql = $this->build_sql($indice, $array_selected, $array_filterValue);
|
||||
}
|
||||
|
||||
// Run the sql
|
||||
$this->sqlusedforexport=$sql;
|
||||
$this->sqlusedforexport = $sql;
|
||||
dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
//$this->array_export_label[$indice]
|
||||
if ($conf->global->EXPORT_PREFIX_SPEC)
|
||||
$filename=$conf->global->EXPORT_PREFIX_SPEC."_".$datatoexport;
|
||||
$filename = $conf->global->EXPORT_PREFIX_SPEC."_".$datatoexport;
|
||||
else
|
||||
$filename="export_".$datatoexport;
|
||||
$filename.='.'.$objmodel->getDriverExtension();
|
||||
$dirname=$conf->export->dir_temp.'/'.$user->id;
|
||||
$filename = "export_".$datatoexport;
|
||||
$filename .= '.'.$objmodel->getDriverExtension();
|
||||
$dirname = $conf->export->dir_temp.'/'.$user->id;
|
||||
|
||||
$outputlangs = clone $langs; // We clone to have an object we can modify (for example to change output charset by csv handler) without changing original value
|
||||
|
||||
// Open file
|
||||
dol_mkdir($dirname);
|
||||
$result=$objmodel->open_file($dirname."/".$filename, $outputlangs);
|
||||
$result = $objmodel->open_file($dirname."/".$filename, $outputlangs);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
|
|
@ -617,61 +617,61 @@ class Export
|
|||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
// Process special operations
|
||||
if (! empty($this->array_export_special[$indice]))
|
||||
if (!empty($this->array_export_special[$indice]))
|
||||
{
|
||||
foreach ($this->array_export_special[$indice] as $key => $value)
|
||||
{
|
||||
if (! array_key_exists($key, $array_selected)) continue; // Field not selected
|
||||
if (!array_key_exists($key, $array_selected)) continue; // Field not selected
|
||||
// Operation NULLIFNEG
|
||||
if ($this->array_export_special[$indice][$key]=='NULLIFNEG')
|
||||
if ($this->array_export_special[$indice][$key] == 'NULLIFNEG')
|
||||
{
|
||||
//$alias=$this->array_export_alias[$indice][$key];
|
||||
$alias=str_replace(array('.', '-','(',')'), '_', $key);
|
||||
if ($obj->$alias < 0) $obj->$alias='';
|
||||
$alias = str_replace(array('.', '-', '(', ')'), '_', $key);
|
||||
if ($obj->$alias < 0) $obj->$alias = '';
|
||||
}
|
||||
// Operation ZEROIFNEG
|
||||
elseif ($this->array_export_special[$indice][$key]=='ZEROIFNEG')
|
||||
elseif ($this->array_export_special[$indice][$key] == 'ZEROIFNEG')
|
||||
{
|
||||
//$alias=$this->array_export_alias[$indice][$key];
|
||||
$alias=str_replace(array('.', '-','(',')'), '_', $key);
|
||||
if ($obj->$alias < 0) $obj->$alias='0';
|
||||
$alias = str_replace(array('.', '-', '(', ')'), '_', $key);
|
||||
if ($obj->$alias < 0) $obj->$alias = '0';
|
||||
}
|
||||
// Operation GETNUMOPENDAYS (for Holiday module)
|
||||
elseif ($this->array_export_special[$indice][$key]=='getNumOpenDays')
|
||||
elseif ($this->array_export_special[$indice][$key] == 'getNumOpenDays')
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
//$alias=$this->array_export_alias[$indice][$key];
|
||||
$alias=str_replace(array('.', '-','(',')'), '_', $key);
|
||||
$obj->$alias=num_open_day(dol_stringtotime($obj->d_date_debut, 1), dol_stringtotime($obj->d_date_fin, 1), 0, 1, $obj->d_halfday, $mysoc->country_code);
|
||||
$alias = str_replace(array('.', '-', '(', ')'), '_', $key);
|
||||
$obj->$alias = num_open_day(dol_stringtotime($obj->d_date_debut, 1), dol_stringtotime($obj->d_date_fin, 1), 0, 1, $obj->d_halfday, $mysoc->country_code);
|
||||
}
|
||||
// Operation INVOICEREMAINTOPAY
|
||||
elseif ($this->array_export_special[$indice][$key]=='getRemainToPay')
|
||||
elseif ($this->array_export_special[$indice][$key] == 'getRemainToPay')
|
||||
{
|
||||
//$alias=$this->array_export_alias[$indice][$key];
|
||||
$alias=str_replace(array('.', '-','(',')'), '_', $key);
|
||||
$remaintopay='';
|
||||
$alias = str_replace(array('.', '-', '(', ')'), '_', $key);
|
||||
$remaintopay = '';
|
||||
if ($obj->f_rowid > 0)
|
||||
{
|
||||
global $tmpobjforcomputecall;
|
||||
if (! is_object($tmpobjforcomputecall))
|
||||
if (!is_object($tmpobjforcomputecall))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$tmpobjforcomputecall=new Facture($this->db);
|
||||
$tmpobjforcomputecall = new Facture($this->db);
|
||||
}
|
||||
$tmpobjforcomputecall->id = $obj->f_rowid;
|
||||
$tmpobjforcomputecall->total_ttc = $obj->f_total_ttc;
|
||||
$remaintopay=$tmpobjforcomputecall->getRemainToPay();
|
||||
$remaintopay = $tmpobjforcomputecall->getRemainToPay();
|
||||
}
|
||||
$obj->$alias=$remaintopay;
|
||||
$obj->$alias = $remaintopay;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO FIXME Export of compute field does not work. $obj containt $obj->alias_field and formulat will contains $obj->field
|
||||
$computestring=$this->array_export_special[$indice][$key];
|
||||
$tmp=dol_eval($computestring, 1, 0);
|
||||
$obj->$alias=$tmp;
|
||||
$computestring = $this->array_export_special[$indice][$key];
|
||||
$tmp = dol_eval($computestring, 1, 0);
|
||||
$obj->$alias = $tmp;
|
||||
|
||||
$this->error="ERROPNOTSUPPORTED. Operation ".$this->array_export_special[$indice][$key]." not supported. Export of 'computed' extrafields is not yet supported, please remove field.";
|
||||
$this->error = "ERROPNOTSUPPORTED. Operation ".$this->array_export_special[$indice][$key]." not supported. Export of 'computed' extrafields is not yet supported, please remove field.";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -690,14 +690,14 @@ class Export
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->error=$objmodel->error;
|
||||
$this->error = $objmodel->error;
|
||||
dol_syslog("Export::build_file Error: ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error()." - sql=".$sql;
|
||||
$this->error = $this->db->error()." - sql=".$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -716,24 +716,24 @@ class Export
|
|||
|
||||
$this->db->begin();
|
||||
|
||||
$filter='';
|
||||
$filter = '';
|
||||
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'export_model (';
|
||||
$sql.= 'label,';
|
||||
$sql.= 'type,';
|
||||
$sql.= 'field,';
|
||||
$sql.= 'fk_user,';
|
||||
$sql.= 'filter';
|
||||
$sql.= ') VALUES (';
|
||||
$sql.= "'".$this->db->escape($this->model_name)."',";
|
||||
$sql.= "'".$this->db->escape($this->datatoexport)."',";
|
||||
$sql.= "'".$this->db->escape($this->hexa)."',";
|
||||
$sql.= "'".$user->id."',";
|
||||
$sql.= "'".$this->db->escape($this->hexafiltervalue)."'";
|
||||
$sql.= ")";
|
||||
$sql .= 'label,';
|
||||
$sql .= 'type,';
|
||||
$sql .= 'field,';
|
||||
$sql .= 'fk_user,';
|
||||
$sql .= 'filter';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= "'".$this->db->escape($this->model_name)."',";
|
||||
$sql .= "'".$this->db->escape($this->datatoexport)."',";
|
||||
$sql .= "'".$this->db->escape($this->hexa)."',";
|
||||
$sql .= "'".$user->id."',";
|
||||
$sql .= "'".$this->db->escape($this->hexafiltervalue)."'";
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
|
|
@ -741,8 +741,8 @@ class Export
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->errno=$this->db->lasterrno();
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errno = $this->db->lasterrno();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -757,8 +757,8 @@ class Export
|
|||
public function fetch($id)
|
||||
{
|
||||
$sql = 'SELECT em.rowid, em.label, em.type, em.field, em.filter';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'export_model as em';
|
||||
$sql.= ' WHERE em.rowid = '.$id;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'export_model as em';
|
||||
$sql .= ' WHERE em.rowid = '.$id;
|
||||
|
||||
dol_syslog("Export::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
|
@ -778,7 +778,7 @@ class Export
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->error="ModelNotFound";
|
||||
$this->error = "ModelNotFound";
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
|
@ -800,20 +800,20 @@ class Export
|
|||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."export_model";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
|
@ -830,13 +830,13 @@ class Export
|
|||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
foreach ($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
return -1 * $error;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -858,8 +858,8 @@ class Export
|
|||
global $conf, $langs;
|
||||
|
||||
$sql = "SELECT em.rowid, em.field, em.label, em.type, em.filter";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."export_model as em";
|
||||
$sql.= " ORDER BY rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."export_model as em";
|
||||
$sql .= " ORDER BY rowid";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
|
|
@ -877,12 +877,12 @@ class Export
|
|||
print $this->array_export_module[$keyModel]->getName().' - ';
|
||||
// recuperation du nom de l'export
|
||||
|
||||
$string=$langs->trans($this->array_export_label[$keyModel]);
|
||||
print ($string!=$this->array_export_label[$keyModel]?$string:$this->array_export_label[$keyModel]);
|
||||
$string = $langs->trans($this->array_export_label[$keyModel]);
|
||||
print ($string != $this->array_export_label[$keyModel] ? $string : $this->array_export_label[$keyModel]);
|
||||
print '</td>';
|
||||
//print '<td>'.$obj->type.$keyModel.'</td>';
|
||||
print '<td>'.str_replace(',', ' , ', $obj->field).'</td>';
|
||||
if (! empty($obj->filter)) {
|
||||
if (!empty($obj->filter)) {
|
||||
$filter = json_decode($obj->filter, true);
|
||||
print '<td>'.str_replace(',', ' , ', $filter['field']).'</td>';
|
||||
print '<td>'.str_replace(',', ' , ', $filter['value']).'</td>';
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -40,23 +40,23 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
// Get parameters
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$cancel=GETPOST('cancel', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$id=GETPOST('id', 'int');
|
||||
$ref=GETPOST('ref', 'alpha');
|
||||
$fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id);
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$fuserid = (GETPOST('fuserid', 'int') ?GETPOST('fuserid', 'int') : $user->id);
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("holiday","mails"));
|
||||
$langs->loadLangs(array("holiday", "mails"));
|
||||
|
||||
$now=dol_now();
|
||||
$now = dol_now();
|
||||
|
||||
$childids = $user->getAllChildIds(1);
|
||||
|
||||
$morefilter = 'AND employee = 1';
|
||||
if (! empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
|
||||
if (!empty($conf->global->HOLIDAY_FOR_NON_SALARIES_TOO)) $morefilter = '';
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ if (!empty($user->rights->holiday->delete)) $candelete = 1;
|
|||
if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) $candelete = 1;
|
||||
|
||||
// Protection if external user
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'holiday', $object->id, 'holiday');
|
||||
|
||||
|
||||
|
|
@ -1287,8 +1287,8 @@ else
|
|||
$htmlhelp = $langs->trans('NbUseDaysCPHelp');
|
||||
$includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
|
||||
$includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
|
||||
if ($includesaturday) $htmlhelp.='<br>'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Saturday"));
|
||||
if ($includesunday) $htmlhelp.='<br>'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Sunday"));
|
||||
if ($includesaturday) $htmlhelp .= '<br>'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Saturday"));
|
||||
if ($includesunday) $htmlhelp .= '<br>'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Sunday"));
|
||||
print $form->textwithpicto($langs->trans('NbUseDaysCP'), $htmlhelp);
|
||||
print '</td>';
|
||||
print '<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'</td>';
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ if ($resql)
|
|||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="right liste_titre">';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
|
|
|
|||
|
|
@ -81,14 +81,14 @@ else
|
|||
|
||||
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_user="";
|
||||
$search_label="";
|
||||
$search_date_start='';
|
||||
$search_date_end='';
|
||||
$search_amount="";
|
||||
$search_account='';
|
||||
$typeid="";
|
||||
$search_ref = "";
|
||||
$search_user = "";
|
||||
$search_label = "";
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_amount = "";
|
||||
$search_account = '';
|
||||
$typeid = "";
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -119,8 +119,8 @@ $sql .= " AND s.entity = ".$conf->entity;
|
|||
if ($search_ref) $sql .= " AND s.rowid=".$search_ref;
|
||||
if ($search_user) $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
|
||||
if ($search_label) $sql .= natural_search(array('s.label'), $search_label);
|
||||
if ($search_date_start) $sql .= " AND s.datep >= '" . $db->idate($search_date_start) . "'";
|
||||
if ($search_date_end) $sql .= " AND s.datep <= '" . $db->idate($search_date_end) . "'";
|
||||
if ($search_date_start) $sql .= " AND s.datep >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND s.datep <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_amount) $sql .= natural_search("s.amount", $search_amount, 1);
|
||||
if ($search_account > 0) $sql .= " AND b.fk_account=".$search_account;
|
||||
if ($filtre) {
|
||||
|
|
@ -188,12 +188,12 @@ if ($result)
|
|||
// Date
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ' ';
|
||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ' ';
|
||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
// Type
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user