diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d13f43a6ed5..3b6fca62005 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -70,7 +70,7 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. -$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,0,25,0,26); +$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,0,25,0,26); // Name of SQL tables of dictionaries $tabname=array(); @@ -102,6 +102,7 @@ $tabname[25]= MAIN_DB_PREFIX."c_email_templates"; $tabname[26]= MAIN_DB_PREFIX."c_units"; $tabname[27]= MAIN_DB_PREFIX."c_stcomm"; $tabname[28]= MAIN_DB_PREFIX."c_holiday_types"; +$tabname[29]= MAIN_DB_PREFIX."c_lead_status"; // Dictionary labels $tablib=array(); @@ -133,6 +134,7 @@ $tablib[25]= "DictionaryEMailTemplates"; $tablib[26]= "DictionaryUnits"; $tablib[27]= "DictionaryProspectStatus"; $tablib[28]= "DictionaryHolidayTypes"; +$tablib[29]= "DictionaryOpportunityStatus"; // Requests to extract data $tabsql=array(); @@ -164,6 +166,7 @@ $tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, $tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units"; $tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm"; $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; +$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; // Criteria to sort dictionaries $tabsqlsort=array(); @@ -195,6 +198,7 @@ $tabsqlsort[25]="label ASC"; $tabsqlsort[26]="code ASC"; $tabsqlsort[27]="code ASC"; $tabsqlsort[28]="country ASC, code ASC"; +$tabsqlsort[29]="position ASC"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield=array(); @@ -226,6 +230,7 @@ $tabfield[25]= "label,type_template,private,position,topic,content"; $tabfield[26]= "code,label,short_label"; $tabfield[27]= "code,libelle"; $tabfield[28]= "code,label,delay,newByMonth,country_id,country"; +$tabfield[29]= "code,label,percent,position"; // Nom des champs d'edition pour modification d'un enregistrement $tabfieldvalue=array(); @@ -257,6 +262,7 @@ $tabfieldvalue[25]= "label,type_template,private,position,topic,content"; $tabfieldvalue[26]= "code,label,short_label"; $tabfieldvalue[27]= "code,libelle"; $tabfieldvalue[28]= "code,label,delay,newByMonth,country"; +$tabfieldvalue[29]= "code,label,percent,position"; // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert=array(); @@ -288,6 +294,7 @@ $tabfieldinsert[25]= "label,type_template,private,position,topic,content"; $tabfieldinsert[26]= "code,label,short_label"; $tabfieldinsert[27]= "code,libelle"; $tabfieldinsert[28]= "code,label,delay,newByMonth,fk_country"; +$tabfieldinsert[29]= "code,label,percent,position"; // Nom du rowid si le champ n'est pas de type autoincrement // Example: "" if id field is "rowid" and has autoincrement on @@ -321,6 +328,7 @@ $tabrowid[25]= ""; $tabrowid[26]= ""; $tabrowid[27]= "id"; $tabrowid[28]= ""; +$tabrowid[29]= ""; // Condition to show dictionary in setup page $tabcond=array(); @@ -352,6 +360,7 @@ $tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_D $tabcond[26]= ! empty($conf->product->enabled); $tabcond[27]= ! empty($conf->societe->enabled); $tabcond[28]= ! empty($conf->holiday->enabled); +$tabcond[29]= ! empty($conf->projet->enabled); // List of help for fields $tabhelp=array(); @@ -383,6 +392,7 @@ $tabhelp[25] = array(); $tabhelp[26] = array(); $tabhelp[27] = array(); $tabhelp[28] = array(); +$tabhelp[29] = array(); // List of check for fields (NOT USED YET) $tabfieldcheck=array(); @@ -414,6 +424,7 @@ $tabfieldcheck[25] = array(); $tabfieldcheck[26] = array(); $tabfieldcheck[27] = array(); $tabfieldcheck[28] = array(); +$tabfieldcheck[29] = array(); // Complete all arrays with entries found into modules complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 98fe5299a5e..9a4b9c2cf36 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -992,7 +992,7 @@ if ($id > 0) print ''; // Contact - print ''.$langs->trans("Contact").''; + print ''.$langs->trans("Contact").''; $form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200'); print ''; } @@ -1065,7 +1065,7 @@ if ($id > 0) 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; } @@ -1275,7 +1275,7 @@ if ($id > 0) { print '
'.$langs->trans("Modify").'
'; } - + if ($user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { @@ -1285,7 +1285,7 @@ if ($id > 0) { print '
'.$langs->trans("ToClone").'
'; } - + if ($user->rights->agenda->allactions->delete || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete)) { diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php index 9e42d2e7167..43c2f4155fc 100644 --- a/htdocs/comm/list.php +++ b/htdocs/comm/list.php @@ -55,7 +55,7 @@ $search_zipcode=GETPOST("search_zipcode"); $search_town=GETPOST("search_town"); $search_code=GETPOST("search_code"); $search_compta=GETPOST("search_compta"); -$search_status = GETPOST("search_status",'int'); +$search_status= GETPOST("search_status",'int'); // Load sale and categ filters $search_sale = GETPOST("search_sale",'int'); diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php index ea5ca1c0048..c08568ad8b6 100644 --- a/htdocs/core/class/html.formorder.class.php +++ b/htdocs/core/class/html.formorder.class.php @@ -82,7 +82,7 @@ class FormOrder print ''; + $sellist = ''; + if ($showempty) $sellist.= ''; + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + + $sellist .=''; + $i++; + } + $sellist .=''; + } + /*else + { + $sellist = ''; + }*/ + $this->db->free($resql); + + return $sellist; + } + else { $this->error=$this->db->lasterror(); $this->errors[]=$this->db->lasterror(); - dol_syslog(get_class($this) . "::select_element " . $this->error, LOG_ERR); + dol_syslog(get_class($this) . "::selectOpportunityStatus " . $this->error, LOG_ERR); return -1; } } - } diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 9b4987ddb56..37846bf2421 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -337,8 +337,8 @@ class Translate } /** - * Return translated value of key. Search in lang file, then into database. - * Key must be any complete entry into lang file: CurrencyEUR, ... + * Return translated value of key for special keys ("Currency...", "Civility...", ...). + * Search in lang file, then into database. Key must be any complete entry into lang file: CurrencyEUR, ... * If not found, return key. * The string return is not formated (translated with transnoentitiesnoconv) * NOTE: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), if you modify this function, @@ -354,25 +354,33 @@ class Translate if (! is_string($key)) return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly. $newstr=$key; - if (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i',$key,$reg)) - { - $newstr=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','label'); - } - else if (preg_match('/^SendingMethod([0-9A-Z]+)$/i',$key,$reg)) - { - $newstr=$this->getLabelFromKey($db,$reg[1],'c_shipment_mode','code','libelle'); - } - else if (preg_match('/^PaymentTypeShort([0-9A-Z]+)$/i',$key,$reg)) - { - $newstr=$this->getLabelFromKey($db,$reg[1],'c_paiement','code','libelle'); - } - else if (preg_match('/^Civility([0-9A-Z]+)$/i',$key,$reg)) + if (preg_match('/^Civility([0-9A-Z]+)$/i',$key,$reg)) { $newstr=$this->getLabelFromKey($db,$reg[1],'c_civility','code','label'); } - else if (preg_match('/^OrderSource([0-9A-Z]+)$/i',$key,$reg)) + elseif (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i',$key,$reg)) + { + $newstr=$this->getLabelFromKey($db,$reg[1],'c_currencies','code_iso','label'); + } + elseif (preg_match('/^SendingMethod([0-9A-Z]+)$/i',$key,$reg)) + { + $newstr=$this->getLabelFromKey($db,$reg[1],'c_shipment_mode','code','libelle'); + } + elseif (preg_match('/^PaymentTypeShort([0-9A-Z]+)$/i',$key,$reg)) { - // TODO Add a table for OrderSourceX + $newstr=$this->getLabelFromKey($db,$reg[1],'c_paiement','code','libelle'); + } + elseif (preg_match('/^OppStatusShort([0-9A-Z]+)$/i',$key,$reg)) + { + $newstr=$this->getLabelFromKey($db,$reg[1],'c_lead_status','code','label'); + } + elseif (preg_match('/^OppStatus([0-9A-Z]+)$/i',$key,$reg)) + { + $newstr=$this->getLabelFromKey($db,$reg[1],'c_lead_status','code','label'); + } + elseif (preg_match('/^OrderSource([0-9A-Z]+)$/i',$key,$reg)) + { + // TODO OrderSourceX must be replaced with content of table llx_c_input_reason or llx_c_input_method //$newstr=$this->getLabelFromKey($db,$reg[1],'c_ordersource','code','label'); } return $newstr; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 0cdde284e28..a1d2ac3cf02 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -340,7 +340,7 @@ function ajax_dialog($title,$message,$w=350,$h=150) * Use ajax_combobox() only for small combo list! If not, use instead ajax_autocompleter(). * TODO: It is used when COMPANY_USE_SEARCH_TO_SELECT and CONTACT_USE_SEARCH_TO_SELECT are set by html.formcompany.class.php. Should use ajax_autocompleter instead like done by html.form.class.php for select_produits. * - * @param string $htmlname Name of html select field + * @param string $htmlname Name of html select field ('myid' or '.myclass') * @param array $events More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete * @param int $forcefocus Force focus on field diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3e617550a95..ff3c968a1d6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4650,7 +4650,7 @@ function dol_osencode($str) * @param string $fieldkey Field for code * @param string $fieldid Field for id * @return int <0 if KO, Id of code if OK - * @see getLabelFromKey + * @see $langs->getLabelFromKey */ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') { @@ -4665,7 +4665,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') return $cache_codes[$tablename][$key]; // Found in cache } - $sql = "SELECT ".$fieldid." as id"; + $sql = "SELECT ".$fieldid." as valuetoget"; $sql.= " FROM ".MAIN_DB_PREFIX.$tablename; $sql.= " WHERE ".$fieldkey." = '".$key."'"; dol_syslog('dol_getIdFromCode', LOG_DEBUG); @@ -4673,7 +4673,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id') if ($resql) { $obj = $db->fetch_object($resql); - if ($obj) $cache_codes[$tablename][$key]=$obj->id; + if ($obj) $cache_codes[$tablename][$key]=$obj->valuetoget; else $cache_codes[$tablename][$key]=''; $db->free($resql); return $cache_codes[$tablename][$key]; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 80c16c8aeb1..3709303f68e 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -891,16 +891,17 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta $project_year_filter=0; $title=$langs->trans("Project"); - if ($statut != '' && $statut >= 0) $title=$langs->trans("Project").' ('.$langs->trans($projectstatic->statuts[$statut]).')'; + if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Project").' ('.$langs->trans($projectstatic->statuts_long[$statut]).')'; print ''; print ''; print_liste_field_titre($title,"index.php","","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder); + //if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print_liste_field_titre($langs->trans("OpportunityStatus"),"","","","",'align="right"',$sortfield,$sortorder); + if (empty($conf->global->PROJECT_HIDE_TASKS)) print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder); print "\n"; - $sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut, COUNT(t.rowid) as nb"; + $sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, COUNT(t.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; if ($mytasks) { @@ -938,7 +939,7 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta $sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")"; } } - $sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut"; + $sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status"; $sql.= " ORDER BY p.title, p.ref"; $var=true; @@ -966,8 +967,15 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta $projectstatic->ref=$objp->ref; print $projectstatic->getNomUrl(1); print ' - '.dol_trunc($objp->title,24).''; - print ''; - $projectstatic->statut = $objp->fk_statut; + /*if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print ''; + }*/ + if (empty($conf->global->PROJECT_HIDE_TASKS)) print ''; + $projectstatic->statut = $objp->status; print ''; print "\n"; } diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index d0e10105471..45f59975ee0 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -27,6 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; $langs->load("sendings"); +$langs->load("deliveries"); $langs->load('companies'); // Security check @@ -143,22 +144,23 @@ if ($resql) print ''; - // Date + // Date delivery planned print ''; if ($conf->livraison_bon->enabled) { + // Delivery order print ''; } + // Status + print ''; + // Search print ''; - print ''; print "\n"; @@ -170,8 +172,9 @@ if ($resql) $var=!$var; - // Ref print ""; + + // Ref print "\n"; - // Date real - print ''."\n"; - if ($conf->livraison_bon->enabled) { $shipment->fetchObjectLinked($shipment->id,$shipment->element); @@ -209,13 +207,16 @@ if ($resql) print ''; - + // Date received print ''."\n"; } print ''; + + print ''; + print "\n"; $i++; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 88cf3a48555..d73fa983e1c 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -308,7 +308,9 @@ if ($resql) // Statut - print ''; + print ''; + + print ''; print "\n"; $i++; diff --git a/htdocs/fourn/list.php b/htdocs/fourn/list.php index c473f89a3b1..692671fba31 100644 --- a/htdocs/fourn/list.php +++ b/htdocs/fourn/list.php @@ -42,6 +42,7 @@ $search_supplier_code = GETPOST("search_supplier_code"); $search_supplier_accounting = GETPOST("search_supplier_accounting"); $search_datec = GETPOST("search_datec"); $search_categ = GETPOST('search_categ','int'); +$search_status = GETPOST("search_status",'int'); $catid = GETPOST("catid",'int'); // Security check @@ -73,9 +74,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_supplier_accounting=""; $search_datec=""; $search_categ=""; + $search_status=''; $catid=""; } +if ($search_status=='') $search_status=1; // always display activ customer first + $extrafields->fetch_name_optionals_label('thirdparty'); @@ -92,6 +96,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e * View */ +$form=new Form($db); $htmlother=new FormOther($db); $thirdpartystatic=new Societe($db); @@ -127,6 +132,7 @@ if ($search_town) $sql .= natural_search('s.town', $search_town); if ($search_supplier_code) $sql .= " AND s.code_fournisseur LIKE '%".$db->escape($search_supplier_code)."%'"; if ($search_supplier_accounting) $sql .= " AND s.code_compta_fournisseur LIKE '%".$db->escape($search_supplier_accounting)."%'"; if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'"; +if ($search_status!='') $sql.= " AND s.status = ".$db->escape($search_status); if ($catid > 0) $sql.= " AND cf.fk_categorie = ".$catid; if ($catid == -2) $sql.= " AND cf.fk_categorie IS NULL"; if ($search_categ > 0) $sql.= " AND cf.fk_categorie = ".$search_categ; @@ -156,6 +162,7 @@ if ($resql) $param = "&search_name=".$search_name."&search_supplier_code=".$search_supplier_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town; if ($search_categ != '') $param.='&search_categ='.$search_categ; + if ($search_status != '') $param.='&search_status='.$search_status; print_barre_liste($langs->trans("ListOfSuppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies'); @@ -194,7 +201,8 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre(''); print "\n"; print ''; @@ -221,6 +229,10 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + print ''; + print '\n"; @@ -253,7 +265,9 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print ''; + print ''; + + print ''; print "\n"; $i++; diff --git a/htdocs/install/mysql/data/llx_c_lead_status.sql b/htdocs/install/mysql/data/llx_c_lead_status.sql new file mode 100644 index 00000000000..82450a9c4e1 --- /dev/null +++ b/htdocs/install/mysql/data/llx_c_lead_status.sql @@ -0,0 +1,31 @@ +-- Copyright (C) 2015 Laurent Destailleur +-- +-- 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 . +-- +-- + +-- +-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors +-- de l'install et tous les sigles '--' sont supprimés. +-- + +-- Opportunities status +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (1,'PROSP' ,'Prospection', 10, 0,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (2,'QUAL' ,'Qualification',20, 20,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (3,'PROPO' ,'Proposal', 30, 40,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (4,'NEGO' ,'Negotiation', 40, 60,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (5,'PENDING','Pending', 50, 50,0); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (6,'WON' ,'Won', 60, 100,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (7,'LOST' ,'Lost', 70, 0,1); + 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 f10fc56af45..5b0b6705e5a 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 @@ -335,7 +335,8 @@ ALTER TABLE llx_commande_fournisseurdet ADD COLUMN fk_parent_line integer NULL a ALTER TABLE llx_projet ADD COLUMN date_close datetime DEFAULT NULL; ALTER TABLE llx_projet ADD COLUMN fk_user_close integer DEFAULT NULL; - +ALTER TABLE llx_projet ADD COLUMN fk_opp_status integer DEFAULT NULL after fk_statut; +ALTER TABLE llx_projet ADD COLUMN opp_amount double(24,8) DEFAULT NULL; -- Module AskPriceSupplier -- @@ -704,3 +705,23 @@ UPDATE llx_holiday_users SET fk_type = 1 WHERE fk_type IS NULL; UPDATE llx_holiday_logs SET fk_type = 1 WHERE fk_type IS NULL; UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_VAT_SOLD_ACCOUNT')__ WHERE __DECRYPT('name')__ = 'ACCOUNTING_VAT_ACCOUNT'; + +create table llx_c_lead_status +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + code varchar(10), + label varchar(50), + position integer, + percent double(5,2), + active tinyint DEFAULT 1 NOT NULL +)ENGINE=innodb; + +-- Opportunities status +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (1,'PROSP' ,'Prospection', 10, 0,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (2,'QUAL' ,'Qualification',20, 20,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (3,'PROPO' ,'Proposal', 30, 40,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (4,'NEGO' ,'Negotiation', 40, 60,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (5,'PENDING','Pending', 50, 50,0); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (6,'WIN' ,'Won', 60, 100,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (7,'LOST' ,'Lost', 70, 0,1); + diff --git a/htdocs/install/mysql/tables/llx_c_lead_status.key.sql b/htdocs/install/mysql/tables/llx_c_lead_status.key.sql new file mode 100644 index 00000000000..c6a273c0e1c --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_lead_status.key.sql @@ -0,0 +1,19 @@ +-- ======================================================================== +-- Copyright (C) 2012 Florian Henry +-- +-- 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 . +-- +-- ======================================================================== + +ALTER TABLE llx_c_lead_status ADD UNIQUE INDEX uk_c_lead_status_code(code); diff --git a/htdocs/install/mysql/tables/llx_c_lead_status.sql b/htdocs/install/mysql/tables/llx_c_lead_status.sql new file mode 100644 index 00000000000..ef23ab48261 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_lead_status.sql @@ -0,0 +1,26 @@ +-- Manage Lead +-- Copyright (C) 2014 Florian HENRY +-- +-- 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 . + +create table llx_c_lead_status +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + code varchar(10), + label varchar(50), + position integer, + percent double(5,2), + active tinyint DEFAULT 1 NOT NULL +)ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index d9192c191ba..635a135b764 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -31,12 +31,14 @@ create table llx_projet description text, fk_user_creat integer NOT NULL, -- createur du projet public integer, -- project is public or not - fk_statut smallint DEFAULT 0 NOT NULL, + fk_statut integer DEFAULT 0 NOT NULL, -- open or close + fk_opp_status integer DEFAULT NULL, -- if project is used to manage opportunities date_close datetime DEFAULT NULL, fk_user_close integer DEFAULT NULL, note_private text, note_public text, --budget_days real, -- budget in days is sum of field planned_workload of tasks + opp_amount double(24,8), budget_amount double(24,8), model_pdf varchar(255) )ENGINE=innodb; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index caf52b28eea..74c705cf547 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -821,6 +821,7 @@ DictionaryEMailTemplates=Emails templates DictionaryUnits=Units DictionaryProspectStatus=Prospection status DictionaryHolidayTypes=Type of leaves +DictionaryOpportunityStatus=Opportunity status for project/lead SetupSaved=Setup saved BackToModuleList=Back to modules list BackToDictionaryList=Back to dictionaries list diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 1ea6ffb5e9d..aadd6603853 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -121,6 +121,8 @@ ProjectCreatedInDolibarr=Project %s created TaskCreatedInDolibarr=Task %s created TaskModifiedInDolibarr=Task %s modified TaskDeletedInDolibarr=Task %s deleted +OpportunityStatus=Opportunity status +OpportunityAmount=Opportunity amount ##### Types de contacts ##### TypeContact_project_internal_PROJECTLEADER=Project leader TypeContact_project_external_PROJECTLEADER=Project leader @@ -154,3 +156,5 @@ ResourceNotAssignedToTask=Not assigned to task AssignTaskToMe=Assign task to me AssignTask=Assign ProjectOverview=Overview +ManageTasks=Use projects to follow tasks and time +ManageOpportunitiesStatus=Use projects to follow leads/opportinuties diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index d13c9884e89..cea060d75f4 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2013-2015 Laurent Destailleur * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -93,10 +93,11 @@ print '
'.$objp->nb.''; + $code = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); + if ($code) print $langs->trans("OppStatus".$code); + print ''.$objp->nb.''.$projectstatic->getLibStatut(3).'
'; print ''; print ' '; print ''; - + // Date received print ' '; print ''; print ''; - print ''.$langs->trans("All").' / '.$langs->trans("None").''; - print '
"; $shipment->id=$objp->rowid; $shipment->ref=$objp->ref; @@ -195,11 +198,6 @@ if ($resql) }*/ print "'; - print dol_print_date($db->jdate($objp->date_expedition),"day"); - print ''; print !empty($receiving) ? $receiving->getNomUrl($db) : ''; print ''; print dol_print_date($db->jdate($objp->date_reception),"day"); print ''.$expedition->LibStatut($objp->fk_statut,5).'
'.$commandestatic->LibStatut($obj->fk_statut, 5).''.$commandestatic->LibStatut($obj->fk_statut, 5).'
'; + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); + print ''; print ''; print "'.$thirdpartystatic->getLibStatut(3).''.$thirdpartystatic->getLibStatut(3).'
'."\n"; print ''; print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.id_sondage",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Title"), $_SERVER["PHP_SELF"], "p.titre",$param,"","",$sortfield,$sortorder); -print ''; +print_liste_field_titre($langs->trans("Type")); print_liste_field_titre($langs->trans("Author"), $_SERVER["PHP_SELF"], "u.".$fieldtosortuser,$param,"","",$sortfield,$sortorder); +print_liste_field_titre($langs->trans("NbOfVoters")); print_liste_field_titre($langs->trans("ExpireDate"), $_SERVER["PHP_SELF"], "p.date_fin",$param,"",'align="center"',$sortfield,$sortorder); -print ''; +print_liste_field_titre(''); print ''."\n"; print ''; @@ -104,6 +105,7 @@ print ''; print ''; print ''; print ''; +print ''; $arraystatus=array(''=>' ','expired'=>$langs->trans("Expired"),'opened'=>$langs->trans("Opened")); print ''; print ''; + print''."\n"; + print ''; - print''."\n"; + print''."\n"; print ''."\n"; $i++; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 31042ec240e..20f3361fac1 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -878,7 +878,7 @@ else } // Description (used in invoice, propal...) - print '"; // Public URL - print ''; @@ -972,7 +972,7 @@ else } // Note (private, no output on invoices, propales...) - print ''; @@ -1266,7 +1266,7 @@ else } // Note - print ''; + print ''; // Public URL - print ''; @@ -1593,7 +1593,7 @@ else // Note print ' '."\n"; - print ''."\n"; + print ''."\n"; print ' '."\n"; // Categories diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index e67e8bb3655..2b9097b8355 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -51,7 +51,16 @@ $type='project'; * Actions */ -if ($action == 'updateMask') +if ($action == 'setmainoptions') +{ + if (GETPOST('PROJECT_USE_OPPORTUNITIES')) dolibarr_set_const($db, "PROJECT_USE_OPPORTUNITIES",GETPOST('PROJECT_USE_OPPORTUNITIES'),'chaine',0,'',$conf->entity); + else dolibarr_del_const($db, "PROJECT_USE_OPPORTUNITIES", $conf->entity); + + if (GETPOST('PROJECT_USE_TASKS')) dolibarr_del_const($db, "PROJECT_HIDE_TASKS", $conf->entity); + else dolibarr_set_const($db, "PROJECT_HIDE_TASKS",1,'chaine',0,'',$conf->entity); +} + +else if ($action == 'updateMask') { $maskconstproject=GETPOST('maskconstproject','alpha'); $maskproject=GETPOST('maskproject','alpha'); @@ -281,10 +290,13 @@ else if ($action == 'setmodtask') dolibarr_set_const($db, "PROJECT_TASK_ADDON",$value,'chaine',0,'',$conf->entity); } -elseif ($action == 'updateoptions') { - if (GETPOST('PROJECT_USE_SEARCH_TO_SELECT')) { +elseif ($action == 'updateoptions') +{ + if (GETPOST('PROJECT_USE_SEARCH_TO_SELECT')) + { $companysearch = GETPOST('activate_PROJECT_USE_SEARCH_TO_SELECT', 'alpha'); - if (dolibarr_set_const($db, "PROJECT_USE_SEARCH_TO_SELECT", $companysearch, 'chaine', 0, '', $conf->entity)) { + if (dolibarr_set_const($db, "PROJECT_USE_SEARCH_TO_SELECT", $companysearch, 'chaine', 0, '', $conf->entity)) + { $conf->global->PROJECT_USE_SEARCH_TO_SELECT = $companysearch; } } @@ -308,6 +320,55 @@ $head=project_admin_prepare_head(); dol_fiche_head($head, 'project', $langs->trans("Projects"), 0, 'project'); + + +// Main options +$form=new Form($db); +$var=true; + +print ''; +print ''; +print ''; + +print '
'. $langs->trans("Type") .''. $langs->trans("NbOfVoters") .'
'. $form->selectarray('status', $arraystatus, $status).''; @@ -174,11 +176,13 @@ while ($i < min($num,$limit)) print ''.$nbuser.''.dol_print_date($db->jdate($obj->date_fin),'day'); if ($db->jdate($obj->date_fin) < time()) { print ' ('.$langs->trans("Expired").')'; } print ''.$nbuser.'
'.$langs->trans("Description").''; + print '
'.$langs->trans("Description").''; $doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 80); $doleditor->Create(); @@ -886,7 +886,7 @@ else print "
'.$langs->trans("PublicUrl").''; + print '
'.$langs->trans("PublicUrl").''; print ''; print '
'.$langs->trans("NoteNotVisibleOnBill").''; + print '
'.$langs->trans("NoteNotVisibleOnBill").''; // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. $doleditor = new DolEditor('note', GETPOST('note'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 8, 70); @@ -1164,7 +1164,7 @@ else } // Description (used in invoice, propal...) - print '
'.$langs->trans("Description").''; + print '
'.$langs->trans("Description").''; // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. $doleditor = new DolEditor('desc', $object->description, '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 80); @@ -1174,7 +1174,7 @@ else print "\n"; // Public Url - print '
'.$langs->trans("PublicUrl").''; + print '
'.$langs->trans("PublicUrl").''; print ''; print '
'.$langs->trans("NoteNotVisibleOnBill").''; + print '
'.$langs->trans("NoteNotVisibleOnBill").''; $doleditor = new DolEditor('note', $object->note, '', 140, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 80); $doleditor->Create(); @@ -1275,7 +1275,7 @@ else if($conf->categorie->enabled) { // Categories - print '
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); $c = new Categorie($db); $cats = $c->containing($object->id,Categorie::TYPE_PRODUCT); @@ -1483,10 +1483,10 @@ else } // Description - print '
'.$langs->trans("Description").''.(dol_textishtml($object->description)?$object->description:dol_nl2br($object->description,1,true)).'
'.$langs->trans("Description").''.(dol_textishtml($object->description)?$object->description:dol_nl2br($object->description,1,true)).'
'.$langs->trans("PublicUrl").''; + print '
'.$langs->trans("PublicUrl").''; print dol_print_url($object->url); print '
'.$langs->trans("Note").''.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'
'.$langs->trans("Note").''.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'
'; +print ''; +print "\n"; +print ''."\n"; +print ''."\n"; + + +$var=!$var; +print ""; +print ''; +print '"; +print ''; + +$var=!$var; +print ""; +print ''; +print '"; +print ''; + +print '
".$langs->trans("Parameters")."'.$langs->trans("Value").' 
'.$langs->trans("ManageOpportunitiesStatus").''; +$arrval=array('0'=>$langs->trans("No"), + '1'=>$langs->trans("Yes"), +); +print $form->selectyesno('PROJECT_USE_OPPORTUNITIES', $conf->global->PROJECT_USE_OPPORTUNITIES, 1); +print ''; +print ''; +print "
'.$langs->trans("ManageTasks").''; +$arrval=array('0'=>$langs->trans("No"), + '1'=>$langs->trans("Yes"), +); +print $form->selectyesno('PROJECT_USE_TASKS', empty($conf->global->PROJECT_HIDE_TASKS)?1:0, 1); +print ''; +print ''; +print "
'; + +print '
'; + + + /* * Projects Numbering model */ @@ -412,110 +473,115 @@ foreach ($dirmodels as $reldir) print '
'; -// Task numbering module -print_titre($langs->trans("TasksNumberingModules")); -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -clearstatcache(); - -foreach ($dirmodels as $reldir) +if (empty($conf->global->PROJECT_HIDE_TASKS)) { - $dir = dol_buildpath($reldir."core/modules/project/task/"); + // Task numbering module + print_titre($langs->trans("TasksNumberingModules")); - if (is_dir($dir)) + print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Activated").''.$langs->trans("ShortInfo").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + clearstatcache(); + + foreach ($dirmodels as $reldir) { - $handle = opendir($dir); - if (is_resource($handle)) + $dir = dol_buildpath($reldir."core/modules/project/task/"); + + if (is_dir($dir)) { - $var=true; - - while (($file = readdir($handle))!==false) + $handle = opendir($dir); + if (is_resource($handle)) { - if (preg_match('/^(mod_.*)\.php$/i',$file,$reg)) + $var=true; + + while (($file = readdir($handle))!==false) { - $file = $reg[1]; - $classname = substr($file,4); - - require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$file.'.php'; - - $module = new $file; - - // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - - if ($module->isEnabled()) + if (preg_match('/^(mod_.*)\.php$/i',$file,$reg)) { - $var=!$var; - print ''; + $file = $reg[1]; + $classname = substr($file,4); - // Show example of numbering module - print ''."\n"; + require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$file.'.php'; - print ''; + $var=!$var; + print ''; - $project=new Project($db); - $project->initAsSpecimen(); + // Show example of numbering module + print ''."\n"; - // Info - $htmltooltip=''; - $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; - $nextval=$module->getNextValue($mysoc,$project); - if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval - { - $htmltooltip.=''.$langs->trans("NextValue").': '; - if ($nextval) + print ''; + + $project=new Project($db); + $project->initAsSpecimen(); + + // Info + $htmltooltip=''; + $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; + $nextval=$module->getNextValue($mysoc,$project); + if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval + { + $htmltooltip.=''.$langs->trans("NextValue").': '; + if ($nextval) + { + $htmltooltip.=$nextval.'
'; + } + else + { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } + + print ''; + + print ''; } - - print ''; - - print ''; } } + closedir($handle); } - closedir($handle); } } + + print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Activated").''.$langs->trans("ShortInfo").'
'.$module->name."\n"; - print $module->info(); - print ''; - $tmp=$module->getExample(); - if (preg_match('/^Error/',$tmp)) print '
'.$langs->trans($tmp).'
'; - elseif ($tmp=='NotConfigured') print $langs->trans($tmp); - else print $tmp; - print '
'; - if ($conf->global->PROJECT_TASK_ADDON == 'mod_'.$classname) + $module = new $file; + + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + + if ($module->isEnabled()) { - print img_picto($langs->trans("Activated"),'switch_on'); - } - else - { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; - } - print '
'.$module->name."\n"; + print $module->info(); + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print '
'.$langs->trans($tmp).'
'; + elseif ($tmp=='NotConfigured') print $langs->trans($tmp); + else print $tmp; + print '
'; + if ($conf->global->PROJECT_TASK_ADDON == 'mod_'.$classname) { - $htmltooltip.=$nextval.'
'; + print img_picto($langs->trans("Activated"),'switch_on'); } else { - $htmltooltip.=$langs->trans($module->error).'
'; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } + print '
'; + print $form->textwithpicto('',$htmltooltip,1,0); + print '
'; - print $form->textwithpicto('',$htmltooltip,1,0); - print '

'; } -print '
'; /* * Document templates generators -*/ + */ print_titre($langs->trans("ProjectsModelModule")); @@ -668,149 +734,154 @@ foreach ($dirmodels as $reldir) print '
'; -/* - * Modeles documents for Task -*/ -print_titre($langs->trans("TaskModelModule")); -// Defini tableau def de modele -$type='project_task'; -$def = array(); - -$sql = "SELECT nom"; -$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; -$sql.= " WHERE type = '".$type."'"; -$sql.= " AND entity = ".$conf->entity; - -$resql=$db->query($sql); -if ($resql) +if (empty($conf->global->PROJECT_HIDE_TASKS)) { - $i = 0; - $num_rows=$db->num_rows($resql); - while ($i < $num_rows) + /* + * Modeles documents for Task + */ + + print_titre($langs->trans("TaskModelModule")); + + // Defini tableau def de modele + $type='project_task'; + $def = array(); + + $sql = "SELECT nom"; + $sql.= " FROM ".MAIN_DB_PREFIX."document_model"; + $sql.= " WHERE type = '".$type."'"; + $sql.= " AND entity = ".$conf->entity; + + $resql=$db->query($sql); + if ($resql) { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); - $i++; - } -} -else -{ - dol_print_error($db); -} - -print "\n"; -print "\n"; -print ' \n"; -print " \n"; -print '\n"; -print '\n"; -print ''; -print ''; -print "\n"; - -clearstatcache(); - -$var=true; -foreach ($dirmodels as $reldir) -{ - foreach (array('','/doc') as $valdir) - { - $dir = dol_buildpath($reldir."core/modules/project/task/".$valdir); - - if (is_dir($dir)) + $i = 0; + $num_rows=$db->num_rows($resql); + while ($i < $num_rows) { - $handle=opendir($dir); - if (is_resource($handle)) + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } + } + else + { + dol_print_error($db); + } + + print "
'.$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
\n"; + print "\n"; + print ' \n"; + print " \n"; + print '\n"; + print '\n"; + print ''; + print ''; + print "\n"; + + clearstatcache(); + + $var=true; + foreach ($dirmodels as $reldir) + { + foreach (array('','/doc') as $valdir) + { + $dir = dol_buildpath($reldir."core/modules/project/task/".$valdir); + + if (is_dir($dir)) { - while (($file = readdir($handle))!==false) + $handle=opendir($dir); + if (is_resource($handle)) { - $filelist[]=$file; - } - closedir($handle); - arsort($filelist); - - foreach($filelist as $file) - { - if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) + while (($file = readdir($handle))!==false) { - if (file_exists($dir.'/'.$file)) + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) { - $name = substr($file, 4, dol_strlen($file) -16); - $classname = substr($file, 0, dol_strlen($file) -12); - - require_once $dir.'/'.$file; - $module = new $classname($db); - - $modulequalified=1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; - - if ($modulequalified) + if (file_exists($dir.'/'.$file)) { - $var = !$var; - print '\n"; + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); - // Active - if (in_array($name, $def)) - { - print ""; - } - else - { - print ""; - } + require_once $dir.'/'.$file; + $module = new $classname($db); - // Defaut - print "'; + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); - if ($module->type == 'pdf') + if ($modulequalified) { - $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; - } - $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $var = !$var; + print '\n"; - print ''; + // Active + if (in_array($name, $def)) + { + print ""; + } + else + { + print ""; + } - // Preview - print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + if ($module->type == 'pdf') + { + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + + print ''; + + // Preview + print ''; + print "\n"; } - else - { - print img_object($langs->trans("PreviewNotAvailable"),'generic'); - } - print ''; - print "\n"; } } } @@ -818,9 +889,10 @@ foreach ($dirmodels as $reldir) } } } + + print '
'.$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; - print (empty($module->name)?$name:$module->name); - print "\n"; - if (method_exists($module,'info')) print $module->info($langs); - else print $module->description; - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("Enabled"),'switch_on'); - print ''; - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; - print ""; - if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name") - { - print img_picto($langs->trans("Default"),'on'); - } - else - { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; - } - print '
'; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print "'; - print $form->textwithpicto('',$htmltooltip,1,0); - print '\n"; + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print "'; - if ($module->type == 'pdf') - { - print ''.img_object($langs->trans("Preview"),'bill').''; + // Defaut + print ""; + if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name") + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'bill').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print '

'; } -print '
'; print_titre($langs->trans("Other")); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 860475c5596..3a01e80c4ba 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -27,6 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -40,6 +41,7 @@ $action=GETPOST('action','alpha'); $backtopage=GETPOST('backtopage','alpha'); $cancel=GETPOST('cancel','alpha'); $status=GETPOST('status','int'); +$opp_status=GETPOST('opp_status','int'); if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && ! $_POST["cancel"])) accessforbidden(); @@ -136,11 +138,13 @@ if (empty($reshook)) $object->socid = GETPOST('socid','int'); $object->description = GETPOST('description'); // Do not use 'alpha' here, we want field as it is $object->public = GETPOST('public','alpha'); - $object->budget_amount = GETPOST('budget_amount','int'); + $object->opp_amount = price2num(GETPOST('opp_amount')); + $object->budget_amount = price2num(GETPOST('budget_amount')); $object->datec=dol_now(); $object->date_start=$date_start; $object->date_end=$date_end; $object->statuts = $status; + $object->opp_status = $opp_status; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -223,9 +227,11 @@ if (empty($reshook)) $object->socid = GETPOST('socid','int'); $object->description = GETPOST('description'); // Do not use 'alpha' here, we want field as it is $object->public = GETPOST('public','alpha'); - $object->budget_amount= GETPOST('budget_amount','int'); $object->date_start = empty($_POST["projectstart"])?'':$date_start; $object->date_end = empty($_POST["projectend"])?'':$date_end; + if (isset($_POST['opp_amount'])) $object->opp_amount = price2num(GETPOST('opp_amount')); + if (isset($_POST['budget_amount'])) $object->budget_amount= price2num(GETPOST('budget_amount')); + if (isset($_POST['opp_status'])) $object->opp_status = $opp_status; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -379,6 +385,7 @@ if (empty($reshook)) $form = new Form($db); $formfile = new FormFile($db); +$formproject = new FormProjets($db); $userstatic = new User($db); $title=$langs->trans("Project").' - '.$object->ref.' '.$object->name; @@ -479,13 +486,27 @@ if ($action == 'create' && $user->rights->projet->creer) print $form->select_date(($date_end?$date_end:-1),'projectend'); print ''; - // Budget - print ''.$langs->trans("Budget").''; - print ''; - print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + // Opportunity status + print ''.$langs->trans("OpportunityStatus").''; + print ''; + print $formproject->selectOpportunityStatus('opp_status',$object->opp_status); + print ''; + + // Opportunity amount + print ''.$langs->trans("OpportunityAmount").''; + print ''; + print ''; + } + + // Budget + print ''.$langs->trans("Budget").''; + print ''; + print ''; // Description - print ''.$langs->trans("Description").''; + print ''.$langs->trans("Description").''; print ''; print ''; print ''; @@ -588,11 +609,11 @@ else print ''; // Ref - print ''; + print ''; print ''; // Label - print ''; + print ''; print ''; // Customer @@ -610,7 +631,7 @@ else print $form->selectarray('public',$array,$object->public); print ''; - // Statut + // Status print ''; // Date start @@ -626,12 +647,27 @@ else print $form->select_date($object->date_end?$object->date_end:-1,'projectend'); print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + // Opportunity status + print ''; + print ''; + print ''; + + // Opportunity amount + print ''; + print ''; + print ''; + } + // Budget print ''; - print ''; - print ''; + print ''; + print ''; - // Description + // Description print ''; print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + // Opportunity status + print ''; + + // Opportunity Amount + print ''; + } + // Budget print ''; // Description diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 4e505eb0910..7a38e7a1278 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -65,7 +65,10 @@ class Project extends CommonObject var $budget_amount; var $statuts_short; - var $statuts; // 0=draft, 1=opened, 2=closed + var $statuts_long; + + var $statut; // 0=draft, 1=opened, 2=closed + var $opp_status; // opportunity status, into table llx_c_lead_status var $oldcopy; @@ -104,7 +107,7 @@ class Project extends CommonObject $this->db = $db; $this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); - $this->statuts = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); + $this->statuts_long = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); } /** @@ -140,10 +143,12 @@ class Project extends CommonObject $sql.= ", fk_soc"; $sql.= ", fk_user_creat"; $sql.= ", fk_statut"; + $sql.= ", fk_opp_status"; $sql.= ", public"; $sql.= ", datec"; $sql.= ", dateo"; $sql.= ", datee"; + $sql.= ", opp_amount"; $sql.= ", budget_amount"; $sql.= ", entity"; $sql.= ") VALUES ("; @@ -152,12 +157,14 @@ class Project extends CommonObject $sql.= ", '" . $this->db->escape($this->description) . "'"; $sql.= ", " . ($this->socid > 0 ? $this->socid : "null"); $sql.= ", " . $user->id; - $sql.= ", ".(is_numeric($this->statuts) ? $this->statuts : '0'); + $sql.= ", ".(is_numeric($this->statut) ? $this->statut : '0'); + $sql.= ", ".(is_numeric($this->opp_status) ? $this->opp_status : 'NULL'); $sql.= ", " . ($this->public ? 1 : 0); $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", " . ($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); $sql.= ", " . ($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); - $sql.= ", " . ($this->budget_amount != '' ? price2num($this->budget_amount) : 'null'); + $sql.= ", " . (strcmp($this->opp_amount,'') ? price2num($this->opp_amount) : 'null'); + $sql.= ", " . (strcmp($this->budget_amount,'') ? price2num($this->budget_amount) : 'null'); $sql.= ", ".$conf->entity; $sql.= ")"; @@ -229,6 +236,7 @@ class Project extends CommonObject // Clean parameters $this->title = trim($this->title); $this->description = trim($this->description); + if ($this->opp_amount < 0) $this->opp_amount=''; if (dol_strlen(trim($this->ref)) > 0) { @@ -240,16 +248,18 @@ class Project extends CommonObject $sql.= ", description = '" . $this->db->escape($this->description) . "'"; $sql.= ", fk_soc = " . ($this->socid > 0 ? $this->socid : "null"); $sql.= ", fk_statut = " . $this->statut; + $sql.= ", fk_opp_status = " . ($this->opp_status > 0 ? $this->opp_status : 'null'); $sql.= ", public = " . ($this->public ? 1 : 0); $sql.= ", datec=" . ($this->date_c != '' ? "'".$this->db->idate($this->date_c)."'" : 'null'); $sql.= ", dateo=" . ($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); $sql.= ", datee=" . ($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); $sql.= ", date_close=" . ($this->date_close != '' ? "'".$this->db->idate($this->date_close)."'" : 'null'); $sql.= ", fk_user_close=" . ($this->fk_user_close > 0 ? $this->fk_user_close : "null"); - $sql.= ", budget_amount = " . ($this->budget_amount > 0 ? $this->budget_amount : "null"); + $sql.= ", opp_amount = " . (strcmp($this->opp_amount, '') ? price2num($this->opp_amount) : "null"); + $sql.= ", budget_amount = " . (strcmp($this->budget_amount, '') ? price2num($this->budget_amount) : "null"); $sql.= " WHERE rowid = " . $this->id; - dol_syslog(get_class($this)."::Update", LOG_DEBUG); + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -308,13 +318,13 @@ class Project extends CommonObject $this->error = $this->db->lasterror(); $this->errors[] = $this->error; $this->db->rollback(); - dol_syslog(get_class($this)."::Update error -2 " . $this->error, LOG_ERR); + dol_syslog(get_class($this)."::update error -2 " . $this->error, LOG_ERR); $result = -2; } } else { - dol_syslog(get_class($this)."::Update ref null"); + dol_syslog(get_class($this)."::update ref null"); $result = -1; } @@ -332,8 +342,8 @@ class Project extends CommonObject { if (empty($id) && empty($ref)) return -1; - $sql = "SELECT rowid, ref, title, description, public, datec, budget_amount,"; - $sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_close, fk_statut, note_private, note_public, model_pdf"; + $sql = "SELECT rowid, ref, title, description, public, datec, opp_amount, budget_amount,"; + $sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_close, fk_statut, fk_opp_status, note_private, note_public, model_pdf"; $sql.= " FROM " . MAIN_DB_PREFIX . "projet"; if (! empty($id)) { @@ -372,6 +382,8 @@ class Project extends CommonObject $this->user_close_id = $obj->fk_user_close; $this->public = $obj->public; $this->statut = $obj->fk_statut; + $this->opp_status = $obj->fk_opp_status; + $this->opp_amount = $obj->opp_amount; $this->budget_amount = $obj->budget_amount; $this->modelpdf = $obj->model_pdf; @@ -748,6 +760,11 @@ class Project extends CommonObject $sql.= " AND entity = " . $conf->entity; $sql.= " AND fk_statut = 1"; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + // TODO What to do if fk_opp_status is not code 'WIN' or 'LOST' + } + dol_syslog(get_class($this)."::setClose", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -804,7 +821,7 @@ class Project extends CommonObject if ($mode == 0) { - return $langs->trans($this->statuts[$statut]); + return $langs->trans($this->statuts_long[$statut]); } if ($mode == 1) { @@ -813,38 +830,38 @@ class Project extends CommonObject if ($mode == 2) { if ($statut == 0) - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]); + return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]); if ($statut == 1) - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_short[$statut]); + return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_short[$statut]); if ($statut == 2) - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); + return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); } if ($mode == 3) { if ($statut == 0) - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); + return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0'); if ($statut == 1) - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); + return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4'); if ($statut == 2) - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); + return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6'); } if ($mode == 4) { if ($statut == 0) - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]); + return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_long[$statut]); if ($statut == 1) - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_short[$statut]); + return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_long[$statut]); if ($statut == 2) - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); + return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_long[$statut]); } if ($mode == 5) { if ($statut == 0) - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); + return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut0'); if ($statut == 1) - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); + return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut4'); if ($statut == 2) - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); + return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut6'); } } @@ -914,6 +931,8 @@ class Project extends CommonObject $this->date_m = $now; $this->date_start = $now; $this->note_public = 'SPECIMEN'; + $this->fk_ele = 20000; + $this->opp_amount = 20000; $this->budget_amount = 10000; /* diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 9c3d5e61364..dc68dd973c5 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -1,6 +1,6 @@ - * Copyright (C) 2012-2014 Laurent Destailleur + * Copyright (C) 2012-2015 Laurent Destailleur * * 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 @@ -183,7 +183,7 @@ if ($id > 0 || ! empty($ref)) else print $langs->trans('PrivateProject'); print ''; - // Statut + // Status print ''; // Date start @@ -196,6 +196,22 @@ if ($id > 0 || ! empty($ref)) print dol_print_date($object->date_end,'day'); print ''; + // Opportunity status + print ''; + + // Opportunity Amount + print ''; + + // Budget + print ''; + print "
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("OpportunityStatus").''; + print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1); + print '
'.$langs->trans("OpportunityAmount").'
'.$langs->trans("Budget").'
'.$langs->trans("Description").''; print ''; @@ -692,9 +728,23 @@ else print dol_print_date($object->date_end,'day'); print '
'.$langs->trans("OpportunityStatus").''; + $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); + if ($code) print $langs->trans("OppStatus".$code); + print '
'.$langs->trans("OpportunityAmount").''; + if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency); + print '
'.$langs->trans("Budget").''; - if ($object->budget_amount != '') print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); + if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("OpportunityStatus").''; + $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); + if ($code) print $langs->trans("OppStatus".$code); + print '
'.$langs->trans("OpportunityAmount").''; + if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency); + print '
'.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); + print '
"; print ''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 8ade207155e..fd8d90d8fad 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -157,6 +157,22 @@ print ''.$langs->trans("DateEnd").''; print dol_print_date($object->date_end,'day'); print ''; +// Opportunity status +print ''.$langs->trans("OpportunityStatus").''; +$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); +if ($code) print $langs->trans("OppStatus".$code); +print ''; + +// Opportunity Amount +print ''.$langs->trans("OpportunityAmount").''; +if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency); +print ''; + +// Budget +print ''.$langs->trans("Budget").''; +if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); +print ''; + print ''; dol_fiche_end(); @@ -487,17 +503,21 @@ foreach ($listofreferent as $key => $value) // If we want the project task array to have details of users //if ($key == 'project_task') $key = 'project_task_time'; - $element = new $classname($db); $addform=''; - $selectList=$formproject->select_element($tablename,$object->thirdparty->id); + + $idtofilterthirdparty=0; + if (! in_array($tablename, array('facture_fourn', 'commande_fourn'))) $idtofilterthirdparty=$object->thirdparty->id; + + $selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth200'); if (! $selectList || ($selectList<0)) { setEventMessages($formproject->error,$formproject->errors,'errors'); } elseif($selectList) { + // Define form with the combo list of elements to link $addform.='
'; $addform.=''; $addform.=''; @@ -621,7 +641,7 @@ foreach ($listofreferent as $key => $value) } else { - if ($element instanceof Task) + if ($element instanceof Task) { print $element->getNomUrl(1,'withproject','time'); print ' - '.dol_trunc($element->label, 48); @@ -692,8 +712,8 @@ foreach ($listofreferent as $key => $value) { $tmp = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty $total_ht_by_line = price2num($tmp['amount'],'MT'); - if ($tmp['nblinesnull'] > 0) - { + if ($tmp['nblinesnull'] > 0) + { $langs->load("errors"); $warning=$langs->trans("WarningSomeLinesWithNullHourlyRate"); } @@ -807,9 +827,22 @@ foreach ($listofreferent as $key => $value) print $elementarray; } print ""; + print "
\n"; } } +// Enhance with select2 +$nodatarole=''; +if ($conf->use_javascript_ajax) +{ + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $comboenhancement = ajax_combobox('.elementselect'); + $out.=$comboenhancement; + $nodatarole=($comboenhancement?' data-role="none"':''); + + print $comboenhancement; +} + llxFooter(); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 6528b5bfe3e..4894aed413b 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -94,6 +94,7 @@ if (! empty($conf->projet->enabled) && $user->rights->projet->lire) print "
\n"; } +// List of draft projects print_projecttasks_array($db,$socid,$projectsListId,0,0); @@ -164,7 +165,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) $max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA); - $sql = "SELECT p.ref, p.title, p.rowid as projectid, t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent"; + $sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; @@ -195,6 +196,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) print ''; //print ''.$langs->trans('TaskRessourceLinks').''; print ''.$langs->trans('Projects').''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print ''.$langs->trans('OpportunityStatus').''; print ''.$langs->trans('Task').''; print ''.$langs->trans('DateStart').''; print ''.$langs->trans('DateEnd').''; @@ -226,6 +228,13 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) print $projectstatic->getNomUrl(1,'',16); //print ''.$obj->title.''; print ''; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print ''; + $code = dol_getIdFromCode($db, $obj->opp_status, 'c_lead_status', 'rowid', 'code'); + if ($code) print $langs->trans("OppStatus".$code); + print ''; + } print ''; if (! empty($obj->taskid)) { @@ -264,7 +273,9 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) if ($num > $max) { - print ''.$langs->trans("WarningTooManyDataPleaseUseMoreFilters").''; + $colspan=6; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) $colspan++; + print ''.$langs->trans("WarningTooManyDataPleaseUseMoreFilters").''; } print ""; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index e79310a5ab6..489f85f7405 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -30,6 +30,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; $langs->load('projects'); @@ -68,6 +69,7 @@ $search_societe=GETPOST("search_societe"); $search_year=GETPOST("search_year"); $search_all=GETPOST("search_all"); $search_status=GETPOST("search_status",'int'); +$search_opp_status=GETPOST("search_opp_status",'int'); $search_public=GETPOST("search_public",'int'); $search_user=GETPOST('search_user','int'); $search_sale=GETPOST('search_sale','int'); @@ -90,6 +92,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_societe=""; $search_year=""; $search_status=-1; + $search_opp_status=-1; $search_public=""; $search_sale=""; $search_user=''; @@ -115,15 +118,17 @@ $projectstatic = new Project($db); $socstatic = new Societe($db); $form = new Form($db); $formother = new FormOther($db); +$formproject = new FormProjets($db); llxHeader("",$langs->trans("Projects"),"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$mine:($user->rights->projet->all->lire?2:0)),1,$socid); -$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.public, p.fk_user_creat"; +$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.fk_opp_status, p.public, p.fk_user_creat"; $sql.= ", p.datec as date_create, p.dateo as date_start, p.datee as date_end"; $sql.= ", s.nom as name, s.rowid as socid"; +$sql.= ", cls.code as opp_status_code"; // Add fields for extrafields foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; // Add fields from hooks @@ -132,6 +137,7 @@ $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // N $sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid"; // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -177,6 +183,7 @@ else if ($year > 0) } if ($search_all) $sql .= natural_search(array('p.ref','p.title','s.nom'), $search_all); if ($search_status >= 0) $sql .= " AND p.fk_statut = ".$db->escape($search_status); +if ($search_opp_status > 0) $sql .= " AND p.fk_opp_status = ".$db->escape($search_opp_status); if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='project' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user; @@ -205,6 +212,7 @@ if ($resql) if ($search_label != '') $param.='&search_label='.$search_label; if ($search_societe != '') $param.='&search_societe='.$search_societe; if ($search_status >= 0) $param.='&search_status='.$search_status; + if ($search_opp_status >= 0) $param.='&search_opp_status='.$search_opp_status; if ($search_public != '') $param.='&search_public='.$search_public; if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_sale > 0) $param.='&search_sale='.$search_sale; @@ -271,6 +279,7 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print_liste_field_titre($langs->trans("OpportunityStatus"),$_SERVER["PHP_SELF"],'p.fk_opp_statut',"",$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(''); print "\n"; @@ -312,6 +321,13 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print ''; + print $formproject->selectOpportunityStatus('search_opp_status',$search_opp_status,1,1); + print ''; + } + print ''; print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('Draft'),'1'=>$langs->trans('Opened'),'2'=>$langs->trans('Closed')),$search_status); print ''; @@ -418,9 +434,18 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print ''; + if ($objp->opp_status_code) print $langs->trans("OppStatusShort".$objp->opp_status_code); + print ''; + } + // Status $projectstatic->statut = $objp->fk_statut; - print ''.$projectstatic->getLibStatut(5).''; + print ''.$projectstatic->getLibStatut(5).''; + + print ''; print "\n"; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index d49520f2f19..531ce2fbcf1 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -437,7 +437,7 @@ else if ($id > 0 || ! empty($ref)) } else { - print ''.$langs->trans("NoTasks").''; + print ''.$langs->trans("NoTasks").''; } print ""; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 730f2d76f18..00f137252e2 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1891,7 +1891,7 @@ div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border } div .tdtop { vertical-align: top; - padding-top: 5px; + padding-top: 5px !important; padding-bottom: 0px; } @@ -2554,9 +2554,9 @@ div.dolgraph div.legend table tbody tr { height: auto; } margin-top: 10px; } .photowithmargin { - -webkit-box-shadow: 0px 0px 3px #777; +/* -webkit-box-shadow: 0px 0px 3px #777; -moz-box-shadow: 0px 0px 3px #777; - box-shadow: 0px 0px 3px #777; + box-shadow: 0px 0px 3px #777;*/ } .photointoolitp { margin-top: 6px;