diff --git a/ChangeLog b/ChangeLog index eb82166af8b..7a3da54652c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -482,6 +482,7 @@ Fix: [ bug #2976 ] "Report" tab is the current tab but it is not marked as selec Fix: [ bug #2861 ] Undefined variable $res when migrating Fix: [ bug #2837 ] Product list table column header does not match column body Fix: [ bug #2835 ] Customer prices of a product shows incorrect history order +Fix: [ bug #2814 ] JPEG photos are not displayed in Product photos page ***** ChangeLog for 3.5.6 compared to 3.5.5 ***** Fix: Avoid missing class error for fetch_thirdparty method #1973 diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php index 9e6d76ee6d8..334980b1470 100644 --- a/dev/skeletons/skeleton_page.php +++ b/dev/skeletons/skeleton_page.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2015 Laurent Destailleur * Copyright (C) ---Put here your own copyright and developer email--- * * This program is free software; you can redistribute it and/or modify @@ -72,6 +72,9 @@ if (($id > 0 || ! empty($ref)) && $action != 'add') if ($result < 0) dol_print_error($db); } +// Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('skeleton')); + /******************************************************************* @@ -80,108 +83,114 @@ if (($id > 0 || ! empty($ref)) && $action != 'add') * Put here all code to do according to value of "action" parameter ********************************************************************/ -// Action to add record -if ($action == 'add') +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - if (GETPOST('cancel')) + // Action to add record + if ($action == 'add') { - $urltogo=$backtopage?$backtopage:dol_buildpath('/buildingmanagement/list.php',1); - header("Location: ".$urltogo); - exit; - } - - $error=0; - - /* object_prop_getpost_prop */ - $object->prop1=GETPOST("field1"); - $object->prop2=GETPOST("field2"); - - if (empty($object->ref)) - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors'); - } - - if (! $error) - { - $result=$object->create($user); - if ($result > 0) + if (GETPOST('cancel')) { - // Creation OK - $urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1); + $urltogo=$backtopage?$backtopage:dol_buildpath('/buildingmanagement/list.php',1); header("Location: ".$urltogo); exit; } + + $error=0; + + /* object_prop_getpost_prop */ + $object->prop1=GETPOST("field1"); + $object->prop2=GETPOST("field2"); + + if (empty($object->ref)) { - // Creation KO - if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); - else setEventMessages($object->error, null, 'errors'); - $action='create'; + $error++; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors'); } - } - else - { - $action='create'; - } -} -// Cancel -if ($action == 'update' && GETPOST('cancel')) $action='view'; - -// Action to update record -if ($action == 'update' && ! GETPOST('cancel')) -{ - $error=0; - - $object->prop1=GETPOST("field1"); - $object->prop2=GETPOST("field2"); - - if (empty($object->ref)) - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),null,'errors'); - } - - if (! $error) - { - $result=$object->update($user); - if ($result > 0) + if (! $error) { - $action='view'; + $result=$object->create($user); + if ($result > 0) + { + // Creation OK + $urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1); + header("Location: ".$urltogo); + exit; + } + { + // Creation KO + if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + else setEventMessages($object->error, null, 'errors'); + $action='create'; + } + } + else + { + $action='create'; + } + } + + // Cancel + if ($action == 'update' && GETPOST('cancel')) $action='view'; + + // Action to update record + if ($action == 'update' && ! GETPOST('cancel')) + { + $error=0; + + $object->prop1=GETPOST("field1"); + $object->prop2=GETPOST("field2"); + + if (empty($object->ref)) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),null,'errors'); + } + + if (! $error) + { + $result=$object->update($user); + if ($result > 0) + { + $action='view'; + } + else + { + // Creation KO + if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + else setEventMessages($object->error, null, 'errors'); + $action='edit'; + } } else { - // Creation KO - if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); - else setEventMessages($object->error, null, 'errors'); $action='edit'; } } - else + + // Action to delete + if ($action == 'confirm_delete') { - $action='edit'; + $result=$object->delete($user); + if ($result > 0) + { + // Delete OK + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); + header("Location: ".dol_buildpath('/buildingmanagement/list.php',1)); + exit; + } + else + { + if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors'); + else setEventMessages($object->error,null,'errors'); + } } } -// Action to delete -if ($action == 'confirm_delete') -{ - $result=$object->delete($user); - if ($result > 0) - { - // Delete OK - setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); - header("Location: ".dol_buildpath('/buildingmanagement/list.php',1)); - exit; - } - else - { - if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors'); - else setEventMessages($object->error,null,'errors'); - } -} - - @@ -225,11 +234,39 @@ if ($action == 'list' || empty($id)) $sql.= " WHERE field3 = 'xxx'"; $sql.= " ORDER BY field1 ASC"; - print ''."\n"; + print ''; + + if (! empty($moreforfilter)) + { + print '
'; + print $moreforfilter; + $parameters=array(); + $formconfirm=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print '
'; + } + + print '
'."\n"; + + // Fields title print ''; print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder); - print ''; + $parameters=array(); + $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print ''."\n"; + + // Fields title search + print ''; + print ''; + print ''; + $parameters=array(); + $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print ''."\n"; + dol_syslog($script_file, LOG_DEBUG); $resql=$db->query($sql); @@ -243,21 +280,32 @@ if ($action == 'list' || empty($id)) if ($obj) { // You can use here results - print ''; + print ''; + print ''; + $parameters=array('obj' => $obj); + $formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print ''; } $i++; } } else - { + { $error++; dol_print_error($db); } - print '
'; + print ''; + print ''; + print ''; + print '
'; + print '
'; print $obj->field1; + print ''; print $obj->field2; - print '
'."\n"; + $db->free($resql); + + $parameters=array('sql' => $sql); + $formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + + print "\n"; + print "\n"; } @@ -267,12 +315,12 @@ if ($action == 'create') { print_fiche_titre($langs->trans("NewResidence")); - dol_fiche_head(); - print '
'; print ''; print ''; + dol_fiche_head(); + print ''."\n"; print '
'.$langs->trans("Label").''; print ''; @@ -280,13 +328,11 @@ if ($action == 'create') print '
'."\n"; - print '
'; + dol_fiche_end(); print '
 
'; print '
'; - - dol_fiche_end(); } @@ -294,21 +340,19 @@ if ($action == 'create') // Part to edit record if (($id || $ref) && $action == 'edit') { + print '
'; + dol_fiche_head(); - print ''; print ''; print ''; print ''; - - print '
'; + dol_fiche_end(); print '
'; print '
'; - - dol_fiche_end(); } diff --git a/htdocs/api/admin/api.php b/htdocs/api/admin/api.php index 0e1673715d2..740d3eb7e8d 100644 --- a/htdocs/api/admin/api.php +++ b/htdocs/api/admin/api.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2015 Regis Houssin + * Copyright (C) 2015 Jean-François Ferry * * 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 @@ -33,27 +33,22 @@ $langs->load("admin"); if (! $user->admin) accessforbidden(); -$actionsave=GETPOST("save"); +$action=GETPOST("action"); -// Sauvegardes parametres -if ($actionsave) +//Activate ProfId +if ($action == 'setproductionmode') { - $i=0; + $status = GETPOST('status','alpha'); - $db->begin(); - - $i+=dolibarr_set_const($db,'API_KEY',trim(GETPOST("API_KEY")),'chaine',0,'',$conf->entity); - - if ($i >= 1) - { - $db->commit(); - setEventMessage($langs->trans("SetupSaved")); - } - else - { - $db->rollback(); - setEventMessage($langs->trans("Error"), 'errors'); - } + if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', $conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } } @@ -69,7 +64,7 @@ print_fiche_titre($langs->trans("ApiSetup"),$linkback,'title_setup'); print $langs->trans("ApiDesc")."
\n"; print "
\n"; -print '
'; +//print ''; print ''; print ''; @@ -80,22 +75,24 @@ print ""; print ""; print ''; -print ''; -print ''; +print ''; +$production_mode=(empty($conf->global->API_PRODUCTION_MODE)?false:true); +if ($production_mode) +{ + print ''; +} +else +{ + print ''; +} print ''; print ''; print '
 
'.$langs->trans("KeyForApiAccess").''; -if (! empty($conf->use_javascript_ajax)) - print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); -print ''.$langs->trans("ApiProductionMode").''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ' 
'; - -print '
'; -print ''; -print '
'; - -print '
'; - print '

'; // API endpoint @@ -111,27 +108,9 @@ $url=DOL_MAIN_URL_ROOT.'/public/api/explorer/index.html'; print img_picto('','object_globe.png').' '.$url."
\n"; print '
'; - - print '
'; print $langs->trans("OnlyActiveElementsAreExposed", DOL_URL_ROOT.'/admin/modules.php'); -if (! empty($conf->use_javascript_ajax)) -{ - print "\n".''; -} llxFooter(); diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index fc892b8d412..33bbe56e0a1 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -43,8 +43,10 @@ class DolibarrApi * @param DoliDb $db Database handler */ function __construct($db) { + global $conf; $this->db = $db; - $this->r = new Restler(); + $production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true ); + $this->r = new Restler($production_mode); } /** diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 9cd40f56498..027c9dcf5f4 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -52,7 +52,7 @@ class DolibarrApiAccess implements iAuthenticate * @return bool * @throws RestException */ - public function _isAllowed() + public function __isAllowed() { global $db; @@ -114,7 +114,7 @@ class DolibarrApiAccess implements iAuthenticate * @example Digest * @example OAuth */ - public function _getWWWAuthenticateString() + public function __getWWWAuthenticateString() { return ''; } diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 5edede7417e..083edbf6b7e 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -7,6 +7,7 @@ * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2015 Marcos García * * 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 @@ -251,6 +252,11 @@ if ($socid) print $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom','','&type='.$type); print ''; + // Alias names (commercial, trademark or alias names) + print ''.$langs->trans('AliasNames').''; + print $soc->name_alias; + print ""; + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''.$langs->trans('Prefix').''.$soc->prefix_comm.''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 044cf9908ea..98fe5299a5e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -57,6 +58,7 @@ $backtopage=GETPOST('backtopage','alpha'); $contactid=GETPOST('contactid','int'); $origin=GETPOST('origin','alpha'); $originid=GETPOST('originid','int'); +$confirm = GETPOST('confirm', 'alpha'); $fulldayevent=GETPOST('fullday'); $datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); @@ -78,6 +80,10 @@ $contact = new Contact($db); $extrafields = new ExtraFields($db); $formfile = new FormFile($db); +$form = new Form($db); +$formfile = new FormFile($db); +$formactions = new FormActions($db); + // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); @@ -129,6 +135,29 @@ if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser')) if ($action == 'update') $action = 'edit'; } +// Action clone object +if ($action == 'confirm_clone' && $confirm == 'yes') +{ + if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + { + setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); + } + else + { + if ($id > 0) { + $object->fetch($id); + $result = $object->createFromClone(GETPOST('fk_userowner'), GETPOST('socid')); + if ($result > 0) { + header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); + exit(); + } else { + setEventMessage($object->error, 'errors'); + $action = ''; + } + } + } +} + // Add event if ($action == 'add') { @@ -542,10 +571,6 @@ if ($action == 'mupdate') $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('',$langs->trans("Agenda"),$help_url); -$form = new Form($db); -$formfile = new FormFile($db); -$formactions = new FormActions($db); - if ($action == 'create') { $contact = new Contact($db); @@ -1035,6 +1060,15 @@ if ($id > 0) { dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action'); + + // Clone event + if($action == 'clone') + { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . GETPOST('id'), $langs->trans('CloneAction'), $langs->trans('ConfirmCloneAction', $object->label), 'confirm_clone', $formquestion, 'yes', 1); + + print $formconfirm; + } + // Affichage fiche action en mode visu print ''; @@ -1241,7 +1275,17 @@ if ($id > 0) { print ''; } - + + if ($user->rights->agenda->allactions->create || + (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) + { + print ''; + } + else + { + print ''; + } + if ($user->rights->agenda->allactions->delete || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete)) { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 530083fb30a..2bea8dad465 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -391,6 +391,67 @@ class ActionComm extends CommonObject } + /** + * Load an object from its id and create a new one in database + * + * @param int $socid Id of thirdparty + * @return int New id of clone + */ + function createFromClone() + { + global $db, $user,$langs,$conf,$hookmanager; + + $this->context['createfromclone']='createfromclone'; + + $error=0; + $now=dol_now(); + + $this->db->begin(); + + // Load source object + $objFrom = dol_clone($this); + + $this->fetch_optionals(); + $this->fetch_userassigned(); + + $this->id=0; + + // Create clone + $result=$this->add($user); + if ($result < 0) $error++; + + if (! $error) + { + // Hook of thirdparty module + if (is_object($hookmanager)) + { + $parameters=array('objFrom'=>$objFrom); + $action=''; + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; + } + + // Call trigger + $result=$this->call_trigger('ACTION_CLONE',$user); + if ($result < 0) { $error++; } + // End call triggers + } + + unset($this->context['createfromclone']); + + // End + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1; + } + } + /** * Load object from database * diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index aba9433cabc..8058eaff9f8 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -8,6 +8,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2015 Frederic France + * Copyright (C) 2015 Marcos García * * 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 @@ -226,6 +227,11 @@ if ($id > 0) print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','',''); print ''; + // Alias names (commercial, trademark or alias names) + print '"; + // Prospect/Customer print ''; + print_liste_field_titre(''); $parameters=array(); $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook - print "\n"; print ''; @@ -238,7 +245,8 @@ if ($result) $parameters=array(); $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook - print "\n"; + print ''."\n"; + $var=True; @@ -256,6 +264,7 @@ if ($result) $thirdpartystatic->code_client=$obj->code_client; $thirdpartystatic->canvas=$obj->canvas; $thirdpartystatic->status=$obj->status; + $thirdpartystatic->name_alias=$obj->name_alias; print $thirdpartystatic->getNomUrl(1); print ''; print ''; @@ -273,13 +282,13 @@ if ($result) print "\n"; $i++; } - //print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num); - print "
'.$langs->trans('AliasNames').''; + print $object->name_alias; + print "
'.$langs->trans('ProspectCustomer').''; print $object->getLibCustProspStatut(); diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index f297313d907..cf5bacc5e25 100644 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -5,6 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Marcos García * * This program is freei software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,6 +92,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both if ($search_status=='') $search_status=1; // always display activ customer first + /* * view */ @@ -102,7 +104,7 @@ $thirdpartystatic=new Societe($db); $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ThirdParty"),$help_url); -$sql = "SELECT s.rowid, s.nom as name, s.client, s.zip, s.town, st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta, s.status as status,"; +$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.zip, s.town, st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta, s.status as status,"; $sql.= " s.datec, s.canvas"; if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -120,7 +122,13 @@ if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_company) { - $sql .= natural_search('s.nom', $search_company); + $sql .= natural_search( + array( + 's.nom', + 's.name_alias' + ), + $search_company + ); } if ($search_zipcode) $sql.= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'"; if ($search_town) { @@ -195,10 +203,9 @@ if ($result) print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); - print ' 
'.$obj->zip.'
\n"; - print "\n"; $db->free($result); $parameters=array('sql' => $sql); $formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + + print "\n"; + print "\n"; } else { diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 80ef52a372a..68299c9a781 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2015 Marcos García * * 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 @@ -208,7 +209,7 @@ $prospectstatic=new Client($db); $prospectstatic->client=2; $prospectstatic->loadCacheOfProspStatus(); -$sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,"; +$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.zip, s.town, s.datec, s.status as status, s.code_client, s.client,"; $sql.= " s.prefix_comm, s.fk_prospectlevel, s.fk_stcomm as stcomm_id,"; $sql.= " st.libelle as stcomm_label,"; $sql.= " d.nom as departement"; @@ -228,7 +229,15 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid; if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; -if ($search_nom) $sql .= natural_search('s.nom', $search_nom); +if ($search_nom) { + $sql .= natural_search( + array( + 's.nom', + 's.name_alias' + ), + $search_nom + ); +} if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'"; if ($search_town) $sql .= natural_search('s.town', $search_town); if ($search_state) $sql .= natural_search('d.nom', $search_state); @@ -427,6 +436,7 @@ if ($resql) $prospectstatic->code_client=$obj->code_client; $prospectstatic->client=$obj->client; $prospectstatic->fk_prospectlevel=$obj->fk_prospectlevel; + $prospectstatic->name_alias=$obj->name_alias; print $prospectstatic->getNomUrl(1,'prospect'); print ''; print "".$obj->zip.""; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index d0730149b36..5cc60cb8bd4 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Marcos García * * 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 @@ -148,6 +149,7 @@ abstract class CommonDocGenerator $array_thirdparty = array( 'company_name'=>$object->name, + 'company_name_alias' => $object->name_alias, 'company_email'=>$object->email, 'company_phone'=>$object->phone, 'company_fax'=>$object->fax, diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 6411c76eeab..cbc5452f3ba 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -1,19 +1,20 @@ + * Copyright (C) 2015 Marcos García * -* 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 -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ /** * \file htdocs/core/class/html.formprojet.class.php @@ -52,11 +53,59 @@ class FormProjets * @param int $option_only Return only html options lines without the select tag * @param int $show_empty Add an empty line * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable) - * @param int $forcefocus Force focus on field (works with javascript only) - * @param int $disabled Disabled + * @param int $forcefocus Force focus on field (works with javascript only) + * @param int $disabled Disabled + * @param int $mode 0 for HTML mode and 1 for JSON mode + * @param string $filterkey Key to filter * @return int Nber of project if OK, <0 if KO */ - function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0) + function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '') + { + global $langs,$conf; + + if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) + { + $placeholder=''; + + if ($selected && empty($selected_input_value)) + { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + $project = new Project($this->db); + $project->fetch($selected); + $selected_input_value=$project->ref; + } + $urloption='socid='.$socid.'&htmlname='.$htmlname; + print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array( +// 'update' => array( +// 'projectid' => 'id' +// ) + )); + + print ''; + } + else + { + print $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, $discard_closed, $forcefocus, $disabled, 0, $filterkey); + } + } + + /** + * Returns an array with projects qualified for a third party + * + * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) + * @param int $selected Id project preselected + * @param string $htmlname Nom de la zone html + * @param int $maxlength Maximum length of label + * @param int $option_only Return only html options lines without the select tag + * @param int $show_empty Add an empty line + * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable) + * @param int $forcefocus Force focus on field (works with javascript only) + * @param int $disabled Disabled + * @param int $mode 0 for HTML mode and 1 for JSON mode + * @param string $filterkey Key to filter + * @return int Nber of project if OK, <0 if KO + */ + function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '') { global $user,$conf,$langs; @@ -81,6 +130,10 @@ class FormProjets if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; + if (!empty($filterkey)) { + $sql .= ' AND p.title LIKE "%'.$this->db->escape($filterkey).'%"'; + $sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"'; + } $sql.= " ORDER BY p.ref ASC"; dol_syslog(__METHOD__, LOG_DEBUG); @@ -126,7 +179,7 @@ class FormProjets continue; } - $labeltoshow=dol_trunc($obj->ref,18); + $labeltoshow=dol_trunc($obj->ref,18).' - '.$obj->title; //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')'; $labeltoshow.=' '.dol_trunc($obj->title,$maxlength); @@ -171,19 +224,30 @@ class FormProjets $resultat.=''; } $out.= $resultat; + + $outarray[] = array( + 'key' => (int) $obj->rowid, + 'value' => $obj->ref, + 'ref' => $obj->ref, + 'label' => $labeltoshow, + 'disabled' => (bool) $disabled + ); } } $i++; } } - if (empty($option_only)) { - $out.= ''; - } - - print $out; $this->db->free($resql); - return $num; + + if (!$mode) { + if (empty($option_only)) { + $out.= ''; + } + print $out; + } else { + return $outarray; + } } else { @@ -290,7 +354,7 @@ class FormProjets } else if ($obj->fk_statut == 2) { - if ($discard_close == 2) $disabled=1; + if ($discard_closed == 2) $disabled=1; $labeltoshow.=' - '.$langs->trans("Closed"); } else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) @@ -299,7 +363,7 @@ class FormProjets $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany"); } // Label for task - $labeltoshow.=' - '.$obj->tref.' '.dol_trunc($obj->tlabel,$maxlenght); + $labeltoshow.=' - '.$obj->tref.' '.dol_trunc($obj->tlabel,$maxlength); if (!empty($selected) && $selected == $obj->rowid) { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6174e2de121..5ca77722dd4 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -9,6 +9,7 @@ * Copyright (C) 2012-2015 Raphaël Doursenaud * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> + * Copyright (C) 2015 Marcos García * * 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 @@ -289,6 +290,33 @@ function pdf_getHeightForLogo($logo, $url = false) return $height; } +/** + * Returns the name of the thirdparty + * + * @param Societe|Contact $thirdparty Contact or thirdparty + * @param Translate $outputlangs Output language + * @return string + */ +function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs) +{ + //Recipient name + $socname = ''; + + // On peut utiliser le nom de la societe du contact + if ($thirdparty instanceof Societe) { + if (!empty($thirdparty->name_alias)) { + $socname = $thirdparty->name_alias."\n"; + } + + $socname .= $thirdparty->name; + } elseif ($thirdparty instanceof Contact) { + $socname = $thirdparty->socname; + } else { + throw new InvalidArgumentException(); + } + + return $outputlangs->convToOutputCharset($socname); +} /** * Return a string with full address formated diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 85adc747827..20a80cb8be1 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -5,6 +5,7 @@ * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2015 Marcos García * * 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 @@ -1293,19 +1294,16 @@ class pdf_einstein extends ModelePDFCommandes $result=$object->fetch_contact($arrayidcontact[0]); } - // Recipient name - if (! empty($usecontact)) - { - // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->name; - $carac_client_name=$outputlangs->convToOutputCharset($socname); - } - else - { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $object->client; } + $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); // Show recipient diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 2b8aaa21818..5afc0fe5c46 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -4,6 +4,7 @@ * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2015 Marcos García * * 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 @@ -1185,19 +1186,16 @@ class pdf_proforma extends ModelePDFCommandes $result=$object->fetch_contact($arrayidcontact[0]); } - // Recipient name - if (! empty($usecontact)) - { - // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->name; - $carac_client_name=$outputlangs->convToOutputCharset($socname); - } - else - { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $object->client; } + $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); // Show recipient diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index d43e773eb6a..e7d6d15b9ea 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -5,6 +5,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011 Fabrice CHERRIER * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2015 Marcos García * * 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 @@ -598,17 +599,16 @@ class pdf_strato extends ModelePDFContract $this->recipient = $object->client; - // Recipient name - if (! empty($usecontact)) { - // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->name; - $this->recipient->name = $outputlangs->convToOutputCharset($socname); - } - else { - $this->recipient->name = $outputlangs->convToOutputCharset($object->client->name); + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $object->client; } + $this->recipient->name = pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target'); // Show recipient diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 312e8bc5e1f..f26d85615e5 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -2,7 +2,8 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 Marcos García * * 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 @@ -622,19 +623,16 @@ class pdf_merou extends ModelePdfExpedition $result=$object->fetch_contact($arrayidcontact[0]); } - // Recipient name - if (! empty($usecontact)) - { - // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->name; - $carac_client_name=$outputlangs->convToOutputCharset($socname); - } - else - { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $object->client; } + $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails'); $blDestX=$blExpX+55; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 6982fc0c6cc..3188359367c 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014-2015 Marcos García * * 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 @@ -662,19 +662,16 @@ class pdf_rouget extends ModelePdfExpedition $result=$object->fetch_contact($arrayidcontact[0]); } - // Recipient name - if (! empty($usecontact)) - { - // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->name; - $carac_client_name=$outputlangs->convToOutputCharset($socname); - } - else - { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $object->client; } + $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails'); // Show recipient diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 16447b8f082..aa9fbf65ed2 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -6,6 +6,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2015 Marcos García * * 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 @@ -1579,19 +1580,16 @@ class pdf_crabe extends ModelePDFFactures $result=$object->fetch_contact($arrayidcontact[0]); } - // Recipient name - if (! empty($usecontact)) - { - // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->name; - $carac_client_name=$outputlangs->convToOutputCharset($socname); - } - else - { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $object->client; } + $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); // Show recipient diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 9fe2eaf7488..116cab79185 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -5,6 +5,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011 Fabrice CHERRIER * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Marcos García * * 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 @@ -609,19 +610,16 @@ class pdf_soleil extends ModelePDFFicheinter $result=$object->fetch_contact($arrayidcontact[0]); } - // Recipient name - if (! empty($usecontact)) - { - // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->name; - $carac_client_name=$outputlangs->convToOutputCharset($socname); - } - else - { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $object->client; } + $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target'); // Show recipient diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index e2dc1f2376e..b6f674e424d 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -4,6 +4,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2008 Chiptronik * Copyright (C) 2011-2012 Philippe Grand + * Copyright (C) 2015 Marcos García * 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 @@ -843,19 +844,16 @@ class pdf_typhon extends ModelePDFDeliveryOrder $result=$object->fetch_contact($arrayidcontact[0]); } - // Recipient name - if (! empty($usecontact)) - { - // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->name; - $carac_client_name=$outputlangs->convToOutputCharset($socname); - } - else - { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $object->client; } + $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); // Show recipient diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index ad45d1150f3..c3da51fc4c4 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -5,6 +5,7 @@ * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2015 Marcos García * * 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 @@ -1485,19 +1486,16 @@ class pdf_azur extends ModelePDFPropales $result=$object->fetch_contact($arrayidcontact[0]); } - // Recipient name - if (! empty($usecontact)) - { - // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->name; - $carac_client_name=$outputlangs->convToOutputCharset($socname); - } - else - { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $object->client; } + $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); // Show recipient diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index e00546711c8..fb0d1df03a9 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -1,6 +1,7 @@ * Copyright (C) 2010-2014 Laurent Destailleur + * Copyright (C) 2015 Marcos García * * 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 @@ -1100,19 +1101,16 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $result=$object->fetch_contact($arrayidcontact[0]); } - // Recipient name - if (! empty($usecontact)) - { - // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $mysoc->name; - $carac_client_name=$outputlangs->convToOutputCharset($socname); - } - else - { - $carac_client_name=$outputlangs->convToOutputCharset($mysoc->name); + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $mysoc; } + $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$mysoc,((!empty($object->contact))?$object->contact:null),$usecontact,'target'); // Show recipient diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 0089790f804..5793660fe98 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2015 Marcos García * * 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 @@ -1152,19 +1153,16 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $result=$object->fetch_contact($arrayidcontact[0]); } - // Recipient name - if (! empty($usecontact)) - { - // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; - else $socname = $object->client->name; - $carac_client_name=$outputlangs->convToOutputCharset($socname); - } - else - { - $carac_client_name=$outputlangs->convToOutputCharset($object->client->name); + //Recipient name + // On peut utiliser le nom de la societe du contact + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { + $thirdparty = $object->contact; + } else { + $thirdparty = $object->client; } + $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target'); // Show recipient diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 8766aca3412..54bdc279098 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; $langs->load("trips"); $langs->load("bills"); +$langs->load("mails"); $action=GETPOST('action'); $cancel=GETPOST('cancel'); diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 45ba2b24f8c..d1ecbf4e5b8 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -109,8 +109,8 @@ $dolibarr_main_document_root_alt=(empty($dolibarr_main_document_root_alt)?'':tri if (empty($dolibarr_main_db_port)) $dolibarr_main_db_port=0; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql' if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // Pour compatibilite avec anciennes configs, si non defini, on prend 'mysql' if (empty($dolibarr_main_db_prefix)) $dolibarr_main_db_prefix='llx_'; -if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set=($dolibarr_main_db_type=='mysql'?'latin1':''); // Old installation -if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation=($dolibarr_main_db_type=='mysql'?'latin1_swedish_ci':''); // Old installation +if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set=($dolibarr_main_db_type=='mysql'?'utf8':''); // Old installation +if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation=($dolibarr_main_db_type=='mysql'?'utf8_general_ci':''); // Old installation if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0; if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey=''; if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 8ee2b9a23b8..121c5ba84ca 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -138,6 +138,11 @@ if ($object->id > 0) print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','',''); print ''; + // Alias names (commercial, trademark or alias names) + print ''.$langs->trans('AliasNames').''; + print $object->name_alias; + print ""; + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 81f259d67c6..500e3ed50f3 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Marcos García + * Copyright (C) 2015 Charlie Benke * * 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 @@ -35,6 +36,7 @@ print_titre($langs->trans("RelatedSupplierInvoices")); + @@ -46,8 +48,9 @@ foreach($linkedObjectBlock as $object) { $var=!$var; ?> - > + > + trans("ShowBill"),"bill").' '.$object->ref; ?> + "; print '
trans("Ref"); ?>trans("RefSupplier"); ?> trans("Date"); ?> trans("AmountHTShort"); ?> trans("Status"); ?>
- trans("ShowBill"),"bill").' '.$object->ref; ?>
ref_supplier; ?> date,'day'); ?> rights->fournisseur->facture->lire) { diff --git a/htdocs/fourn/list.php b/htdocs/fourn/list.php index 8f77ea73115..f5f4d4dc897 100644 --- a/htdocs/fourn/list.php +++ b/htdocs/fourn/list.php @@ -98,7 +98,7 @@ $thirdpartystatic=new Societe($db); $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ThirdParty"),$help_url); -$sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.datec, st.libelle as stcomm, s.prefix_comm, s.status as status, "; +$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias, s.zip, s.town, s.datec, st.libelle as stcomm, s.prefix_comm, s.status as status, "; $sql.= "code_fournisseur, code_compta_fournisseur"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; // Add fields for extrafields @@ -122,7 +122,13 @@ if ($socname) { $sortorder = "ASC"; } if ($search_name) { - $sql .= natural_search('s.nom', $search_name); + $sql .= natural_search( + array( + 's.nom', + 's.name_alias' + ), + $search_name + ); } if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'"; if ($search_town) { @@ -237,6 +243,7 @@ if ($resql) $thirdpartystatic->id=$obj->socid; $thirdpartystatic->name=$obj->name; $thirdpartystatic->status=$obj->status; + $thirdpartystatic->name_alias=$obj->name_alias; print "
'; diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 1bd3a473fd1..a406ad9c6d0 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -304,7 +304,8 @@ create table llx_payment_expensereport ALTER TABLE llx_projet ADD COLUMN budget_amount double(24,8); - +-- Alias names (commercial, trademark or alias names) +ALTER TABLE llx_societe ADD COLUMN name_alias varchar(128) NULL; create table llx_commande_fournisseurdet_extrafields ( diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index b3464f9fc1f..4dc1b3fe750 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -4,6 +4,7 @@ -- Copyright (C) 2005-2010 Regis Houssin -- Copyright (C) 2010 Juanjo Menent -- Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> +-- Copyright (C) 2015 Marcos García -- -- 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 @@ -24,6 +25,7 @@ create table llx_societe ( rowid integer AUTO_INCREMENT PRIMARY KEY, nom varchar(128), -- company reference name (should be same length than adherent.societe) + name_alias varchar(128) NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id ref_ext varchar(128), -- reference into an external system (not used by dolibarr) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 94bc57e7050..7c9a4b85a9a 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1564,6 +1564,7 @@ EndPointIs=SOAP clients must send their requests to the Dolibarr endpoint availa ApiSetup=API module setup ApiDesc=By enabling this module, Dolibarr become a REST server to provide miscellaneous web services. KeyForApiAccess=Key to use API (parameter "api_key") +ApiProductionMode=Enable production mode ApiEndPointIs=You can access to the API at url ApiExporerIs=You can explore the API at url OnlyActiveElementsAreExposed=Only elements from enabled modules are exposed @@ -1597,6 +1598,7 @@ ProjectsSetup=Project module setup ProjectsModelModule=Project reports document model TasksNumberingModules=Tasks numbering module TaskModelModule=Tasks reports document model +UseSearchToSelectProject=Use autocompletion fields to choose project (instead of using a list box) ##### ECM (GED) ##### ECMSetup = GED Setup ECMAutoTree = Automatic tree folder and document diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index dd485291e73..ac30b5685be 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -95,3 +95,5 @@ AddEvent=Create event MyAvailability=My availability ActionType=Event type DateActionBegin=Start event date +CloneAction=Clone event +ConfirmCloneEvent=Are you sure you want to clone the event %s ? diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index a0626c1087f..a95eb99012d 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -30,6 +30,7 @@ ThirdPartyContact=Third party contact/address StatusContactValidated=Status of contact/address Company=Company CompanyName=Company name +AliasNames=Alias names (commercial, trademark, ...) Companies=Companies CountryIsInEEC=Country is inside European Economic Community ThirdPartyName=Third party name diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index e982d04ae18..9d9b1e24c51 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -128,6 +128,7 @@ TagCheckMail=Track mail opening TagUnsubscribe=Unsubscribe link TagSignature=Signature sending user TagMailtoEmail=Recipient EMail +NoEmailSentBadSenderOrRecipientEmail=No email sent. Bad sender or recipient email. Verify user profile. # Module Notifications Notifications=Notifications NoNotificationsWillBeSent=No email notifications are planned for this event and company diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index bd4709d1649..3290a930d37 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -96,3 +96,5 @@ AddEvent=Créer un événement MyAvailability=Ma disponibilité ActionType=Type événement DateActionBegin=Date début événément +CloneAction=Cloner événement +ConfirmCloneAction=Êtes-vous sûr de vouloir cloner l'événement %s ? \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 03f776ce6d5..eceabf772af 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1526,33 +1526,33 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname', 'T', 'searchleftt'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', $langs->trans("ThirdParties"), 'soc', 'socname', 'T', 'searchleftt', img_object('','company')); } if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname', '', 'searchleftc'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'contactname', '', 'searchleftc', img_object('','contact')); } if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)) { $langs->load("products"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleftp'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', $langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleftp', img_object('','product')); } if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->fournisseur->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER)) { $langs->load("products"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/list.php', DOL_URL_ROOT.'/fourn/product/list.php', img_object('','product').' '.$langs->trans("SupplierRef"), 'products', 'srefsupplier', '', 'searchlefts'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/list.php', DOL_URL_ROOT.'/fourn/product/list.php', $langs->trans("SupplierRef"), 'products', 'srefsupplier', '', 'searchlefts', img_object('','product')); } if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire) { $langs->load("members"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', 'M', 'searchleftm'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', $langs->trans("Members"), 'member', 'sall', 'M', 'searchleftm', img_object('','user')); } // Execute hook printSearchForm @@ -1797,9 +1797,10 @@ function getHelpParamFor($helppagename,$langs) * @param string $htmlinputname Field Name input form * @param string $accesskey Accesskey * @param string $idname Complement for id to avoid multiple same id in the page + * @param string $img Image to use * @return string */ -function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='', $idname='') +function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='', $idname='',$img='') { global $conf,$langs; @@ -1809,10 +1810,13 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinput $ret=''; $ret.='
'; - $ret.='

'; +print_titre($langs->trans("Other")); + +// Other options +$form=new Form($db); +$var=true; + +print ''; +print ''; +print ''; + +print ''; +print ''; +print "\n"; +print ''."\n"; +print ''."\n"; + + +$var=!$var; +print ""; +print ''; +if (! $conf->use_javascript_ajax) +{ + print '"; +} +else +{ + print '"; +} +print '
".$langs->trans("Parameters")."'.$langs->trans("Value").' 
'.$langs->trans("UseSearchToSelectProject").''; + print $langs->trans("NotAvailableWhenAjaxDisabled"); + print "'; + $arrval=array('0'=>$langs->trans("No"), + '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')', + '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')', + '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')', + ); + print $form->selectarray("activate_PROJECT_USE_SEARCH_TO_SELECT",$arrval,$conf->global->PROJECT_USE_SEARCH_TO_SELECT); + print ''; + print ''; + print "
'; + $db->close(); llxFooter(); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 4464c9cb8ef..eacc44cb3dd 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005 Marc Bariley / Ocebo * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2013 Cédric Salvador @@ -100,6 +100,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $syear=""; } +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('projectlist')); + + + + /* * View */ @@ -212,10 +218,7 @@ if ($resql) if ($mine) $text=$langs->trans('MyProjects'); print_barre_liste($text, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num,'','title_project'); - print '
'; - - print ''; - + print ''; // Show description of content if ($mine) print $langs->trans("MyProjectsDesc").'

'; @@ -242,13 +245,16 @@ if ($resql) } if (! empty($moreforfilter)) { - print ''; - print ''; + $parameters=array(); + $formconfirm=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print ''; } + print '
'; + print '
'; print $moreforfilter; - print '
'; + print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder); @@ -259,6 +265,8 @@ if ($resql) print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); + $parameters=array(); + $formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print "\n"; print ''; @@ -301,6 +309,11 @@ if ($resql) print ''; print ''; + $parameters=array(); + $formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print ''."\n"; + + while ($i < $num) { $objp = $db->fetch_object($resql); @@ -396,21 +409,29 @@ if ($resql) $projectstatic->statut = $objp->fk_statut; print ''; + $parameters=array('obj' => $objp); + $formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print "\n"; } $i++; - } - $db->free($resql); + } + $db->free($resql); + + $parameters=array('sql' => $sql); + $formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook + + print "
'.$projectstatic->getLibStatut(5).'
\n"; + print "
\n"; } else { dol_print_error($db); } -print ""; llxFooter(); diff --git a/htdocs/public/api/htaccess.txt b/htdocs/public/api/htaccess.txt new file mode 100644 index 00000000000..a8106809018 --- /dev/null +++ b/htdocs/public/api/htaccess.txt @@ -0,0 +1,15 @@ +# +# Apache configuration file to use API +# + +DirectoryIndex index.php + + RewriteEngine On + RewriteRule ^$ index.php [QSA,L] + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)$ index.php [QSA,L] + + + php_flag display_errors On + \ No newline at end of file diff --git a/htdocs/public/api/index.php b/htdocs/public/api/index.php index 17b691675c5..f78424ce6a9 100644 --- a/htdocs/public/api/index.php +++ b/htdocs/public/api/index.php @@ -28,8 +28,7 @@ if (! defined("NOLOGIN")) define("NOLOGIN",'1'); $res=0; -if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php'; -if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../dolibarr/htdocs/main.inc.php'; // For custom directory +if (! $res && file_exists("../../main.inc.php")) $res=include '../../main.inc.php'; if (! $res) die("Include of main fails"); require_once DOL_DOCUMENT_ROOT.'/includes/restler/vendor/autoload.php'; @@ -48,7 +47,6 @@ if (empty($conf->global->MAIN_MODULE_API)) } use \Luracast\Restler\Defaults; -Defaults::setProperty('authenticationMethod','_isAllowed'); $api = new DolibarrApi($db); @@ -113,12 +111,12 @@ foreach ($modulesdir as $dir) $classname=$reg[1]; $classname = str_replace('Api_','',ucwords($reg[1])).'Api'; require_once $dir_part.$file_searched; - if(class_exists($classname)) + if(class_exists($classname)) { $api->r->addAPIClass($classname,''); + } } } } - } } } diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index e3b273796fa..31ddda84933 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -5,6 +5,7 @@ * Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2015 Marcos García * * 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 @@ -85,6 +86,11 @@ if ($socid) print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print ''; + // Alias names (commercial, trademark or alias names) + print ''.$langs->trans('AliasNames').''; + print $object->name_alias; + print ""; + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4d55732b801..965727ef6e9 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -63,8 +63,15 @@ class Societe extends CommonObject */ public $nom; - public $firstname; - public $lastname; + var $firstname; + var $lastname; + + /** + * Alias names (commercial, trademark or alias names) + * @var string + */ + public $name_alias; + public $particulier; public $civility_id; public $address; @@ -451,8 +458,8 @@ class Societe extends CommonObject if ($result >= 0) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, entity, datec, fk_user_creat, canvas, status, ref_int, ref_ext, fk_stcomm, fk_incoterms, location_incoterms ,import_key)"; - $sql.= " VALUES ('".$this->db->escape($this->name)."', ".$conf->entity.", '".$this->db->idate($now)."'"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, name_alias, entity, datec, fk_user_creat, canvas, status, ref_int, ref_ext, fk_stcomm, fk_incoterms, location_incoterms ,import_key)"; + $sql.= " VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".$conf->entity.", '".$this->db->idate($now)."'"; $sql.= ", ".(! empty($user->id) ? "'".$user->id."'":"null"); $sql.= ", ".(! empty($this->canvas) ? "'".$this->canvas."'":"null"); $sql.= ", ".$this->status; @@ -666,6 +673,7 @@ class Societe extends CommonObject $this->id = $id; $this->name = $this->name?trim($this->name):trim($this->nom); $this->nom = $this->name; // For backward compatibility + $this->name_alias = trim($this->name_alias); $this->ref_ext = trim($this->ref_ext); $this->address = $this->address?trim($this->address):trim($this->address); $this->zip = $this->zip?trim($this->zip):trim($this->zip); @@ -777,6 +785,7 @@ class Societe extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET "; $sql .= "nom = '" . $this->db->escape($this->name) ."'"; // Required + $sql .= ",name_alias = '" . $this->db->escape($this->name_alias) ."'"; $sql .= ",ref_ext = " .(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext) ."'":"null"); $sql .= ",address = '" . $this->db->escape($this->address) ."'"; @@ -999,7 +1008,7 @@ class Societe extends CommonObject if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; - $sql = 'SELECT s.rowid, s.nom as name, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm'; + $sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm'; $sql .= ', s.status'; $sql .= ', s.price_level'; $sql .= ', s.tms as date_modification'; @@ -1060,6 +1069,7 @@ class Societe extends CommonObject $this->ref = $obj->rowid; $this->name = $obj->name; $this->nom = $obj->name; // deprecated + $this->name_alias = $obj->name_alias; $this->ref_ext = $obj->ref_ext; $this->ref_int = $obj->ref_int; @@ -1782,6 +1792,10 @@ class Societe extends CommonObject $name =$code.' '.$name; } + if (!empty($this->name_alias)) { + $name .= ' ('.$this->name_alias.')'; + } + $result=''; $label=''; $link=''; $linkend=''; @@ -2130,7 +2144,6 @@ class Societe extends CommonObject return $bac->getRibLabel(true); } - /** * Return Array of RIB * diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 6eb8b823184..18cc214246d 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -2,6 +2,7 @@ /* Copyright (C) 2012-2013 Philippe Berthet * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2013-2015 Juanjo Menent + * Copyright (C) 2015 Marcos García * * Version V1.1 Initial version of Philippe Berthet * Version V2 Change to be compatible with 3.4 and enhanced to be more generic @@ -119,6 +120,10 @@ print ''; print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print ''; +// Alias names (commercial, trademark or alias names) +print ''; +print ''; + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index b152e6097c6..a4ca499ab5a 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Marcos García * * 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 @@ -117,6 +118,11 @@ if ($object->id) print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print ''; + // Alias names (commercial, trademark or alias names) + print ''.$langs->trans('AliasNames').''; + print $object->name_alias; + print ""; + // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index d00e92887d1..271c69872ce 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 Marcos García * * 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 @@ -81,6 +82,11 @@ if ($id > 0) print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print ''; + // Alias names (commercial, trademark or alias names) + print ''.$langs->trans('AliasNames').''; + print $object->name_alias; + print ""; + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index a9bb37d07eb..357947134f2 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2015 Marcos García * * 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 @@ -148,6 +149,11 @@ if ($result > 0) print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print ''; + // Alias names (commercial, trademark or alias names) + print ''.$langs->trans('AliasNames').''; + print $object->name_alias; + print ""; + // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 500612d48ed..6f1f4e1a42c 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2015 Marcos García * * 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 @@ -136,6 +137,11 @@ print '' . $langs->trans("ThirdPartyName") . 'showrefnav($soc, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); print ''; +// Alias names (commercial, trademark or alias names) +print ''.$langs->trans('AliasNames').''; +print $soc->name_alias; +print ""; + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print '' . $langs->trans('Prefix') . '' . $soc->prefix_comm . ''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 9d7d3d26f72..863863811e0 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -159,10 +159,6 @@ if (empty($reshook)) } //External modules should update their ones too - $hookmanager->initHooks(array( - 'mergethirds' - )); - if (!$errors) { $reshook = $hookmanager->executeHooks('replaceThirdparty', array( @@ -251,7 +247,9 @@ if (empty($reshook)) else { $object->name = GETPOST('name', 'alpha'); + $object->name_alias = GETPOST('name_alias'); } + $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); $object->town = GETPOST('town', 'alpha'); @@ -915,6 +913,7 @@ else $("#radiocompany").click(function() { $(".individualline").hide(); $("#typent_id").val(0); + $("#name_alias").show(); $("#effectif_id").val(0); $("#TypeName").html(document.formsoc.ThirdPartyName.value); document.formsoc.private.value=0; @@ -922,6 +921,7 @@ else $("#radioprivate").click(function() { $(".individualline").show(); $("#typent_id").val(id_te_private); + $("#name_alias").hide(); $("#effectif_id").val(id_ef15); $("#TypeName").html(document.formsoc.LastName.value); document.formsoc.private.value=1; @@ -1053,6 +1053,10 @@ else print ''; } + // Alias names (commercial, trademark or alias names) + print ''; + print ''; + // Address print ''.fieldLabel('Address','address').''; print '