diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 0cd604675ba..9b73b00d375 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -454,8 +454,8 @@ class ActionComm extends CommonObject /** - * \brief Charge les informations d'ordre info dans l'objet facture - * \param id Id de la facture a charger + * Charge les informations d'ordre info dans l'objet facture + * @param id Id de la facture a charger */ function info($id) { @@ -502,9 +502,9 @@ class ActionComm extends CommonObject /** - * \brief Retourne le libelle du statut de la commande - * \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * \return string Libelle + * Return label of status + * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Libelle */ function getLibStatut($mode) { @@ -512,10 +512,10 @@ class ActionComm extends CommonObject } /** - * \brief Renvoi le libelle d'un statut donne - * \param percent Pourcentage avancement - * \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * \return string Libelle + * Return label of action status + * @param percent Percent + * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label */ function LibStatut($percent,$mode) { @@ -523,7 +523,7 @@ class ActionComm extends CommonObject if ($mode == 0) { - if ($percent==0) return $langs->trans('StatusActionToDo'); + if ($percent==0) return $langs->trans('StatusActionToDo').' (0%)'; if ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)'; if ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)'; } @@ -541,9 +541,9 @@ class ActionComm extends CommonObject } if ($mode == 3) { - if ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo'),'statut1'); + if ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo').' (0%)','statut1'); if ($percent > 0 && $percent < 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3'); - if ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone'),'statut6'); + if ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone').' (100%)','statut6'); } if ($mode == 4) { @@ -560,20 +560,20 @@ class ActionComm extends CommonObject } /** - * \brief Renvoie nom clicable (avec eventuellement le picto) - * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul - * \param maxlength Nombre de caracteres max dans libelle - * \param class Force style class on a link - * \param option ''=Link to action,'birthday'=Link to contact - * \return string Chaine avec URL - * \remarks Utilise $this->id, $this->code et $this->libelle + * Renvoie nom clicable (avec eventuellement le picto) + * @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul + * @param maxlength Nombre de caracteres max dans libelle + * @param class Force style class on a link + * @param option ''=Link to action,'birthday'=Link to contact + * @return string Chaine avec URL + * @remarks Utilise $this->id, $this->code et $this->libelle */ function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='') { global $langs; $result=''; - if ($option=='birthday') $lien = ''; + if ($option=='birthday') $lien = ''.img_object('','contact').' '; else $lien = ''; $lienfin=''; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 24c3211db6a..1ab739e66f9 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -22,7 +22,7 @@ /** * \file htdocs/comm/action/index.php * \ingroup agenda - * \brief Page accueil des rapports des actions + * \brief Home page of calendar events * \version $Id$ */ @@ -580,6 +580,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$action print $action->getNomUrl(0,$nbofchartoshow,'cal_event','birthday'); } print ''; + // Status - Percent print ''; if ($action->type_code != 'BIRTHDAY') print $action->getLibStatut(3); else print ' '; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index a588596cf9e..b3821491bdd 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -77,9 +77,9 @@ class Contact extends CommonObject /** - * \brief Constructeur de l'objet contact - * \param DB Habler d'acces base - * \param id Id contact + * Constructor of class Contact + * @param DB Habler d'acces base + * @param id Id contact */ function Contact($DB, $id=0) { @@ -90,16 +90,19 @@ class Contact extends CommonObject } /** - * \brief Add a contact into database - * \param user Object user that create - * \return int <0 if KO, >0 if OK + * Add a contact into database + * @param user Object user that create + * @return int <0 if KO, >0 if OK */ function create($user) { global $conf, $langs; + $error=0; $now=dol_now(); + $this->db->begin(); + // Clean parameters $this->name=trim($this->name); if (! $this->socid) $this->socid = 0; @@ -122,36 +125,64 @@ class Contact extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."socpeople"); - $result=$this->update($this->id, $user, 1); - if ($result < 0) + if (! $error) { - $this->error=$this->db->error(); - return -2; + $result=$this->update($this->id, $user, 1); + if ($result < 0) + { + $error++; + $this->error=$this->db->lasterror(); + } } - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('CONTACT_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + if (! $error) + { + $result=$this->update_perso($this->id, $user); + if ($result < 0) + { + $error++; + $this->error=$this->db->lasterror(); + } + } - return $this->id; + if (! $error) + { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('CONTACT_CREATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // Fin appel triggers + } + + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + dol_syslog("Contact::create ".$this->error, LOG_ERR); + return -2; + } } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); + + $this->db->rollback(); dol_syslog("Contact::create ".$this->error, LOG_ERR); return -1; } } /** - * \brief Update informations into database - * \param id Id du contact a mettre a jour - * \param user Objet utilisateur qui effectue la mise a jour - * \param notrigger 0=non, 1=oui - * \return int <0 if KO, >0 if OK + * Update informations into database + * @param id Id du contact a mettre a jour + * @param user Objet utilisateur qui effectue la mise a jour + * @param notrigger 0=non, 1=oui + * @return int <0 if KO, >0 if OK */ function update($id, $user=0, $notrigger=0) { @@ -226,10 +257,9 @@ class Contact extends CommonObject } else { - $this->db->rollback(); - $this->error=$this->db->lasterror().' sql='.$sql; dol_syslog("Contact::update Error ".$this->error,LOG_ERR); + $this->db->rollback(); return -1; } } @@ -323,29 +353,20 @@ class Contact extends CommonObject } - /* - * \brief Mise a jour des alertes - * \param id id du contact - * \param user Utilisateur qui demande l'alerte + /** + * Update field alert birthday + * @param id Id of contact + * @param user User asking to change alert or birthday + * @return int */ function update_perso($id, $user=0) { + $error=0; + $result=false; + // Mis a jour contact $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET rowid=".$id; - - if ($this->birthday) // <0 si avant 1970, >0 si apres 1970 - { - if (preg_match('/^[0-9]+\-/',$this->birthday)) - { - // Si date = chaine (ne devrait pas arriver) - $sql .= ", birthday='".$this->birthday."'"; - } - else - { - // Si date = timestamp - $sql .= ", birthday=".$this->db->idate($this->birthday); - } - } + $sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null"); if ($user) $sql .= ", fk_user_modif=".$user->id; $sql .= " WHERE rowid=".$id; //print "update_perso: ".$this->birthday.'-'.$this->db->idate($this->birthday); @@ -353,7 +374,8 @@ class Contact extends CommonObject $resql = $this->db->query($sql); if (! $resql) { - $this->error=$this->db->error(); + $error++; + $this->error=$this->db->lasterror(); } // Mis a jour alerte birthday @@ -370,7 +392,8 @@ class Contact extends CommonObject $result = $this->db->query($sql); if (!$result) { - $this->error='Echec sql='.$sql; + $error++; + $this->error=$this->db->lasterror(); } } else @@ -383,11 +406,13 @@ class Contact extends CommonObject $sql = "DELETE from ".MAIN_DB_PREFIX."user_alert "; $sql.= "where type=1 AND fk_contact=".$id." AND fk_user=".$user->id; $result = $this->db->query($sql); - if (!$result) + if (! $result) { - $this->error='Echec sql='.$sql; + $error++; + $this->error=$this->db->lasterror(); } } + return $result; } diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 9a943fe53ec..4b615ebbc45 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -89,13 +89,13 @@ else { // Recuperation contact actuel $result = $object->fetch($_GET["id"]); - + if ($result > 0) { // Creation user $nuser = new User($db); $result=$nuser->create_from_contact($object,$_POST["login"]); - + if ($result < 0) { $msg=$nuser->error; @@ -106,12 +106,16 @@ else $msg=$object->error; } } - + // Creation contact if ($_POST["action"] == 'add' && $user->rights->societe->contact->creer) { + $error=0; + + $db->begin(); + $object->socid = $_POST["socid"]; - + $object->name = $_POST["name"]; $object->firstname = $_POST["firstname"]; $object->civilite_id = $_POST["civilite_id"]; @@ -129,36 +133,48 @@ else $object->jabberid = $_POST["jabberid"]; $object->priv = $_POST["priv"]; $object->note = $_POST["note"]; - + + // Note: Correct date should be completed with location to have exact GM time of birth. + $object->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]); + $object->birthday_alert = $_POST["birthday_alert"]; + if (! $_POST["name"]) { + $error++; array_push($errors,$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label"))); $_GET["action"] = $_POST["action"] = 'create'; } - + if ($_POST["name"]) { $id = $object->create($user); - if ($id > 0) + if ($id <= 0) { - Header("Location: fiche.php?id=".$id); - exit; - } - else - { - $errors=array($object->error); + $error++; + $errors=array($object->error); $_GET["action"] = $_POST["action"] = 'create'; } } + + if (! $error && $id > 0) + { + $db->commit(); + Header("Location: fiche.php?id=".$id); + exit; + } + else + { + $db->rollback(); + } } - + if (GETPOST("action") == 'confirm_delete' && GETPOST("confirm") == 'yes' && $user->rights->societe->contact->supprimer) { $result=$object->fetch($_GET["id"]); - + $object->old_name = $_POST["old_name"]; $object->old_firstname = $_POST["old_firstname"]; - + $result = $object->delete(); if ($result > 0) { @@ -170,7 +186,7 @@ else $mesg=$object->error; } } - + if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer) { if (empty($_POST["name"])) @@ -179,28 +195,28 @@ else $error++; $_GET["action"] = $_POST["action"] = 'edit'; } - + if (! sizeof($errors)) { $object->fetch($_POST["contactid"]); - + $object->oldcopy=dol_clone($object); - + $object->old_name = $_POST["old_name"]; $object->old_firstname = $_POST["old_firstname"]; - + $object->socid = $_POST["socid"]; $object->name = $_POST["name"]; $object->firstname = $_POST["firstname"]; $object->civilite_id = $_POST["civilite_id"]; $object->poste = $_POST["poste"]; - + $object->address = $_POST["address"]; $object->cp = $_POST["cp"]; $object->ville = $_POST["ville"]; $object->fk_departement= $_POST["departement_id"]; $object->fk_pays = $_POST["pays_id"]; - + $object->email = $_POST["email"]; $object->phone_pro = $_POST["phone_pro"]; $object->phone_perso = $_POST["phone_perso"]; @@ -209,9 +225,9 @@ else $object->jabberid = $_POST["jabberid"]; $object->priv = $_POST["priv"]; $object->note = $_POST["note"]; - + $result = $object->update($_POST["contactid"], $user); - + if ($result > 0) { $object->old_name=''; @@ -248,25 +264,25 @@ if (! empty($canvas)) // ----------------------------------------- // When used with CANVAS // ----------------------------------------- - + if (GETPOST("action") == 'create') { // Set action type $objcanvas->setAction(GETPOST("action")); - + // Card header $title = $objcanvas->getTitle(); print_fiche_titre($title); - + // Assign _POST data $objcanvas->assign_post(); - + // Assign template values $objcanvas->assign_values(); // Show errors dol_htmloutput_errors($objcanvas->error,$objcanvas->errors); - + // Display canvas $objcanvas->display_canvas(); } @@ -275,26 +291,26 @@ if (! empty($canvas)) /* * Mode edition */ - + // Set action type $objcanvas->setAction(GETPOST("action")); - + // Fetch object $result=$objcanvas->fetch($id); if ($result > 0) { // Card header $objcanvas->showHead(); - + if ($_POST["name"]) { // Assign _POST data $objcanvas->assign_post(); } - + // Assign values $objcanvas->assign_values(); - + // Display canvas $objcanvas->display_canvas(); } @@ -303,12 +319,12 @@ if (! empty($canvas)) dol_htmloutput_errors($objcanvas->error,$objcanvas->errors); } } - + if (GETPOST("id") && GETPOST("action") != 'edit') { // Set action type $objcanvas->setAction('view'); - + // Fetch object $result=$objcanvas->fetch($id); if ($result > 0) @@ -318,30 +334,30 @@ if (! empty($canvas)) // Assign values $objcanvas->assign_values(); - + //Show errors dol_htmloutput_errors($objcanvas->error,$objcanvas->errors); // Display canvas $objcanvas->display_canvas(); - + print show_actions_todo($conf,$langs,$db,$objsoc,$objcanvas->control->object); - + print show_actions_done($conf,$langs,$db,$objsoc,$objcanvas->control->object); } else { dol_htmloutput_errors($objcanvas->error,$objcanvas->errors); - } + } } - + } else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- - + /* * Confirmation de la suppression du contact */ @@ -353,29 +369,29 @@ else if ($ret == 'html') print '
'; } } - + /* * Onglets */ - if ($_GET["id"] > 0) + if (GETPOST("id") > 0) { // Si edition contact deja existant - $contact = new Contact($db); - $return=$contact->fetch($_GET["id"], $user); + $object = new Contact($db); + $return=$object->fetch(GETPOST("id"), $user); if ($return <= 0) { - dol_print_error('',$contact->error); + dol_print_error('',$object->error); $_GET["id"]=0; } - + /* * Affichage onglets */ - $head = contact_prepare_head($contact); - + $head = contact_prepare_head($object); + dol_fiche_head($head, 'card', $langs->trans("Contact"), 0, 'contact'); } - + if ($user->rights->societe->contact->creer) { if (GETPOST("action") == 'create') @@ -384,7 +400,7 @@ else * Fiche en mode creation */ $object->fk_departement = $_POST["departement_id"]; - + // We set pays_id, pays_code and label for the selected country $object->fk_pays=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id; if ($object->fk_pays) @@ -404,12 +420,12 @@ else $object->pays_code=$obj->code; $object->pays=$obj->libelle; } - + print_fiche_titre($langs->trans("AddContact")); - + // Affiche les erreurs dol_htmloutput_errors($mesg,$errors); - + if ($conf->use_javascript_ajax) { print "\n".''."\n"; } - + print '
'; print '
'; print ''; print ''; print ''; - + // Name - print ''; - print ''; - + print ''; + print ''; + // Company if ($socid > 0) { @@ -449,31 +465,31 @@ else //print $langs->trans("ContactNotLinkedToCompany"); print ''; } - + // Civility print ''; - + print ''; - + // Address if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($object->address)) == 0) $object->address = $objsoc->address; // Predefined with third party print ''; - + // Zip / Town if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($object->cp)) == 0) $object->cp = $objsoc->cp; // Predefined with third party if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($object->ville)) == 0) $object->ville = $objsoc->ville; // Predefined with third party print ''; - + // Country if (dol_strlen(trim($object->fk_pays)) == 0) $object->fk_pays = $objsoc->pays_id; // Predefined with third party print ''; - + // State print ''; - + // Phone / Fax if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($object->phone_pro)) == 0) $object->phone_pro = $objsoc->tel; // Predefined with third party print ''; print ''; - + if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($object->fax)) == 0) $object->fax = $objsoc->fax; // Predefined with third party print ''; print ''; - + // EMail if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party print ''; - + // Jabberid print ''; - + // Visibility print ''; - + // Note print ''; - - print ''; - print "
'.$langs->trans("Lastname").' / '.$langs->trans("Label").'name).'">'.$langs->trans("Firstname").'firstname).'">
'.$langs->trans("Lastname").' / '.$langs->trans("Label").'name).'">'.$langs->trans("Firstname").'firstname).'">
'.$langs->trans("UserTitle").''; print $formcompany->select_civilite(isset($_POST["civilite_id"])?$_POST["civilite_id"]:$object->civilite_id); print '
'.$langs->trans("PostOrFunction").'poste).'">
'.$langs->trans("Address").'
'.$langs->trans("Zip").' / '.$langs->trans("Town").'cp).'"> '; print 'ville).'" maxlength="80">
'.$langs->trans("Country").''; $form->select_pays((isset($_POST["pays_id"])?$_POST["pays_id"]:$object->fk_pays),'pays_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('State').''; if ($object->fk_pays) @@ -485,35 +501,69 @@ else print $countrynotdefined; } print '
'.$langs->trans("PhonePro").'phone_pro).'">'.$langs->trans("PhonePerso").'phone_perso).'">
'.$langs->trans("PhoneMobile").'phone_mobile).'">'.$langs->trans("Fax").'fax).'">
'.$langs->trans("Email").'email).'">
Jabberidjabberid).'">
'.$langs->trans("ContactVisibility").''; $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); print $form->selectarray('priv',$selectarray,(isset($_POST["priv"])?$_POST["priv"]:$object->priv),0); print '
'.$langs->trans("Note").'

"; - + + print "
"; + + + // Add personnal information + print_fiche_titre('
'.$langs->trans("PersonalInformations").'
','',''); + + print ''; + + // Date To Birth + print ''; + + print ''; + } + else + { + print ''; + } + print ''; + + print "
'.$langs->trans("DateToBirth").''; + $html=new Form($db); + if ($object->birthday) + { + print $html->select_date($object->birthday,'birthday',0,0,0,"perso"); + } + else + { + print $html->select_date('','birthday',0,0,1,"perso"); + } + print ''.$langs->trans("Alert").': '; + if ($object->birthday_alert) + { + print '

"; + + + print '
'; + print "
"; } elseif (GETPOST("action") == 'edit' && GETPOST("id")) @@ -521,7 +571,7 @@ else /* * Fiche en mode edition */ - + // We set pays_id, and pays_code label of the chosen country if (isset($_POST["pays_id"]) || $object->fk_pays) { @@ -538,22 +588,22 @@ else $object->pays_code=$obj->code; $object->pays=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle; } - + // Affiche les erreurs dol_htmloutput_errors($mesg,$errors); - + if ($conf->use_javascript_ajax) { - print "\n".''."\n"; + print ''; } - + print '
'; print ''; print ''; @@ -562,55 +612,55 @@ else print ''; print ''; print ''; - + // Ref print ''; - + // Name - print ''; - print ''; - + print ''; + print ''; + // Company - print ''; + print ''; print ''; print ''; - + // Civility print ''; - + print ''; - + // Address print ''; - + // Zip / Town print ''; - + // Country print ''; - + // Department print ''; - + // Phone print ''; print ''; - + print ''; print ''; - + // EMail print ''; if ($conf->mailing->enabled) @@ -624,51 +674,51 @@ else print ''; } print ''; - + // Jabberid print ''; - + // Visibility print ''; - + print ''; - + $object->load_ref_elements(); - + if ($conf->commande->enabled) { print ''; } - + if ($conf->propal->enabled) { print ''; } - + if ($conf->contrat->enabled) { print ''; } - + if ($conf->facture->enabled) { print ''; } - + // Login Dolibarr print ''; - - print '
'.$langs->trans("Ref").''; print $object->ref; print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").'name).'">'.$langs->trans("Firstname").'firstname).'">
'.$langs->trans("Lastname").' / '.$langs->trans("Label").'name).'">'.$langs->trans("Firstname").'firstname).'">
'.$langs->trans("Company").'
'.$langs->trans("Company").''; print $form->select_societes(isset($_POST["socid"])?$_POST["socid"]:($object->socid?$object->socid:-1),'socid','',1); print '
'.$langs->trans("UserTitle").''; print $formcompany->select_civilite(isset($_POST["civilite_id"])?$_POST["civilite_id"]:$object->civilite_id); print '
'.$langs->trans("PostOrFunction" ).'poste).'">
'.$langs->trans("Address").'
'.$langs->trans("Zip").' / '.$langs->trans("Town").'cp).'"> '; print 'ville).'" maxlength="80">
'.$langs->trans("Country").''; $form->select_pays(isset($_POST["pays_id"])?$_POST["pays_id"]:$object->fk_pays,'pays_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans('State').''; $formcompany->select_departement($object->fk_departement,$object->pays_code); print '
'.$langs->trans("PhonePro").'phone_pro).'">'.$langs->trans("PhonePerso").'phone_perso).'">
'.$langs->trans("PhoneMobile").'phone_mobile).'">'.$langs->trans("Fax").'fax).'">
'.$langs->trans("EMail").'email).'"> 
Jabberidjabberid).'">
'.$langs->trans("ContactVisibility").''; $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate")); print $form->selectarray('priv',$selectarray,$object->priv,0); print '
'.$langs->trans("Note").''; print '
'.$langs->trans("ContactForOrders").''; print $object->ref_commande?$object->ref_commande:$langs->trans("NoContactForAnyOrder"); print '
'.$langs->trans("ContactForProposals").''; print $object->ref_propal?$object->ref_propal:$langs->trans("NoContactForAnyProposal"); print '
'.$langs->trans("ContactForContracts").''; print $object->ref_contrat?$object->ref_contrat:$langs->trans("NoContactForAnyContract"); print '
'.$langs->trans("ContactForInvoices").''; print $object->ref_facturation?$object->ref_facturation:$langs->trans("NoContactForAnyInvoice"); print '
'.$langs->trans("DolibarrLogin").''; if ($object->user_id) @@ -679,22 +729,23 @@ else } else print $langs->trans("NoDolibarrAccess"); print '
'; + + print '

'; + + print '
'; print ''; print '   '; print ''; - print ''; - print ''; - + print '
'; + print "
"; } } - + if (GETPOST("id") && GETPOST("action") != 'edit') { $objsoc = new Societe($db); - + /* * Fiche en mode visualisation */ @@ -703,29 +754,29 @@ else $langs->load("errors"); print '
'.$langs->trans($msg).'
'; } - + if ($_GET["action"] == 'create_user') { $login=strtolower(substr(dol_string_unaccent($object->prenom), 0, 4)) . strtolower(substr(dol_string_unaccent($object->nom), 0, 4)); - + // Create a form array $formquestion=array(array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)); - + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion); if ($ret == 'html') print '
'; } - + print ''; - + // Ref print ''; - + // Name print ''; - print ''; - + print ''; + // Company print ''; - + // Civility print ''; - + print ''; - + // Address print ''; - + // Zip Town print ''; - + // Country print ''; - + // Department print ''; - + // Phone print ''; print ''; - + print ''; print ''; - + // Email print ''; if ($conf->mailing->enabled) @@ -785,48 +836,48 @@ else print ''; } print ''; - + // Jabberid print ''; - + print ''; - + print ''; - + $object->load_ref_elements(); - + if ($conf->commande->enabled) { print ''; } - + if ($conf->propal->enabled) { print ''; } - + if ($conf->contrat->enabled) { print ''; } - + if ($conf->facture->enabled) { print ''; } - + print ''; - + print "
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id'); print '
'.$langs->trans("Lastname").''.$object->name.''.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("Company").''; if ($object->socid > 0) @@ -738,40 +789,40 @@ else print $langs->trans("ContactNotLinkedToCompany"); } print '
'.$langs->trans("UserTitle").''; print $object->getCivilityLabel(); print '
'.$langs->trans("PostOrFunction" ).''.$object->poste.'
'.$langs->trans("Address").''.nl2br($object->address).'
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; print $object->cp; if ($object->cp) print ' '; print $object->ville.'
'.$langs->trans("Country").''; $img=picto_from_langcode($object->pays_code); if ($img) print $img.' '; print $object->pays; print '
'.$langs->trans('State').''.$object->departement.'
'.$langs->trans("PhonePro").''.dol_print_phone($object->phone_pro,$object->pays_code,$object->id,$object->socid,'AC_TEL').''.$langs->trans("PhonePerso").''.dol_print_phone($object->phone_perso,$object->pays_code,$object->id,$object->socid,'AC_TEL').'
'.$langs->trans("PhoneMobile").''.dol_print_phone($object->phone_mobile,$object->pays_code,$object->id,$object->socid,'AC_TEL').''.$langs->trans("Fax").''.dol_print_phone($object->fax,$object->pays_code,$object->id,$object->socid,'AC_FAX').'
'.$langs->trans("EMail").''.dol_print_email($object->email,$object->id,$object->socid,'AC_EMAIL').' 
Jabberid'.$object->jabberid.'
'.$langs->trans("ContactVisibility").''; print $object->LibPubPriv($object->priv); print '
'.$langs->trans("Note").''; print nl2br($object->note); print '
'.$langs->trans("ContactForOrders").''; print $object->ref_commande?$object->ref_commande:$langs->trans("NoContactForAnyOrder"); print '
'.$langs->trans("ContactForProposals").''; print $object->ref_propal?$object->ref_propal:$langs->trans("NoContactForAnyProposal"); print '
'.$langs->trans("ContactForContracts").''; print $object->ref_contrat?$object->ref_contrat:$langs->trans("NoContactForAnyContract"); print '
'.$langs->trans("ContactForInvoices").''; print $object->ref_facturation?$object->ref_facturation:$langs->trans("NoContactForAnyInvoice"); print '
'.$langs->trans("DolibarrLogin").''; if ($object->user_id) { @@ -836,36 +887,36 @@ else } else print $langs->trans("NoDolibarrAccess"); print '
"; - + print ""; - + // Barre d'actions if (! $user->societe_id) { print '
'; - + if ($user->rights->societe->contact->creer) { print ''.$langs->trans('Modify').''; } - + if (! $object->user_id && $user->rights->user->user->creer) { print ''.$langs->trans("CreateDolibarrLogin").''; } - + if ($user->rights->societe->contact->supprimer) { print ''.$langs->trans('Delete').''; } - + print "

"; } - + print show_actions_todo($conf,$langs,$db,$objsoc,$object); - + print show_actions_done($conf,$langs,$db,$objsoc,$object); } } diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 658615a4131..5775f53f1c5 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -36,6 +36,7 @@ $contactid = isset($_GET["id"])?$_GET["id"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contact', $contactid, 'socpeople'); + /* * Action */ @@ -102,8 +103,8 @@ if ($_GET["action"] == 'edit') print ''; // Name - print ''.$langs->trans("Lastname").''.$contact->nom.''; - print ''.$langs->trans("Firstname").''.$contact->prenom.''; + print ''.$langs->trans("Lastname").''.$contact->nom.''; + print ''.$langs->trans("Firstname").''.$contact->prenom.''; // Company if ($contact->socid > 0) @@ -128,20 +129,13 @@ if ($_GET["action"] == 'edit') // Date To Birth print ''.$langs->trans("DateToBirth").''; $html=new Form($db); - if ($contact->birthday) - { - print $html->select_date($contact->birthday,'birthday',0,0,0,"perso"); - } - else - { - print $html->select_date('','birthday',0,0,1,"perso"); - } + print $html->select_date($contact->birthday,'birthday',0,0,1,"perso"); print ''; print ''.$langs->trans("Alert").': '; if ($contact->birthday_alert) { - print ''; + print ''; } else { @@ -149,8 +143,13 @@ if ($_GET["action"] == 'edit') } print ''; - print ''; - print ""; + print "
"; + + print '
'; + print ''; + print '   '; + print ''; + print '
'; print ""; } @@ -167,8 +166,8 @@ else print ''; // Name - print ''.$langs->trans("Lastname").''.$contact->name.''; - print ''.$langs->trans("Firstname").''.$contact->firstname.''; + print ''.$langs->trans("Lastname").''.$contact->name.''; + print ''.$langs->trans("Firstname").''.$contact->firstname.''; // Company if ($contact->socid > 0) diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js index bcb05299d6f..302bbe00595 100644 --- a/htdocs/lib/lib_head.js +++ b/htdocs/lib/lib_head.js @@ -379,11 +379,18 @@ function formatDate(date,format) * getDateFromFormat(date_string, format_string) Purpose: This function takes a * date string and a format string. It parses the date string with format and it * returns the date as a javascript Date() object. If date does not match - * format, it returns 0. The format string can use the following tags: Field | - * Tags -------------+------------------------------- Year | yyyy (4 digits), yy - * (2 digits) Month | MM (2 digits) Day of Month | dd (2 digits) Hour (1-12) | - * hh (2 digits) Hour (0-23) | HH (2 digits) Minute | mm (2 digits) Second | ss - * (2 digits) Author: Laurent Destailleur Licence: GPL + * format, it returns 0. The format string can use the following tags: + * Field | Tags + * -------------+----------------------------------- + * Year | yyyy (4 digits), yy (2 digits) + * Month | MM (2 digits) + * Day of Month | dd (2 digits) + * Hour (1-12) | hh (2 digits) + * Hour (0-23) | HH (2 digits) + * Minute | mm (2 digits) + * Second | ss (2 digits) + * Author: Laurent Destailleur + * Licence: GPL * ================================================================== */ function getDateFromFormat(val,format) @@ -394,6 +401,8 @@ function getDateFromFormat(val,format) val=val+""; format=format+""; + if (val == '') return 0; + var now=new Date(); var year=now.getYear(); if (year.length < 4) { year=""+(year-0+1900); } var month=now.getMonth()+1;