diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index c3c64758225..fc44cc02332 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -374,6 +374,9 @@ class Conf $this->format_date_hour_text_short="%d %b %Y %H:%M"; $this->format_date_hour_text="%d %B %Y %H:%M"; + // Duration of workday + if (! isset($conf->global->MAIN_DURATION_OF_WORKDAY)) $this->global->MAIN_DURATION_OF_WORKDAY=86400; + // Limites decimales si non definie (peuvent etre egale a 0) if (! isset($this->global->MAIN_MAX_DECIMALS_UNIT)) $this->global->MAIN_MAX_DECIMALS_UNIT=5; if (! isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT=2; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 96776c1af1d..9915cc703d6 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -790,16 +790,17 @@ function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0) function dol_delete_preview($object) { global $langs,$conf; - require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); $element = $object->element; - $dir = $conf->$element->dir_output; - if ($object->element == 'order_supplier') $dir = $conf->fournisseur->dir_output.'/commande'; - elseif ($object->element == 'invoice_supplier') $dir = $conf->fournisseur->dir_output.'/facture'; - elseif ($object->element == 'project') $dir = $conf->projet->dir_output; - elseif ($object->element == 'shipping') $dir = $conf->expedition->dir_output.'/sending'; - elseif ($object->element == 'delivery') $dir = $conf->expedition->dir_output.'/receipt'; + if ($object->element == 'order_supplier') $dir = $conf->fournisseur->dir_output.'/commande'; + elseif ($object->element == 'invoice_supplier') $dir = $conf->fournisseur->dir_output.'/facture'; + elseif ($object->element == 'project') $dir = $conf->projet->dir_output; + elseif ($object->element == 'shipping') $dir = $conf->expedition->dir_output.'/sending'; + elseif ($object->element == 'delivery') $dir = $conf->expedition->dir_output.'/receipt'; + elseif ($object->element == 'fichinter') $dir = $conf->ficheinter->dir_output; + else + $dir = $conf->$element->dir_output; if (empty($dir)) return 'ErrorObjectNoSupportedByFunction'; diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index d36b371799a..062acb79557 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -86,7 +86,8 @@ class pdf_soleil extends ModelePDFFicheinter // Recupere emmetteur $this->emetteur=$mysoc; - if (! $this->emetteur->code_pays) $this->emetteur->code_pays=substr($langs->defaultlang,-2); // By default, if not defined + if (empty($this->emetteur->country_code)) + $this->emetteur->country_code = substr($langs->defaultlang,-2); // By default, if not defined // Defini position des colonnes $this->posxdesc=$this->marge_gauche+1; @@ -271,6 +272,7 @@ class pdf_soleil extends ModelePDFFicheinter $nexY+=2; // Passe espace entre les lignes // Detect if some page were added automatically and output _tableau for past pages + // FIXME $pageposafter not defined while ($pagenb < $pageposafter) { if ($pagenb == 1) @@ -553,7 +555,7 @@ class pdf_soleil extends ModelePDFFicheinter $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); } - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target'); + $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target'); // Show recipient $posy=42; diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index edd5be4401a..0b06b7132ff 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -44,7 +44,7 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator * @param string $maxfilenamelength Max length of value to show * @return array List of templates */ - function liste_modeles($db,$maxfilenamelength=0) + static function liste_modeles($db,$maxfilenamelength=0) { global $conf; @@ -224,9 +224,6 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); dol_delete_preview($object); - // Success in building document. We build meta file. - dol_meta_create($object); - // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); $interface=new Interfaces($db); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index d2287050cc4..0498ab21466 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -87,7 +87,7 @@ class Fichinter extends CommonObject */ function create() { - global $conf; + global $conf, $user, $langs; dol_syslog(get_class($this)."::create ref=".$this->ref); @@ -156,8 +156,8 @@ class Fichinter extends CommonObject $result=$this->db->query($sql); if ($result) { - $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter"); - $this->db->commit(); + $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter"); + $this->db->commit(); // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); @@ -328,10 +328,9 @@ class Fichinter extends CommonObject * Validate a intervention * * @param User $user User that validate - * @param string $outputdir Output directory * @return int <0 if KO, >0 if OK */ - function setValid($user, $outputdir) + function setValid($user) { global $langs, $conf; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 8c7eb21e1f8..34edbbc2675 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -76,7 +76,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->fichein $object->fetch($id); $object->fetch_thirdparty(); - $result = $object->setValid($user, $conf->fichinter->outputdir); + $result = $object->setValid($user); if ($result >= 0) { // Define output language @@ -905,7 +905,7 @@ else if ($id > 0 || ! empty($ref)) // Duration print ''.$langs->trans("TotalDuration").''; - print ''.convertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).''; + print ''.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).''; print ''; // Description (must be a textarea and not html must be allowed (used in list view) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index dfced7618f5..62a146fa289 100755 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -42,21 +42,12 @@ $result = restrictedArea($user, 'ficheinter', $fichinterid,'fichinter'); $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); -if ($page == -1) { - $page = 0; -} +if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; - if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="fd.date"; -if ($page == -1) { $page = 0 ; } - -$limit = $conf->liste_limit; -$offset = $limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; $search_ref=GETPOST('search_ref','alpha'); $search_company=GETPOST('search_company','alpha'); diff --git a/htdocs/fichinter/rapport.php b/htdocs/fichinter/rapport.php index 890b0e4bfbe..0be18134f70 100644 --- a/htdocs/fichinter/rapport.php +++ b/htdocs/fichinter/rapport.php @@ -23,9 +23,23 @@ require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); $langs->load("interventions"); +$socid=GETPOST('socid', 'int'); + // Security check -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); +if (! empty($user->societe_id)) $socid=$user->societe_id; +$result = restrictedArea($user, 'ficheinter', '', 'fichinter'); + +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); +if ($page == -1) { + $page = 0; +} +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="f.datei"; /* @@ -34,21 +48,7 @@ $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); llxHeader(); -if ($sortorder == "") -{ - $sortorder="ASC"; -} -if ($sortfield == "") -{ - $sortfield="f.datei"; -} - -if ($page == -1) { $page = 0 ; } - -$limit = $conf->liste_limit; -$offset = $limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; +$now=dol_now(); $sql = "SELECT s.nom, s.rowid as socid, f.description, f.ref"; $sql.= ", f.datei as dp, f.rowid as fichid, f.fk_statut, f.duree"; @@ -56,23 +56,22 @@ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."fichinter as f "; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity = ".$conf->entity; - - -if ($socid > 0) -{ +if (! empty($socid)) $sql .= " AND s.rowid = " . $socid; -} -if (empty ($MM)) -$MM=strftime("%m",time()); + +if (empty($MM)) + $MM=strftime("%m", $now); if (empty($YY)) -$YY=strftime("%Y",time());; + $YY=strftime("%Y", $now); + echo "
"; -echo "\n
"; +echo ''; +echo ''; echo ""; echo $langs->trans("Month")." "; echo " Année "; -echo ""; +echo ""; echo ""; echo "
"; @@ -100,7 +99,7 @@ if ($resql) $i = 0; print ''; - print ""; + print ''; print ''; if (empty($socid)) print ''; @@ -120,9 +119,9 @@ if ($resql) if (empty($socid)) { - if (!empty($MM)) $filter="&MM=$MM&YY=$YY"; - print '\n"; + if (!empty($MM)) $filter='&MM='.$MM.'&YY='.$YY; + print ''."\n"; } print ''; print "\n"; @@ -140,7 +139,8 @@ else { dol_print_error($db); } -$db->close(); + llxFooter(); +$db->close(); ?>
Num'.$langs->trans("Customers").' '; - print "rowid.$filter."\">".$objp->nom." '; + print ''.$objp->nom.''.nl2br($objp->description).'".dol_print_date($db->jdate($objp->dp),"day")."