From 53add04a2e6e8a6c777278a1aa97bc01cd775643 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 31 Jul 2017 10:28:24 +0200 Subject: [PATCH 01/20] fix :add missing hook into product price card --- htdocs/product/price.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 2b5617c601d..d2ba54e12a2 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1172,6 +1172,9 @@ if ($action == 'edit_price' && $object->getRights()->creer) print ''; print ''; + $parameters=array('colspan' => 2); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + print ''; dol_fiche_end(); From efd24cc1a2b27f613b0f29cb977410b1899615d7 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Aug 2017 06:16:23 +0200 Subject: [PATCH 02/20] Fix: function length_accountg has been moved in getNomUrl --- htdocs/compta/bank/index.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 9bc8608692d..6c0d1613943 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -492,12 +492,10 @@ foreach ($accounts as $key=>$type) // Account number if (! empty($arrayfields['b.account_number']['checked'])) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch('',$acc->account_number); - print ''.length_accountg($accountingaccount->getNomUrl(0,1,1,'',1)).''; + print ''.$accountingaccount->getNomUrl(0,1,1,'',1).''; if (! $i) $totalarray['nbfield']++; } From 9629a50853fb81953e17e012d4c7d84ae0be9c73 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Aug 2017 06:21:19 +0200 Subject: [PATCH 03/20] Fix: SQL error in payment list --- htdocs/compta/paiement/list.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 4a7a2e3c81a..bddc5e9f500 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -3,8 +3,9 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2017 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,14 +32,15 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; $langs->load("bills"); $langs->load("compta"); // Security check -$facid =GETPOST('facid','int'); -$socid =GETPOST('socid','int'); -$userid=GETPOST('userid','int'); +$facid = GETPOST('facid','int'); +$socid = GETPOST('socid','int'); +$userid = GETPOST('userid','int'); $day = GETPOST('day','int'); $month = GETPOST('month','int'); $year = GETPOST('year','int'); @@ -129,7 +131,7 @@ else $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives $sql.= " p.statut, p.num_paiement,"; $sql.= " c.code as paiement_code,"; - $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.accountancy_journal as accountancy_journal,"; + $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,"; $sql.= " s.rowid as socid, s.nom as name"; // Add fields for extrafields foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; @@ -329,7 +331,11 @@ if ($resql) $accountstatic->label=$objp->blabel; $accountstatic->number=$objp->number; $accountstatic->account_number=$objp->account_number; - $accountstatic->accountancy_journal=$objp->accountancy_journal; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($objp->accountancy_journal); + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1); + print $accountstatic->getNomUrl(1); } else print ' '; From 3c34add0d60c4351045fd1cdb221baa31724a961 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Aug 2017 06:26:35 +0200 Subject: [PATCH 04/20] remove condition --- htdocs/compta/paiement/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index bddc5e9f500..04dbaf8fc11 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; $langs->load("bills"); $langs->load("compta"); From e41543c22eefe9796b1bdf7be1e2e4b777554aad Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Aug 2017 06:44:37 +0200 Subject: [PATCH 05/20] Fix v6: Debug various_payment --- htdocs/compta/bank/various_payment/card.php | 20 ++-- htdocs/compta/bank/various_payment/index.php | 103 +++++++++++++------ 2 files changed, 85 insertions(+), 38 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index f75c111094d..9328b6f599b 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; $langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); @@ -70,7 +71,7 @@ if (empty($reshook)) { if ($action != 'addlink') { - $urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/myobject_list.php',1); + $urltogo=$backtopage?$backtopage:dol_buildpath('/compta/bank/various_payment/index.php',1); header("Location: ".$urltogo); exit; } @@ -172,7 +173,7 @@ if (empty($reshook)) if ($result >= 0) { $db->commit(); - header("Location: ".DOL_URL_ROOT.'/compta/salaries/index.php'); + header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/index.php'); exit; } else @@ -339,9 +340,9 @@ if ($id) print ''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; - print ""; + print ""; print ''; @@ -349,11 +350,13 @@ if ($id) // Label print ''; + // Payment date print ""; print ''; + // Value date print ''; @@ -370,11 +373,10 @@ if ($id) print '\n"; print ''; + // Ref print ''; + // Label print ''; + // Date print ''; + // Type print ''; + // Account if (! empty($conf->banque->enabled)) { @@ -181,10 +189,15 @@ if ($result) $form->select_comptes($search_account,'search_account',0,'',1); print ''; } - // Amount - print ''; - // Sens - print ''; + + // Accounting account + if (! empty($conf->accounting->enabled)) print ''; + + // Debit + print ''; + + // Credit + print ''; print '\n"; + $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); @@ -201,50 +215,81 @@ if ($result) $variousstatic->id=$obj->rowid; $variousstatic->ref=$obj->rowid; + // Ref print "\n"; + // Label payment print "\n"; + // Date payment print '\n"; + // Type print ''; + // Account if (! empty($conf->banque->enabled)) { print ''; } - // Amount - print ""; - // Sens - if ($obj->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit"); - print ""; - print ""; - print "\n"; - $total = $total + $obj->amount; + // Accounting account + if (! empty($conf->accounting->enabled)) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('',$obj->accountancy_code); + + print ''; + } + + // Debit + print ""; + + // Credit + print ""; + + print ""; $i++; } - $colspan=4; + $colspan=5; if (! empty($conf->banque->enabled)) $colspan++; print ''; print ''; - print '"; + print '"; + print '"; print ''; print ''; print ''; From adbb41799cd52c99a2fd9d12a33ce8595a022a32 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Tue, 1 Aug 2017 11:08:58 +0200 Subject: [PATCH 06/20] FIX: calculate correct remain to pay for planned bank transactions --- htdocs/compta/bank/treso.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index cbdb769789f..92c1a73cf4f 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -282,6 +282,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $refcomp=$societestatic->getNomUrl(1,'',24); $paiement = $facturestatic->getSommePaiement(); // Payment already done + $paiement+= $facturestatic->getSumDepositsUsed(); + $paiement+= $facturestatic->getSumCreditNotesUsed(); } if ($obj->family == 'social_contribution') { From 09c271b7c57d073752e51def1e6ee58979855b5a Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 2 Aug 2017 10:31:16 +0200 Subject: [PATCH 07/20] Fix: Correction in the calculation of the next week --- htdocs/core/lib/date.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index b06baaa9288..e08b6c24de5 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011-2015 Juanjo Menent + * Copyright (C) 2017 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -407,7 +408,7 @@ function dol_get_next_week($day, $week, $month, $year) { $tmparray = dol_get_first_day_week($day, $month, $year); - $time=dol_mktime(12,0,0,$month,$tmparray['first_day'],$year,1,0); + $time=dol_mktime(12,0,0,$tmparray['first_month'],$tmparray['first_day'],$tmparray['first_year'],1,0); $time+=24*60*60*7; $tmparray=dol_getdate($time,true); From f130a297394e84b2acd4721d384c4592846cc4fe Mon Sep 17 00:00:00 2001 From: John Date: Wed, 2 Aug 2017 12:14:36 +0200 Subject: [PATCH 08/20] Fix ref search --- htdocs/contrat/services.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 6534ef1e362..f42bc343387 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -223,7 +223,7 @@ if ($mode == "5") $sql.= " AND cd.statut = 5"; if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'"; if ($filter == "notexpired") $sql.= " AND cd.date_fin_validite >= '".$db->idate($now)."'"; if ($search_name) $sql.= " AND s.nom LIKE '%".$db->escape($search_name)."%'"; -if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'"; +if ($search_contract) $sql.= " AND c.ref LIKE '%".$db->escape($search_contract)."%' "; if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')"; if ($socid > 0) $sql.= " AND s.rowid = ".$socid; $filter_dateouvertureprevue=dol_mktime(0,0,0,$opouvertureprevuemonth,$opouvertureprevueday,$opouvertureprevueyear); From 56e6794151ca06bcc6a2d169842bacb50d8a42d1 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 2 Aug 2017 14:10:26 +0200 Subject: [PATCH 09/20] Fix contract reopen btn if no contract line --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 90ec4c7edba..ce3915cf2ee 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2045,7 +2045,7 @@ else if ($user->rights->contrat->creer) print ''; else print ''; } - if ($object->statut == 1 && $nbofservices) + if ($object->statut == 1) { if ($user->rights->contrat->creer) print ''; else print ''; From a8e2f95c39d17f8ad7d4eb1dc5a39f8b0ee6d94f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Aug 2017 10:45:52 +0200 Subject: [PATCH 10/20] Better help --- htdocs/core/modules/modCron.class.php | 2 +- htdocs/langs/en_US/cron.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 7f949501023..731bcaf02f9 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -105,7 +105,7 @@ class modCron extends DolibarrModules 1=>array('label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>20, 'status'=>0, 'test'=>in_array($db->type, array('mysql','mysqli'))), // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) ); - + $this->rights[$r][0] = 23001; $this->rights[$r][1] = 'Read cron jobs'; $this->rights[$r][3] = 0; diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 8eb03114c64..9d440ddbd7f 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -10,7 +10,7 @@ CronSetup= Scheduled job management setup URLToLaunchCronJobs=URL to check and launch qualified cron jobs OrToLaunchASpecificJob=Or to check and launch a specific job KeyForCronAccess=Security key for URL to launch cron jobs -FileToLaunchCronJobs=Command line to launch cron jobs +FileToLaunchCronJobs=Command line to check and launch qualified cron jobs CronExplainHowToRunUnix=On Unix environment you should use the following crontab entry to run the command line each 5 minutes CronExplainHowToRunWin=On Microsoft(tm) Windows environement you can use Scheduled task tools to run the command line each 5 minutes CronMethodDoesNotExists=Class %s does not contains any method %s From 68b19462c3603f2980de4ca4574f7b293c5e6881 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Aug 2017 11:01:43 +0200 Subject: [PATCH 11/20] Fix list of cron jobs --- htdocs/cron/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 6a0b794c607..b62091d1c95 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -353,7 +353,7 @@ if ($num > 0) { $obj = $db->fetch_object($result); - + if (empty($obj)) break; if (! verifCond($obj->test)) continue; // Discard line with test = false // title profil From ddd60d1cd2dead65759f3bcecf19d6fe91f6bdb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Aug 2017 11:22:37 +0200 Subject: [PATCH 12/20] Fix error counting in cron --- htdocs/cron/class/cronjob.class.php | 2 -- htdocs/public/cron/cron_run_jobs.php | 24 ++++++++++++------- scripts/cron/cron_run_jobs.php | 35 ++++++++++++++++++++-------- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 64c2d026ab4..00f8d5d6ae0 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -439,7 +439,6 @@ class Cronjob extends CommonObject { while ($i < $num) { - $line = new Cronjobline(); $obj = $this->db->fetch_object($resql); @@ -480,7 +479,6 @@ class Cronjob extends CommonObject $this->lines[]=$line; $i++; - } } $this->db->free($resql); diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index 725aea8825d..36b21c514e9 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -125,19 +125,25 @@ if ($result<0) exit; } +$qualifiedjobs = array(); +foreach($object->lines as $val) +{ + if (! verifCond($val->test)) continue; + $qualifiedjobs[] = $val; +} // TODO Duplicate code. This sequence of code must be shared with code into cron_run_jobs.php script. // current date $now=dol_now(); -$nbofjobs=count($object->lines); +$nbofjobs=count($qualifiedjobs); $nbofjobslaunchedok=0; $nbofjobslaunchedko=0; -if (is_array($object->lines) && (count($object->lines)>0)) +if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) { // Loop over job - foreach($object->lines as $line) + foreach($qualifiedjobs as $line) { dol_syslog("cron_run_jobs.php cronjobid: ".$line->id, LOG_WARNING); @@ -150,16 +156,16 @@ if (is_array($object->lines) && (count($object->lines)>0)) $result=$cronjob->fetch($line->id); if ($result<0) { - echo "Error:".$cronjob->error."
\n"; - dol_syslog("cron_run_jobs.php:: fetch Error".$cronjob->error, LOG_ERR); + echo "Error cronjob->fetch: ".$cronjob->error."
\n"; + dol_syslog("cron_run_jobs.php::fetch Error".$cronjob->error, LOG_ERR); exit; } // Execut job $result=$cronjob->run_jobs($userlogin); if ($result < 0) { - echo "Error:".$cronjob->error."
\n"; - dol_syslog("cron_run_jobs.php:: run_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjob->run_job: ".$cronjob->error."
\n"; + dol_syslog("cron_run_jobs.php::run_jobs Error".$cronjob->error, LOG_ERR); $nbofjobslaunchedko++; } else @@ -171,8 +177,8 @@ if (is_array($object->lines) && (count($object->lines)>0)) $result=$cronjob->reprogram_jobs($userlogin, $now); if ($result<0) { - echo "Error:".$cronjob->error."
\n"; - dol_syslog("cron_run_jobs.php:: reprogram_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjob->reprogram_job: ".$cronjob->error."
\n"; + dol_syslog("cron_run_jobs.php::reprogram_jobs Error".$cronjob->error, LOG_ERR); exit; } diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 841e85e1443..6ec317cdc70 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -79,7 +79,7 @@ if ($key != $conf->global->CRON_KEY) exit(-1); } -// If param userlogin is reserved word 'firstadmin' +// If param userlogin is reserved word 'firstadmin' if ($userlogin == 'firstadmin') { $sql='SELECT login from '.MAIN_DB_PREFIX.'user WHERE admin = 1 and statut = 1 ORDER BY entity LIMIT 1'; @@ -87,7 +87,7 @@ if ($userlogin == 'firstadmin') if ($resql) { $obj=$db->fetch_object($resql); - if ($obj) + if ($obj) { $userlogin = $obj->login; echo "First admin user found is login '".$userlogin."'\n"; @@ -136,27 +136,37 @@ if ($result<0) exit(-1); } +$qualifiedjobs = array(); +foreach($object->lines as $val) +{ + if (! verifCond($val->test)) continue; + $qualifiedjobs[] = $val; +} + // TODO This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page. // current date $now=dol_now(); +$nbofjobs=count($qualifiedjobs); +$nbofjobslaunchedok=0; +$nbofjobslaunchedko=0; -if(is_array($object->lines) && (count($object->lines)>0)) +if(is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) { // Loop over job - foreach($object->lines as $line) + foreach($qualifiedjobs as $line) { dol_syslog("cron_run_jobs.php cronjobid: ".$line->id, LOG_DEBUG); echo "cron_run_jobs.php cronjobid: ".$line->id."\n"; - + //If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) { dol_syslog("cron_run_jobs.php:: to run line->datenextrun:".dol_print_date($line->datenextrun,'dayhourrfc')." line->datestart:".dol_print_date($line->datestart,'dayhourrfc')." line->dateend:".dol_print_date($line->dateend,'dayhourrfc')." now:".dol_print_date($now,'dayhourrfc')); - + $cronjob=new Cronjob($db); $result=$cronjob->fetch($line->id); - if ($result<0) + if ($result < 0) { echo "Error cronjob->fetch: ".$cronjob->error."\n"; echo "Failed to fetch job ".$line->id."\n"; @@ -165,18 +175,22 @@ if(is_array($object->lines) && (count($object->lines)>0)) } // Execute job $result=$cronjob->run_jobs($userlogin); - if ($result<0) + if ($result < 0) { echo "Error cronjob->run_job: ".$cronjob->error."\n"; echo "At least one job failed. Go on menu Home-Setup-Admin tools to see result for each job.\n"; echo "You can also enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; dol_syslog("cron_run_jobs.php::run_jobs Error ".$cronjob->error, LOG_ERR); - exit(-1); + $nbofjobslaunchedko++; + } + else + { + $nbofjobslaunchedok++; } // we re-program the next execution and stores the last execution time for this job $result=$cronjob->reprogram_jobs($userlogin, $now); - if ($result<0) + if ($result<0) { echo "Error cronjob->reprogram_job: ".$cronjob->error."\n"; echo "Enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; @@ -194,6 +208,7 @@ if(is_array($object->lines) && (count($object->lines)>0)) $db->close(); +if ($nbofjobslaunchedko) exit(1); exit(0); From d1398887e6d26b8cfd267074e25a5242d7a01b07 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Aug 2017 12:02:42 +0200 Subject: [PATCH 13/20] Missing picto --- htdocs/theme/eldy/img/object_stripe.png | Bin 0 -> 819 bytes htdocs/theme/md/img/object_stripe.png | Bin 0 -> 819 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 htdocs/theme/eldy/img/object_stripe.png create mode 100644 htdocs/theme/md/img/object_stripe.png diff --git a/htdocs/theme/eldy/img/object_stripe.png b/htdocs/theme/eldy/img/object_stripe.png new file mode 100644 index 0000000000000000000000000000000000000000..287bd24910cb0fc86f886d02789f29b993bad530 GIT binary patch literal 819 zcmV-31I+x1P)2`81ATls8IUq4NIxsmpFgGA8FflMNTjFhO00007bV*G`2iXD;69^O^U!ddw z00M_eL_t(IPfb%#NK`=_{$}2L`}XbI#Y*sBfuXLJQs|+mbEhCG$e>Q)sY3?|JV=3r zhax(3=~@s$cInbJItE!FL?o7(MUj}TmTjx+8d^I5p&UgdzdheUcQK3M;T)V+b@tl3*XuCg;3mUOj+e2U zwd2~^!rh)@rLp?c;M;Nxy)ah+d=Dn@;pB4g0=lOp!u2Uak~o9^C6#iSj#&I^pe~$z zZfsma*{F=ym&cj&?dT~oB2$&ib-bP3z`gq=t}DA&glvh4leoChL`!>sv8!F^+ZS50 zjC|g~!2>z&ON_)lfdVBcKuEJB$)Te=k;!n8WBSE!Je(@w>9cjLl%fWyQA$I^CfNSy z!flXcWU?A_^ILfQwv=yCu zeJfyS7UeW*Ay6%_B1;q{E1>aXwT|mIm+)$)f+(_wi=M6wE?;a$bBkx)qpU*gQ_M?C zNI~@=^zgkDSyg78(Ri53(-IKB!LKsGm#2? zUaH~!$0};Ir2eRGFuPd8t*J8BC;~4PkRAZ)(&!gcV>BC8ggDEh#0=Q&O4M+(L?J0u zn;4&$3p;rEx_Z2A@_*4}b0y|Y<6Cg^d?(GkiF-nrVjk$^ygQ5TcCHVf&Z4*1;}ez= xl0Jw_8nqA>;D-U6fJV|l@gnx;>KNIzfxiXLt)E)oqyhi{002ovPDHLkV1kvqX=wle literal 0 HcmV?d00001 diff --git a/htdocs/theme/md/img/object_stripe.png b/htdocs/theme/md/img/object_stripe.png new file mode 100644 index 0000000000000000000000000000000000000000..287bd24910cb0fc86f886d02789f29b993bad530 GIT binary patch literal 819 zcmV-31I+x1P)2`81ATls8IUq4NIxsmpFgGA8FflMNTjFhO00007bV*G`2iXD;69^O^U!ddw z00M_eL_t(IPfb%#NK`=_{$}2L`}XbI#Y*sBfuXLJQs|+mbEhCG$e>Q)sY3?|JV=3r zhax(3=~@s$cInbJItE!FL?o7(MUj}TmTjx+8d^I5p&UgdzdheUcQK3M;T)V+b@tl3*XuCg;3mUOj+e2U zwd2~^!rh)@rLp?c;M;Nxy)ah+d=Dn@;pB4g0=lOp!u2Uak~o9^C6#iSj#&I^pe~$z zZfsma*{F=ym&cj&?dT~oB2$&ib-bP3z`gq=t}DA&glvh4leoChL`!>sv8!F^+ZS50 zjC|g~!2>z&ON_)lfdVBcKuEJB$)Te=k;!n8WBSE!Je(@w>9cjLl%fWyQA$I^CfNSy z!flXcWU?A_^ILfQwv=yCu zeJfyS7UeW*Ay6%_B1;q{E1>aXwT|mIm+)$)f+(_wi=M6wE?;a$bBkx)qpU*gQ_M?C zNI~@=^zgkDSyg78(Ri53(-IKB!LKsGm#2? zUaH~!$0};Ir2eRGFuPd8t*J8BC;~4PkRAZ)(&!gcV>BC8ggDEh#0=Q&O4M+(L?J0u zn;4&$3p;rEx_Z2A@_*4}b0y|Y<6Cg^d?(GkiF-nrVjk$^ygQ5TcCHVf&Z4*1;}ez= xl0Jw_8nqA>;D-U6fJV|l@gnx;>KNIzfxiXLt)E)oqyhi{002ovPDHLkV1kvqX=wle literal 0 HcmV?d00001 From f4a44ced803ab2b46ec5496ff6400831a9d71ad4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Aug 2017 11:25:10 +0200 Subject: [PATCH 14/20] Update module template --- htdocs/modulebuilder/template/class/myobject.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index a93d2fa6565..49aa42ad96d 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -443,8 +443,12 @@ class MyObject extends CommonObject { global $conf, $langs; + $this->output = ''; + $this->error=''; + dol_syslog(__METHOD__, LOG_DEBUG); + // ... return 0; } From 3a098ca0477f3b392ddb3a856062ad9fb520c931 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Aug 2017 11:50:30 +0200 Subject: [PATCH 15/20] Reduce verbosity --- htdocs/core/class/interfaces.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index ef64ac8d8e5..f8400cb963a 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -120,7 +120,7 @@ class Interfaces if (! $qualified) { - dol_syslog(get_class($this)."::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled", LOG_DEBUG); + //dol_syslog(get_class($this)."::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled", LOG_DEBUG); continue; } From c107a777227843bd10a51da325217ca822adb769 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Aug 2017 13:07:15 +0200 Subject: [PATCH 16/20] NEW Can filter on document name in ECM module for automatic tree --- htdocs/core/ajax/ajaxdirpreview.php | 12 ++++-- htdocs/core/class/html.formfile.class.php | 52 ++++++++++++++++++++--- htdocs/ecm/index_auto.php | 13 ++++-- 3 files changed, 66 insertions(+), 11 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index cee16f923f5..74d9db0ec6d 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -32,7 +32,6 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); - if (! isset($mode) || $mode != 'noajax') // For ajax call { require_once '../../main.inc.php'; @@ -45,6 +44,7 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call $section=GETPOST("section"); $module=GETPOST("module"); $urlsource=GETPOST("urlsource"); + $search_doc_ref=GETPOST('search_doc_ref','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -188,12 +188,16 @@ if ($type == 'directory') if (in_array($module, $automodules)) { $param.='&module='.$module; + if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref; + $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound"))); if ($module == 'company') $excludefiles[]='^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty. - $filearray=dol_dir_list($upload_dir,"files",1,'', $excludefiles, $sortfield, $sorting,1); - $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url); + $filter=preg_quote($search_doc_ref, '/'); + $filearray=dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting,1); + + $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url,1); } // Manual list else @@ -211,6 +215,8 @@ if ($type == 'directory') if ($section) { $param.='§ion='.$section; + if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref; + $textifempty = $langs->trans('NoFileFound'); } else if ($section === '0') $textifempty='
'.$langs->trans("DirNotSynchronizedSyncFirst").'

'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 0db46e416cb..7f9661b1d06 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -922,9 +922,10 @@ class FormFile * @param string $sortfield Sort field ('name', 'size', 'position', ...) * @param string $sortorder Sort order ('ASC' or 'DESC') * @param int $disablemove 1=Disable move button, 0=Position move is possible. + * @param int $addfilterfields Add line with filters * @return int <0 if KO, nb of files shown if OK */ - function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1) + function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1, $addfilterfields=0) { global $user, $conf, $langs, $hookmanager; global $bc,$bcdd; @@ -1006,6 +1007,18 @@ class FormFile print '
'; print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); print '
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("DatePayment").''; print dol_print_date($object->datep,'day'); print '
'.$langs->trans("DateValue").''; print dol_print_date($object->datev,'day'); print '
'; if (! empty($conf->accounting->enabled)) { - $accountancyaccount = new AccountingAccount($db); - $accountancyaccount->fetch('',$object->accountancy_code); + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('',$object->accountancy_code); - print $accountancyaccount->getNomUrl(1); - // print length_accountg($object->accountancy_code); + print $accountingaccount->getNomUrl(1); } else { print $object->accountancy_code; } @@ -411,7 +413,7 @@ if ($id) print '
'."\n"; if ($object->rappro == 0) { - if (! empty($user->rights->banque->delete)) + if (! empty($user->rights->banque->modifier)) { print ''.$langs->trans("Delete").''; } diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 5b2488cc5e8..101517df6fd 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/compta/bank/various_payment/index.php + * \file htdocs/compta/bank/various_payment/index.php * \ingroup bank * \brief List of various payments */ @@ -25,10 +25,10 @@ require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; +if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; -$langs->load("compta"); -$langs->load("banks"); -$langs->load("bills"); +$langs->loadLangs(array("compta","banks","bills","accountancy")); // Security check $socid = GETPOST("socid","int"); @@ -41,7 +41,8 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $search_ref = GETPOST('search_ref','int'); $search_user = GETPOST('search_user','alpha'); $search_label = GETPOST('search_label','alpha'); -$search_amount = GETPOST('search_amount','alpha'); +$search_amount_deb = GETPOST('search_amount_deb','alpha'); +$search_amount_cred = GETPOST('search_amount_cred','alpha'); $search_account = GETPOST('search_account','int'); $sortfield = GETPOST("sortfield",'alpha'); @@ -75,7 +76,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', { $search_ref=""; $search_label=""; - $search_amount=""; + $search_amount_deb=""; + $search_amount_cred=""; $search_account=''; $typeid=""; } @@ -90,8 +92,8 @@ $form = new Form($db); $variousstatic = new PaymentVarious($db); $accountstatic = new Account($db); -$sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank,"; -$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,"; +$sql = "SELECT v.rowid, 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.sens,"; +$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,"; $sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id"; @@ -102,7 +104,8 @@ $sql.= " WHERE v.entity = ".$conf->entity; // Search criteria if ($search_ref) $sql.=" AND v.rowid=".$search_ref; if ($search_label) $sql.=natural_search(array('v.label'), $search_label); -if ($search_amount) $sql.=natural_search("v.amount", $search_amount, 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_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($filtre) { $filtre=str_replace(":","=",$filtre); @@ -113,7 +116,6 @@ if ($typeid) { } $sql.= $db->order($sortfield,$sortorder); -//$sql.= " GROUP BY u.rowid, u.lastname, u.firstname, v.rowid, v.fk_user, v.amount, v.label, v.datev, v.fk_typepayment, v.num_payment, pst.code"; $totalnboflines=0; $result=$db->query($sql); if ($result) @@ -156,24 +158,30 @@ if ($result) print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Sens"),$_SERVER["PHP_SELF"],"v.sens","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AccountAccounting"),$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Debit"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Credit"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "
'; print ''; print ' '; $form->select_types_paiements($typeid,'typeid','',0,0,1,16); print '  '; $searchpicto=$form->showFilterAndCheckAddButtons(0); @@ -193,6 +206,7 @@ if ($result) print "
".$variousstatic->getNomUrl(1)."".dol_trunc($obj->label,40)."'.dol_print_date($db->jdate($obj->datep),'day')."'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; if ($obj->fk_bank > 0) { - //$accountstatic->fetch($obj->fk_bank); $accountstatic->id=$obj->bid; $accountstatic->ref=$obj->bref; $accountstatic->number=$obj->bnumber; - $accountstatic->accountancy_number=$obj->account_number; - $accountstatic->fk_accountancy_journal=$obj->fk_accountancy_journal; + + if (! empty($conf->accounting->enabled)) { + $accountstatic->account_number=$obj->bank_account_number; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($obj->accountancy_journal); + $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1); + } + $accountstatic->label=$obj->blabel; print $accountstatic->getNomUrl(1); } else print ' '; print '".price($obj->amount)."".$sens."
'.$accountingaccount->getNomUrl(0,1,1,'',1).'"; + if ($obj->sens == 0) + { + print price($obj->amount); + $totalarray['totaldeb'] += $obj->amount; + } + print ""; + if ($obj->sens == 1) + { + print price($obj->amount); + $totalarray['totalcred'] += $obj->amount; + } + print "
'.$langs->trans("Total").''.price($total)."'.price($totalarray['totaldeb'])."'.price($totalarray['totalcred'])."
'."\n"; + if (! empty($addfilterfields)) + { + print ''; + print ''; + print ''; + print ''; + if (empty($useinecm)) print ''; + print ''; + if (! $disablemove) print ''; + print "\n"; + } + print ''; print_liste_field_titre('Documents2',$url,"name","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre('Size',$url,"size","",$param,'align="right"',$sortfield,$sortorder); @@ -1291,21 +1304,47 @@ class FormFile * @param int $useinecm Change output for use in ecm module * @param int $textifempty Text to show if filearray is empty * @param int $maxlength Maximum length of file name shown - * @param string $url Full url to use for click links ('' = autodetect) + * @param string $url Full url to use for click links ('' = autodetect) + * @param int $addfilterfields Add line with filters * @return int <0 if KO, nb of files shown if OK */ - function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$url='') + function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$url='',$addfilterfields=0) { - global $user, $conf, $langs; + global $user, $conf, $langs, $form; global $bc; global $sortfield, $sortorder; + global $search_doc_ref; dol_syslog(get_class($this).'::list_of_autoecmfiles upload_dir='.$upload_dir.' modulepart='.$modulepart); // Show list of documents if (empty($useinecm)) print load_fiche_titre($langs->trans("AttachedFiles")); if (empty($url)) $url=$_SERVER["PHP_SELF"]; + + if (! empty($addfilterfields)) + { + print ''; + print ''; + } + + print '
'; print '
'."\n"; + + if (! empty($addfilterfields)) + { + print ''; + print ''; + print ''; + print ''; + print ''; + // Action column + print ''; + print "\n"; + } + print ''; $sortref="fullname"; if ($modulepart == 'invoice_supplier') $sortref='level1name'; @@ -1490,12 +1529,15 @@ class FormFile if (count($filearray) == 0) { - print ''; } print "
'; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; + print '
'; + print '
'; if (empty($textifempty)) print $langs->trans("NoFileFound"); else print $textifempty; print '
"; + print ''; + + if (! empty($addfilterfields)) print ''; // Fin de zone } diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index b613d336fc4..9d314e20bbd 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -50,10 +50,11 @@ $result = restrictedArea($user, 'ecm', 0); // Get parameters $socid=GETPOST('socid','int'); $action=GETPOST('action','aZ09'); -$section=GETPOST("section")?GETPOST("section","int"):GETPOST("section_id","int"); -$module=GETPOST("module"); +$section=GETPOST('section','int')?GETPOST('section','int'):GETPOST('section_id','int'); +$module=GETPOST('module','alpha'); if (! $section) $section=0; -$section_dir=GETPOST('section_dir'); +$section_dir=GETPOST('section_dir','alpha'); +$search_doc_ref=GETPOST('search_doc_ref','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -88,6 +89,12 @@ $error=0; * Actions */ +// Purge search criteria +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers +{ + $search_doc_ref=''; +} + // Upload file if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) { From 5b7c144f953722c455cca4dc6be75c5e88fa64b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Aug 2017 13:45:20 +0200 Subject: [PATCH 17/20] FIX Bad link in ECM --- htdocs/core/class/html.formfile.class.php | 39 ++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7f9661b1d06..b6ce8c69178 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -835,9 +835,9 @@ class FormFile $out=''; $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); - //if (! empty($conf->dol_use_jmobile)) return ''; + $filterforfilesearch = preg_quote(basename($modulesubdir),'/').'[^\-]+'; - $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) + $file_list=dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) // For ajax treatment $out.= ''."\n"; @@ -1443,20 +1443,20 @@ class FormFile $id=0; $ref=''; $label=''; // To show ref or specific information according to view to show (defined by $module) - if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices - if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices + if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} if (! $id && ! $ref) continue; $found=0; @@ -1488,20 +1488,23 @@ class FormFile if (! $found > 0 || ! is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) continue; // We do not show orphelins files - print ''."\n"; print ''; print ''; if ($found > 0 && is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) print $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]->getNomUrl(1,'document'); else print $langs->trans("ObjectDeleted",($id?$id:$ref)); - $filename=dol_sanitizeFileName($ref); + //$modulesubdir=dol_sanitizeFileName($ref); + $modulesubdir=dirname($relativefile); + //$filedir=$conf->$modulepart->dir_output . '/' . dol_sanitizeFileName($obj->ref); $filedir=$file['path']; //$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; //print $formfile->getDocumentsLink($modulepart, $filename, $filedir); print ''; + + // File print ''; //print "XX".$file['name']; //$file['name'] must be utf8 print '\n"; print ''.dol_print_size($file['size'],1,1).''; From da831d2c8e1bab6f331bc56ad8045c2a63168291 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Aug 2017 13:45:20 +0200 Subject: [PATCH 18/20] FIX Bad link in ECM --- htdocs/core/class/html.formfile.class.php | 39 ++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 0db46e416cb..824b13fd62f 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -835,9 +835,9 @@ class FormFile $out=''; $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); - //if (! empty($conf->dol_use_jmobile)) return ''; + $filterforfilesearch = preg_quote(basename($modulesubdir),'/').'[^\-]+'; - $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) + $file_list=dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) // For ajax treatment $out.= ''."\n"; @@ -1404,20 +1404,20 @@ class FormFile $id=0; $ref=''; $label=''; // To show ref or specific information according to view to show (defined by $module) - if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices - if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices + if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} if (! $id && ! $ref) continue; $found=0; @@ -1449,20 +1449,23 @@ class FormFile if (! $found > 0 || ! is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) continue; // We do not show orphelins files - print ''."\n"; print ''; print ''; if ($found > 0 && is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) print $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]->getNomUrl(1,'document'); else print $langs->trans("ObjectDeleted",($id?$id:$ref)); - $filename=dol_sanitizeFileName($ref); + //$modulesubdir=dol_sanitizeFileName($ref); + $modulesubdir=dirname($relativefile); + //$filedir=$conf->$modulepart->dir_output . '/' . dol_sanitizeFileName($obj->ref); $filedir=$file['path']; //$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; //print $formfile->getDocumentsLink($modulepart, $filename, $filedir); print ''; + + // File print ''; //print "XX".$file['name']; //$file['name'] must be utf8 print '\n"; print ''.dol_print_size($file['size'],1,1).''; From 8a71b9e95e09f66cde96f645cccebb7dd4d485c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Aug 2017 13:51:25 +0200 Subject: [PATCH 19/20] Avoid creation of dir that is not indexed --- htdocs/core/modules/modECM.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php index bfe0e45e02c..b263b16e29e 100644 --- a/htdocs/core/modules/modECM.class.php +++ b/htdocs/core/modules/modECM.class.php @@ -63,7 +63,7 @@ class modECM extends DolibarrModules $this->picto='dir'; // Data directories to create when module is enabled - $this->dirs = array("/ecm/My_First_Directory","/ecm/temp"); + $this->dirs = array("/ecm/temp"); // Config pages. Put here list of php page names stored in admmin directory used to setup module $this->config_page_url = array('ecm.php'); From 4cb2a0bce27e6e559ed5ddedaf9142cf6b1086bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Aug 2017 15:17:30 +0200 Subject: [PATCH 20/20] Update list.php --- htdocs/compta/paiement/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 04dbaf8fc11..8344ed08095 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -334,7 +334,7 @@ if ($resql) $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($objp->accountancy_journal); - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1); + $accountstatic->accountancy_journal = $accountingjournal->code; print $accountstatic->getNomUrl(1); }