diff --git a/ChangeLog b/ChangeLog
index dd2fc646f7f..798f3ef91f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -403,6 +403,115 @@ So if you included it into your module, change your code like this to be compati
if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
+
+***** ChangeLog for 3.9.4 compared to 3.9.3 *****
+FIX: #2853
+FIX: #3128
+FIX: #4447
+FIX: #5128 if create method return duplicated code error not use GETPOST in order to get a new code
+FIX: #5340
+FIX: #5473
+FIX: #5474 Country_id of "Don" object is still empty
+FIX: #5534
+FIX: #5535 bad dependency.
+FIX: #5537 AJAX project search does not work properly
+FIX: #5540 getFormMail is not registered as addReplace hook
+FIX: #5544 Disabled Contact still appear in lists to send emails
+FIX: #5549 getNomUrl tooltips show Order info even if user has no rights to read them
+FIX: #5568
+FIX: #5594
+FIX: #5629 PgSQL Interger string stylish error
+FIX: #5651
+FIX: #5660
+FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
+FIX: #5907
+FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them
+FIX: #6051
+FIX: #6088
+FIX: Can correct stock of lot using eatby or sell by date
+FIX: Can make a movement on "out of sell" products
+FIX: cannot update bank account on invoice if module order not activated
+FIX: Can't create withdrawal document
+FIX: delete contract extrafields on contract deletion
+FIX: Direction of movement lost if an error occurs
+FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object
+FIX: export extrafields must not include separe type
+FIX: External user must not be able to edit its discounts
+FIX: Failed to export contact categories with contact extra fields
+FIX: header title in commercial area
+FIX: HT and TTC price should always be displayed together
+FIX: incoterms
+FIX: incoterms do not output into crabe invoice PDF
+FIX: in PgSQL no quote "word style" is permitted around column name
+FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email.
+FIX: margin tab on customer card must filter on current entity invoices
+FIX: missing column into SQL on thridparty list
+FIX: only show projects of related third if external user
+FIX: PgSQL Module Ressource list crash #5637
+FIX: php Strict
+FIX: Regression when deleting product
+FIX: Security to restrict email sending was not efficient
+FIX: tag for date rfc in odt substitution
+FIX: Update intervention lline crash with PgSQL
+FIX: update limit stock on product stock
+FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15)
+FIX: wrong test on dict.php
+
+
+***** ChangeLog for 3.9.4 compared to 3.9.3 *****
+FIX: #2853
+FIX: #3128
+FIX: #4447
+FIX: #5128 if create method return duplicated code error not use GETPOST in order to get a new code
+FIX: #5340
+FIX: #5473
+FIX: #5474 Country_id of "Don" object is still empty
+FIX: #5534
+FIX: #5535 bad dependency.
+FIX: #5537 AJAX project search does not work properly
+FIX: #5540 getFormMail is not registered as addReplace hook
+FIX: #5544 Disabled Contact still appear in lists to send emails
+FIX: #5549 getNomUrl tooltips show Order info even if user has no rights to read them
+FIX: #5568
+FIX: #5594
+FIX: #5629 PgSQL Interger string stylish error
+FIX: #5651
+FIX: #5660
+FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
+FIX: #5907
+FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them
+FIX: #6051
+FIX: #6088
+FIX: Can correct stock of lot using eatby or sell by date
+FIX: Can make a movement on "out of sell" products
+FIX: cannot update bank account on invoice if module order not activated
+FIX: Can't create withdrawal document
+FIX: delete contract extrafields on contract deletion
+FIX: Direction of movement lost if an error occurs
+FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object
+FIX: export extrafields must not include separe type
+FIX: External user must not be able to edit its discounts
+FIX: Failed to export contact categories with contact extra fields
+FIX: header title in commercial area
+FIX: HT and TTC price should always be displayed together
+FIX: incoterms
+FIX: incoterms do not output into crabe invoice PDF
+FIX: in PgSQL no quote "word style" is permitted around column name
+FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email.
+FIX: margin tab on customer card must filter on current entity invoices
+FIX: missing column into SQL on thridparty list
+FIX: only show projects of related third if external user
+FIX: PgSQL Module Ressource list crash #5637
+FIX: php Strict
+FIX: Regression when deleting product
+FIX: Security to restrict email sending was not efficient
+FIX: tag for date rfc in odt substitution
+FIX: Update intervention lline crash with PgSQL
+FIX: update limit stock on product stock
+FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15)
+FIX: wrong test on dict.php
+
+
***** ChangeLog for 3.9.3 compared to 3.9.2 *****
FIX: #4383 $userid not defined
FIX: #4448 $filebonprev is not used, $this->filename now
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 9ca79421f20..6e304a019d0 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -1061,7 +1061,8 @@ if ($resql)
$text_info='';
$text_warning='';
$nbprod=0;
-
+
+ // Ref
if (! empty($arrayfields['c.ref']['checked']))
{
print '
';
@@ -1186,12 +1187,12 @@ if ($resql)
print ' | ';
}
- // Warning late icon
+ // Warning late icon and note
print '';
if ($generic_commande->hasDelay()) {
print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning");
}
- if(!empty($obj->note_private))
+ if (!empty($obj->note_private) || !empty($obj->note_public))
{
print ' ';
print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'';
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index eb8a7f4cfa4..91267578197 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1345,8 +1345,16 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error ++;
}
+ if (! GETPOST('prod_entry_mode'))
+ {
+ if (GETPOST('type') < 0 && ! GETPOST('search_idprod'))
+ {
+ setEventMessages($langs->trans('ErrorChooseBetweenFreeAntryOrPredefinedProduct'), null, 'errors');
+ $error ++;
+ }
+ }
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
- setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
+ setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''
diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php
index 3f952ef15c6..aec371ac0b3 100644
--- a/htdocs/compta/recap-compta.php
+++ b/htdocs/compta/recap-compta.php
@@ -30,14 +30,14 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
$langs->load("companies");
if (! empty($conf->facture->enabled)) $langs->load("bills");
-// Security check
-$socid = GETPOST("socid",'int');
-if ($user->societe_id > 0)
-{
- $action = '';
- $socid = $user->societe_id;
-}
+$id = GETPOST('id')?GETPOST('id','int'):GETPOST('socid','int');
+// Security check
+if ($user->societe_id) $id=$user->societe_id;
+$result = restrictedArea($user, 'societe', $id, '&societe');
+
+$object = new Societe($db);
+if ($id > 0) $object->fetch($id);
/*
@@ -47,20 +47,21 @@ if ($user->societe_id > 0)
$form = new Form($db);
$userstatic=new User($db);
-llxHeader();
+$title=$langs->trans("ThirdParty").' - '.$langs->trans("Summary");
+if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Symmary");
+$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
-if ($socid > 0)
+llxHeader('',$title,$help_url);
+
+if ($id > 0)
{
- $societe = new Societe($db);
- $societe->fetch($socid);
-
/*
* Affichage onglets
*/
- $head = societe_prepare_head($societe);
+ $head = societe_prepare_head($object);
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company');
- dol_banner_tab($societe, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
+ dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 1);
dol_fiche_end();
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
@@ -86,7 +87,7 @@ if ($socid > 0)
$sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
$sql.= " u.login, u.rowid as userid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";
- $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
+ $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND f.fk_user_valid = u.rowid";
$sql.= " ORDER BY f.datef ASC";
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index ccec6af47d0..f5f8ec5456d 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -965,7 +965,7 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac
* @return mixed Return html part or void if noprint is 1
* TODO change function to be able to list event linked to an object.
*/
-function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC')
+function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep,a.id', $sortorder='DESC')
{
global $bc,$user,$conf;
global $form;
@@ -1183,7 +1183,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
}
$out.=getTitleFieldOfList($langs->trans("Ref"), 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder);
$out.=' | '.$langs->trans("Label").' | ';
- $out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep, a.id', '', $param, '', $sortfield, $sortorder);
+ $out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, '', $sortfield, $sortorder);
$out.=''.$langs->trans("Type").' | ';
$out.=' | ';
$out.=' | ';
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index b1c674ef5ca..a3ff1af0726 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -110,8 +110,8 @@ class pdf_einstein extends ModelePDFCommandes
{
$this->posxtva=99;
$this->posxup=114;
- $this->posxqty=133;
- $this->posxunit=150;
+ $this->posxqty=130;
+ $this->posxunit=147;
}
else
{
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index cd864e0d766..6b9b2bf5dd0 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -119,8 +119,8 @@ class pdf_crabe extends ModelePDFFactures
{
$this->posxtva=99;
$this->posxup=114;
- $this->posxqty=133;
- $this->posxunit=150;
+ $this->posxqty=130;
+ $this->posxunit=147;
}
else
{
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index c5b546bd72f..fc2e7a0e5d6 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -108,8 +108,8 @@ class pdf_azur extends ModelePDFPropales
{
$this->posxtva=99;
$this->posxup=114;
- $this->posxqty=133;
- $this->posxunit=150;
+ $this->posxqty=130;
+ $this->posxunit=147;
}
else
{
diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
index 01d5da92d50..dd29a839a48 100644
--- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
+++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php
@@ -102,8 +102,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if($conf->global->PRODUCT_USE_UNITS) {
$this->posxtva=99;
$this->posxup=114;
- $this->posxqty=133;
- $this->posxunit=150;
+ $this->posxqty=130;
+ $this->posxunit=147;
}
//if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
index 9a5132a8bea..d6d904ecb35 100644
--- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
+++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php
@@ -111,8 +111,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
{
$this->posxtva=99;
$this->posxup=114;
- $this->posxqty=133;
- $this->posxunit=150;
+ $this->posxqty=130;
+ $this->posxunit=147;
} else {
$this->posxtva=112;
$this->posxup=126;
diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php
index ce682273b6e..00b6343bf97 100644
--- a/htdocs/expensereport/list.php
+++ b/htdocs/expensereport/list.php
@@ -183,7 +183,7 @@ $min_year = 5;
$sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
-$sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve,";
+$sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve, d.note_private, d.note_public,";
$sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.statut, u.photo";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
@@ -524,17 +524,40 @@ if ($resql)
$expensereportstatic->date_modif=$db->jdate($obj->date_modif);
$expensereportstatic->date_valid=$db->jdate($obj->date_valid);
$expensereportstatic->date_approve=$db->jdate($obj->date_approve);
+ $expensereportstatic->note_private=$obj->note_private;
+ $expensereportstatic->note_public=$obj->note_public;
$var=!$var;
print "";
+ // Ref
if (! empty($arrayfields['d.ref']['checked'])) {
print '';
+ print '';
+ print '| ';
print $expensereportstatic->getNomUrl(1);
+ print ' | ';
+ // Warning late icon and note
+ print '';
if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) print img_warning($langs->trans("Late"));
if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) print img_warning($langs->trans("Late"));
+ if (!empty($obj->note_private) || !empty($obj->note_public))
+ {
+ print ' ';
+ print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'';
+ print '';
+ }
+ print ' | ';
+ print '';
+ $filename=dol_sanitizeFileName($obj->ref);
+ $filedir=$conf->expensereport->dir_output . '/' . dol_sanitizeFileName($obj->ref);
+ $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
+ print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir);
+ print ' | ';
+ print ' ';
print ' | ';
if (! $i) $totalarray['nbfield']++;
}
+ // User
if (! empty($arrayfields['user']['checked'])) {
print '';
$usertmp->id=$obj->id_user;
@@ -547,18 +570,22 @@ if ($resql)
print ' | ';
if (! $i) $totalarray['nbfield']++;
}
+ // Start date
if (! empty($arrayfields['d.date_debut']['checked'])) {
print ''.($obj->date_debut > 0 ? dol_print_date($obj->date_debut, 'day') : '').' | ';
if (! $i) $totalarray['nbfield']++;
}
+ // End date
if (! empty($arrayfields['d.date_fin']['checked'])) {
print ''.($obj->date_fin > 0 ? dol_print_date($obj->date_fin, 'day') : '').' | ';
if (! $i) $totalarray['nbfield']++;
}
+ // Date validation
if (! empty($arrayfields['d.date_valid']['checked'])) {
print ''.($obj->date_valid > 0 ? dol_print_date($obj->date_valid, 'day') : '').' | ';
if (! $i) $totalarray['nbfield']++;
}
+ // Date approval
if (! empty($arrayfields['d.date_approve']['checked'])) {
print ''.($obj->date_approve > 0 ? dol_print_date($obj->date_approve, 'day') : '').' | ';
if (! $i) $totalarray['nbfield']++;
diff --git a/htdocs/install/mysql/tables/llx_c_typent.sql b/htdocs/install/mysql/tables/llx_c_typent.sql
index d492c41ff13..ae89faf5c74 100644
--- a/htdocs/install/mysql/tables/llx_c_typent.sql
+++ b/htdocs/install/mysql/tables/llx_c_typent.sql
@@ -21,7 +21,7 @@ create table llx_c_typent
(
id integer PRIMARY KEY,
code varchar(12) NOT NULL,
- libelle varchar(30),
+ libelle varchar(48),
fk_country integer NULL, -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B)
active tinyint DEFAULT 1 NOT NULL,
module varchar(32) NULL,
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index e872c1710cc..90f3ea5e15b 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -170,11 +170,11 @@ ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship
ErrorFileMustHaveFormat=File must have format %s
ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first.
ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled.
-ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to add it into a new order.
-ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice.
-ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment.
-ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal.
-ErrorFailedToLoadLoginFileForMode=Failed to get the login file for mode '%s'.
+ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enough for product %s to add it into a new order.
+ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enough for product %s to add it into a new invoice.
+ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enough for product %s to add it into a new shipment.
+ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enough for product %s to add it into a new proposal.
+ErrorFailedToLoadLoginFileForMode=Failed to get the login key for mode '%s'.
ErrorModuleNotFound=File of module was not found.
ErrorFieldAccountNotDefinedForBankLine=Value for Accounting account not defined for source bank line %s
ErrorBankStatementNameMustFollowRegex=Error, bank statement name must follow the following syntax rule %s
diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang
index 9e0f3a987fb..0c894cc7b19 100644
--- a/htdocs/langs/en_US/mails.lang
+++ b/htdocs/langs/en_US/mails.lang
@@ -35,7 +35,7 @@ MailingStatusSentPartialy=Sent partialy
MailingStatusSentCompletely=Sent completely
MailingStatusError=Error
MailingStatusNotSent=Not sent
-MailSuccessfulySent=Email successfully sent (from %s to %s)
+MailSuccessfulySent=Email successfully accepted for delivery (from %s to %s)
MailingSuccessfullyValidated=EMailing successfully validated
MailUnsubcribe=Unsubscribe
MailingStatusNotContact=Don't contact anymore
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index ecf61d17d36..392e20697aa 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -58,6 +58,7 @@ TaskDateEnd=Task end date
TaskDescription=Task description
NewTask=New task
AddTask=Create task
+AddTimeSpent=Create time spent
Activity=Activity
Activities=Tasks/activities
MyActivities=My tasks/activities
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 7a88fc3112c..460e698e432 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1498,7 +1498,7 @@ class Project extends CommonObject
{
$sql="UPDATE ".MAIN_DB_PREFIX.$tableName;
- if ($TableName=="actioncomm")
+ if ($tableName == "actioncomm")
{
$sql.= " SET fk_project=".$this->id;
$sql.= " WHERE id=".$elementSelectId;
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 15e3b154b20..ec180704563 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -1039,12 +1039,12 @@ class Task extends CommonObject
}
/**
- * Calculate value of time consumed using the thm (hourly amount value of work for user entering time)
+ * Calculate quantity and value of time consumed using the thm (hourly amount value of work for user entering time)
*
* @param User $fuser Filter on a dedicated user
* @param string $dates Start date (ex 00:00:00)
* @param string $datee End date (ex 23:59:59)
- * @return array Array of info for task array('amount')
+ * @return array Array of info for task array('amount','nbseconds','nblinesnull')
*/
function getSumOfAmount($fuser='', $dates='', $datee='')
{
@@ -1055,6 +1055,7 @@ class Task extends CommonObject
$result=array();
$sql = "SELECT";
+ $sql.= " SUM(t.task_duration) as nbseconds,";
$sql.= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as amount, SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull";
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
$sql.= " WHERE t.fk_task = ".$id;
@@ -1081,6 +1082,7 @@ class Task extends CommonObject
$obj = $this->db->fetch_object($resql);
$result['amount'] = $obj->amount;
+ $result['nbseconds'] = $obj->nbseconds;
$result['nblinesnull'] = $obj->nblinesnull;
$this->db->free($resql);
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 710807dcdec..231765cd7c6 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -370,6 +370,19 @@ $listofreferent=array(
'buttonnew'=>'AddDonation',
'testnew'=>$user->rights->don->creer,
'test'=>$conf->don->enabled && $user->rights->don->lire),
+'project_task'=>array(
+ 'name'=>"TaskTimeValorised",
+ 'title'=>"ListTaskTimeUserProject",
+ 'class'=>'Task',
+ 'margin'=>'minus',
+ 'table'=>'projet_task',
+ 'datefieldname'=>'task_date',
+ 'disableamount'=>0,
+ 'urlnew'=>DOL_URL_ROOT.'/projet/tasks.php?id='.$id,
+ 'buttonnew'=>'AddTimeSpent',
+ 'testnew'=>$user->rights->projet->creer,
+ 'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))),
+/* No need for this, available on dedicated tab "Agenda/Events"
'agenda'=>array(
'name'=>"Agenda",
'title'=>"ListActionsAssociatedProject",
@@ -382,15 +395,7 @@ $listofreferent=array(
'buttonnew'=>'AddEvent',
'testnew'=>$user->rights->agenda->myactions->create,
'test'=>$conf->agenda->enabled && $user->rights->agenda->myactions->read),
-'project_task'=>array(
- 'name'=>"TaskTimeValorised",
- 'title'=>"ListTaskTimeUserProject",
- 'class'=>'Task',
- 'margin'=>'minus',
- 'table'=>'projet_task',
- 'datefieldname'=>'task_date',
- 'disableamount'=>0,
- 'test'=>$conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS)),
+*/
);
$parameters=array('listofreferent'=>$listofreferent);
@@ -691,6 +696,7 @@ foreach ($listofreferent as $key => $value)
print ''.$langs->trans("Ref").' | ';
// Date
print '';
+ if (in_array($tablename, array('projet_task'))) print $langs->trans("TimeSpent");
if (! in_array($tablename, array('projet_task'))) print $langs->trans("Date");
print ' | ';
// Thirdparty or user
@@ -784,9 +790,9 @@ foreach ($listofreferent as $key => $value)
print 'id . '">' . img_picto($langs->trans('Unlink'), 'editdelete') . '';
}
print "\n";
+
// Ref
print '';
-
if ($tablename == 'expensereport_det')
{
print $expensereport->getNomUrl(1);
@@ -822,11 +828,10 @@ foreach ($listofreferent as $key => $value)
// Show customer ref
if (! empty($element->ref_customer)) print ' - '.$element->ref_customer;
}
-
print " | \n";
- // Date
- $date='';
+ // Date or TimeSpent
+ $date=''; $total_time_by_line = null;
if ($tablename == 'expensereport_det') $date = $element->date; // No draft status on lines
elseif (! empty($element->status) || ! empty($element->statut) || ! empty($element->fk_status))
{
@@ -851,6 +856,12 @@ foreach ($listofreferent as $key => $value)
print dol_print_date($element->datep,'dayhour');
if ($element->datef && $element->datef > $element->datep) print " - ".dol_print_date($element->datef,'dayhour');
}
+ else if (in_array($tablename, array('projet_task')))
+ {
+ $tmpprojtime = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty
+ print convertSecondToTime($tmpprojtime['nbseconds'], 'allhourmin');
+ $total_time_by_line = $tmpprojtime['nbseconds'];
+ }
else print dol_print_date($date,'day');
print '';
@@ -885,14 +896,13 @@ foreach ($listofreferent as $key => $value)
$total_ht_by_line=null;
$othermessage='';
if ($tablename == 'don') $total_ht_by_line=$element->amount;
- elseif ($tablename == 'projet_task')
+ elseif (in_array($tablename, array('projet_task')))
{
if (! empty($conf->salaries->enabled))
{
- // TODO Permission to read daily rate
- $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)
+ // TODO Permission to read daily rate to show value
+ $total_ht_by_line = price2num($tmpprojtime['amount'],'MT');
+ if ($tmpprojtime['nblinesnull'] > 0)
{
$langs->load("errors");
$warning=$langs->trans("WarningSomeLinesWithNullHourlyRate", $conf->currency);
@@ -988,6 +998,8 @@ foreach ($listofreferent as $key => $value)
$total_ht_by_third += $total_ht_by_line;
$total_ttc_by_third += $total_ttc_by_line;
+
+ $total_time = $total_time + $total_time_by_line;
}
if (canApplySubtotalOn($tablename))
@@ -1013,7 +1025,17 @@ foreach ($listofreferent as $key => $value)
if ($breakline) print $breakline;
// Total
- print '
| '.$langs->trans("Number").': '.$i.' | ';
+ $colspan=4;
+ if (in_array($tablename, array('projet_task'))) $colspan=2;
+ print '
| '.$langs->trans("Number").': '.$i.' | ';
+ if (in_array($tablename, array('projet_task')))
+ {
+ print '';
+ print convertSecondToTime($total_time, 'allhourmin');
+ print ' | ';
+ print '';
+ print ' | ';
+ }
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''.$langs->trans("TotalHT").' : '.price($total_ht).' | ';
//elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''.$langs->trans("Total").' : '.price($total_ht).' | ';
print '';
diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php
index 0c37f999259..e3c151df7a6 100644
--- a/htdocs/projet/info.php
+++ b/htdocs/projet/info.php
@@ -35,6 +35,18 @@ $ref = GETPOST('ref','alpha');
$socid = GETPOST('socid','int');
$action = GETPOST('action','alpha');
+$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
+$sortfield = GETPOST("sortfield","alpha");
+$sortorder = GETPOST("sortorder");
+$page = GETPOST("page");
+$page = is_numeric($page) ? $page : 0;
+$page = $page == -1 ? 0 : $page;
+if (! $sortfield) $sortfield="a.datep,a.id";
+if (! $sortorder) $sortorder="DESC";
+$offset = $limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
if (GETPOST('actioncode','array'))
{
$actioncode=GETPOST('actioncode','array',3);
@@ -181,7 +193,7 @@ if (!empty($object->id))
// List of all actions
$filters=array();
$filters['search_agenda_label']=$search_agenda_label;
- show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters);
+ show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
}
|