diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php index b6dffd15f19..ad90d11884b 100644 --- a/htdocs/actioncomm.class.php +++ b/htdocs/actioncomm.class.php @@ -71,6 +71,7 @@ class ActionComm function ActionComm($db) { $this->db = $db; + /* $this->societe = new Societe($db); $this->author = new User($db); $this->usermod = new User($db); @@ -80,6 +81,7 @@ class ActionComm { $this->contact = new Contact($db); } + */ } /** diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 8b0e48f1833..4c61fb5f371 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -69,7 +69,7 @@ $pagenext = $page + 1; if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { /* - * Creation répertoire si n'existe pas + * Creation r�pertoire si n'existe pas */ $upload_dir = $conf->actions->dir_output.'/'.sanitizeFileName($objectid); if (! is_dir($upload_dir)) create_exdir($upload_dir); @@ -83,7 +83,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) } else { - // Echec transfert (fichier dépassant la limite ?) + // Echec transfert (fichier d�passant la limite ?) $mesg = '
'.$langs->trans("ErrorFileNotUploaded").'
'; // print_r($_FILES); } @@ -114,10 +114,19 @@ if ($objectid > 0) if ($act->fetch($objectid)) { $upload_dir = $conf->actions->dir_output.'/'.sanitizeFileName($objectid); + + $company=new Societe($db); + $company->fetch($act->societe->id); + $act->societe=$company; - $res=$act->societe->fetch($act->societe->id); - $res=$act->author->fetch(); // Le paramètre est le login, hors seul l'id est chargé. - $res=$act->contact->fetch($act->contact->id); + $author=new User($db); + $author->id=$act->author->id; + $author->fetch(); + $act->author=$author; + + $contact=new Contact($db); + $contact->fetch($act->contact->id); + $act->contact=$contact; $h=0; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index ad414e63577..d81ea3d97d0 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -610,10 +610,10 @@ if ($_GET["id"]) } $act->societe = $societe; - if ($act->author->id > 0) $res=$act->author->fetch(); // Le parametre est le login, hors seul l'id est charge. - if ($act->usermod->id > 0) $res=$act->usermod->fetch(); - if ($act->usertodo->id > 0) $res=$act->usertodo->fetch(); - if ($act->userdone->id > 0) $res=$act->userdone->fetch(); + if ($act->author->id > 0) { $tmpuser=new User($db); $tmpuser->id=$act->author->id; $res=$tmpuser->fetch(); $act->author=$tmpuser; } + if ($act->usermod->id > 0) { $tmpuser=new User($db); $tmpuser->id=$act->usermod->id; $res=$tmpuser->fetch(); $act->usermod=$tmpuser; } + if ($act->usertodo->id > 0) { $tmpuser=new User($db); $tmpuser->id=$act->usertodo->id; $res=$tmpuser->fetch(); $act->usertodo=$tmpuser; } + if ($act->userdone->id > 0) { $tmpuser=new User($db); $tmpuser->id=$act->userdone->id; $res=$tmpuser->fetch(); $act->userdone=$tmpuser; } $contact = new Contact($db); if ($act->contact->id) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 678f7c41bc0..a364867e38a 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -119,10 +119,10 @@ $next = dol_get_next_month($month, $year); $next_year = $next['year']; $next_month = $next['month']; -$max_day_in_prev_month = date("t",dolibarr_mktime(0,0,0,$prev_month,1,$prev_year)); -$max_day_in_month = date("t",dolibarr_mktime(0,0,0,$month,1,$year)); +$max_day_in_prev_month = date("t",dolibarr_mktime(0,0,0,$prev_month,1,$prev_year)); // Nb of days in previous month +$max_day_in_month = date("t",dolibarr_mktime(0,0,0,$month,1,$year)); // Nb of days in next month $tmpday = -date("w",dolibarr_mktime(0,0,0,$month,1,$year))+2; -if ($tmpday > 1) $tmpday -= 7; +if ($tmpday >= 1) $tmpday -= 7; $firstdaytoshow=dolibarr_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year); $next_day=7-($max_day_in_month+1-$tmpday)%7; if ($next_day < 6) $next_day+=7; @@ -404,6 +404,8 @@ if ($_GET["action"] != 'show_day') echo ' '.$langs->trans("Saturday")."\n"; echo ' '.$langs->trans("Sunday")."\n"; echo " \n"; + + // In loops, tmpday contains day nb in current month (can be negative for days of previous month) for($iter_week = 0; $iter_week < 6 ; $iter_week++) { echo " \n"; diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index e2caa1e315c..b3770536757 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); $langs->load("commercial"); -// Sécurité accés client +// Security check if ($user->societe_id > 0) { $action = ''; @@ -49,9 +49,6 @@ llxHeader(); $act = new ActionComm($db); $act->fetch($_GET["id"]); $act->info($_GET["id"]); -$res=$act->societe->fetch($act->societe->id); -$res=$act->author->fetch(); // Le paramètre est le login, hors seul l'id est chargé. -$res=$act->contact->fetch($act->contact->id); $h=0; @@ -78,7 +75,7 @@ print ''; print ''; -// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent +// Juste pour �viter bug IE qui r�organise mal div pr�c�dents si celui-ci absent print '
'; print '
'; diff --git a/htdocs/user.class.php b/htdocs/user.class.php index c4d095c3f51..b263062ec98 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -116,6 +116,14 @@ class User extends CommonObject return 1; } + + /* Polymorph functions not allowed in PHP + function fetch($id) + { + $this->id=$id; + $this->fetch(); + } + */ /** * \brief Charge un objet user avec toutes ces caracteristiques depuis un id ou login