Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
526ae83e8f
@ -29,18 +29,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
|
|
||||||
$action=GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page', 'int');
|
$page = GETPOST('page', 'int');
|
||||||
if (! $sortorder) $sortorder="DESC";
|
if (!$sortorder) $sortorder = "DESC";
|
||||||
if (! $sortfield) $sortfield="date";
|
if (!$sortfield) $sortfield = "date";
|
||||||
if (empty($page) || $page == -1) { $page = 0; }
|
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;
|
$offset = $limit * $page;
|
||||||
|
|
||||||
if (! $user->admin)
|
if (!$user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
@ -52,33 +52,33 @@ if ($action == 'delete')
|
|||||||
{
|
{
|
||||||
if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha')))
|
if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha')))
|
||||||
{
|
{
|
||||||
$file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
$file = $conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
||||||
$ret=dol_delete_file($file, 1);
|
$ret = dol_delete_file($file, 1);
|
||||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$file=$conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
|
$file = $conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
|
||||||
$ret=dol_delete_file($file, 1);
|
$ret = dol_delete_file($file, 1);
|
||||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||||
}
|
}
|
||||||
$action='';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form = new Form($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
$label=$db::LABEL;
|
$label = $db::LABEL;
|
||||||
$type=$db->type;
|
$type = $db->type;
|
||||||
//var_dump($db);
|
//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);
|
llxHeader('', '', $help_url);
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
@ -141,9 +141,9 @@ print '<br>';
|
|||||||
|
|
||||||
print '<div id="backupdatabaseleft" class="fichehalfleft" >';
|
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 '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
|
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");
|
print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
|
||||||
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
|
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
|
||||||
{
|
{
|
||||||
$fullpathofmysqldump=$db->getPathOfDump();
|
$fullpathofmysqldump = $db->getPathOfDump();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
$fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||||
}
|
}
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
|
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>';
|
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 '<div class="formelementrow">';
|
||||||
print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
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>';
|
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 '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||||
print '</legend>';
|
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 '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '</fieldset>';
|
print '</fieldset>';
|
||||||
@ -293,7 +293,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||||
|
|
||||||
print '</div>';
|
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 '<div class="formelementrow">';
|
||||||
print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
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>';
|
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 '<br>';
|
||||||
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
|
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 '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '</fieldset>';
|
print '</fieldset>';
|
||||||
@ -338,11 +338,11 @@ if (in_array($type, array('pgsql'))) {
|
|||||||
|
|
||||||
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
|
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
|
||||||
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
|
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
|
||||||
$fullpathofpgdump=$db->getPathOfDump();
|
$fullpathofpgdump = $db->getPathOfDump();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
$fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||||
}
|
}
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
|
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 '<br>';
|
||||||
print '<label for="filename_template">'.$langs->trans("FileNameToGenerate").'</label>';
|
print '<label for="filename_template">'.$langs->trans("FileNameToGenerate").'</label>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
$prefix='dump';
|
$prefix = 'dump';
|
||||||
$ext='.sql';
|
$ext = '.sql';
|
||||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||||
$prefix='mysqldump';
|
$prefix = 'mysqldump';
|
||||||
$ext='sql';
|
$ext = 'sql';
|
||||||
}
|
}
|
||||||
//if ($label == 'PostgreSQL') {
|
//if ($label == 'PostgreSQL') {
|
||||||
// $prefix='pg_dump';
|
// $prefix='pg_dump';
|
||||||
// $ext='dump';
|
// $ext='dump';
|
||||||
//}
|
//}
|
||||||
if (in_array($type, array('pgsql'))) {
|
if (in_array($type, array('pgsql'))) {
|
||||||
$prefix='pg_dump';
|
$prefix = 'pg_dump';
|
||||||
$ext='sql';
|
$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 '<input type="text" name="filename_template" style="width: 90%" id="filename_template" value="'.$file.'" />';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Define compressions array
|
// Define compressions array
|
||||||
$compression=array();
|
$compression = array();
|
||||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||||
$compression['gz'] = array(
|
$compression['gz'] = array(
|
||||||
'function' => 'gzopen',
|
'function' => 'gzopen',
|
||||||
@ -488,7 +488,7 @@ print '<input type="hidden" name="page_y" value="'.GETPOST('page_y', 'int').'">'
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
if (! empty($_SESSION["commandbackuplastdone"]))
|
if (!empty($_SESSION["commandbackuplastdone"]))
|
||||||
{
|
{
|
||||||
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||||
print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><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 '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||||
print $_SESSION["commandbackupresult"];
|
print $_SESSION["commandbackupresult"];
|
||||||
|
|
||||||
$_SESSION["commandbackuplastdone"]='';
|
$_SESSION["commandbackuplastdone"] = '';
|
||||||
$_SESSION["commandbackuptorun"]='';
|
$_SESSION["commandbackuptorun"] = '';
|
||||||
$_SESSION["commandbackupresult"]='';
|
$_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 '<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";
|
print '<textarea id="commandbackuptoruntext" rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuptorun"].'</textarea><br>'."\n";
|
||||||
@ -513,9 +513,9 @@ if (! empty($_SESSION["commandbackuptorun"]))
|
|||||||
|
|
||||||
//print $paramclear;
|
//print $paramclear;
|
||||||
|
|
||||||
$_SESSION["commandbackuplastdone"]='';
|
$_SESSION["commandbackuplastdone"] = '';
|
||||||
$_SESSION["commandbackuptorun"]='';
|
$_SESSION["commandbackuptorun"] = '';
|
||||||
$_SESSION["commandbackupresult"]='';
|
$_SESSION["commandbackupresult"] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</div> <!-- end div center button -->\n";
|
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 id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
|
||||||
print '<div class="ficheaddleft">';
|
print '<div class="ficheaddleft">';
|
||||||
|
|
||||||
$filearray=dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
|
$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"));
|
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -217,12 +217,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
$search_type = '';
|
$search_type = '';
|
||||||
$search_country = '';
|
$search_country = '';
|
||||||
$search_type_thirdparty = '';
|
$search_type_thirdparty = '';
|
||||||
$search_date_start='';
|
$search_date_start = '';
|
||||||
$search_date_end='';
|
$search_date_end = '';
|
||||||
$search_dateend_start='';
|
$search_dateend_start = '';
|
||||||
$search_dateend_end='';
|
$search_dateend_end = '';
|
||||||
$search_datedelivery_start='';
|
$search_datedelivery_start = '';
|
||||||
$search_datedelivery_end='';
|
$search_datedelivery_end = '';
|
||||||
$search_availability = '';
|
$search_availability = '';
|
||||||
$viewstatut = '';
|
$viewstatut = '';
|
||||||
$object_statut = '';
|
$object_statut = '';
|
||||||
@ -338,13 +338,13 @@ if ($viewstatut != '' && $viewstatut != '-1')
|
|||||||
{
|
{
|
||||||
$sql .= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')';
|
$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_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_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_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_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_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_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_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
|
||||||
if ($search_user > 0)
|
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);
|
$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 '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ' ';
|
print $langs->trans('to').' ';
|
||||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -613,12 +613,12 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_dateend_start?$search_dateend_start:-1, 'search_dateend_start', 0, 0, 1);
|
print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ' ';
|
print $langs->trans('to').' ';
|
||||||
print $form->selectDate($search_dateend_end?$search_dateend_end:-1, 'search_dateend_end', 0, 0, 1);
|
print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -627,12 +627,12 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1);
|
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ' ';
|
print $langs->trans('to').' ';
|
||||||
print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1);
|
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -195,10 +195,10 @@ if (empty($reshook))
|
|||||||
$search_total_ht = '';
|
$search_total_ht = '';
|
||||||
$search_total_vat = '';
|
$search_total_vat = '';
|
||||||
$search_total_ttc = '';
|
$search_total_ttc = '';
|
||||||
$search_dateorder_start ='';
|
$search_dateorder_start = '';
|
||||||
$search_dateorder_end ='';
|
$search_dateorder_end = '';
|
||||||
$search_datedelivery_start ='';
|
$search_datedelivery_start = '';
|
||||||
$search_datedelivery_end ='';
|
$search_datedelivery_end = '';
|
||||||
$search_project_ref = '';
|
$search_project_ref = '';
|
||||||
$search_project = '';
|
$search_project = '';
|
||||||
$viewstatut = '';
|
$viewstatut = '';
|
||||||
@ -308,10 +308,10 @@ if ($viewstatut <> '')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($search_dateorder_start) $sql .= " AND c.date_commande >= '" . $db->idate($search_dateorder_start) . "'";
|
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_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_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_datedelivery_end) $sql .= " AND c.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||||
@ -646,12 +646,12 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_dateorder_start?$search_dateorder_start:-1, 'search_dateorder_start', 0, 0, 1);
|
print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1, 'search_dateorder_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ' ';
|
print $langs->trans('to').' ';
|
||||||
print $form->selectDate($search_dateorder_end?$search_dateorder_end:-1, 'search_dateorder_end', 0, 0, 1);
|
print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1, 'search_dateorder_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -659,12 +659,12 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1);
|
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ' ';
|
print $langs->trans('to').' ';
|
||||||
print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1);
|
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,16 +31,16 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("compta","banks","bills","accountancy"));
|
$langs->loadLangs(array("compta", "banks", "bills", "accountancy"));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid", "int");
|
$socid = GETPOST("socid", "int");
|
||||||
if ($user->socid) $socid=$user->socid;
|
if ($user->socid) $socid = $user->socid;
|
||||||
$result = restrictedArea($user, 'banque', '', '', '');
|
$result = restrictedArea($user, 'banque', '', '', '');
|
||||||
|
|
||||||
$optioncss = GETPOST('optioncss', 'alpha');
|
$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_ref = GETPOST('search_ref', 'int');
|
||||||
$search_user = GETPOST('search_user', 'alpha');
|
$search_user = GETPOST('search_user', 'alpha');
|
||||||
$search_label = GETPOST('search_label', '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;
|
$offset = $conf->liste_limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortfield) $sortfield="v.datep,v.rowid";
|
if (!$sortfield) $sortfield = "v.datep,v.rowid";
|
||||||
if (! $sortorder) $sortorder="DESC";
|
if (!$sortorder) $sortorder = "DESC";
|
||||||
|
|
||||||
$filtre=GETPOST("filtre", 'alpha');
|
$filtre = GETPOST("filtre", 'alpha');
|
||||||
|
|
||||||
if (! GETPOST('typeid'))
|
if (!GETPOST('typeid'))
|
||||||
{
|
{
|
||||||
$newfiltre=str_replace('filtre=', '', $filtre);
|
$newfiltre = str_replace('filtre=', '', $filtre);
|
||||||
$filterarray=explode('-', $newfiltre);
|
$filterarray = explode('-', $newfiltre);
|
||||||
foreach($filterarray as $val)
|
foreach ($filterarray as $val)
|
||||||
{
|
{
|
||||||
$part=explode(':', $val);
|
$part = explode(':', $val);
|
||||||
if ($part[0] == 'v.fk_typepayment') $typeid=$part[1];
|
if ($part[0] == 'v.fk_typepayment') $typeid = $part[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_ref="";
|
$search_ref = "";
|
||||||
$search_label="";
|
$search_label = "";
|
||||||
$search_date_start='';
|
$search_date_start = '';
|
||||||
$search_date_end='';
|
$search_date_end = '';
|
||||||
$search_amount_deb="";
|
$search_amount_deb = "";
|
||||||
$search_amount_cred="";
|
$search_amount_cred = "";
|
||||||
$search_account='';
|
$search_account = '';
|
||||||
$search_accountancy_account = '';
|
$search_accountancy_account = '';
|
||||||
$search_accountancy_subledger = '';
|
$search_accountancy_subledger = '';
|
||||||
$typeid="";
|
$typeid = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -107,62 +107,62 @@ $variousstatic = new PaymentVarious($db);
|
|||||||
$accountstatic = new Account($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 = "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 .= " 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 .= " pst.code as payment_code";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
$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."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 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 .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||||
$sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
|
$sql .= " WHERE v.entity IN (".getEntity('payment_various').")";
|
||||||
|
|
||||||
// Search criteria
|
// Search criteria
|
||||||
if ($search_ref) $sql.= " AND v.rowid=".$db->escape($search_ref);
|
if ($search_ref) $sql .= " AND v.rowid=".$db->escape($search_ref);
|
||||||
if ($search_label) $sql.= natural_search(array('v.label'), $search_label);
|
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_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_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_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_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_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_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 ($search_accountancy_subledger > 0) $sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
|
||||||
if ($typeid > 0) $sql.= " AND v.fk_typepayment=".$typeid;
|
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
|
||||||
if ($filtre) {
|
if ($filtre) {
|
||||||
$filtre=str_replace(":", "=", $filtre);
|
$filtre = str_replace(":", "=", $filtre);
|
||||||
$sql .= " AND ".$filtre;
|
$sql .= " AND ".$filtre;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
$totalnboflines=0;
|
$totalnboflines = 0;
|
||||||
$result=$db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$totalnboflines = $db->num_rows($result);
|
$totalnboflines = $db->num_rows($result);
|
||||||
}
|
}
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$total = 0 ;
|
$total = 0;
|
||||||
|
|
||||||
$param='';
|
$param = '';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||||
if ($search_label) $param.='&search_label='.urlencode($search_label);
|
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||||
if ($search_date_start) $param.='&search_date_start='.urlencode($search_date_start);
|
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 ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||||
if ($typeid > 0) $param.='&typeid='.urlencode($typeid);
|
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
|
||||||
if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb);
|
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_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
|
||||||
if ($search_account > 0) $param.='&search_amount='.urlencode($search_account);
|
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_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account);
|
||||||
if ($search_accountancy_subledger > 0) $param.='&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
|
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 = '';
|
$newcardbutton = '';
|
||||||
if ($user->rights->banque->modifier)
|
if ($user->rights->banque->modifier)
|
||||||
@ -198,12 +198,12 @@ if ($result)
|
|||||||
// Date
|
// Date
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ' ';
|
print $langs->trans('to').' ';
|
||||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -227,7 +227,7 @@ if ($result)
|
|||||||
// Accounting account
|
// Accounting account
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<div class="nowrap">';
|
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 '</div>';
|
||||||
print '</td>';
|
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 right"><input name="search_amount_cred" class="flat" type="text" size="8" value="'.$search_amount_cred.'"></td>';
|
||||||
|
|
||||||
print '<td class="liste_titre maxwidthsearch">';
|
print '<td class="liste_titre maxwidthsearch">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
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("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("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 ');
|
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->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("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->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("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("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||||
@ -279,19 +279,19 @@ if ($result)
|
|||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
|
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
// Label payment
|
// Label payment
|
||||||
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
|
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
// Account
|
// Account
|
||||||
if (!empty($conf->banque->enabled))
|
if (!empty($conf->banque->enabled))
|
||||||
@ -316,7 +316,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accounting account
|
// Accounting account
|
||||||
@ -325,14 +325,14 @@ if ($result)
|
|||||||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||||
|
|
||||||
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accounting subledger account
|
// Accounting subledger account
|
||||||
if (! empty($conf->accounting->enabled))
|
if (!empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
print '<td>' . length_accounta($obj->subledger_account) . '</td>';
|
print '<td>'.length_accounta($obj->subledger_account).'</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debit
|
// Debit
|
||||||
@ -342,8 +342,8 @@ if ($result)
|
|||||||
print price($obj->amount);
|
print price($obj->amount);
|
||||||
$totalarray['val']['total_deb'] += $obj->amount;
|
$totalarray['val']['total_deb'] += $obj->amount;
|
||||||
}
|
}
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_deb';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Credit
|
// Credit
|
||||||
@ -353,12 +353,12 @@ if ($result)
|
|||||||
print price($obj->amount);
|
print price($obj->amount);
|
||||||
$totalarray['val']['total_cred'] += $obj->amount;
|
$totalarray['val']['total_cred'] += $obj->amount;
|
||||||
}
|
}
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_cred';
|
||||||
print '</td>' ;
|
print '</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
print "</tr>\n";
|
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_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_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_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_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_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_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_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 ($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_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".(int) $search_sale;
|
||||||
if ($search_user > 0)
|
if ($search_user > 0)
|
||||||
@ -752,12 +752,12 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ' ';
|
print $langs->trans('to').' ';
|
||||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -766,12 +766,12 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_datelimit_start?$search_datelimit_start:-1, 'search_datelimit_start', 0, 0, 1);
|
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ' ';
|
print $langs->trans('to').' ';
|
||||||
print $form->selectDate($search_datelimit_end?$search_datelimit_end:-1, 'search_datelimit_end', 0, 0, 1);
|
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1135,7 +1135,7 @@ class DolGraph
|
|||||||
public function total()
|
public function total()
|
||||||
{
|
{
|
||||||
$value = 0;
|
$value = 0;
|
||||||
foreach($this->data as $valarray) // Loop on each x
|
foreach ($this->data as $valarray) // Loop on each x
|
||||||
{
|
{
|
||||||
$value += $valarray[1];
|
$value += $valarray[1];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5912,7 +5912,7 @@ class Form
|
|||||||
//var_dump($objecttmp->filter);
|
//var_dump($objecttmp->filter);
|
||||||
$prefixforautocompletemode = $objecttmp->element;
|
$prefixforautocompletemode = $objecttmp->element;
|
||||||
if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode = 'company';
|
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
|
$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);
|
dol_syslog(get_class($this)."::selectForForms object->filter=".$objecttmp->filter, LOG_DEBUG);
|
||||||
@ -7866,7 +7866,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)
|
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';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
|
||||||
@ -7875,16 +7875,16 @@ class Form
|
|||||||
$usertofilter = $user;
|
$usertofilter = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out='';
|
$out = '';
|
||||||
|
|
||||||
$hideunselectables = false;
|
$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($projectsListId))
|
||||||
{
|
{
|
||||||
if (empty($usertofilter->rights->projet->all->lire))
|
if (empty($usertofilter->rights->projet->all->lire))
|
||||||
{
|
{
|
||||||
$projectstatic=new Project($this->db);
|
$projectstatic = new Project($this->db);
|
||||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter, 0, 1);
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter, 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7892,37 +7892,37 @@ class Form
|
|||||||
// Search all projects
|
// Search all projects
|
||||||
$sql = 'SELECT f.rowid, f.ref as fref, "nolabel" as flabel, p.rowid as pid, f.ref,
|
$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,';
|
p.title, p.fk_soc, p.fk_statut, p.public,';
|
||||||
$sql.= ' s.nom as name';
|
$sql .= ' s.nom as name';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
|
||||||
$sql.= ' '.MAIN_DB_PREFIX.'facture as f';
|
$sql .= ' '.MAIN_DB_PREFIX.'facture as f';
|
||||||
$sql.= " WHERE p.entity IN (".getEntity('project').")";
|
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||||
$sql.= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
|
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
|
||||||
//if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
//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=0 OR p.fk_soc IS NULL)";
|
||||||
//if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." 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)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Use select2 selector
|
// 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);
|
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||||
$out.=$comboenhancement;
|
$out .= $comboenhancement;
|
||||||
$morecss='minwidth200imp maxwidth500';
|
$morecss = 'minwidth200imp maxwidth500';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($option_only)) {
|
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)) {
|
if (!empty($show_empty)) {
|
||||||
$out.= '<option value="0" class="optiongrey">';
|
$out .= '<option value="0" class="optiongrey">';
|
||||||
if (! is_numeric($show_empty)) $out.=$show_empty;
|
if (!is_numeric($show_empty)) $out .= $show_empty;
|
||||||
else $out.=' ';
|
else $out .= ' ';
|
||||||
$out.= '</option>';
|
$out .= '</option>';
|
||||||
}
|
}
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -7948,57 +7948,57 @@ class Form
|
|||||||
|
|
||||||
if ($showproject == 'all')
|
if ($showproject == 'all')
|
||||||
{
|
{
|
||||||
$labeltoshow.=dol_trunc($obj->ref, 18); // Invoice ref
|
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
|
||||||
if ($obj->name) $labeltoshow.=' - '.$obj->name; // Soc name
|
if ($obj->name) $labeltoshow .= ' - '.$obj->name; // Soc name
|
||||||
|
|
||||||
$disabled=0;
|
$disabled = 0;
|
||||||
if ($obj->fk_statut == Project::STATUS_DRAFT)
|
if ($obj->fk_statut == Project::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
$disabled=1;
|
$disabled = 1;
|
||||||
$labeltoshow.=' - '.$langs->trans("Draft");
|
$labeltoshow .= ' - '.$langs->trans("Draft");
|
||||||
}
|
}
|
||||||
elseif ($obj->fk_statut == Project::STATUS_CLOSED)
|
elseif ($obj->fk_statut == Project::STATUS_CLOSED)
|
||||||
{
|
{
|
||||||
if ($discard_closed == 2) $disabled=1;
|
if ($discard_closed == 2) $disabled = 1;
|
||||||
$labeltoshow.=' - '.$langs->trans("Closed");
|
$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;
|
$disabled = 1;
|
||||||
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
|
$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($selected) && $selected == $obj->rowid)
|
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
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
|
||||||
$out.= '>'.$labeltoshow.'</option>';
|
$out .= '>'.$labeltoshow.'</option>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($hideunselectables && $disabled && ($selected != $obj->rowid))
|
if ($hideunselectables && $disabled && ($selected != $obj->rowid))
|
||||||
{
|
{
|
||||||
$resultat='';
|
$resultat = '';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$resultat='<option value="'.$obj->rowid.'"';
|
$resultat = '<option value="'.$obj->rowid.'"';
|
||||||
if ($disabled) $resultat.=' disabled';
|
if ($disabled) $resultat .= ' disabled';
|
||||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
|
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
|
||||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||||
$resultat.='>';
|
$resultat .= '>';
|
||||||
$resultat.=$labeltoshow;
|
$resultat .= $labeltoshow;
|
||||||
$resultat.='</option>';
|
$resultat .= '</option>';
|
||||||
}
|
}
|
||||||
$out.= $resultat;
|
$out .= $resultat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($option_only)) {
|
if (empty($option_only)) {
|
||||||
$out.= '</select>';
|
$out .= '</select>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print $out;
|
print $out;
|
||||||
|
|||||||
@ -493,7 +493,7 @@ class Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clean old files
|
// 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);
|
$tmpfiles = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '(\.err|\.old|\.sav)$', 'date', SORT_DESC);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -219,7 +219,7 @@ class modAgenda extends DolibarrModules
|
|||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=0',
|
'fk_menu'=>'r=0',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'Actions',
|
'titre'=>'Actions',
|
||||||
@ -233,7 +233,7 @@ class modAgenda extends DolibarrModules
|
|||||||
'user'=>2,
|
'user'=>2,
|
||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=1',
|
'fk_menu'=>'r=1',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'NewAction',
|
'titre'=>'NewAction',
|
||||||
@ -248,7 +248,7 @@ class modAgenda extends DolibarrModules
|
|||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
// Calendar
|
// Calendar
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=1',
|
'fk_menu'=>'r=1',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'Calendar',
|
'titre'=>'Calendar',
|
||||||
@ -262,7 +262,7 @@ class modAgenda extends DolibarrModules
|
|||||||
'user'=>2
|
'user'=>2
|
||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=3',
|
'fk_menu'=>'r=3',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'MenuToDoMyActions',
|
'titre'=>'MenuToDoMyActions',
|
||||||
@ -276,7 +276,7 @@ class modAgenda extends DolibarrModules
|
|||||||
'user'=>2
|
'user'=>2
|
||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=3',
|
'fk_menu'=>'r=3',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'MenuDoneMyActions',
|
'titre'=>'MenuDoneMyActions',
|
||||||
@ -290,7 +290,7 @@ class modAgenda extends DolibarrModules
|
|||||||
'user'=>2
|
'user'=>2
|
||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=3',
|
'fk_menu'=>'r=3',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'MenuToDoActions',
|
'titre'=>'MenuToDoActions',
|
||||||
@ -304,7 +304,7 @@ class modAgenda extends DolibarrModules
|
|||||||
'user'=>2
|
'user'=>2
|
||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=3',
|
'fk_menu'=>'r=3',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'MenuDoneActions',
|
'titre'=>'MenuDoneActions',
|
||||||
@ -320,7 +320,7 @@ class modAgenda extends DolibarrModules
|
|||||||
|
|
||||||
// List
|
// List
|
||||||
$r++;
|
$r++;
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=1',
|
'fk_menu'=>'r=1',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'List',
|
'titre'=>'List',
|
||||||
@ -334,7 +334,7 @@ class modAgenda extends DolibarrModules
|
|||||||
'user'=>2
|
'user'=>2
|
||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=8',
|
'fk_menu'=>'r=8',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'MenuToDoMyActions',
|
'titre'=>'MenuToDoMyActions',
|
||||||
@ -348,7 +348,7 @@ class modAgenda extends DolibarrModules
|
|||||||
'user'=>2
|
'user'=>2
|
||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=8',
|
'fk_menu'=>'r=8',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'MenuDoneMyActions',
|
'titre'=>'MenuDoneMyActions',
|
||||||
@ -362,7 +362,7 @@ class modAgenda extends DolibarrModules
|
|||||||
'user'=>2
|
'user'=>2
|
||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=8',
|
'fk_menu'=>'r=8',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'MenuToDoActions',
|
'titre'=>'MenuToDoActions',
|
||||||
@ -376,7 +376,7 @@ class modAgenda extends DolibarrModules
|
|||||||
'user'=>2
|
'user'=>2
|
||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=8',
|
'fk_menu'=>'r=8',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'MenuDoneActions',
|
'titre'=>'MenuDoneActions',
|
||||||
@ -391,7 +391,7 @@ class modAgenda extends DolibarrModules
|
|||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
// Reports
|
// Reports
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu'=>'r=1',
|
'fk_menu'=>'r=1',
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'Reportings',
|
'titre'=>'Reportings',
|
||||||
@ -406,7 +406,7 @@ class modAgenda extends DolibarrModules
|
|||||||
);
|
);
|
||||||
$r++;
|
$r++;
|
||||||
// Categories
|
// Categories
|
||||||
$this->menu[$r]=array(
|
$this->menu[$r] = array(
|
||||||
'fk_menu' => 'r=1',
|
'fk_menu' => 'r=1',
|
||||||
'type' => 'left',
|
'type' => 'left',
|
||||||
'titre' => 'Categories',
|
'titre' => 'Categories',
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
* \brief Fichier de description et activation du module Utilisateur
|
* \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
|
* Class to describe and enable module User
|
||||||
@ -55,7 +55,7 @@ class modUser extends DolibarrModules
|
|||||||
$this->version = 'dolibarr';
|
$this->version = 'dolibarr';
|
||||||
|
|
||||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||||
$this->picto='group';
|
$this->picto = 'group';
|
||||||
|
|
||||||
// Data directories to create when module is enabled
|
// Data directories to create when module is enabled
|
||||||
$this->dirs = array("/users/temp");
|
$this->dirs = array("/users/temp");
|
||||||
@ -68,8 +68,8 @@ class modUser extends DolibarrModules
|
|||||||
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
$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->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->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->phpmin = array(5, 4); // Minimum version of PHP required by module
|
||||||
$this->langfiles = array("main","users","companies","members","salaries","hrm");
|
$this->langfiles = array("main", "users", "companies", "members", "salaries", "hrm");
|
||||||
$this->always_enabled = true; // Can't be disabled
|
$this->always_enabled = true; // Can't be disabled
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
@ -77,15 +77,15 @@ class modUser extends DolibarrModules
|
|||||||
|
|
||||||
// Boxes
|
// Boxes
|
||||||
$this->boxes = array(
|
$this->boxes = array(
|
||||||
0=>array('file'=>'box_lastlogin.php','enabledbydefaulton'=>'Home'),
|
0=>array('file'=>'box_lastlogin.php', 'enabledbydefaulton'=>'Home'),
|
||||||
1=>array('file'=>'box_birthdays.php','enabledbydefaulton'=>'Home')
|
1=>array('file'=>'box_birthdays.php', 'enabledbydefaulton'=>'Home')
|
||||||
);
|
);
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
$this->rights = array();
|
$this->rights = array();
|
||||||
$this->rights_class = 'user';
|
$this->rights_class = 'user';
|
||||||
$this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled)
|
$this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled)
|
||||||
$r=0;
|
$r = 0;
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 251;
|
$this->rights[$r][0] = 251;
|
||||||
@ -213,114 +213,114 @@ class modUser extends DolibarrModules
|
|||||||
|
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
$r=0;
|
$r = 0;
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||||
$this->export_label[$r]='List of users and attributes';
|
$this->export_label[$r] = 'List of users and attributes';
|
||||||
$this->export_permission[$r]=array(array("user","user","export"));
|
$this->export_permission[$r] = array(array("user", "user", "export"));
|
||||||
$this->export_fields_array[$r]=array(
|
$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.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.accountancy_code'=>"UserAccountancyCode",
|
||||||
'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
|
'u.address'=>"Address", 'u.zip'=>"Zip", 'u.town'=>"Town",
|
||||||
'u.office_phone'=>'Phone','u.user_mobile'=>"Mobile",'u.office_fax'=>'Fax',
|
'u.office_phone'=>'Phone', 'u.user_mobile'=>"Mobile", 'u.office_fax'=>'Fax',
|
||||||
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature',
|
'u.email'=>"Email", 'u.note'=>"Note", 'u.signature'=>'Signature',
|
||||||
'u.fk_user'=>'HierarchicalResponsible','u.thm'=>'THM','u.tjm'=>'TJM','u.weeklyhours'=>'WeeklyHours',
|
'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.dateemployment'=>'DateEmployment', 'u.salary'=>'Salary', 'u.color'=>'Color', 'u.api_key'=>'ApiKey',
|
||||||
'u.birth'=>'BirthdayDate',
|
'u.birth'=>'BirthdayDate',
|
||||||
'u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",
|
'u.datec'=>"DateCreation", 'u.tms'=>"DateLastModification",
|
||||||
'u.admin'=>"Administrator",'u.statut'=>'Status','u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion',
|
'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.fk_socpeople'=>"IdContact", 'u.fk_soc'=>"IdCompany", 'u.fk_member'=>"MemberId"
|
||||||
);
|
);
|
||||||
$this->export_TypeFields_array[$r]=array(
|
$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.rowid'=>'Numeric', 'u.login'=>"Text", 'u.lastname'=>"Text", 'u.firstname'=>"Text", 'u.employee'=>'Boolean', 'u.job'=>'Text',
|
||||||
'u.accountancy_code'=>'Text',
|
'u.accountancy_code'=>'Text',
|
||||||
'u.address'=>"Text",'u.zip'=>"Text",'u.town'=>"Text",
|
'u.address'=>"Text", 'u.zip'=>"Text", 'u.town'=>"Text",
|
||||||
'u.office_phone'=>'Text','u.user_mobile'=>'Text','u.office_fax'=>'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.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.fk_user'=>"List:user:login",
|
||||||
'u.birth'=>'Date',
|
'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(
|
$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.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.accountancy_code'=>'user',
|
||||||
'u.address'=>"user",'u.zip'=>"user",'u.town'=>"user",
|
'u.address'=>"user", 'u.zip'=>"user", 'u.town'=>"user",
|
||||||
'u.office_phone'=>'user','u.user_mobile'=>'user','u.office_fax'=>'user',
|
'u.office_phone'=>'user', 'u.user_mobile'=>'user', 'u.office_fax'=>'user',
|
||||||
'u.email'=>'user','u.note'=>"user",'u.signature'=>'user',
|
'u.email'=>'user', 'u.note'=>"user", 'u.signature'=>'user',
|
||||||
'u.fk_user'=>'user','u.thm'=>'user','u.tjm'=>'user','u.weeklyhours'=>'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.dateemployment'=>'user', 'u.salary'=>'user', 'u.color'=>'user', 'u.api_key'=>'user',
|
||||||
'u.birth'=>'user',
|
'u.birth'=>'user',
|
||||||
'u.datec'=>"user",'u.tms'=>"user",
|
'u.datec'=>"user", 'u.tms'=>"user",
|
||||||
'u.admin'=>"user",'u.statut'=>'user','u.datelastlogin'=>'user','u.datepreviouslogin'=>'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.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member"
|
||||||
);
|
);
|
||||||
if (empty($conf->adherent->enabled))
|
if (empty($conf->adherent->enabled))
|
||||||
{
|
{
|
||||||
unset($this->export_fields_array[$r]['u.fk_member']);
|
unset($this->export_fields_array[$r]['u.fk_member']);
|
||||||
unset($this->export_entities_array[$r]['u.fk_member']);
|
unset($this->export_entities_array[$r]['u.fk_member']);
|
||||||
}
|
}
|
||||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
|
$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_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')';
|
||||||
|
|
||||||
// Imports
|
// Imports
|
||||||
$r=0;
|
$r = 0;
|
||||||
|
|
||||||
// Import list of users attributes
|
// Import list of users attributes
|
||||||
$r++;
|
$r++;
|
||||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||||
$this->import_label[$r]='ImportDataset_user_1';
|
$this->import_label[$r] = 'ImportDataset_user_1';
|
||||||
$this->import_icon[$r]='user';
|
$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_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_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(
|
$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.login'=>"Login*", 'u.lastname'=>"Name*", 'u.firstname'=>"Firstname", 'u.employee'=>"Employee*", 'u.job'=>"PostOrFunction", 'u.gender'=>"Gender",
|
||||||
'u.accountancy_code'=>"UserAccountancyCode",
|
'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.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.fk_state'=>"StateId", 'u.fk_country'=>"CountryCode",
|
||||||
'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",
|
'u.office_phone'=>"Phone", 'u.user_mobile'=>"Mobile", 'u.office_fax'=>"Fax",
|
||||||
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature',
|
'u.email'=>"Email", 'u.note'=>"Note", 'u.signature'=>'Signature',
|
||||||
'u.fk_user'=>'HierarchicalResponsible','u.thm'=>'THM','u.tjm'=>'TJM','u.weeklyhours'=>'WeeklyHours',
|
'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.dateemployment'=>'DateEmployment', 'u.salary'=>'Salary', 'u.color'=>'Color', 'u.api_key'=>'ApiKey',
|
||||||
'u.birth'=>'BirthdayDate',
|
'u.birth'=>'BirthdayDate',
|
||||||
'u.datec'=>"DateCreation",
|
'u.datec'=>"DateCreation",
|
||||||
'u.statut'=>'Status'
|
'u.statut'=>'Status'
|
||||||
);
|
);
|
||||||
// Add extra fields
|
// Add extra fields
|
||||||
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
|
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
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;
|
$fieldname = 'extra.'.$obj->name;
|
||||||
$fieldlabel=ucfirst($obj->label);
|
$fieldlabel = ucfirst($obj->label);
|
||||||
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
|
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// End add extra fields
|
// 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_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(
|
$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_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.fk_country'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/ccountry.class.php', 'class'=>'Ccountry', 'method'=>'fetch', 'dict'=>'DictionaryCountry'),
|
||||||
'u.salary'=>array('rule'=>'numeric')
|
'u.salary'=>array('rule'=>'numeric')
|
||||||
);
|
);
|
||||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
//$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.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.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.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]$'
|
'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.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.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.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.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)",
|
'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_exp) $sql .= natural_search('e.ref', $search_ref_exp);
|
||||||
if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv);
|
if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv);
|
||||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
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_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_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_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_datereceipt_end) $sql .= " AND l.date_delivery <= '".$db->idate($search_datereceipt_end)."'";
|
||||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||||
|
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
@ -409,12 +409,12 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_delivery_start?$search_delivery_start:-1, 'search_delivery_start', 0, 0, 1);
|
print $form->selectDate($search_delivery_start ? $search_delivery_start : -1, 'search_delivery_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ' ';
|
print $langs->trans('to').' ';
|
||||||
print $form->selectDate($search_delivery_end?$search_delivery_end:-1, 'search_delivery_end', 0, 0, 1);
|
print $form->selectDate($search_delivery_end ? $search_delivery_end : -1, 'search_delivery_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -430,12 +430,12 @@ if ($resql)
|
|||||||
// Date received
|
// Date received
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_receipt_start?$search_receipt_start:-1, 'search_receipt_start', 0, 0, 1);
|
print $form->selectDate($search_receipt_start ? $search_receipt_start : -1, 'search_receipt_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ' ';
|
print $langs->trans('to').' ';
|
||||||
print $form->selectDate($search_receipt_end?$search_receipt_end:-1, 'search_receipt_end', 0, 0, 1);
|
print $form->selectDate($search_receipt_end ? $search_receipt_end : -1, 'search_receipt_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,21 +35,21 @@ class Export
|
|||||||
*/
|
*/
|
||||||
public $db;
|
public $db;
|
||||||
|
|
||||||
public $array_export_code=array(); // Tableau de "idmodule_numlot"
|
public $array_export_code = array(); // Tableau de "idmodule_numlot"
|
||||||
public $array_export_module=array(); // Tableau de "nom de modules"
|
public $array_export_module = array(); // Tableau de "nom de modules"
|
||||||
public $array_export_label=array(); // Tableau de "libelle de lots"
|
public $array_export_label = array(); // Tableau de "libelle de lots"
|
||||||
public $array_export_sql_start=array(); // Tableau des "requetes sql"
|
public $array_export_sql_start = array(); // Tableau des "requetes sql"
|
||||||
public $array_export_sql_end=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_sql_order = array(); // Tableau des "requetes sql"
|
||||||
|
|
||||||
public $array_export_fields=array(); // Tableau des listes de champ+libelle a exporter
|
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_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_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_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_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_special = array(); // array of special operations to do on field
|
||||||
public $array_export_examplevalues=array(); // array with examples for fields
|
public $array_export_examplevalues = array(); // array with examples for fields
|
||||||
public $array_export_help=array(); // array with tooltip help for fields
|
public $array_export_help = array(); // array with tooltip help for fields
|
||||||
|
|
||||||
// To store export modules
|
// To store export modules
|
||||||
public $hexa; // List of fields in the export profile
|
public $hexa; // List of fields in the export profile
|
||||||
@ -67,7 +67,7 @@ class Export
|
|||||||
*/
|
*/
|
||||||
public function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db=$db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -82,35 +82,35 @@ class Export
|
|||||||
public function load_arrays($user, $filter = '')
|
public function load_arrays($user, $filter = '')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs,$conf,$mysoc;
|
global $langs, $conf, $mysoc;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter);
|
dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter);
|
||||||
|
|
||||||
$i=0;
|
$i = 0;
|
||||||
|
|
||||||
// Define list of modules directories into modulesdir
|
// Define list of modules directories into modulesdir
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
$modulesdir = dolGetModulesDirs();
|
$modulesdir = dolGetModulesDirs();
|
||||||
|
|
||||||
foreach($modulesdir as $dir)
|
foreach ($modulesdir as $dir)
|
||||||
{
|
{
|
||||||
// Search available exports
|
// Search available exports
|
||||||
$handle=@opendir(dol_osencode($dir));
|
$handle = @opendir(dol_osencode($dir));
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
// Search module files
|
// 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))
|
if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i", $file, $reg))
|
||||||
{
|
{
|
||||||
$modulename=$reg[1];
|
$modulename = $reg[1];
|
||||||
|
|
||||||
// Defined if module is enabled
|
// Defined if module is enabled
|
||||||
$enabled=true;
|
$enabled = true;
|
||||||
$part=strtolower(preg_replace('/^mod/i', '', $modulename));
|
$part = strtolower(preg_replace('/^mod/i', '', $modulename));
|
||||||
if ($part == 'propale') $part='propal';
|
if ($part == 'propale') $part = 'propal';
|
||||||
if (empty($conf->$part->enabled)) $enabled=false;
|
if (empty($conf->$part->enabled)) $enabled = false;
|
||||||
|
|
||||||
if ($enabled)
|
if ($enabled)
|
||||||
{
|
{
|
||||||
@ -122,32 +122,32 @@ class Export
|
|||||||
|
|
||||||
if (isset($module->export_code) && is_array($module->export_code))
|
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>';
|
//print $i.'-'.$filter.'-'.$modulename.'-'.join(',',$module->export_code).'<br>';
|
||||||
if ($filter && ($filter != $module->export_code[$r])) continue;
|
if ($filter && ($filter != $module->export_code[$r])) continue;
|
||||||
|
|
||||||
// Test if condition to show are ok
|
// 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
|
// Test if permissions are ok
|
||||||
$bool=true;
|
$bool = true;
|
||||||
if (isset($module->export_permission))
|
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>");
|
//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
|
else
|
||||||
{
|
{
|
||||||
$bool=$user->rights->{$perm[0]}->{$perm[1]};
|
$bool = $user->rights->{$perm[0]}->{$perm[1]};
|
||||||
}
|
}
|
||||||
if ($perm[0]=='user' && $user->admin) $bool=true;
|
if ($perm[0] == 'user' && $user->admin) $bool = true;
|
||||||
if (! $bool) break;
|
if (!$bool) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//print $bool." $perm[0]"."<br>";
|
//print $bool." $perm[0]"."<br>";
|
||||||
@ -156,47 +156,47 @@ class Export
|
|||||||
// if ($bool)
|
// if ($bool)
|
||||||
// {
|
// {
|
||||||
// Charge fichier lang en rapport
|
// Charge fichier lang en rapport
|
||||||
$langtoload=$module->getLangFilesArray();
|
$langtoload = $module->getLangFilesArray();
|
||||||
if (is_array($langtoload))
|
if (is_array($langtoload))
|
||||||
{
|
{
|
||||||
foreach($langtoload as $key)
|
foreach ($langtoload as $key)
|
||||||
{
|
{
|
||||||
$langs->load($key);
|
$langs->load($key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module
|
// Module
|
||||||
$this->array_export_module[$i]=$module;
|
$this->array_export_module[$i] = $module;
|
||||||
// Permission
|
// Permission
|
||||||
$this->array_export_perms[$i]=$bool;
|
$this->array_export_perms[$i] = $bool;
|
||||||
// Icon
|
// 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
|
// 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
|
// 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)
|
// 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
|
// 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)
|
// 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)
|
// 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
|
// 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
|
// 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
|
// 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
|
// Requete sql du dataset
|
||||||
$this->array_export_sql_start[$i]=$module->export_sql_start[$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_end[$i] = $module->export_sql_end[$r];
|
||||||
$this->array_export_sql_order[$i]=$module->export_sql_order[$r];
|
$this->array_export_sql_order[$i] = $module->export_sql_order[$r];
|
||||||
//$this->array_export_sql[$i]=$module->export_sql[$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++;
|
$i++;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
@ -226,42 +226,42 @@ class Export
|
|||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
// Build the sql request
|
// Build the sql request
|
||||||
$sql=$this->array_export_sql_start[$indice];
|
$sql = $this->array_export_sql_start[$indice];
|
||||||
$i=0;
|
$i = 0;
|
||||||
|
|
||||||
//print_r($array_selected);
|
//print_r($array_selected);
|
||||||
foreach ($this->array_export_fields[$indice] as $key => $value)
|
foreach ($this->array_export_fields[$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
|
||||||
if (preg_match('/^none\./', $key)) continue; // A field that must not appears into SQL
|
if (preg_match('/^none\./', $key)) continue; // A field that must not appears into SQL
|
||||||
if ($i > 0) $sql.=', ';
|
if ($i > 0) $sql .= ', ';
|
||||||
else $i++;
|
else $i++;
|
||||||
|
|
||||||
if (strpos($key, ' as ')===false) {
|
if (strpos($key, ' as ') === false) {
|
||||||
$newfield=$key.' as '.str_replace(array('.', '-','(',')'), '_', $key);
|
$newfield = $key.' as '.str_replace(array('.', '-', '(', ')'), '_', $key);
|
||||||
} else {
|
} 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
|
// Add the WHERE part. Filtering into sql if a filtering array is provided
|
||||||
if (is_array($array_filterValue) && !empty($array_filterValue))
|
if (is_array($array_filterValue) && !empty($array_filterValue))
|
||||||
{
|
{
|
||||||
$sqlWhere='';
|
$sqlWhere = '';
|
||||||
// Loop on each condition to add
|
// Loop on each condition to add
|
||||||
foreach ($array_filterValue as $key => $value)
|
foreach ($array_filterValue as $key => $value)
|
||||||
{
|
{
|
||||||
if (preg_match('/GROUP_CONCAT/i', $key)) continue;
|
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
|
// Add the order
|
||||||
$sql.=$this->array_export_sql_order[$indice];
|
$sql .= $this->array_export_sql_order[$indice];
|
||||||
|
|
||||||
// Add the HAVING part.
|
// Add the HAVING part.
|
||||||
if (is_array($array_filterValue) && !empty($array_filterValue))
|
if (is_array($array_filterValue) && !empty($array_filterValue))
|
||||||
@ -269,7 +269,7 @@ class Export
|
|||||||
// Loop on each condition to add
|
// Loop on each condition to add
|
||||||
foreach ($array_filterValue as $key => $value)
|
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
|
// build the input field on depend of the type of file
|
||||||
switch ($InfoFieldList[0]) {
|
switch ($InfoFieldList[0]) {
|
||||||
case 'Text':
|
case 'Text':
|
||||||
if (! (strpos($ValueField, '%') === false))
|
if (!(strpos($ValueField, '%') === false))
|
||||||
$szFilterQuery.=" ".$NameField." LIKE '".$ValueField."'";
|
$szFilterQuery .= " ".$NameField." LIKE '".$ValueField."'";
|
||||||
else
|
else
|
||||||
$szFilterQuery.=" ".$NameField." = '".$ValueField."'";
|
$szFilterQuery .= " ".$NameField." = '".$ValueField."'";
|
||||||
break;
|
break;
|
||||||
case 'Date':
|
case 'Date':
|
||||||
if (strpos($ValueField, "+") > 0)
|
if (strpos($ValueField, "+") > 0)
|
||||||
{
|
{
|
||||||
// mode plage
|
// mode plage
|
||||||
$ValueArray = explode("+", $ValueField);
|
$ValueArray = explode("+", $ValueField);
|
||||||
$szFilterQuery ="(".$this->conditionDate($NameField, trim($ValueArray[0]), ">=");
|
$szFilterQuery = "(".$this->conditionDate($NameField, trim($ValueArray[0]), ">=");
|
||||||
$szFilterQuery.=" AND ".$this->conditionDate($NameField, trim($ValueArray[1]), "<=").")";
|
$szFilterQuery .= " AND ".$this->conditionDate($NameField, trim($ValueArray[1]), "<=").")";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (is_numeric(substr($ValueField, 0, 1)))
|
if (is_numeric(substr($ValueField, 0, 1)))
|
||||||
$szFilterQuery=$this->conditionDate($NameField, trim($ValueField), "=");
|
$szFilterQuery = $this->conditionDate($NameField, trim($ValueField), "=");
|
||||||
else
|
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;
|
break;
|
||||||
case 'Duree':
|
case 'Duree':
|
||||||
@ -322,29 +322,29 @@ class Export
|
|||||||
{
|
{
|
||||||
// mode plage
|
// mode plage
|
||||||
$ValueArray = explode("+", $ValueField);
|
$ValueArray = explode("+", $ValueField);
|
||||||
$szFilterQuery ="(".$NameField.">=".$ValueArray[0];
|
$szFilterQuery = "(".$NameField.">=".$ValueArray[0];
|
||||||
$szFilterQuery.=" AND ".$NameField."<=".$ValueArray[1].")";
|
$szFilterQuery .= " AND ".$NameField."<=".$ValueArray[1].")";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (is_numeric(substr($ValueField, 0, 1)))
|
if (is_numeric(substr($ValueField, 0, 1)))
|
||||||
$szFilterQuery=" ".$NameField."=".$ValueField;
|
$szFilterQuery = " ".$NameField."=".$ValueField;
|
||||||
else
|
else
|
||||||
$szFilterQuery=" ".$NameField.substr($ValueField, 0, 1).substr($ValueField, 1);
|
$szFilterQuery = " ".$NameField.substr($ValueField, 0, 1).substr($ValueField, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Boolean':
|
case 'Boolean':
|
||||||
$szFilterQuery=" ".$NameField."=".(is_numeric($ValueField) ? $ValueField : ($ValueField =='yes' ? 1: 0) );
|
$szFilterQuery = " ".$NameField."=".(is_numeric($ValueField) ? $ValueField : ($ValueField == 'yes' ? 1 : 0));
|
||||||
break;
|
break;
|
||||||
case 'Status':
|
case 'Status':
|
||||||
case 'List':
|
case 'List':
|
||||||
if (is_numeric($ValueField))
|
if (is_numeric($ValueField))
|
||||||
$szFilterQuery=" ".$NameField."=".$ValueField;
|
$szFilterQuery = " ".$NameField."=".$ValueField;
|
||||||
else {
|
else {
|
||||||
if (! (strpos($ValueField, '%') === false))
|
if (!(strpos($ValueField, '%') === false))
|
||||||
$szFilterQuery=" ".$NameField." LIKE '".$ValueField."'";
|
$szFilterQuery = " ".$NameField." LIKE '".$ValueField."'";
|
||||||
else
|
else
|
||||||
$szFilterQuery=" ".$NameField." = '".$ValueField."'";
|
$szFilterQuery = " ".$NameField." = '".$ValueField."'";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -365,9 +365,9 @@ class Export
|
|||||||
public function conditionDate($Field, $Value, $Sens)
|
public function conditionDate($Field, $Value, $Sens)
|
||||||
{
|
{
|
||||||
// TODO date_format is forbidden, not performant and not portable. Use instead BETWEEN
|
// TODO date_format is forbidden, not performant and not portable. Use instead BETWEEN
|
||||||
if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$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."'";
|
elseif (strlen($Value) == 6) $Condition = " date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'";
|
||||||
else $Condition=" date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value;
|
else $Condition = " date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value;
|
||||||
return $Condition;
|
return $Condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,9 +383,9 @@ class Export
|
|||||||
public function build_filterField($TypeField, $NameField, $ValueField)
|
public function build_filterField($TypeField, $NameField, $ValueField)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf,$langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$szFilterField='';
|
$szFilterField = '';
|
||||||
$InfoFieldList = explode(":", $TypeField);
|
$InfoFieldList = explode(":", $TypeField);
|
||||||
|
|
||||||
// build the input field on depend of the type of file
|
// build the input field on depend of the type of file
|
||||||
@ -393,31 +393,31 @@ class Export
|
|||||||
{
|
{
|
||||||
case 'Text':
|
case 'Text':
|
||||||
case 'Date':
|
case 'Date':
|
||||||
$szFilterField='<input type="text" name="'.$NameField.'" value="'.$ValueField.'">';
|
$szFilterField = '<input type="text" name="'.$NameField.'" value="'.$ValueField.'">';
|
||||||
break;
|
break;
|
||||||
case 'Duree':
|
case 'Duree':
|
||||||
case 'Numeric':
|
case 'Numeric':
|
||||||
case 'Number':
|
case 'Number':
|
||||||
// Must be a string text to allow to use comparison strings like "<= 999"
|
// 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;
|
break;
|
||||||
case 'Status':
|
case 'Status':
|
||||||
$szFilterField='<input type="number" size="6" name="'.$NameField.'" value="'.$ValueField.'">';
|
$szFilterField = '<input type="number" size="6" name="'.$NameField.'" value="'.$ValueField.'">';
|
||||||
break;
|
break;
|
||||||
case 'Boolean':
|
case 'Boolean':
|
||||||
$szFilterField='<select name="'.$NameField.'" class="flat">';
|
$szFilterField = '<select name="'.$NameField.'" class="flat">';
|
||||||
$szFilterField.='<option ';
|
$szFilterField .= '<option ';
|
||||||
if ($ValueField=='') $szFilterField.=' selected ';
|
if ($ValueField == '') $szFilterField .= ' selected ';
|
||||||
$szFilterField.=' value=""> </option>';
|
$szFilterField .= ' value=""> </option>';
|
||||||
|
|
||||||
$szFilterField.='<option ';
|
$szFilterField .= '<option ';
|
||||||
if ($ValueField=='yes' || $ValueField == '1') $szFilterField.=' selected ';
|
if ($ValueField == 'yes' || $ValueField == '1') $szFilterField .= ' selected ';
|
||||||
$szFilterField.=' value="1">'.yn(1).'</option>';
|
$szFilterField .= ' value="1">'.yn(1).'</option>';
|
||||||
|
|
||||||
$szFilterField.='<option ';
|
$szFilterField .= '<option ';
|
||||||
if ($ValueField=='no' || $ValueField=='0') $szFilterField.=' selected ';
|
if ($ValueField == 'no' || $ValueField == '0') $szFilterField .= ' selected ';
|
||||||
$szFilterField.=' value="0">'.yn(0).'</option>';
|
$szFilterField .= ' value="0">'.yn(0).'</option>';
|
||||||
$szFilterField.="</select>";
|
$szFilterField .= "</select>";
|
||||||
break;
|
break;
|
||||||
case 'List':
|
case 'List':
|
||||||
// 0 : Type du champ
|
// 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.
|
// 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().
|
// 4 : Name of element for getEntity().
|
||||||
|
|
||||||
if (! empty($InfoFieldList[3]))
|
if (!empty($InfoFieldList[3]))
|
||||||
$keyList=$InfoFieldList[3];
|
$keyList = $InfoFieldList[3];
|
||||||
else
|
else
|
||||||
$keyList='rowid';
|
$keyList = 'rowid';
|
||||||
$sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3])?'':', '.$InfoFieldList[3].' as code');
|
$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_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';
|
if ($InfoFieldList[1] == 'c_country') $sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label, code as code';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[1];
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[1];
|
||||||
if (! empty($InfoFieldList[4])) {
|
if (!empty($InfoFieldList[4])) {
|
||||||
$sql.= ' WHERE entity IN ('.getEntity($InfoFieldList[4]).')';
|
$sql .= ' WHERE entity IN ('.getEntity($InfoFieldList[4]).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$szFilterField='<select class="flat" name="'.$NameField.'">';
|
$szFilterField = '<select class="flat" name="'.$NameField.'">';
|
||||||
$szFilterField.='<option value="0"> </option>';
|
$szFilterField .= '<option value="0"> </option>';
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -458,30 +458,30 @@ class Export
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//var_dump($InfoFieldList[1]);
|
//var_dump($InfoFieldList[1]);
|
||||||
$labeltoshow=dol_trunc($obj->label, 18);
|
$labeltoshow = dol_trunc($obj->label, 18);
|
||||||
if ($InfoFieldList[1] == 'c_stcomm')
|
if ($InfoFieldList[1] == 'c_stcomm')
|
||||||
{
|
{
|
||||||
$langs->load("companies");
|
$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')
|
if ($InfoFieldList[1] == 'c_country')
|
||||||
{
|
{
|
||||||
//var_dump($sql);
|
//var_dump($sql);
|
||||||
$langs->load("dict");
|
$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)
|
if (!empty($ValueField) && $ValueField == $obj->rowid)
|
||||||
{
|
{
|
||||||
$szFilterField.='<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
|
$szFilterField .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$szFilterField.='<option value="'.$obj->rowid.'" >'.$labeltoshow.'</option>';
|
$szFilterField .= '<option value="'.$obj->rowid.'" >'.$labeltoshow.'</option>';
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$szFilterField.="</select>";
|
$szFilterField .= "</select>";
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
}
|
}
|
||||||
@ -502,12 +502,12 @@ class Export
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$szMsg='';
|
$szMsg = '';
|
||||||
$InfoFieldList = explode(":", $TypeField);
|
$InfoFieldList = explode(":", $TypeField);
|
||||||
// build the input field on depend of the type of file
|
// build the input field on depend of the type of file
|
||||||
switch ($InfoFieldList[0]) {
|
switch ($InfoFieldList[0]) {
|
||||||
case 'Text':
|
case 'Text':
|
||||||
$szMsg= $langs->trans('ExportStringFilter');
|
$szMsg = $langs->trans('ExportStringFilter');
|
||||||
break;
|
break;
|
||||||
case 'Date':
|
case 'Date':
|
||||||
$szMsg = $langs->trans('ExportDateFilter');
|
$szMsg = $langs->trans('ExportDateFilter');
|
||||||
@ -542,37 +542,37 @@ class Export
|
|||||||
public function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery = '')
|
public function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery = '')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf,$langs,$mysoc;
|
global $conf, $langs, $mysoc;
|
||||||
|
|
||||||
$indice=0;
|
$indice = 0;
|
||||||
asort($array_selected);
|
asort($array_selected);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::".__FUNCTION__." ".$model.", ".$datatoexport.", ".implode(",", $array_selected));
|
dol_syslog(get_class($this)."::".__FUNCTION__." ".$model.", ".$datatoexport.", ".implode(",", $array_selected));
|
||||||
|
|
||||||
// Check parameters or context properties
|
// 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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creation of class to export using model ExportXXX
|
// 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";
|
$file = "export_".$model.".modules.php";
|
||||||
$classname = "Export".$model;
|
$classname = "Export".$model;
|
||||||
require_once $dir.$file;
|
require_once $dir.$file;
|
||||||
$objmodel = new $classname($this->db);
|
$objmodel = new $classname($this->db);
|
||||||
|
|
||||||
if (! empty($sqlquery)) $sql = $sqlquery;
|
if (!empty($sqlquery)) $sql = $sqlquery;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Define value for indice from $datatoexport
|
// Define value for indice from $datatoexport
|
||||||
$foundindice=0;
|
$foundindice = 0;
|
||||||
foreach($this->array_export_code as $key => $dataset)
|
foreach ($this->array_export_code as $key => $dataset)
|
||||||
{
|
{
|
||||||
if ($datatoexport == $dataset)
|
if ($datatoexport == $dataset)
|
||||||
{
|
{
|
||||||
$indice=$key;
|
$indice = $key;
|
||||||
$foundindice++;
|
$foundindice++;
|
||||||
//print "Found indice = ".$indice." for dataset=".$datatoexport."\n";
|
//print "Found indice = ".$indice." for dataset=".$datatoexport."\n";
|
||||||
break;
|
break;
|
||||||
@ -580,31 +580,31 @@ class Export
|
|||||||
}
|
}
|
||||||
if (empty($foundindice))
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
$sql=$this->build_sql($indice, $array_selected, $array_filterValue);
|
$sql = $this->build_sql($indice, $array_selected, $array_filterValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the sql
|
// Run the sql
|
||||||
$this->sqlusedforexport=$sql;
|
$this->sqlusedforexport = $sql;
|
||||||
dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG);
|
dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
//$this->array_export_label[$indice]
|
//$this->array_export_label[$indice]
|
||||||
if ($conf->global->EXPORT_PREFIX_SPEC)
|
if ($conf->global->EXPORT_PREFIX_SPEC)
|
||||||
$filename=$conf->global->EXPORT_PREFIX_SPEC."_".$datatoexport;
|
$filename = $conf->global->EXPORT_PREFIX_SPEC."_".$datatoexport;
|
||||||
else
|
else
|
||||||
$filename="export_".$datatoexport;
|
$filename = "export_".$datatoexport;
|
||||||
$filename.='.'.$objmodel->getDriverExtension();
|
$filename .= '.'.$objmodel->getDriverExtension();
|
||||||
$dirname=$conf->export->dir_temp.'/'.$user->id;
|
$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
|
$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
|
// Open file
|
||||||
dol_mkdir($dirname);
|
dol_mkdir($dirname);
|
||||||
$result=$objmodel->open_file($dirname."/".$filename, $outputlangs);
|
$result = $objmodel->open_file($dirname."/".$filename, $outputlangs);
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
@ -617,61 +617,61 @@ class Export
|
|||||||
while ($obj = $this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
// Process special operations
|
// 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)
|
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
|
// 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=$this->array_export_alias[$indice][$key];
|
||||||
$alias=str_replace(array('.', '-','(',')'), '_', $key);
|
$alias = str_replace(array('.', '-', '(', ')'), '_', $key);
|
||||||
if ($obj->$alias < 0) $obj->$alias='';
|
if ($obj->$alias < 0) $obj->$alias = '';
|
||||||
}
|
}
|
||||||
// Operation ZEROIFNEG
|
// 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=$this->array_export_alias[$indice][$key];
|
||||||
$alias=str_replace(array('.', '-','(',')'), '_', $key);
|
$alias = str_replace(array('.', '-', '(', ')'), '_', $key);
|
||||||
if ($obj->$alias < 0) $obj->$alias='0';
|
if ($obj->$alias < 0) $obj->$alias = '0';
|
||||||
}
|
}
|
||||||
// Operation GETNUMOPENDAYS (for Holiday module)
|
// 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';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
//$alias=$this->array_export_alias[$indice][$key];
|
//$alias=$this->array_export_alias[$indice][$key];
|
||||||
$alias=str_replace(array('.', '-','(',')'), '_', $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);
|
$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
|
// 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=$this->array_export_alias[$indice][$key];
|
||||||
$alias=str_replace(array('.', '-','(',')'), '_', $key);
|
$alias = str_replace(array('.', '-', '(', ')'), '_', $key);
|
||||||
$remaintopay='';
|
$remaintopay = '';
|
||||||
if ($obj->f_rowid > 0)
|
if ($obj->f_rowid > 0)
|
||||||
{
|
{
|
||||||
global $tmpobjforcomputecall;
|
global $tmpobjforcomputecall;
|
||||||
if (! is_object($tmpobjforcomputecall))
|
if (!is_object($tmpobjforcomputecall))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
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->id = $obj->f_rowid;
|
||||||
$tmpobjforcomputecall->total_ttc = $obj->f_total_ttc;
|
$tmpobjforcomputecall->total_ttc = $obj->f_total_ttc;
|
||||||
$remaintopay=$tmpobjforcomputecall->getRemainToPay();
|
$remaintopay = $tmpobjforcomputecall->getRemainToPay();
|
||||||
}
|
}
|
||||||
$obj->$alias=$remaintopay;
|
$obj->$alias = $remaintopay;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO FIXME Export of compute field does not work. $obj containt $obj->alias_field and formulat will contains $obj->field
|
// 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];
|
$computestring = $this->array_export_special[$indice][$key];
|
||||||
$tmp=dol_eval($computestring, 1, 0);
|
$tmp = dol_eval($computestring, 1, 0);
|
||||||
$obj->$alias=$tmp;
|
$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;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -690,14 +690,14 @@ class Export
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$objmodel->error;
|
$this->error = $objmodel->error;
|
||||||
dol_syslog("Export::build_file Error: ".$this->error, LOG_ERR);
|
dol_syslog("Export::build_file Error: ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error()." - sql=".$sql;
|
$this->error = $this->db->error()." - sql=".$sql;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -716,24 +716,24 @@ class Export
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$filter='';
|
$filter = '';
|
||||||
|
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'export_model (';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'export_model (';
|
||||||
$sql.= 'label,';
|
$sql .= 'label,';
|
||||||
$sql.= 'type,';
|
$sql .= 'type,';
|
||||||
$sql.= 'field,';
|
$sql .= 'field,';
|
||||||
$sql.= 'fk_user,';
|
$sql .= 'fk_user,';
|
||||||
$sql.= 'filter';
|
$sql .= 'filter';
|
||||||
$sql.= ') VALUES (';
|
$sql .= ') VALUES (';
|
||||||
$sql.= "'".$this->db->escape($this->model_name)."',";
|
$sql .= "'".$this->db->escape($this->model_name)."',";
|
||||||
$sql.= "'".$this->db->escape($this->datatoexport)."',";
|
$sql .= "'".$this->db->escape($this->datatoexport)."',";
|
||||||
$sql.= "'".$this->db->escape($this->hexa)."',";
|
$sql .= "'".$this->db->escape($this->hexa)."',";
|
||||||
$sql.= "'".$user->id."',";
|
$sql .= "'".$user->id."',";
|
||||||
$sql.= "'".$this->db->escape($this->hexafiltervalue)."'";
|
$sql .= "'".$this->db->escape($this->hexafiltervalue)."'";
|
||||||
$sql.= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -741,8 +741,8 @@ class Export
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$this->errno=$this->db->lasterrno();
|
$this->errno = $this->db->lasterrno();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -757,8 +757,8 @@ class Export
|
|||||||
public function fetch($id)
|
public function fetch($id)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT em.rowid, em.label, em.type, em.field, em.filter';
|
$sql = 'SELECT em.rowid, em.label, em.type, em.field, em.filter';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'export_model as em';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'export_model as em';
|
||||||
$sql.= ' WHERE em.rowid = '.$id;
|
$sql .= ' WHERE em.rowid = '.$id;
|
||||||
|
|
||||||
dol_syslog("Export::fetch", LOG_DEBUG);
|
dol_syslog("Export::fetch", LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
@ -778,7 +778,7 @@ class Export
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error="ModelNotFound";
|
$this->error = "ModelNotFound";
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -800,20 +800,20 @@ class Export
|
|||||||
public function delete($user, $notrigger = 0)
|
public function delete($user, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error=0;
|
$error = 0;
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."export_model";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."export_model";
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql .= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) { $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
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
// want this action call a trigger.
|
// want this action call a trigger.
|
||||||
@ -830,13 +830,13 @@ class Export
|
|||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
foreach($this->errors as $errmsg)
|
foreach ($this->errors as $errmsg)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1*$error;
|
return -1 * $error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -858,8 +858,8 @@ class Export
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$sql = "SELECT em.rowid, em.field, em.label, em.type, em.filter";
|
$sql = "SELECT em.rowid, em.field, em.label, em.type, em.filter";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."export_model as em";
|
$sql .= " FROM ".MAIN_DB_PREFIX."export_model as em";
|
||||||
$sql.= " ORDER BY rowid";
|
$sql .= " ORDER BY rowid";
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -877,12 +877,12 @@ class Export
|
|||||||
print $this->array_export_module[$keyModel]->getName().' - ';
|
print $this->array_export_module[$keyModel]->getName().' - ';
|
||||||
// recuperation du nom de l'export
|
// recuperation du nom de l'export
|
||||||
|
|
||||||
$string=$langs->trans($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 ($string != $this->array_export_label[$keyModel] ? $string : $this->array_export_label[$keyModel]);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
//print '<td>'.$obj->type.$keyModel.'</td>';
|
//print '<td>'.$obj->type.$keyModel.'</td>';
|
||||||
print '<td>'.str_replace(',', ' , ', $obj->field).'</td>';
|
print '<td>'.str_replace(',', ' , ', $obj->field).'</td>';
|
||||||
if (! empty($obj->filter)) {
|
if (!empty($obj->filter)) {
|
||||||
$filter = json_decode($obj->filter, true);
|
$filter = json_decode($obj->filter, true);
|
||||||
print '<td>'.str_replace(',', ' , ', $filter['field']).'</td>';
|
print '<td>'.str_replace(',', ' , ', $filter['field']).'</td>';
|
||||||
print '<td>'.str_replace(',', ' , ', $filter['value']).'</td>';
|
print '<td>'.str_replace(',', ' , ', $filter['value']).'</td>';
|
||||||
|
|||||||
@ -46,27 +46,27 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
/**
|
/**
|
||||||
* @var string ID to identify managed object
|
* @var string ID to identify managed object
|
||||||
*/
|
*/
|
||||||
public $element='invoice_supplier';
|
public $element = 'invoice_supplier';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Name of table without prefix where object is stored
|
* @var string Name of table without prefix where object is stored
|
||||||
*/
|
*/
|
||||||
public $table_element='facture_fourn';
|
public $table_element = 'facture_fourn';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Name of subtable line
|
* @var int Name of subtable line
|
||||||
*/
|
*/
|
||||||
public $table_element_line='facture_fourn_det';
|
public $table_element_line = 'facture_fourn_det';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Field with ID of parent key if this field has a parent
|
* @var int Field with ID of parent key if this field has a parent
|
||||||
*/
|
*/
|
||||||
public $fk_element='fk_facture_fourn';
|
public $fk_element = 'fk_facture_fourn';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||||
*/
|
*/
|
||||||
public $picto='bill';
|
public $picto = 'bill';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
@ -198,7 +198,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
public $location_incoterms;
|
public $location_incoterms;
|
||||||
public $label_incoterms; //Used into tooltip
|
public $label_incoterms; //Used into tooltip
|
||||||
|
|
||||||
public $extraparams=array();
|
public $extraparams = array();
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
/**
|
/**
|
||||||
@ -317,86 +317,86 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if (! $remise) $remise = 0 ;
|
if (!$remise) $remise = 0;
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn (";
|
||||||
$sql.= "ref";
|
$sql .= "ref";
|
||||||
$sql.= ", ref_supplier";
|
$sql .= ", ref_supplier";
|
||||||
$sql.= ", entity";
|
$sql .= ", entity";
|
||||||
$sql.= ", type";
|
$sql .= ", type";
|
||||||
$sql.= ", libelle";
|
$sql .= ", libelle";
|
||||||
$sql.= ", fk_soc";
|
$sql .= ", fk_soc";
|
||||||
$sql.= ", datec";
|
$sql .= ", datec";
|
||||||
$sql.= ", datef";
|
$sql .= ", datef";
|
||||||
$sql.= ", fk_projet";
|
$sql .= ", fk_projet";
|
||||||
$sql.= ", fk_cond_reglement";
|
$sql .= ", fk_cond_reglement";
|
||||||
$sql.= ", fk_mode_reglement";
|
$sql .= ", fk_mode_reglement";
|
||||||
$sql.= ", fk_account";
|
$sql .= ", fk_account";
|
||||||
$sql.= ", note_private";
|
$sql .= ", note_private";
|
||||||
$sql.= ", note_public";
|
$sql .= ", note_public";
|
||||||
$sql.= ", fk_user_author";
|
$sql .= ", fk_user_author";
|
||||||
$sql.= ", date_lim_reglement";
|
$sql .= ", date_lim_reglement";
|
||||||
$sql.= ", fk_incoterms, location_incoterms";
|
$sql .= ", fk_incoterms, location_incoterms";
|
||||||
$sql.= ", fk_multicurrency";
|
$sql .= ", fk_multicurrency";
|
||||||
$sql.= ", multicurrency_code";
|
$sql .= ", multicurrency_code";
|
||||||
$sql.= ", multicurrency_tx";
|
$sql .= ", multicurrency_tx";
|
||||||
$sql.= ", fk_facture_source";
|
$sql .= ", fk_facture_source";
|
||||||
$sql.= ")";
|
$sql .= ")";
|
||||||
$sql.= " VALUES (";
|
$sql .= " VALUES (";
|
||||||
$sql.= "'(PROV)'";
|
$sql .= "'(PROV)'";
|
||||||
$sql.= ", '".$this->db->escape($this->ref_supplier)."'";
|
$sql .= ", '".$this->db->escape($this->ref_supplier)."'";
|
||||||
$sql.= ", ".$conf->entity;
|
$sql .= ", ".$conf->entity;
|
||||||
$sql.= ", '".$this->db->escape($this->type)."'";
|
$sql .= ", '".$this->db->escape($this->type)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->label?$this->label:$this->libelle)."'";
|
$sql .= ", '".$this->db->escape($this->label ? $this->label : $this->libelle)."'";
|
||||||
$sql.= ", ".$this->socid;
|
$sql .= ", ".$this->socid;
|
||||||
$sql.= ", '".$this->db->idate($now)."'";
|
$sql .= ", '".$this->db->idate($now)."'";
|
||||||
$sql.= ", '".$this->db->idate($this->date)."'";
|
$sql .= ", '".$this->db->idate($this->date)."'";
|
||||||
$sql.= ", ".($this->fk_project > 0 ? $this->fk_project:"null");
|
$sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null");
|
||||||
$sql.= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id:"null");
|
$sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : "null");
|
||||||
$sql.= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id:"null");
|
$sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "null");
|
||||||
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
|
||||||
$sql.= ", '".$this->db->escape($this->note_private)."'";
|
$sql .= ", '".$this->db->escape($this->note_private)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->note_public)."'";
|
$sql .= ", '".$this->db->escape($this->note_public)."'";
|
||||||
$sql.= ", ".$user->id.",";
|
$sql .= ", ".$user->id.",";
|
||||||
$sql.= $this->date_echeance!=''?"'".$this->db->idate($this->date_echeance)."'":"null";
|
$sql .= $this->date_echeance != '' ? "'".$this->db->idate($this->date_echeance)."'" : "null";
|
||||||
$sql.= ", ".(int) $this->fk_incoterms;
|
$sql .= ", ".(int) $this->fk_incoterms;
|
||||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
$sql .= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||||
$sql.= ", ".(int) $this->fk_multicurrency;
|
$sql .= ", ".(int) $this->fk_multicurrency;
|
||||||
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
|
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
|
||||||
$sql.= ", ".(double) $this->multicurrency_tx;
|
$sql .= ", ".(double) $this->multicurrency_tx;
|
||||||
$sql.= ", ".(isset($this->fk_facture_source)?$this->fk_facture_source:"NULL");
|
$sql .= ", ".(isset($this->fk_facture_source) ? $this->fk_facture_source : "NULL");
|
||||||
$sql.= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn');
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn');
|
||||||
|
|
||||||
// Update ref with new one
|
// Update ref with new one
|
||||||
$this->ref='(PROV'.$this->id.')';
|
$this->ref = '(PROV'.$this->id.')';
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture_fourn SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture_fourn SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) $error++;
|
if (!$resql) $error++;
|
||||||
|
|
||||||
if (! empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
|
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
|
||||||
{
|
{
|
||||||
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add object linked
|
// Add object linked
|
||||||
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
|
||||||
{
|
{
|
||||||
foreach($this->linked_objects as $origin => $tmp_origin_id)
|
foreach ($this->linked_objects as $origin => $tmp_origin_id)
|
||||||
{
|
{
|
||||||
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||||
{
|
{
|
||||||
foreach($tmp_origin_id as $origin_id)
|
foreach ($tmp_origin_id as $origin_id)
|
||||||
{
|
{
|
||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (! $ret)
|
if (!$ret)
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$error++;
|
$error++;
|
||||||
@ -501,28 +501,28 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update total price
|
// Update total price
|
||||||
$result=$this->update_price();
|
$result = $this->update_price();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
{
|
{
|
||||||
$result=$this->insertExtraFields(); // This also set $this->error or $this->errors if errors are found
|
$result = $this->insertExtraFields(); // This also set $this->error or $this->errors if errors are found
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('BILL_SUPPLIER_CREATE', $user);
|
$result = $this->call_trigger('BILL_SUPPLIER_CREATE', $user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
@ -569,57 +569,57 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " t.rowid,";
|
$sql .= " t.rowid,";
|
||||||
$sql.= " t.ref,";
|
$sql .= " t.ref,";
|
||||||
$sql.= " t.ref_supplier,";
|
$sql .= " t.ref_supplier,";
|
||||||
$sql.= " t.entity,";
|
$sql .= " t.entity,";
|
||||||
$sql.= " t.type,";
|
$sql .= " t.type,";
|
||||||
$sql.= " t.fk_soc,";
|
$sql .= " t.fk_soc,";
|
||||||
$sql.= " t.datec,";
|
$sql .= " t.datec,";
|
||||||
$sql.= " t.datef,";
|
$sql .= " t.datef,";
|
||||||
$sql.= " t.tms,";
|
$sql .= " t.tms,";
|
||||||
$sql.= " t.libelle as label,";
|
$sql .= " t.libelle as label,";
|
||||||
$sql.= " t.paye,";
|
$sql .= " t.paye,";
|
||||||
$sql.= " t.amount,";
|
$sql .= " t.amount,";
|
||||||
$sql.= " t.remise,";
|
$sql .= " t.remise,";
|
||||||
$sql.= " t.close_code,";
|
$sql .= " t.close_code,";
|
||||||
$sql.= " t.close_note,";
|
$sql .= " t.close_note,";
|
||||||
$sql.= " t.tva,";
|
$sql .= " t.tva,";
|
||||||
$sql.= " t.localtax1,";
|
$sql .= " t.localtax1,";
|
||||||
$sql.= " t.localtax2,";
|
$sql .= " t.localtax2,";
|
||||||
$sql.= " t.total_ht,";
|
$sql .= " t.total_ht,";
|
||||||
$sql.= " t.total_tva,";
|
$sql .= " t.total_tva,";
|
||||||
$sql.= " t.total_ttc,";
|
$sql .= " t.total_ttc,";
|
||||||
$sql.= " t.fk_statut,";
|
$sql .= " t.fk_statut,";
|
||||||
$sql.= " t.fk_user_author,";
|
$sql .= " t.fk_user_author,";
|
||||||
$sql.= " t.fk_user_valid,";
|
$sql .= " t.fk_user_valid,";
|
||||||
$sql.= " t.fk_facture_source,";
|
$sql .= " t.fk_facture_source,";
|
||||||
$sql.= " t.fk_projet as fk_project,";
|
$sql .= " t.fk_projet as fk_project,";
|
||||||
$sql.= " t.fk_cond_reglement,";
|
$sql .= " t.fk_cond_reglement,";
|
||||||
$sql.= " t.fk_account,";
|
$sql .= " t.fk_account,";
|
||||||
$sql.= " t.fk_mode_reglement,";
|
$sql .= " t.fk_mode_reglement,";
|
||||||
$sql.= " t.date_lim_reglement,";
|
$sql .= " t.date_lim_reglement,";
|
||||||
$sql.= " t.note_private,";
|
$sql .= " t.note_private,";
|
||||||
$sql.= " t.note_public,";
|
$sql .= " t.note_public,";
|
||||||
$sql.= " t.model_pdf,";
|
$sql .= " t.model_pdf,";
|
||||||
$sql.= " t.import_key,";
|
$sql .= " t.import_key,";
|
||||||
$sql.= " t.extraparams,";
|
$sql .= " t.extraparams,";
|
||||||
$sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,";
|
$sql .= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,";
|
||||||
$sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle,";
|
$sql .= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle,";
|
||||||
$sql.= ' s.nom as socnom, s.rowid as socid,';
|
$sql .= ' s.nom as socnom, s.rowid as socid,';
|
||||||
$sql.= ' t.fk_incoterms, t.location_incoterms,';
|
$sql .= ' t.fk_incoterms, t.location_incoterms,';
|
||||||
$sql.= " i.libelle as label_incoterms,";
|
$sql .= " i.libelle as label_incoterms,";
|
||||||
$sql.= ' t.fk_multicurrency, t.multicurrency_code, t.multicurrency_tx, t.multicurrency_total_ht, t.multicurrency_total_tva, t.multicurrency_total_ttc';
|
$sql .= ' t.fk_multicurrency, t.multicurrency_code, t.multicurrency_tx, t.multicurrency_total_ht, t.multicurrency_total_tva, t.multicurrency_total_ttc';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t';
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON t.fk_cond_reglement = cr.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON t.fk_cond_reglement = cr.rowid";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid';
|
||||||
if ($id) $sql.= " WHERE t.rowid=".$id;
|
if ($id) $sql .= " WHERE t.rowid=".$id;
|
||||||
if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."' AND t.entity IN (".getEntity('supplier_invoice').")";
|
if ($ref) $sql .= " WHERE t.ref='".$this->db->escape($ref)."' AND t.entity IN (".getEntity('supplier_invoice').")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($resql))
|
if ($this->db->num_rows($resql))
|
||||||
@ -627,11 +627,11 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->ref?$obj->ref:$obj->rowid; // We take rowid if ref is empty for backward compatibility
|
$this->ref = $obj->ref ? $obj->ref : $obj->rowid; // We take rowid if ref is empty for backward compatibility
|
||||||
|
|
||||||
$this->ref_supplier = $obj->ref_supplier;
|
$this->ref_supplier = $obj->ref_supplier;
|
||||||
$this->entity = $obj->entity;
|
$this->entity = $obj->entity;
|
||||||
$this->type = empty($obj->type)? self::TYPE_STANDARD:$obj->type;
|
$this->type = empty($obj->type) ? self::TYPE_STANDARD : $obj->type;
|
||||||
$this->fk_soc = $obj->fk_soc;
|
$this->fk_soc = $obj->fk_soc;
|
||||||
$this->datec = $this->db->jdate($obj->datec);
|
$this->datec = $this->db->jdate($obj->datec);
|
||||||
$this->date = $this->db->jdate($obj->datef);
|
$this->date = $this->db->jdate($obj->datef);
|
||||||
@ -832,40 +832,40 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
public function update($user = null, $notrigger = 0)
|
public function update($user = null, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error=0;
|
$error = 0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($this->type)) $this->type= self::TYPE_STANDARD;
|
if (empty($this->type)) $this->type = self::TYPE_STANDARD;
|
||||||
if (isset($this->ref)) $this->ref=trim($this->ref);
|
if (isset($this->ref)) $this->ref = trim($this->ref);
|
||||||
if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier);
|
if (isset($this->ref_supplier)) $this->ref_supplier = trim($this->ref_supplier);
|
||||||
if (isset($this->entity)) $this->entity=trim($this->entity);
|
if (isset($this->entity)) $this->entity = trim($this->entity);
|
||||||
if (isset($this->type)) $this->type=trim($this->type);
|
if (isset($this->type)) $this->type = trim($this->type);
|
||||||
if (isset($this->fk_soc)) $this->fk_soc=trim($this->fk_soc);
|
if (isset($this->fk_soc)) $this->fk_soc = trim($this->fk_soc);
|
||||||
if (isset($this->label)) $this->label=trim($this->label);
|
if (isset($this->label)) $this->label = trim($this->label);
|
||||||
if (isset($this->libelle)) $this->libelle=trim($this->libelle); // deprecated
|
if (isset($this->libelle)) $this->libelle = trim($this->libelle); // deprecated
|
||||||
if (isset($this->paye)) $this->paye=trim($this->paye);
|
if (isset($this->paye)) $this->paye = trim($this->paye);
|
||||||
if (isset($this->amount)) $this->amount=trim($this->amount);
|
if (isset($this->amount)) $this->amount = trim($this->amount);
|
||||||
if (isset($this->remise)) $this->remise=trim($this->remise);
|
if (isset($this->remise)) $this->remise = trim($this->remise);
|
||||||
if (isset($this->close_code)) $this->close_code=trim($this->close_code);
|
if (isset($this->close_code)) $this->close_code = trim($this->close_code);
|
||||||
if (isset($this->close_note)) $this->close_note=trim($this->close_note);
|
if (isset($this->close_note)) $this->close_note = trim($this->close_note);
|
||||||
if (isset($this->tva)) $this->tva=trim($this->tva);
|
if (isset($this->tva)) $this->tva = trim($this->tva);
|
||||||
if (isset($this->localtax1)) $this->localtax1=trim($this->localtax1);
|
if (isset($this->localtax1)) $this->localtax1 = trim($this->localtax1);
|
||||||
if (isset($this->localtax2)) $this->localtax2=trim($this->localtax2);
|
if (isset($this->localtax2)) $this->localtax2 = trim($this->localtax2);
|
||||||
if (empty($this->total_ht)) $this->total_ht=0;
|
if (empty($this->total_ht)) $this->total_ht = 0;
|
||||||
if (empty($this->total_tva)) $this->total_tva=0;
|
if (empty($this->total_tva)) $this->total_tva = 0;
|
||||||
// if (isset($this->total_localtax1)) $this->total_localtax1=trim($this->total_localtax1);
|
// if (isset($this->total_localtax1)) $this->total_localtax1=trim($this->total_localtax1);
|
||||||
// if (isset($this->total_localtax2)) $this->total_localtax2=trim($this->total_localtax2);
|
// if (isset($this->total_localtax2)) $this->total_localtax2=trim($this->total_localtax2);
|
||||||
if (isset($this->total_ttc)) $this->total_ttc=trim($this->total_ttc);
|
if (isset($this->total_ttc)) $this->total_ttc = trim($this->total_ttc);
|
||||||
if (isset($this->statut)) $this->statut=(int) $this->statut;
|
if (isset($this->statut)) $this->statut = (int) $this->statut;
|
||||||
if (isset($this->author)) $this->author=trim($this->author);
|
if (isset($this->author)) $this->author = trim($this->author);
|
||||||
if (isset($this->fk_user_valid)) $this->fk_user_valid=trim($this->fk_user_valid);
|
if (isset($this->fk_user_valid)) $this->fk_user_valid = trim($this->fk_user_valid);
|
||||||
if (isset($this->fk_facture_source)) $this->fk_facture_source=trim($this->fk_facture_source);
|
if (isset($this->fk_facture_source)) $this->fk_facture_source = trim($this->fk_facture_source);
|
||||||
if (isset($this->fk_project)) $this->fk_project=trim($this->fk_project);
|
if (isset($this->fk_project)) $this->fk_project = trim($this->fk_project);
|
||||||
if (isset($this->cond_reglement_id)) $this->cond_reglement_id=trim($this->cond_reglement_id);
|
if (isset($this->cond_reglement_id)) $this->cond_reglement_id = trim($this->cond_reglement_id);
|
||||||
if (isset($this->note_private)) $this->note=trim($this->note_private);
|
if (isset($this->note_private)) $this->note = trim($this->note_private);
|
||||||
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
|
if (isset($this->note_public)) $this->note_public = trim($this->note_public);
|
||||||
if (isset($this->model_pdf)) $this->model_pdf=trim($this->model_pdf);
|
if (isset($this->model_pdf)) $this->model_pdf = trim($this->model_pdf);
|
||||||
if (isset($this->import_key)) $this->import_key=trim($this->import_key);
|
if (isset($this->import_key)) $this->import_key = trim($this->import_key);
|
||||||
|
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
@ -873,38 +873,38 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn SET";
|
||||||
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
|
$sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").",";
|
||||||
$sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").",";
|
$sql .= " ref_supplier=".(isset($this->ref_supplier) ? "'".$this->db->escape($this->ref_supplier)."'" : "null").",";
|
||||||
$sql.= " entity=".(isset($this->entity)?$this->entity:"null").",";
|
$sql .= " entity=".(isset($this->entity) ? $this->entity : "null").",";
|
||||||
$sql.= " type=".(isset($this->type)?$this->type:"null").",";
|
$sql .= " type=".(isset($this->type) ? $this->type : "null").",";
|
||||||
$sql.= " fk_soc=".(isset($this->fk_soc)?$this->fk_soc:"null").",";
|
$sql .= " fk_soc=".(isset($this->fk_soc) ? $this->fk_soc : "null").",";
|
||||||
$sql.= " datec=".(dol_strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
|
$sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
|
||||||
$sql.= " datef=".(dol_strlen($this->date)!=0 ? "'".$this->db->idate($this->date)."'" : 'null').",";
|
$sql .= " datef=".(dol_strlen($this->date) != 0 ? "'".$this->db->idate($this->date)."'" : 'null').",";
|
||||||
if (dol_strlen($this->tms) != 0) $sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
|
if (dol_strlen($this->tms) != 0) $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
|
||||||
$sql.= " libelle=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
$sql .= " libelle=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").",";
|
||||||
$sql.= " paye=".(isset($this->paye)?$this->paye:"null").",";
|
$sql .= " paye=".(isset($this->paye) ? $this->paye : "null").",";
|
||||||
$sql.= " amount=".(isset($this->amount)?$this->amount:"null").",";
|
$sql .= " amount=".(isset($this->amount) ? $this->amount : "null").",";
|
||||||
$sql.= " remise=".(isset($this->remise)?$this->remise:"null").",";
|
$sql .= " remise=".(isset($this->remise) ? $this->remise : "null").",";
|
||||||
$sql.= " close_code=".(isset($this->close_code)?"'".$this->db->escape($this->close_code)."'":"null").",";
|
$sql .= " close_code=".(isset($this->close_code) ? "'".$this->db->escape($this->close_code)."'" : "null").",";
|
||||||
$sql.= " close_note=".(isset($this->close_note)?"'".$this->db->escape($this->close_note)."'":"null").",";
|
$sql .= " close_note=".(isset($this->close_note) ? "'".$this->db->escape($this->close_note)."'" : "null").",";
|
||||||
$sql.= " tva=".(isset($this->tva)?$this->tva:"null").",";
|
$sql .= " tva=".(isset($this->tva) ? $this->tva : "null").",";
|
||||||
$sql.= " localtax1=".(isset($this->localtax1)?$this->localtax1:"null").",";
|
$sql .= " localtax1=".(isset($this->localtax1) ? $this->localtax1 : "null").",";
|
||||||
$sql.= " localtax2=".(isset($this->localtax2)?$this->localtax2:"null").",";
|
$sql .= " localtax2=".(isset($this->localtax2) ? $this->localtax2 : "null").",";
|
||||||
$sql.= " total_ht=".(isset($this->total_ht)?$this->total_ht:"null").",";
|
$sql .= " total_ht=".(isset($this->total_ht) ? $this->total_ht : "null").",";
|
||||||
$sql.= " total_tva=".(isset($this->total_tva)?$this->total_tva:"null").",";
|
$sql .= " total_tva=".(isset($this->total_tva) ? $this->total_tva : "null").",";
|
||||||
$sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").",";
|
$sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").",";
|
||||||
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
|
$sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").",";
|
||||||
$sql.= " fk_user_author=".(isset($this->author)?$this->author:"null").",";
|
$sql .= " fk_user_author=".(isset($this->author) ? $this->author : "null").",";
|
||||||
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";
|
$sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? $this->fk_user_valid : "null").",";
|
||||||
$sql.= " fk_facture_source=".(isset($this->fk_facture_source)?$this->fk_facture_source:"null").",";
|
$sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? $this->fk_facture_source : "null").",";
|
||||||
$sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").",";
|
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
|
||||||
$sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").",";
|
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
|
||||||
$sql.= " date_lim_reglement=".(dol_strlen($this->date_echeance)!=0 ? "'".$this->db->idate($this->date_echeance)."'" : 'null').",";
|
$sql .= " date_lim_reglement=".(dol_strlen($this->date_echeance) != 0 ? "'".$this->db->idate($this->date_echeance)."'" : 'null').",";
|
||||||
$sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
|
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
|
||||||
$sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
|
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
|
||||||
$sql.= " model_pdf=".(isset($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null").",";
|
$sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
|
||||||
$sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null")."";
|
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql .= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
@ -1313,13 +1313,13 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0)
|
public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$now=dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$error=0;
|
$error = 0;
|
||||||
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse);
|
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse);
|
||||||
|
|
||||||
// Force to have object complete for checks
|
// Force to have object complete for checks
|
||||||
@ -1385,10 +1385,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
$mouvP->origin = &$this;
|
$mouvP->origin = &$this;
|
||||||
// We increase stock for product
|
// We increase stock for product
|
||||||
$up_ht_disc=$this->lines[$i]->pu_ht;
|
$up_ht_disc = $this->lines[$i]->pu_ht;
|
||||||
if (! empty($this->lines[$i]->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc=price2num($up_ht_disc * (100 - $this->lines[$i]->remise_percent) / 100, 'MU');
|
if (!empty($this->lines[$i]->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) $up_ht_disc = price2num($up_ht_disc * (100 - $this->lines[$i]->remise_percent) / 100, 'MU');
|
||||||
if ($this->type == FactureFournisseur::TYPE_CREDIT_NOTE) $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $up_ht_disc, $langs->trans("InvoiceValidatedInDolibarr", $num));
|
if ($this->type == FactureFournisseur::TYPE_CREDIT_NOTE) $result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $up_ht_disc, $langs->trans("InvoiceValidatedInDolibarr", $num));
|
||||||
else $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $up_ht_disc, $langs->trans("InvoiceValidatedInDolibarr", $num));
|
else $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $up_ht_disc, $langs->trans("InvoiceValidatedInDolibarr", $num));
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
unset($this->line);
|
unset($this->line);
|
||||||
}
|
}
|
||||||
@ -1412,17 +1412,17 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||||
{
|
{
|
||||||
// Now we rename also files into index
|
// Now we rename also files into index
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'fournisseur/facture/".get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$this->db->escape($this->newref)."'";
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'fournisseur/facture/".get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$this->db->escape($this->newref)."'";
|
||||||
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'fournisseur/facture/".get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'fournisseur/facture/".get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
|
if (!$resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||||
|
|
||||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||||
$oldref = dol_sanitizeFileName($this->ref);
|
$oldref = dol_sanitizeFileName($this->ref);
|
||||||
$newref = dol_sanitizeFileName($num);
|
$newref = dol_sanitizeFileName($num);
|
||||||
$dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$oldref;
|
$dirsource = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$oldref;
|
||||||
$dirdest = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$newref;
|
$dirdest = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$newref;
|
||||||
if (! $error && file_exists($dirsource))
|
if (!$error && file_exists($dirsource))
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
||||||
|
|
||||||
@ -1521,16 +1521,16 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
$mouvP->origin = &$this;
|
$mouvP->origin = &$this;
|
||||||
// We increase stock for product
|
// We increase stock for product
|
||||||
if ($this->type == FactureFournisseur::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr", $this->ref));
|
if ($this->type == FactureFournisseur::TYPE_CREDIT_NOTE) $result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr", $this->ref));
|
||||||
else $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr", $this->ref));
|
else $result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr", $this->ref));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Triggers call
|
// Triggers call
|
||||||
if (! $error && empty($notrigger))
|
if (!$error && empty($notrigger))
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('BILL_SUPPLIER_UNVALIDATE', $user);
|
$result = $this->call_trigger('BILL_SUPPLIER_UNVALIDATE', $user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
@ -1595,27 +1595,27 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
if ($this->statut == self::STATUS_DRAFT)
|
if ($this->statut == self::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($remise_percent)) $remise_percent=0;
|
if (empty($remise_percent)) $remise_percent = 0;
|
||||||
if (empty($qty)) $qty=0;
|
if (empty($qty)) $qty = 0;
|
||||||
if (empty($info_bits)) $info_bits=0;
|
if (empty($info_bits)) $info_bits = 0;
|
||||||
if (empty($rang)) $rang=0;
|
if (empty($rang)) $rang = 0;
|
||||||
if (empty($ventil)) $ventil=0;
|
if (empty($ventil)) $ventil = 0;
|
||||||
if (empty($txtva)) $txtva=0;
|
if (empty($txtva)) $txtva = 0;
|
||||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
if (empty($txlocaltax1)) $txlocaltax1 = 0;
|
||||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
if (empty($txlocaltax2)) $txlocaltax2 = 0;
|
||||||
|
|
||||||
$remise_percent=price2num($remise_percent);
|
$remise_percent = price2num($remise_percent);
|
||||||
$qty=price2num($qty);
|
$qty = price2num($qty);
|
||||||
$pu=price2num($pu);
|
$pu = price2num($pu);
|
||||||
$txlocaltax1=price2num($txlocaltax1);
|
$txlocaltax1 = price2num($txlocaltax1);
|
||||||
$txlocaltax2=price2num($txlocaltax2);
|
$txlocaltax2 = price2num($txlocaltax2);
|
||||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||||
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
|
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($date_start && $date_end && $date_start > $date_end) {
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
$this->error = $langs->trans('ErrorStartDateGreaterEnd');
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2191,31 +2191,31 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut';
|
$sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as ff';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as ff';
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= ' WHERE ff.paye=0';
|
$sql .= ' WHERE ff.paye=0';
|
||||||
$sql.= ' AND ff.fk_statut > 0';
|
$sql .= ' AND ff.fk_statut > 0';
|
||||||
$sql.= " AND ff.entity = ".$conf->entity;
|
$sql .= " AND ff.entity = ".$conf->entity;
|
||||||
if ($user->socid) $sql.=' AND ff.fk_soc = '.$user->socid;
|
if ($user->socid) $sql .= ' AND ff.fk_soc = '.$user->socid;
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$now=dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24;
|
$response->warning_delay = $conf->facture->fournisseur->warning_delay / 60 / 60 / 24;
|
||||||
$response->label=$langs->trans("SupplierBillsToPay");
|
$response->label = $langs->trans("SupplierBillsToPay");
|
||||||
$response->labelShort=$langs->trans("StatusToPay");
|
$response->labelShort = $langs->trans("StatusToPay");
|
||||||
|
|
||||||
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills';
|
$response->url = DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills';
|
||||||
$response->img=img_object($langs->trans("Bills"), "bill");
|
$response->img = img_object($langs->trans("Bills"), "bill");
|
||||||
|
|
||||||
$facturestatic = new FactureFournisseur($this->db);
|
$facturestatic = new FactureFournisseur($this->db);
|
||||||
|
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$response->nbtodo++;
|
$response->nbtodo++;
|
||||||
|
|
||||||
@ -2265,58 +2265,58 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
if ($option !== 'nolink')
|
if ($option !== 'nolink')
|
||||||
{
|
{
|
||||||
// Add param to save lastsearch_values or not
|
// Add param to save lastsearch_values or not
|
||||||
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
|
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
|
||||||
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
|
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
||||||
}
|
}
|
||||||
|
|
||||||
$picto=$this->picto;
|
$picto = $this->picto;
|
||||||
if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice
|
if ($this->type == self::TYPE_REPLACEMENT) $picto .= 'r'; // Replacement invoice
|
||||||
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
|
if ($this->type == self::TYPE_CREDIT_NOTE) $picto .= 'a'; // Credit note
|
||||||
if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice
|
if ($this->type == self::TYPE_DEPOSIT) $picto .= 'd'; // Deposit invoice
|
||||||
|
|
||||||
$label = '<u>' . $langs->trans("ShowSupplierInvoice") . '</u>';
|
$label = '<u>'.$langs->trans("ShowSupplierInvoice").'</u>';
|
||||||
if (! empty($this->ref))
|
if (!empty($this->ref))
|
||||||
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||||
if (! empty($this->ref_supplier))
|
if (!empty($this->ref_supplier))
|
||||||
$label.= '<br><b>' . $langs->trans('RefSupplier') . ':</b> ' . $this->ref_supplier;
|
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_supplier;
|
||||||
if (! empty($this->label))
|
if (!empty($this->label))
|
||||||
$label.= '<br><b>' . $langs->trans('Label') . ':</b> ' . $this->label;
|
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
|
||||||
if (! empty($this->date))
|
if (!empty($this->date))
|
||||||
$label .= '<br><b>' . $langs->trans('Date') . ':</b> ' . dol_print_date($this->date, 'day');
|
$label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->date, 'day');
|
||||||
if (! empty($this->total_ht))
|
if (!empty($this->total_ht))
|
||||||
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
if (! empty($this->total_tva))
|
if (!empty($this->total_tva))
|
||||||
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
|
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
if (! empty($this->total_ttc))
|
if (!empty($this->total_ttc))
|
||||||
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
|
if ($this->type == self::TYPE_REPLACEMENT) $label = $langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
|
||||||
elseif ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref;
|
elseif ($this->type == self::TYPE_CREDIT_NOTE) $label = $langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref;
|
||||||
elseif ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref;
|
elseif ($this->type == self::TYPE_DEPOSIT) $label = $langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref;
|
||||||
if ($moretitle) $label.=' - '.$moretitle;
|
if ($moretitle) $label .= ' - '.$moretitle;
|
||||||
|
|
||||||
$ref=$this->ref;
|
$ref = $this->ref;
|
||||||
if (empty($ref)) $ref=$this->id;
|
if (empty($ref)) $ref = $this->id;
|
||||||
|
|
||||||
$linkclose='';
|
$linkclose = '';
|
||||||
if (empty($notooltip))
|
if (empty($notooltip))
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||||
{
|
{
|
||||||
$label=$langs->trans("ShowSupplierInvoice");
|
$label = $langs->trans("ShowSupplierInvoice");
|
||||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose.=' class="classfortooltip"';
|
$linkclose .= ' class="classfortooltip"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'"';
|
$linkstart = '<a href="'.$url.'"';
|
||||||
$linkstart.=$linkclose.'>';
|
$linkstart .= $linkclose.'>';
|
||||||
$linkend='</a>';
|
$linkend = '</a>';
|
||||||
|
|
||||||
$result .= $linkstart;
|
$result .= $linkstart;
|
||||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), $picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||||
if ($withpicto != 2) $result.= ($max?dol_trunc($ref, $max):$ref);
|
if ($withpicto != 2) $result .= ($max ?dol_trunc($ref, $max) : $ref);
|
||||||
$result .= $linkend;
|
$result .= $linkend;
|
||||||
|
|
||||||
if ($addlinktonotes)
|
if ($addlinktonotes)
|
||||||
@ -2384,7 +2384,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$obj->error;
|
$this->error = $obj->error;
|
||||||
//dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
|
//dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2505,27 +2505,27 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf, $user;
|
global $conf, $user;
|
||||||
|
|
||||||
$this->nb=array();
|
$this->nb = array();
|
||||||
|
|
||||||
$clause = "WHERE";
|
$clause = "WHERE";
|
||||||
|
|
||||||
$sql = "SELECT count(f.rowid) as nb";
|
$sql = "SELECT count(f.rowid) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid)
|
if (!$user->rights->societe->client->voir && !$user->socid)
|
||||||
{
|
{
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||||
$sql.= " WHERE sc.fk_user = " .$user->id;
|
$sql .= " WHERE sc.fk_user = ".$user->id;
|
||||||
$clause = "AND";
|
$clause = "AND";
|
||||||
}
|
}
|
||||||
$sql.= " ".$clause." f.entity = ".$conf->entity;
|
$sql .= " ".$clause." f.entity = ".$conf->entity;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
while ($obj=$this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$this->nb["supplier_invoices"]=$obj->nb;
|
$this->nb["supplier_invoices"] = $obj->nb;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2550,16 +2550,16 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$error=0;
|
$error = 0;
|
||||||
|
|
||||||
$object=new FactureFournisseur($this->db);
|
$object = new FactureFournisseur($this->db);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Load source object
|
// Load source object
|
||||||
$object->fetch($fromid);
|
$object->fetch($fromid);
|
||||||
$object->id=0;
|
$object->id = 0;
|
||||||
$object->statut=self::STATUS_DRAFT;
|
$object->statut = self::STATUS_DRAFT;
|
||||||
|
|
||||||
// Clear fields
|
// Clear fields
|
||||||
$object->ref_supplier = (empty($this->ref_supplier) ? $langs->trans("CopyOf").' '.$object->ref_supplier : $this->ref_supplier);
|
$object->ref_supplier = (empty($this->ref_supplier) ? $langs->trans("CopyOf").' '.$object->ref_supplier : $this->ref_supplier);
|
||||||
@ -2714,9 +2714,9 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
|
|
||||||
$sql = "SELECT fk_invoice_supplier FROM ".MAIN_DB_PREFIX."societe_remise_except WHERE fk_invoice_supplier_source=".$this->id;
|
$sql = "SELECT fk_invoice_supplier FROM ".MAIN_DB_PREFIX."societe_remise_except WHERE fk_invoice_supplier_source=".$this->id;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if(!empty($resql)){
|
if (!empty($resql)) {
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if(!empty($obj->fk_invoice_supplier))$isUsed=true;
|
if (!empty($obj->fk_invoice_supplier))$isUsed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $isUsed;
|
return $isUsed;
|
||||||
@ -2968,14 +2968,14 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||||||
public function fetch($rowid)
|
public function fetch($rowid)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx';
|
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx';
|
||||||
$sql.= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
|
$sql .= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
|
||||||
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_facture_fourn, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
|
$sql .= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_facture_fourn, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
|
||||||
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc';
|
$sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc';
|
||||||
$sql.= ', f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, multicurrency_total_ttc';
|
$sql .= ', f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, multicurrency_total_ttc';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
|
||||||
$sql.= ' WHERE f.rowid = '.$rowid;
|
$sql .= ' WHERE f.rowid = '.$rowid;
|
||||||
$sql.= ' ORDER BY f.rang, f.rowid';
|
$sql .= ' ORDER BY f.rang, f.rowid';
|
||||||
|
|
||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
@ -3209,50 +3209,50 @@ class SupplierInvoiceLine extends CommonObjectLine
|
|||||||
*/
|
*/
|
||||||
public function insert($notrigger = 0)
|
public function insert($notrigger = 0)
|
||||||
{
|
{
|
||||||
global $user,$conf;
|
global $user, $conf;
|
||||||
|
|
||||||
$error=0;
|
$error = 0;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG);
|
dol_syslog(get_class($this)."::insert rang=".$this->rang, LOG_DEBUG);
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->desc=trim($this->desc);
|
$this->desc = trim($this->desc);
|
||||||
if (empty($this->tva_tx)) $this->tva_tx=0;
|
if (empty($this->tva_tx)) $this->tva_tx = 0;
|
||||||
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;
|
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
|
||||||
if (empty($this->localtax2_tx)) $this->localtax2_tx=0;
|
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
|
||||||
if (empty($this->localtax1_type)) $this->localtax1_type='0';
|
if (empty($this->localtax1_type)) $this->localtax1_type = '0';
|
||||||
if (empty($this->localtax2_type)) $this->localtax2_type='0';
|
if (empty($this->localtax2_type)) $this->localtax2_type = '0';
|
||||||
if (empty($this->total_tva)) $this->total_tva=0;
|
if (empty($this->total_tva)) $this->total_tva = 0;
|
||||||
if (empty($this->total_localtax1)) $this->total_localtax1=0;
|
if (empty($this->total_localtax1)) $this->total_localtax1 = 0;
|
||||||
if (empty($this->total_localtax2)) $this->total_localtax2=0;
|
if (empty($this->total_localtax2)) $this->total_localtax2 = 0;
|
||||||
if (empty($this->rang)) $this->rang=0;
|
if (empty($this->rang)) $this->rang = 0;
|
||||||
if (empty($this->remise_percent)) $this->remise_percent=0;
|
if (empty($this->remise_percent)) $this->remise_percent = 0;
|
||||||
if (empty($this->info_bits)) $this->info_bits=0;
|
if (empty($this->info_bits)) $this->info_bits = 0;
|
||||||
if (empty($this->subprice)) $this->subprice=0;
|
if (empty($this->subprice)) $this->subprice = 0;
|
||||||
if (empty($this->special_code)) $this->special_code=0;
|
if (empty($this->special_code)) $this->special_code = 0;
|
||||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
if (empty($this->fk_parent_line)) $this->fk_parent_line = 0;
|
||||||
if (! isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') $this->situation_percent = 100;
|
if (!isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') $this->situation_percent = 100;
|
||||||
|
|
||||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
if (empty($this->pa_ht)) $this->pa_ht = 0;
|
||||||
if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice=0;
|
if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice = 0;
|
||||||
if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0;
|
if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht = 0;
|
||||||
if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0;
|
if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva = 0;
|
||||||
if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0;
|
if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc = 0;
|
||||||
|
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($this->product_type < 0)
|
if ($this->product_type < 0)
|
||||||
{
|
{
|
||||||
$this->error='ErrorProductTypeMustBe0orMore';
|
$this->error = 'ErrorProductTypeMustBe0orMore';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (! empty($this->fk_product))
|
if (!empty($this->fk_product))
|
||||||
{
|
{
|
||||||
// Check product exists
|
// Check product exists
|
||||||
$result=Product::isExistingObject('product', $this->fk_product);
|
$result = Product::isExistingObject('product', $this->fk_product);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
$this->error='ErrorProductIdDoesNotExists';
|
$this->error = 'ErrorProductIdDoesNotExists';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,23 +40,23 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$action=GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$cancel=GETPOST('cancel', 'alpha');
|
$cancel = GETPOST('cancel', 'alpha');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
|
|
||||||
$id=GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$ref=GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
$fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id);
|
$fuserid = (GETPOST('fuserid', 'int') ?GETPOST('fuserid', 'int') : $user->id);
|
||||||
|
|
||||||
// Load translation files required by the page
|
// 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);
|
$childids = $user->getAllChildIds(1);
|
||||||
|
|
||||||
$morefilter = 'AND employee = 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;
|
$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;
|
if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) $candelete = 1;
|
||||||
|
|
||||||
// Protection if external user
|
// Protection if external user
|
||||||
if ($user->socid) $socid=$user->socid;
|
if ($user->socid) $socid = $user->socid;
|
||||||
$result = restrictedArea($user, 'holiday', $object->id, 'holiday');
|
$result = restrictedArea($user, 'holiday', $object->id, 'holiday');
|
||||||
|
|
||||||
|
|
||||||
@ -1287,8 +1287,8 @@ else
|
|||||||
$htmlhelp = $langs->trans('NbUseDaysCPHelp');
|
$htmlhelp = $langs->trans('NbUseDaysCPHelp');
|
||||||
$includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
|
$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);
|
$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 ($includesaturday) $htmlhelp .= '<br>'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Saturday"));
|
||||||
if ($includesunday) $htmlhelp.='<br>'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Sunday"));
|
if ($includesunday) $htmlhelp .= '<br>'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Sunday"));
|
||||||
print $form->textwithpicto($langs->trans('NbUseDaysCP'), $htmlhelp);
|
print $form->textwithpicto($langs->trans('NbUseDaysCP'), $htmlhelp);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'</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="liste_titre"></td>';
|
||||||
print '<td class="right liste_titre">';
|
print '<td class="right liste_titre">';
|
||||||
print '<td class="liste_titre maxwidthsearch">';
|
print '<td class="liste_titre maxwidthsearch">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
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
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_ref="";
|
$search_ref = "";
|
||||||
$search_user="";
|
$search_user = "";
|
||||||
$search_label="";
|
$search_label = "";
|
||||||
$search_date_start='';
|
$search_date_start = '';
|
||||||
$search_date_end='';
|
$search_date_end = '';
|
||||||
$search_amount="";
|
$search_amount = "";
|
||||||
$search_account='';
|
$search_account = '';
|
||||||
$typeid="";
|
$typeid = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,8 +119,8 @@ $sql .= " AND s.entity = ".$conf->entity;
|
|||||||
if ($search_ref) $sql .= " AND s.rowid=".$search_ref;
|
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_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_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_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_end) $sql .= " AND s.datep <= '".$db->idate($search_date_end)."'";
|
||||||
if ($search_amount) $sql .= natural_search("s.amount", $search_amount, 1);
|
if ($search_amount) $sql .= natural_search("s.amount", $search_amount, 1);
|
||||||
if ($search_account > 0) $sql .= " AND b.fk_account=".$search_account;
|
if ($search_account > 0) $sql .= " AND b.fk_account=".$search_account;
|
||||||
if ($filtre) {
|
if ($filtre) {
|
||||||
@ -188,12 +188,12 @@ if ($result)
|
|||||||
// Date
|
// Date
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('From') . ' ';
|
print $langs->trans('From').' ';
|
||||||
print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
|
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $langs->trans('to') . ' ';
|
print $langs->trans('to').' ';
|
||||||
print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
|
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Type
|
// Type
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user