diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index d6803b4ae17..4e6c540d2a5 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2500,7 +2500,6 @@ class Adherent extends CommonObject - /** * Send reminders by emails before subscription end * CAN BE A CRON TASK @@ -2512,6 +2511,7 @@ class Adherent extends CommonObject { global $conf, $langs, $mysoc, $user; + $error = 0; $this->output = ''; $this->error=''; @@ -2561,9 +2561,6 @@ class Adherent extends CommonObject $adherent->fetch_thirdparty(); // Send reminder email - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail=new FormMail($db); - $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang); $outputlangs->loadLangs(array("main", "members")); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 682e66e8144..7960bbd764d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1654,7 +1654,8 @@ class ActionComm extends CommonObject { global $conf, $langs; - $this->output = ''; + $error = 0; + $this->output = ''; $this->error=''; if (empty($conf->global->AGENDA_REMINDER_EMAIL)) @@ -1668,6 +1669,8 @@ class ActionComm extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); + $this->db->begin(); + // TODO Scan events of type 'email' into table llx_actioncomm_reminder with status todo, send email, then set status to done @@ -1676,7 +1679,9 @@ class ActionComm extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'"; $this->db->query($sql); - return 0; + $this->db->commit(); + + return $error; } } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 94118d415bf..55dfacdf2c5 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -205,8 +205,6 @@ $formother = new FormOther($db); $socstatic = new Societe($db); $contracttmp = new Contrat($db); -llxHeader('', $langs->trans("Contracts")); - $sql = 'SELECT'; $sql.= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,"; $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; @@ -309,489 +307,504 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= $db->plimit($limit + 1, $offset); $resql=$db->query($sql); -if ($resql) +if (! $resql) { - $num = $db->num_rows($resql); - $i = 0; + dol_print_error($db); + exit; +} - $arrayofselected=is_array($toselect)?$toselect:array(); +$num = $db->num_rows($resql); - if ($socid > 0) +// Direct jump if only one record found +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/contrat/card.php?id='.$id); + exit; +} + + +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $langs->trans("Contracts")); + +$i = 0; + +$arrayofselected=is_array($toselect)?$toselect:array(); + +if ($socid > 0) +{ + $soc = new Societe($db); + $soc->fetch($socid); + if (empty($search_name)) $search_name = $soc->name; +} + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($sall != '') $param.='&sall='.urlencode($sall); +if ($search_contract != '') $param.='&search_contract='.urlencode($search_contract); +if ($search_name != '') $param.='&search_name='.urlencode($search_name); +if ($search_email != '') $param.='&search_email='.urlencode($search_email); +if ($search_ref_customer != '') $param.='&search_ref_customer='.urlencode($search_ref_customer); +if ($search_ref_supplier != '') $param.='&search_ref_supplier='.urlencode($search_ref_supplier); +if ($search_op2df != '') $param.='&search_op2df='.urlencode($search_op2df); +if ($search_dfyear != '') $param.='&search_dfyear='.urlencode($search_dfyear); +if ($search_dfmonth != '') $param.='&search_dfmonth='.urlencode($search_dfmonth); +if ($search_sale != '') $param.='&search_sale=' .urlencode($search_sale); +if ($search_user != '') $param.='&search_user=' .urlencode($search_user); +if ($search_product_category != '') $param.='&search_product_category=' .urlencode($search_product_category); +if ($show_files) $param.='&show_files=' .urlencode($show_files); +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + +// List of mass actions available +$arrayofmassactions = array( + 'presend'=>$langs->trans("SendByMail"), + 'builddoc'=>$langs->trans("PDFMerge"), +); +if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + +print '
'; + +$hidegeneratedfilelistifempty=1; +if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; + +// Show list of available documents +$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; +$urlsource.=str_replace('&','&',$param); + +$filedir=$diroutputmassaction; +$genallowed=$user->rights->contrat->lire; +$delallowed=$user->rights->contrat->lire; + +print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); llxFooter(); diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 3314830b68a..3a7a79122c9 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -449,7 +449,6 @@ class Utils } } - return 0; } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 5024ec48d5d..376c9bcfc38 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -470,14 +470,23 @@ class MyObject extends CommonObject { global $conf, $langs; + //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; + + $error = 0; $this->output = ''; $this->error=''; dol_syslog(__METHOD__, LOG_DEBUG); + $now = dol_now(); + + $this->db->begin(); + // ... - return 0; + $this->db->commit(); + + return $error; } } diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 111da0c46ea..6b2199925be 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -504,40 +504,4 @@ class SocieteAccount extends CommonObject { $this->initAsSpecimenCommon(); } - - - /** - * Action executed by scheduler - * CAN BE A CRON TASK - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - $this->output = ''; - $this->error=''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - // ... - - return 0; - } } - -/** - * Class societeAccountLine. You can also remove this and generate a CRUD class for lines objects. - */ -/* -class societeAccountLine -{ - // @var int ID - public $id; - // @var mixed Sample line property 1 - public $prop1; - // @var mixed Sample line property 2 - public $prop2; -} -*/ \ No newline at end of file