From 746e00572632fcd7ddea856545a7403dd415def2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 9 Mar 2013 20:34:38 +0100 Subject: [PATCH] Fix: Fix ton of regression due to field name change --- .../actions_adherentcard_common.class.php | 2 +- htdocs/adherents/card_subscriptions.php | 2 +- htdocs/adherents/class/adherent.class.php | 6 ++-- htdocs/admin/accounting.php | 20 ------------- htdocs/admin/prelevement.php | 20 ++++++------- htdocs/asterisk/cidlookup.php | 2 +- .../commande/class/boutiquecommande.class.php | 28 +++++++++---------- htdocs/comm/action/class/actioncomm.class.php | 8 +++--- htdocs/comm/action/index.php | 2 +- htdocs/comm/action/listactions.php | 2 +- htdocs/comm/bookmark.php | 6 ++-- htdocs/compta/deplacement/index.php | 2 +- htdocs/compta/index.php | 2 +- htdocs/compta/stats/cabyuser.php | 6 ++-- .../actions_contactcard_common.class.php | 2 +- htdocs/contact/exportimport.php | 2 +- htdocs/contact/fiche.php | 8 +++--- htdocs/contact/ldap.php | 2 +- htdocs/contact/vcard.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.form.class.php | 3 +- htdocs/core/class/notify.class.php | 4 +-- .../modules/mailings/contacts1.modules.php | 4 +-- .../modules/mailings/contacts3.modules.php | 2 +- .../core/modules/mailings/fraise.modules.php | 2 +- .../modules/mailings/framboise.modules.php | 2 +- .../core/modules/mailings/pomme.modules.php | 2 +- .../modules/mailings/thirdparties.modules.php | 2 +- .../thirdparties_services_expired.modules.php | 2 +- htdocs/fourn/commande/index.php | 2 +- htdocs/fourn/contact.php | 16 ++++++----- htdocs/societe/commerciaux.php | 26 ++++++++--------- htdocs/societe/notify/fiche.php | 4 +-- htdocs/societe/notify/index.php | 6 ++-- htdocs/user/class/user.class.php | 4 +-- htdocs/user/class/usergroup.class.php | 1 - .../company/export-contacts-xls-example.php | 8 +++--- ...ail_unpaid_invoices_to_representatives.php | 2 +- 38 files changed, 100 insertions(+), 118 deletions(-) diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index d57b7ea093e..2d577270677 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -394,7 +394,7 @@ abstract class ActionsAdherentCardCommon $this->object->old_firstname = $_POST["old_firstname"]; $this->object->fk_soc = $_POST["fk_soc"]; - $this->object->name = $_POST["name"]; + $this->object->lastname = $_POST["lastname"]; $this->object->firstname = $_POST["firstname"]; $this->object->civilite_id = $_POST["civilite_id"]; $this->object->address = $_POST["address"]; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 6b989004b3c..25767e8f5b2 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -829,7 +829,7 @@ if ($rowid) print '<input type="hidden" name="action" value="cotisation">'; print '<input type="hidden" name="rowid" value="'.$rowid.'">'; print '<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag($object->getFullName($langs)).'">'; - print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->name).'">'; + print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->societe).'">'; print "<table class=\"border\" width=\"100%\">\n"; $today=dol_now(); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 8a3bd19e93c..7dd0f5fbbd1 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -49,6 +49,7 @@ class Adherent extends CommonObject var $login; var $pass; var $societe; + var $company; var $address; var $zip; var $town; @@ -1005,7 +1006,7 @@ class Adherent extends CommonObject { global $langs; - $sql = "SELECT d.rowid, d.civilite, d.firstname, d.lastname, d.societe, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,"; + $sql = "SELECT d.rowid, d.civilite, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; @@ -1047,7 +1048,8 @@ class Adherent extends CommonObject $this->lastname = $obj->lastname; $this->login = $obj->login; $this->pass = $obj->pass; - $this->societe = $obj->societe; + $this->societe = $obj->company; + $this->company = $obj->company; $this->fk_soc = $obj->fk_soc; $this->address = $obj->address; $this->zip = $obj->zip; diff --git a/htdocs/admin/accounting.php b/htdocs/admin/accounting.php index 0023cda87d4..fc6c83b3561 100644 --- a/htdocs/admin/accounting.php +++ b/htdocs/admin/accounting.php @@ -212,26 +212,6 @@ $list=array('COMPTA_PRODUCT_BUY_ACCOUNT','COMPTA_PRODUCT_SOLD_ACCOUNT','COMPTA_S 'COMPTA_VAT_ACCOUNT','COMPTA_ACCOUNT_CUSTOMER','COMPTA_ACCOUNT_SUPPLIER' ); -/*$sql = "SELECT rowid, name, value, type, note"; -$sql.= " FROM ".MAIN_DB_PREFIX."const"; -$sql.= " WHERE name LIKE 'COMPTA_%'"; -$sql.= " AND name NOT IN ('COMPTA_MODE')"; -$sql.= " AND entity = ".$conf->entity; -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows($result); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($result); - $var=!$var; - $list[$obj->name]=$obj->value; - $i++; - } -}*/ - $num=count($list); if ($num) { diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index c079e5a8d72..bbbc307e420 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -165,8 +165,8 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) $langs->load("mails"); print_titre($langs->trans("Notifications")); - $sql = "SELECT rowid, name, firstname, fk_societe, email"; - $sql.= " FROM ".MAIN_DB_PREFIX."user"; + $sql = "SELECT u.rowid, u.lastname, u.firstname, u.fk_societe, u.email"; + $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE entity IN (0,".$conf->entity.")"; $resql=$db->query($sql); @@ -181,7 +181,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) $var=!$var; if (!$obj->fk_societe) { - $username= $obj->firstname.' '.$obj->name; + $username= $obj->firstname.' '.$obj->lastname; $internalusers[$obj->rowid] = $username; } @@ -233,11 +233,11 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>'; } // List of current notifications for objet_type='withdraw' -$sql = "SELECT u.lastname, u.firstname"; -$sql.= ", nd.rowid, ad.code, ad.label"; -$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; -$sql.= ", ".MAIN_DB_PREFIX."notify_def as nd"; -$sql.= ", ".MAIN_DB_PREFIX."c_action_trigger as ad"; +$sql = "SELECT u.lastname, u.firstname,"; +$sql.= " nd.rowid, ad.code, ad.label"; +$sql.= " FROM ".MAIN_DB_PREFIX."user as u,"; +$sql.= " ".MAIN_DB_PREFIX."notify_def as nd,"; +$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as ad"; $sql.= " WHERE u.rowid = nd.fk_user"; $sql.= " AND nd.fk_action = ad.rowid"; $sql.= " AND u.entity IN (0,".$conf->entity.")"; @@ -253,8 +253,8 @@ if ($resql) $obj = $db->fetch_object($resql); $var=!$var; - print "<tr $bc[$var]>"; - print '<td>'.$obj->firstname." ".$obj->name.'</td>'; + print "<tr ".$bc[$var].">"; + print '<td>'.$obj->firstname." ".$obj->lastname.'</td>'; $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); print '<td>'.$label.'</td>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=deletenotif&notif='.$obj->rowid.'">'.img_delete().'</a></td>'; diff --git a/htdocs/asterisk/cidlookup.php b/htdocs/asterisk/cidlookup.php index 77cd271fe70..b90d393f01d 100644 --- a/htdocs/asterisk/cidlookup.php +++ b/htdocs/asterisk/cidlookup.php @@ -40,7 +40,7 @@ if (empty($phone)) exit; } -$sql = "SELECT nom as name FROM ".MAIN_DB_PREFIX."societe as s"; +$sql = "SELECT s.nom as name FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid"; $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; $sql.= " AND (s.phone='".$db->escape($phone)."'"; diff --git a/htdocs/boutique/commande/class/boutiquecommande.class.php b/htdocs/boutique/commande/class/boutiquecommande.class.php index 102d43085c2..bf1e2fd7fd1 100644 --- a/htdocs/boutique/commande/class/boutiquecommande.class.php +++ b/htdocs/boutique/commande/class/boutiquecommande.class.php @@ -75,24 +75,24 @@ class BoutiqueCommande $array = $this->db->fetch_array($result); $this->id = $array["orders_id"]; - $this->client_id = stripslashes($array["customers_id"]); - $this->client_name = stripslashes($array["customers_name"]); + $this->client_id = $array["customers_id"]; + $this->client_name = $array["customers_name"]; - $this->payment_method = stripslashes($array["payment_method"]); + $this->payment_method = $array["payment_method"]; $this->date = $this->db->jdate($array["date_purchased"]); - $this->delivery_adr->name = stripslashes($array["delivery_name"]); - $this->delivery_adr->street = stripslashes($array["delivery_street_address"]); - $this->delivery_adr->zip = stripslashes($array["delivery_zipcode"]); - $this->delivery_adr->city = stripslashes($array["delivery_city"]); - $this->delivery_adr->country = stripslashes($array["delivery_country"]); + $this->delivery_adr->name = $array["delivery_name"]; + $this->delivery_adr->street = $array["delivery_street_address"]; + $this->delivery_adr->zip = $array["delivery_zipcode"]; + $this->delivery_adr->city = $array["delivery_city"]; + $this->delivery_adr->country = $array["delivery_country"]; - $this->billing_adr->name = stripslashes($array["billing_name"]); - $this->billing_adr->street = stripslashes($array["billing_street_address"]); - $this->billing_adr->zip = stripslashes($array["billing_zipcode"]); - $this->billing_adr->city = stripslashes($array["billing_city"]); - $this->billing_adr->country = stripslashes($array["billing_country"]); + $this->billing_adr->name = $array["billing_name"]; + $this->billing_adr->street = $array["billing_street_address"]; + $this->billing_adr->zip = $array["billing_zipcode"]; + $this->billing_adr->city = $array["billing_city"]; + $this->billing_adr->country = $array["billing_country"]; $this->db->free(); @@ -106,7 +106,7 @@ class BoutiqueCommande if ( $result ) { $num = $this->db->num_rows($result); - + $i=0; while ($i < $num) { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 38ee9cd8d8b..48307e19905 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -38,7 +38,7 @@ class ActionComm extends CommonObject protected $ismultientitymanaged = 2; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id; - + var $type_id; // id into parent table llx_c_actioncomm (will be deprecated into future, link should not be required) var $type_code; // code into parent table llx_c_actioncomm (will be deprecated into future, link should not be required) var $type; // label into parent table llx_c_actioncomm (will be deprecated into future, link should not be required) @@ -109,7 +109,7 @@ class ActionComm extends CommonObject function add($user,$notrigger=0) { global $langs,$conf,$hookmanager; - + $error=0; $now=dol_now(); @@ -309,7 +309,7 @@ class ActionComm extends CommonObject $transcode=$langs->trans("Action".$obj->type_code); $type_libelle=($transcode!="Action".$obj->type_code?$transcode:$obj->libelle); $this->type = $type_libelle; - + $this->code = $obj->code; $this->label = $obj->label; $this->datep = $this->db->jdate($obj->datep); @@ -948,7 +948,7 @@ class ActionComm extends CommonObject $event['startdate']=$datestart; $event['duration']=$duration; // Not required with type 'journal' $event['enddate']=$dateend; // Not required with type 'journal' - $event['author']=$obj->firstname.($obj->name?" ".$obj->name:""); + $event['author']=$obj->firstname.($obj->lastname?" ".$obj->lastname:""); $event['priority']=$obj->priority; $event['fulldayevent']=$obj->fulldayevent; $event['location']=$obj->location; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 2a46dbbbae3..f16579051e1 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -486,7 +486,7 @@ if ($showbirthday) $event->datep=dol_mktime(0,0,0,$datearray['mon'],$datearray['mday'],$year,true); // For full day events, date are also GMT but they wont but converted during output $event->datef=$event->datep; $event->type_code='BIRTHDAY'; - $event->libelle=$langs->trans("Birthday").' '.$obj->firstname.' '.$obj->name; + $event->libelle=$langs->trans("Birthday").' '.$obj->firstname.' '.$obj->lastname; $event->percentage=100; $event->fulldayevent=true; diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 7648c3db989..b603792b957 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -306,7 +306,7 @@ if ($resql) print '<td>'; if ($obj->fk_contact > 0) { - $contactstatic->name=$obj->name; + $contactstatic->lastname=$obj->lastname; $contactstatic->firstname=$obj->firstname; $contactstatic->id=$obj->fk_contact; print $contactstatic->getNomUrl(1,'',10); diff --git a/htdocs/comm/bookmark.php b/htdocs/comm/bookmark.php index 8baa4678510..dff26cb2618 100644 --- a/htdocs/comm/bookmark.php +++ b/htdocs/comm/bookmark.php @@ -87,7 +87,7 @@ if ($_GET["action"] == 'delete') print_fiche_titre($langs->trans("Bookmarks")); -$sql = "SELECT s.rowid, s.nom, b.dateb as dateb, b.rowid as bid, b.fk_user, b.url, b.target, u.lastname, u.firstname"; +$sql = "SELECT s.rowid, s.nom as name, b.dateb as dateb, b.rowid as bid, b.fk_user, b.url, b.target, u.lastname, u.firstname"; $sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE b.fk_soc = s.rowid AND b.fk_user=u.rowid"; if (! $user->admin) $sql.= " AND b.fk_user = ".$user->id; @@ -125,9 +125,9 @@ if ($resql) print "<tr $bc[$var]>"; //print "<td>" . ($i + 1 + ($limit * $page)) . "</td>"; print "<td align=\"center\"><b>".$obj->bid."</b></td>"; - print "<td><a href='".DOL_URL_ROOT."/user/fiche.php?id=".$obj->fk_user."'>".img_object($langs->trans("ShowUser"),"user").' '.$obj->name." ".$obj->firstname."</a></td>\n"; + print "<td><a href='".DOL_URL_ROOT."/user/fiche.php?id=".$obj->fk_user."'>".img_object($langs->trans("ShowUser"),"user").' '.$obj->lastname." ".$obj->firstname."</a></td>\n"; print '<td align="center">'.dol_print_date($db->jdate($obj->dateb))."</td>"; - print "<td><a href=\"index.php?socid=".$obj->rowid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom."</a></td>\n"; + print "<td><a href=\"index.php?socid=".$obj->rowid."\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->name."</a></td>\n"; print '<td align="center">'.$obj->url."</td>"; print '<td align="center">'.$obj->target."</td>"; print "<td><a href=\"bookmark.php?action=delete&bid=".$obj->bid."\">".img_delete()."</a></td>\n"; diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index a4c59834529..1c94159d083 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -168,7 +168,7 @@ if ($result) $deplacementstatic->ref=$obj->rowid; $deplacementstatic->id=$obj->rowid; $userstatic->id=$obj->uid; - $userstatic->lastname=$obj->name; + $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; print '<tr '.$bc[$var].'>'; print '<td>'.$deplacementstatic->getNomUrl(1).'</td>'; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 7250c028b87..7f541e1b8db 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -613,7 +613,7 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) $deplacementstatic->ref=$objp->rowid; $deplacementstatic->id=$objp->rowid; $userstatic->id=$objp->uid; - $userstatic->lastname=$objp->name; + $userstatic->lastname=$objp->lastname; $userstatic->firstname=$objp->firstname; print '<tr '.$bc[$var].'>'; print '<td>'.$deplacementstatic->getNomUrl(1).'</td>'; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index a8bc8b56e64..86f16cf3684 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -171,7 +171,7 @@ if ($result) { $obj = $db->fetch_object($result); $amount[$obj->rowid] = $obj->amount_ttc; - $name[$obj->rowid] = $obj->name.' '.$obj->firstname; + $name[$obj->rowid] = $obj->lastname.' '.$obj->firstname; $catotal+=$obj->amount_ttc; $i++; } @@ -183,7 +183,7 @@ else { // On ajoute les paiements ancienne version, non lies par paiement_facture donc sans user if ($modecompta != 'CREANCES-DETTES') { - $sql = "SELECT -1 as rowidx, '' as name, '' as firstname, sum(p.amount) as amount_ttc"; + $sql = "SELECT -1 as rowidx, '' as lastname, '' as firstname, sum(p.amount) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p"; @@ -205,7 +205,7 @@ if ($modecompta != 'CREANCES-DETTES') { $obj = $db->fetch_object($result); $amount[$obj->rowidx] = $obj->amount_ttc; - $name[$obj->rowidx] = $obj->name.' '.$obj->firstname; + $name[$obj->rowidx] = $obj->lastname.' '.$obj->firstname; $catotal+=$obj->amount_ttc; $i++; } diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index a0fb97d7158..f86970afc0a 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -425,7 +425,7 @@ abstract class ActionsContactCardCommon $this->object->old_firstname = $_POST["old_firstname"]; $this->object->socid = $_POST["socid"]; - $this->object->name = $_POST["name"]; + $this->object->lastname = $_POST["name"]; $this->object->firstname = $_POST["firstname"]; $this->object->civilite_id = $_POST["civilite_id"]; $this->object->poste = $_POST["poste"]; diff --git a/htdocs/contact/exportimport.php b/htdocs/contact/exportimport.php index d1cb013c85f..c3f9f2605ee 100644 --- a/htdocs/contact/exportimport.php +++ b/htdocs/contact/exportimport.php @@ -64,7 +64,7 @@ print $form->showrefnav($contact, 'id', $linkback); print '</td></tr>'; // Name -print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->name.'</td>'; +print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>'; print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>'; // Company diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 3cd480a1ef0..2f1f0613740 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -198,7 +198,7 @@ if (empty($reshook)) { $result=$object->fetch($_GET["id"]); - $object->old_name = $_POST["old_name"]; + $object->old_lastname = $_POST["old_lastname"]; $object->old_firstname = $_POST["old_firstname"]; $result = $object->delete(); @@ -227,7 +227,7 @@ if (empty($reshook)) $object->oldcopy=dol_clone($object); - $object->old_name = $_POST["old_name"]; + $object->old_lastname = $_POST["old_lastname"]; $object->old_firstname = $_POST["old_firstname"]; $object->socid = $_POST["socid"]; @@ -265,7 +265,7 @@ if (empty($reshook)) if ($result > 0) { - $object->old_name=''; + $object->old_lastname=''; $object->old_firstname=''; $action = 'view'; } @@ -620,7 +620,7 @@ else print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="contactid" value="'.$object->id.'">'; - print '<input type="hidden" name="old_name" value="'.$object->name.'">'; + print '<input type="hidden" name="old_lastname" value="'.$object->lastname.'">'; print '<input type="hidden" name="old_firstname" value="'.$object->firstname.'">'; if (! empty($backtopage)) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 927d8c1c922..bb1114c18da 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -96,7 +96,7 @@ print $form->showrefnav($contact,'id'); print '</td></tr>'; // Name -print '<tr><td>'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->name.'</td>'; +print '<tr><td>'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>'; print '<td>'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>'; // Company diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index 683be86bb08..f9f4c80fad1 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -46,7 +46,7 @@ $v = new vCard(); $v->setProdId('Dolibarr '.DOL_VERSION); $v->setUid('DOLIBARR-CONTACTID-'.$contact->id); -$v->setName($contact->name, $contact->firstname, "", "", ""); +$v->setName($contact->lastname, $contact->firstname, "", "", ""); $v->setFormattedName($contact->getFullName($langs)); // By default, all informations are for work (except phone_perso and phone_mobile) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 234054f9da2..58655666755 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -63,7 +63,7 @@ abstract class CommonObject $lastname=$this->lastname; $firstname=$this->firstname; - if (empty($lastname)) $lastname=($this->name?$this->name:$this->nom); + if (empty($lastname)) $lastname=($this->lastname?$this->lastname:($this->name?$this->name:$this->nom)); if (empty($firstname)) $firstname=$this->firstname; $ret=''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 268a5d712d3..784c8bc926f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -898,8 +898,7 @@ class Form $obj = $this->db->fetch_object($resql); $contactstatic->id=$obj->rowid; - $contactstatic->name=$obj->name; - $contactstatic->lastname=$obj->name; + $contactstatic->lastname=$obj->lastname; $contactstatic->firstname=$obj->firstname; if ($htmlname != 'none') diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index a0ea370c5ee..abf124b02f3 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -135,7 +135,7 @@ class Notify dol_syslog("Notify::send action=$action, socid=$socid, texte=$texte, objet_type=$objet_type, objet_id=$objet_id, file=$file"); - $sql = "SELECT s.nom, c.email, c.rowid as cid, c.name, c.firstname,"; + $sql = "SELECT s.nom, c.email, c.rowid as cid, c.lastname, c.firstname,"; $sql.= " a.rowid as adid, a.label, a.code, n.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; @@ -157,7 +157,7 @@ class Notify { $obj = $this->db->fetch_object($result); - $sendto = $obj->firstname . " " . $obj->name . " <".$obj->email.">"; + $sendto = $obj->firstname . " " . $obj->lastname . " <".$obj->email.">"; $actiondefid = $obj->adid; if (dol_strlen($sendto)) diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 0067f67af16..8ce9207ea75 100755 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -200,7 +200,7 @@ class mailing_contacts1 extends MailingTargets // La requete doit retourner: id, email, fk_contact, name, firstname, other $sql = "SELECT c.rowid as id, c.email as email, c.rowid as fk_contact,"; - $sql.= " c.name as name, c.firstname as firstname, c.civilite,"; + $sql.= " c.lastname, c.firstname, c.civilite,"; $sql.= " s.nom as companyname"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " ".MAIN_DB_PREFIX."societe as s"; @@ -238,7 +238,7 @@ class mailing_contacts1 extends MailingTargets $cibles[$j] = array( 'email' => $obj->email, 'fk_contact' => $obj->fk_contact, - 'name' => $obj->name, + 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'other' => ($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'. diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php index 10afb1dd10f..229f26f7ca7 100755 --- a/htdocs/core/modules/mailings/contacts3.modules.php +++ b/htdocs/core/modules/mailings/contacts3.modules.php @@ -104,7 +104,7 @@ class mailing_contacts3 extends MailingTargets $target[] = array( 'email' => $obj->email, 'fk_contact' => $obj->fk_contact, - 'name' => $obj->name, + 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'other' => ($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'. diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index fda48271159..93267937800 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -197,7 +197,7 @@ class mailing_fraise extends MailingTargets $cibles[$j] = array( 'email' => $obj->email, 'fk_contact' => $obj->fk_contact, - 'name' => $obj->name, + 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'other' => ($langs->transnoentities("Login").'='.$obj->login).';'. diff --git a/htdocs/core/modules/mailings/framboise.modules.php b/htdocs/core/modules/mailings/framboise.modules.php index e787f750c47..433b48427d9 100644 --- a/htdocs/core/modules/mailings/framboise.modules.php +++ b/htdocs/core/modules/mailings/framboise.modules.php @@ -95,7 +95,7 @@ class mailing_framboise extends MailingTargets $cibles[$j] = array( 'email' => $obj->email, 'fk_contact' => $obj->fk_contact, - 'name' => $obj->name, + 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'other' => ($obj->label?$langs->transnoentities("Category").'='.$obj->label:''), 'source_url' => $this->url($obj->id), diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 4541b2c92dc..c4c5d0cc3c4 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -176,7 +176,7 @@ class mailing_pomme extends MailingTargets $cibles[$j] = array( 'email' => $obj->email, 'fk_contact' => $obj->fk_contact, - 'name' => $obj->name, + 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'other' => ($langs->transnoentities("Login").'='.$obj->login).';'. diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index dc4e41cd03f..ae6942e1179 100755 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -105,7 +105,7 @@ class mailing_thirdparties extends MailingTargets $cibles[$j] = array( 'email' => $obj->email, 'fk_contact' => $obj->fk_contact, - 'name' => $obj->name, + 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'other' => ($obj->label?$langs->transnoentities("Category").'='.$obj->label:''), 'source_url' => $this->url($obj->id), diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 15b3ad6f0d4..a5c36464253 100755 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -122,7 +122,7 @@ class mailing_thirdparties_services_expired extends MailingTargets { $cibles[$j] = array( 'email' => $obj->email, - 'name' => $obj->name, + 'lastname' => $obj->lastname, 'other' => ('StartDate='.dol_print_date($this->db->jdate($obj->date_ouverture),'day')).';'. ('EndDate='.dol_print_date($this->db->jdate($obj->date_fin_validite),'day')).';'. diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index bfb22597be7..c55765fd238 100755 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -276,7 +276,7 @@ if ($resql) print "<tr $bc[$var]>"; print '<td>'; $userstatic->id=$obj->rowid; - $userstatic->lastname=$obj->name; + $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; print $userstatic->getNomUrl(1); print '</td>'; diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php index 259faf75882..f1052c6130e 100644 --- a/htdocs/fourn/contact.php +++ b/htdocs/fourn/contact.php @@ -57,7 +57,7 @@ $limit = $conf->liste_limit; * Mode liste */ -$sql = "SELECT s.rowid as socid, s.nom, st.libelle as stcomm, p.rowid as cidp, p.name, p.firstname, p.email, p.phone"; +$sql = "SELECT s.rowid as socid, s.nom as name, st.libelle as stcomm, p.rowid as cidp, p.lastname, p.firstname, p.email, p.phone"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."socpeople as p, ".MAIN_DB_PREFIX."c_stcomm as st"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -85,13 +85,14 @@ if ($socid) { $sql .= " AND s.rowid = ".$socid; } -$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($limit, $offset); +$sql .= " ORDER BY $sortfield $sortorder "; +$sql .= $db->plimit($limit, $offset); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - + $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); print_barre_liste($title." (".$langs->trans("Suppliers").")",$page, "contact.php", "",$sortfield,$sortorder,"",$num); @@ -111,11 +112,11 @@ if ($result) $var=!$var; - print "<tr $bc[$var]>"; + print "<tr ".$bc[$var].">"; - print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'">'.img_object($langs->trans("ShowContact"),"contact").' '.$obj->name.'</a></td>'; + print '<td><a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$obj->cidp.'">'.img_object($langs->trans("ShowContact"),"contact").' '.$obj->lastname.'</a></td>'; print '<td>'.$obj->firstname.'</td>'; - print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>'; + print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>'; print '<td>'.$obj->email.'</td>'; print '<td>'.$obj->phone.'</td>'; @@ -131,7 +132,8 @@ else dol_print_error($db); } -$db->close(); llxFooter(); + +$db->close(); ?> diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index 5f0f7af2410..0fa9f78353b 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -46,7 +46,7 @@ $hookmanager->initHooks(array('salesrepresentativescard')); if($_GET["socid"] && $_GET["commid"]) { $action = 'add'; - + if ($user->rights->societe->creer) { @@ -54,10 +54,10 @@ if($_GET["socid"] && $_GET["commid"]) $soc->id = $_GET["socid"]; $soc->fetch($_GET["socid"]); - + $parameters=array('id'=>$_GET["commid"]); $reshook=$hookmanager->executeHooks('doActions',$parameters,$soc,$action); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); + $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); if (empty($reshook)) $soc->add_commercial($user, $_GET["commid"]); @@ -74,19 +74,19 @@ if($_GET["socid"] && $_GET["commid"]) if($_GET["socid"] && $_GET["delcommid"]) { - $action = 'delete'; - + $action = 'delete'; + if ($user->rights->societe->creer) { $soc = new Societe($db); $soc->id = $_GET["socid"]; $soc->fetch($_GET["socid"]); - + $parameters=array('id'=>$_GET["delcommid"]); $reshook=$hookmanager->executeHooks('doActions',$parameters,$soc,$action); // Note that $action and $object may have been modified by some hooks - $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); - - + $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors); + + if (empty($reshook)) $soc->del_commercial($user, $_GET["delcommid"]); header("Location: commerciaux.php?socid=".$soc->id); @@ -116,7 +116,7 @@ if ($_GET["socid"]) $result=$soc->fetch($_GET["socid"]); $action='view'; - + $head=societe_prepare_head2($soc); dol_fiche_head($head, 'salesrepresentative', $langs->trans("ThirdParty"),0,'company'); @@ -182,13 +182,13 @@ if ($_GET["socid"]) $parameters=array('socid'=>$soc->id); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$obj,$action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { - + null; // actions in normal case } print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">'; print img_object($langs->trans("ShowUser"),"user").' '; - print $obj->firstname." " .$obj->name."\n"; + print $obj->firstname." " .$obj->lastname."\n"; print '</a> '; if ($user->rights->societe->creer) { @@ -254,7 +254,7 @@ if ($_GET["socid"]) print "<tr $bc[$var]><td>"; print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">'; print img_object($langs->trans("ShowUser"),"user").' '; - print stripslashes($obj->firstname)." " .stripslashes($obj->name)."\n"; + print $obj->firstname." " .$obj->lastname."\n"; print '</a>'; print '</td><td>'.$obj->login.'</td>'; print '<td><a href="commerciaux.php?socid='.$_GET["socid"].'&commid='.$obj->rowid.'">'.$langs->trans("Add").'</a></td>'; diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 785326f076d..2499ae30a5b 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -301,7 +301,7 @@ if ($result > 0) $obj = $db->fetch_object($resql); $contactstatic->id=$obj->contactid; - $contactstatic->name=$obj->name; + $contactstatic->lastname=$obj->lastname; $contactstatic->firstname=$obj->firstname; print '<tr '.$bc[$var].'><td>'.$contactstatic->getNomUrl(1); if ($obj->type == 'email') @@ -378,7 +378,7 @@ if ($result > 0) $obj = $db->fetch_object($resql); $contactstatic->id=$obj->id; - $contactstatic->name=$obj->name; + $contactstatic->lastname=$obj->lastname; $contactstatic->firstname=$obj->firstname; print '<tr '.$bc[$var].'><td>'.$contactstatic->getNomUrl(1); print $obj->email?' <'.$obj->email.'>':$langs->trans("NoMail"); diff --git a/htdocs/societe/notify/index.php b/htdocs/societe/notify/index.php index 9b20118298a..9a1fc344a53 100644 --- a/htdocs/societe/notify/index.php +++ b/htdocs/societe/notify/index.php @@ -57,7 +57,7 @@ $pagenext = $page + 1; llxHeader(); -$sql = "SELECT s.nom, s.rowid as socid, c.name, c.firstname, a.label, n.rowid"; +$sql = "SELECT s.nom, s.rowid as socid, c.lastname, c.firstname, a.label, n.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql.= " ".MAIN_DB_PREFIX."notify_def as n,"; @@ -83,7 +83,7 @@ if ($result) print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","",'valign="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Contact"),"index.php","c.name","","",'valign="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Contact"),"index.php","c.lastname","","",'valign="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Action"),"index.php","a.titre","","",'valign="center"',$sortfield,$sortorder); print "</tr>\n"; $var=True; @@ -95,7 +95,7 @@ if ($result) print "<tr $bc[$var]>"; print "<td><a href=\"fiche.php?socid=".$obj->socid."\">$obj->nom</A></td>\n"; - print "<td>".$obj->firstname." ".$obj->name."</td>\n"; + print "<td>".$obj->firstname." ".$obj->lastname."</td>\n"; print "<td>".$obj->titre."</td>\n"; print "</tr>\n"; $i++; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 5008f51159c..feb1b6164e0 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -188,7 +188,7 @@ class User extends CommonObject $this->ref_ext = $obj->ref_ext; $this->ldap_sid = $obj->ldap_sid; - $this->lastname = $obj->name; + $this->lastname = $obj->lastname; $this->firstname = $obj->firstname; $this->login = $obj->login; @@ -2194,7 +2194,7 @@ class User extends CommonObject $this->users[$obj->rowid]['id'] = $obj->rowid; $this->users[$obj->rowid]['fk_user'] = $obj->fk_user; $this->users[$obj->rowid]['firstname'] = $obj->firstname; - $this->users[$obj->rowid]['name'] = $obj->name; + $this->users[$obj->rowid]['lastname'] = $obj->lastname; $this->users[$obj->rowid]['login'] = $obj->login; $this->users[$obj->rowid]['statut'] = $obj->statut; $i++; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 5876e05a213..ef554f85d2c 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -96,7 +96,6 @@ class UserGroup extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; $this->entity = $obj->entity; - $this->nom = $obj->name; // depecated $this->name = $obj->name; $this->note = $obj->note; $this->datec = $obj->datec; diff --git a/scripts/company/export-contacts-xls-example.php b/scripts/company/export-contacts-xls-example.php index 3b21137eed2..a07813b3606 100644 --- a/scripts/company/export-contacts-xls-example.php +++ b/scripts/company/export-contacts-xls-example.php @@ -2,7 +2,7 @@ <?php /* * Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2009-2011 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2009-2013 Laurent Destailleur <eldy@users.sourceforge.net> * * 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 @@ -57,8 +57,8 @@ $fname = DOL_DATA_ROOT.'/export-contacts.xls'; //$objPHPExcel = new writeexcel_workbook($fname); $objPHPExcel = new PHPExcel(); -$objPHPExcel->getProperties()->setCreator("Maarten Balliauw"); -$objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw"); +$objPHPExcel->getProperties()->setCreator("Dolibarr script"); +$objPHPExcel->getProperties()->setLastModifiedBy("Dolibarr script"); $objPHPExcel->getProperties()->setTitle("Test Document"); $objPHPExcel->getProperties()->setSubject("Test Document"); $objPHPExcel->getProperties()->setDescription("Test document, generated using PHP classes."); @@ -70,7 +70,7 @@ $objPHPExcel->getActiveSheet()->setTitle('Contacts'); //$page->set_column(0,4,18); // A -$sql = "SELECT distinct c.name as lastname, c.firstname, c.email, s.nom as name"; +$sql = "SELECT distinct c.lastname, c.firstname, c.email, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = c.fk_soc"; diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 19741c5f7a0..2d3bd6f6c75 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -85,7 +85,7 @@ if ($resql) $total = 0; } - $message .= "Facture ".$obj->facnumber." : ".price($obj->total_ttc)." : ".$obj->name."\n"; + $message .= $langs->trans("Invoice")." ".$obj->facnumber." : ".price($obj->total_ttc)." : ".$obj->name."\n"; $total += $obj->total_ttc; dol_syslog("email_unpaid_invoices_to_representatives.php: ".$obj->email); -- GitLab