diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 2a6a3b2cd8c..7f1dc549054 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2614,8 +2614,22 @@ class Propal extends CommonObject $newprivatenote = dol_concatdesc($this->note_private, $note); + if (empty($conf->global->PROPALE_KEEP_OLD_SIGNATURE_INFO)) { + $date_signature = $now; + $fk_user_signature = $user->id; + } else { + $this->info($this->id); + if (!isset($this->date_signature) || $this->date_signature == '') { + $date_signature = $now; + $fk_user_signature = $user->id; + } else { + $date_signature = $this->date_signature; + $fk_user_signature = $this->user_signature->id; + } + } + $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."', date_signature='".$this->db->idate($now)."', fk_user_signature=".$user->id; + $sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."', date_signature='".$this->db->idate($date_signature)."', fk_user_signature=".$fk_user_signature; $sql .= " WHERE rowid = ".((int) $this->id); $resql = $this->db->query($sql); @@ -2662,7 +2676,7 @@ class Propal extends CommonObject $this->oldcopy= clone $this; $this->statut = $status; $this->status = $status; - $this->date_signature = $now; + $this->date_signature = $date_signature; $this->note_private = $newprivatenote; } diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index e9de957e4a8..18bd7226400 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -213,6 +213,53 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c return $content; } +/** + * Converts smiley string into the utf8 sequence. + * @param string $content Content to replace + * @return string Replacement of all smiley strings with their utf8 code + * @see dolWebsiteOutput() + */ +function dolReplaceSmileyCodeWithUTF8($content) +{ + $map = array( + ":face_with_tears_of_joy:" => "\xF0\x9F\x98\x82", + ":grinning_face_with_smiling_eyes:" => "\xF0\x9F\x98\x81", + ":smiling_face_with_open_mouth:" => "\xF0\x9F\x98\x83", + ":smiling_face_with_open_mouth_and_cold_sweat:" => "\xF0\x9F\x98\x85", + ":smiling_face_with_open_mouth_and_tightly_closed_eyes:" => "\xF0\x9F\x98\x86", + ":winking_face:" => "\xF0\x9F\x98\x89", + ":smiling_face_with_smiling_eyes:" => "\xF0\x9F\x98\x8A", + ":face_savouring_delicious_food:" => "\xF0\x9F\x98\x8B", + ":relieved_face:" => "\xF0\x9F\x98\x8C", + ":smiling_face_with_heart_shaped_eyes:" => "\xF0\x9F\x98\x8D", + ":smiling_face_with_sunglasses:" => "\xF0\x9F\x98\x8E", + ":smirking_face:" => "\xF0\x9F\x98\x8F", + ":neutral_face:" => "\xF0\x9F\x98\x90", + ":expressionless_face:" => "\xF0\x9F\x98\x91", + ":unamused_face:" => "\xF0\x9F\x98\x92", + ":face_with_cold_sweat:" => "\xF0\x9F\x98\x93", + ":pensive_face:" => "\xF0\x9F\x98\x94", + ":confused_face:" => "\xF0\x9F\x98\x95", + ":confounded_face:" => "\xF0\x9F\x98\x96", + ":kissing_face:" => "\xF0\x9F\x98\x97", + ":face_throwing_a_kiss:" => "\xF0\x9F\x98\x98", + ":kissing_face_with_smiling_eyes:" => "\xF0\x9F\x98\x99", + ":kissing_face_with_closed_eyes:" => "\xF0\x9F\x98\x9A", + ":face_with_stuck_out_tongue:" => "\xF0\x9F\x98\x9B", + ":face_with_stuck_out_tongue_and_winking_eye:" => "\xF0\x9F\x98\x9C", + ":face_with_stuck_out_tongue_and_tightly_closed_eyes:" => "\xF0\x9F\x98\x9D", + ":disappointed_face:" => "\xF0\x9F\x98\x9E", + ":worried_face:" => "\xF0\x9F\x98\x9F", + ":angry_face:" => "\xF0\x9F\x98\xA0", + ":face_with_symbols_on_mouth:" => "\xF0\x9F\x98\xA1", + ); + foreach ($map as $key => $value) { + $content = str_replace($key, $value, $content); + } + return $content; +} + + /** * Render a string of an HTML content and output it. * Used to ouput the page when viewed from a server (Dolibarr or Apache). @@ -369,6 +416,8 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') $content = str_replace('"LineUnitPrice", 'fd.tva_tx'=>"LineVATRate", 'fd.qty'=>"LineQty", 'fd.total_ht'=>"LineTotalHT", 'fd.total_tva'=>"LineTotalVAT", 'fd.total_ttc'=>"LineTotalTTC", 'fd.date_start'=>"DateStart", 'fd.date_end'=>"DateEnd", 'fd.special_code'=>'SpecialCode', 'fd.product_type'=>"TypeOfLineServiceOrProduct", 'fd.fk_product'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', - $alias_product_perentity . '.accountancy_code_sell'=>'ProductAccountancySellCode' + $alias_product_perentity . '.accountancy_code_sell'=>'ProductAccountancySellCode', + 'aa.account_number' => 'AccountingAffectation' ); if (!empty($conf->multicurrency->enabled)) { $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; @@ -549,6 +550,7 @@ class modFacture extends DolibarrModules 'fd.special_code'=>'Numeric', 'fd.product_type'=>"Numeric", 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text', $alias_product_perentity . '.accountancy_code_sell'=>'Text', 'f.entity'=>'List:entity:label:rowid', + 'aa.account_number' => 'Text' ); if (!empty($conf->cashdesk->enabled) || !empty($conf->takepos->enabled) || !empty($conf->global->INVOICE_SHOW_POS)) { $this->export_TypeFields_array[$r]['f.module_source'] = 'Text'; @@ -561,7 +563,8 @@ class modFacture extends DolibarrModules 'fd.subprice'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_tva'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva_tx'=>"invoice_line", 'fd.qty'=>"invoice_line", 'fd.date_start'=>"invoice_line", 'fd.date_end'=>"invoice_line", 'fd.special_code'=>'invoice_line', 'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product', 'p.ref'=>'product', 'p.label'=>'product', $alias_product_perentity . '.accountancy_code_sell'=>'product', - 'f.fk_user_author'=>'user', 'uc.login'=>'user', 'f.fk_user_valid'=>'user', 'uv.login'=>'user' + 'f.fk_user_author'=>'user', 'uc.login'=>'user', 'f.fk_user_valid'=>'user', 'uv.login'=>'user', + 'aa.account_number' => "invoice_line", ); $this->export_special_array[$r] = array('none.rest'=>'getRemainToPay'); $this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them @@ -602,6 +605,7 @@ class modFacture extends DolibarrModules $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_account as aa on fd.fk_code_ventilation = aa.rowid'; $this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; $this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('invoice').')'; if (empty($user->rights->societe->client->voir)) { diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index b17ab4fdeb2..792070e3d43 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -1,4 +1,5 @@ # Dolibarr language file - Source file is en_US - loan +IdModule= Module id ModuleBuilderDesc=This tool must be used only by experienced users or developers. It provides utilities to build or edit your own module. Documentation for alternative manual development is here. EnterNameOfModuleDesc=Enter the name of the module/application to create with no spaces. Use uppercase to separate words (For example: MyModule, EcommerceForShop, SyncWithMySystem...) EnterNameOfObjectDesc=Enter the name of the object to create with no spaces. Use uppercase to separate words (For example: MyObject, Student, Teacher...). The CRUD class file, but also API file, pages to list/add/edit/delete object and SQL files will be generated. diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5697e93407d..bea27a09cab 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1349,7 +1349,7 @@ if (!function_exists("llxHeader")) { */ function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0) { - global $conf; + global $conf, $hookmanager; // html header top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, $disablenofollow, $disablenoindex); @@ -1369,6 +1369,12 @@ if (!function_exists("llxHeader")) { print ''."\n"; + $parameters = array('help_url' => $help_url); + $reshook = $hookmanager->executeHooks('changeHelpURL', $parameters); + if ($reshook > 0) { + $help_url = $hookmanager->resPrint; + } + // top menu and left menu area if ((empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && !GETPOST('dol_openinpopup', 'aZ09')) { top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring, $help_url); diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index fd84cb5e4dd..3416c1c69b8 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -71,6 +71,12 @@ $file = GETPOST('file', 'alpha'); $modulename = dol_sanitizeFileName(GETPOST('modulename', 'alpha')); $objectname = dol_sanitizeFileName(GETPOST('objectname', 'alpha')); $dicname = dol_sanitizeFileName(GETPOST('dicname', 'alpha')); +$editorname= GETPOST('editorname', 'alpha'); +$editorurl= GETPOST('editorurl', 'alpha'); +$version= GETPOST('version', 'alpha'); +$family= GETPOST('family', 'alpha'); +$picto= GETPOST('idpicto', 'alpha'); +$idmodule= GETPOST('idmodule', 'alpha'); // Security check if (!isModEnabled('modulebuilder')) { @@ -334,7 +340,13 @@ if ($dirins && $action == 'initmodule' && $modulename) { 'Mon module'=>$modulename, 'mon module'=>$modulename, 'htdocs/modulebuilder/template'=>strtolower($modulename), - '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : '') + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : ''), + 'Editor name'=>$editorname, + 'https://www.example.com'=>$editorurl, + '1.0'=>$version, + 'idpicto'=>(empty($picto)) ? 'generic' : $picto, + "modulefamily" =>$family, + 500000=>$idmodule ); if (!empty($conf->global->MODULEBUILDER_SPECIFIC_EDITOR_NAME)) { @@ -350,7 +362,7 @@ if ($dirins && $action == 'initmodule' && $modulename) { $arrayreplacement['1.0'] = $conf->global->MODULEBUILDER_SPECIFIC_VERSION; } if (!empty($conf->global->MODULEBUILDER_SPECIFIC_FAMILY)) { - $arrayreplacement['other'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY; + $arrayreplacement['modulefamily'] = $conf->global->MODULEBUILDER_SPECIFIC_FAMILY; } $result = dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); @@ -2075,10 +2087,32 @@ if ($module == 'initmodule') { print ''; //print ''.$langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $newdircustom).'
'; - print $langs->trans("EnterNameOfModuleDesc").'
'; print '
'; - print '
'; + print ''; + print ' '.$form->textwithpicto('', $langs->trans("EnterNameOfModuleDesc")).'
'; + + + + print '
'; + print '
'; + print '
'; + print '
'; + print $langs->trans("Family").'
'; + print '
'; print '
'; print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index eaf9c5022a3..2c111a30c2c 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -108,6 +108,7 @@ $search_accept_conference_suggestions = GETPOST('search_accept_conference_sugges $search_accept_booth_suggestions = GETPOST('search_accept_booth_suggestions', 'int'); $search_price_registration = GETPOST("search_price_registration", 'alpha'); $search_price_booth = GETPOST("search_price_booth", 'alpha'); +$search_login = GETPOST('search_login', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $mine = ((GETPOST('mode') == 'mine') ? 1 : 0); @@ -201,6 +202,7 @@ $arrayfields['s.nom'] = array('label'=>$langs->trans("ThirdParty"), 'checked'=>1 $arrayfields['commercial'] = array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>0, 'position'=>23); $arrayfields['c.assigned'] = array('label'=>$langs->trans("AssignedTo"), 'checked'=>-1, 'position'=>120); $arrayfields['opp_weighted_amount'] = array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'position'=> 116, 'enabled'=>(empty($conf->global->PROJECT_USE_OPPORTUNITIES) ? 0 : 1), 'position'=>106); +$arrayfields['u.login'] = array('label'=>"Author", 'checked'=>1, 'position'=>165); // Force some fields according to search_usage filter... if (GETPOST('search_usage_opportunity')) { //$arrayfields['p.usage_opportunity']['visible'] = 1; // Not require, filter on search_opp_status is enough @@ -285,6 +287,7 @@ if (empty($reshook)) { $search_accept_booth_suggestions = ''; $search_price_registration = ''; $search_price_booth = ''; + $search_login = ''; $toselect = array(); $search_array_options = array(); $search_category_array = array(); @@ -390,10 +393,11 @@ $sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as statu $sql .= " p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount,"; $sql .= " p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event,"; $sql .= " p.email_msgid,"; -$sql .= " accept_conference_suggestions, accept_booth_suggestions, price_registration, price_booth,"; +$sql .= " p.accept_conference_suggestions, p.accept_booth_suggestions, p.price_registration, p.price_booth,"; $sql .= " s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client,"; $sql .= " country.code as country_code,"; -$sql .= " cls.code as opp_status_code"; +$sql .= " cls.code as opp_status_code,"; +$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender'; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -415,6 +419,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label']) &&is_array $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid"; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON p.fk_user_creat = u.rowid'; // We'll need this table joined to the select in order to filter by sale // No check is done on company permission because readability is managed by public status of project and assignement. //if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; @@ -544,6 +549,9 @@ if ($search_price_registration != '') { if ($search_price_booth != '') { $sql .= natural_search('p.price_booth', $search_price_booth, 1); } +if ($search_login) { + $sql .= natural_search(array('u.login', 'u.firstname', 'u.lastname'), $search_login); +} // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks @@ -735,6 +743,9 @@ if ($search_price_registration != '') { if ($search_price_booth != '') { $param .= '&search_price_booth='.urlencode($search_price_booth); } +if ($search_login) { + $param .= '&search_login='.urlencode($search_login); +} if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } @@ -999,6 +1010,12 @@ if (!empty($arrayfields['p.price_booth']['checked'])) { print ''; print ''; } +if (!empty($arrayfields['u.login']['checked'])) { + // Author + print ''; + print ''; + print ''; +} // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -1104,6 +1121,9 @@ if (!empty($arrayfields['p.price_registration']['checked'])) { if (!empty($arrayfields['p.price_booth']['checked'])) { print_liste_field_titre($arrayfields['p.price_booth']['label'], $_SERVER["PHP_SELF"], 'p.price_booth', "", $param, '', $sortfield, $sortorder, 'right '); } +if (!empty($arrayfields['u.login']['checked'])) { + print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); +} // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -1125,6 +1145,8 @@ if (!empty($arrayfields['p.fk_statut']['checked'])) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; +$userstatic = new User($db); + $i = 0; $totalarray = array( 'nbfield' => 0, @@ -1473,6 +1495,33 @@ while ($i < min($num, $limit)) { $totalarray['pos'][$totalarray['nbfield']] = 'p.price_booth'; } } + // Author + $userstatic->id = $obj->fk_user_creat; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; + + if (!empty($arrayfields['u.login']['checked'])) { + print ''; + if ($userstatic->id) { + print $userstatic->getNomUrl(-1); + } else { + print ' '; + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index ab93e3561b0..801e0cb0a00 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formintervention.class.php'; // Load translation files required by the page -$langsLoad=array('projects', 'bills', 'orders'); +$langsLoad=array('projects', 'bills', 'orders', 'companies'); if (!empty($conf->eventorganization->enabled)) { $langsLoad[]='eventorganization'; } @@ -73,6 +73,7 @@ $search_task_ref = GETPOST('search_task_ref', 'alpha'); $search_task_label = GETPOST('search_task_label', 'alpha'); $search_user = GETPOST('search_user', 'int'); $search_valuebilled = GETPOST('search_valuebilled', 'int'); +$search_company = GETPOST('$search_company', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -161,6 +162,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_date_creation = ''; $search_date_update = ''; $search_task_ref = ''; + $search_company = ''; $search_task_label = ''; $search_user = 0; $search_valuebilled = ''; @@ -1071,6 +1073,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Definition of fields for list $arrayfields = array(); $arrayfields['t.task_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1); + $arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1','checked'=>1); if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) { // Not a dedicated task $arrayfields['t.task_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1); $arrayfields['t.task_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1); @@ -1104,6 +1107,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if ($search_task_ref != '') { $param .= '&search_task_ref='.urlencode($search_task_ref); } + if ($search_company != '') { + $param .= '&$search_company='.urlencode($search_company); + } if ($search_task_label != '') { $param .= '&search_task_label='.urlencode($search_task_label); } @@ -1304,6 +1310,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $sql .= " pt.ref, pt.label, pt.fk_projet,"; $sql .= " u.lastname, u.firstname, u.login, u.photo, u.statut as user_status,"; $sql .= " il.fk_facture as invoice_id, inv.fk_statut,"; + $sql .= " p.fk_soc,"; // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -1312,13 +1319,16 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facturedet as il ON il.rowid = t.invoice_line_id"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as inv ON inv.rowid = il.fk_facture"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."projet_task as pt ON pt.rowid = t.fk_task"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON t.fk_user = u.rowid"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = pt.fk_projet"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; + // Add table from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; - $sql .= ", ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; - + $sql .= " WHERE 1 = 1 "; if (empty($projectidforalltimes) && empty($allprojectforuser)) { // Limit on one task $sql .= " AND t.fk_task =".((int) $object->id); @@ -1339,6 +1349,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if ($search_task_ref) { $sql .= natural_search('pt.ref', $search_task_ref); } + if ($search_company) { + $sql .= natural_search('s.nom', $search_company); + } if ($search_task_label) { $sql .= natural_search('pt.label', $search_task_label); } @@ -1572,6 +1585,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print $formother->selectyear($search_year, 'search_year', 1, 20, 5); print ''; } + // Thirdparty + if (!empty($arrayfields['p.fk_soc']['checked'])) { + print ''; + } + if (!empty($allprojectforuser)) { print ''; } @@ -1624,6 +1642,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (!empty($arrayfields['t.task_date']['checked'])) { print_liste_field_titre($arrayfields['t.task_date']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder); } + if (!empty($arrayfields['p.fk_soc']['checked'])) { + print_liste_field_titre($arrayfields['p.fk_soc']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder); + } if (!empty($allprojectforuser)) { print_liste_field_titre("Project", $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); } @@ -1697,6 +1718,23 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } } + // Thirdparty + if (!empty($arrayfields['p.fk_soc']['checked'])) { + print ''; + if (empty($conf->cache['thridparty'][$task_time->fk_soc])) { + $tmpsociete = new Societe($db); + $tmpsociete->fetch($task_time->fk_soc); + $conf->cache['thridparty'][$task_time->fk_soc] = $tmpsociete; + } else { + $tmpsociete = $conf->cache['thridparty'][$task_time->fk_soc]; + } + print $tmpsociete->getNomUrl(1); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Project ref if (!empty($allprojectforuser)) { print '';