From d3893b8b959ca979c8ec44f9d2a73f9893c91678 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Oct 2018 19:00:24 +0200 Subject: [PATCH 1/3] Debug v9 --- htdocs/core/class/html.formprojet.class.php | 5 +++- .../install/mysql/migration/8.0.0-9.0.0.sql | 3 ++ htdocs/install/mysql/tables/llx_paiement.sql | 2 +- .../mysql/tables/llx_payment_salary.sql | 3 +- .../mysql/tables/llx_payment_various.sql | 3 +- htdocs/langs/en_US/projects.lang | 28 +++++++++---------- htdocs/projet/element.php | 6 ++-- htdocs/projet/tasks/time.php | 8 +++++- 8 files changed, 37 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index b2166453bbd..bc62ebc7604 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -490,7 +490,7 @@ class FormProjets if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done) $linkedtothirdparty=false; - if (! in_array($table_element, array('don','expensereport_det','expensereport','loan','stock_mouvement','chargesociales'))) $linkedtothirdparty=true; + if (! in_array($table_element, array('don','expensereport_det','expensereport','loan','stock_mouvement','payment_salary','payment_various','chargesociales'))) $linkedtothirdparty=true; $sqlfilter=''; @@ -533,6 +533,9 @@ class FormProjets $sql = 'SELECT t.rowid, t.label as ref'; $projectkey='fk_origin'; break; + case "payment_salary": + $sql = "SELECT t.rowid, t.num_payment as ref"; // TODO In a future fill and use real ref field + break; case "payment_various": $sql = "SELECT t.rowid, t.num_payment as ref"; break; diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index f98c932943c..40660508ad6 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -72,8 +72,11 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203); +ALTER TABLE llx_payment_salary ADD COLUMN ref varchar(30) NULL; ALTER TABLE llx_payment_salary ADD COLUMN fk_projet integer DEFAULT NULL after amount; +ALTER TABLE llx_payment_various ADD COLUMN ref varchar(30) NULL; + ALTER TABLE llx_categorie ADD COLUMN ref_ext varchar(255); ALTER TABLE llx_paiement ADD COLUMN ext_payment_id varchar(128); diff --git a/htdocs/install/mysql/tables/llx_paiement.sql b/htdocs/install/mysql/tables/llx_paiement.sql index 6eb6b28f695..25c0097f10e 100644 --- a/htdocs/install/mysql/tables/llx_paiement.sql +++ b/htdocs/install/mysql/tables/llx_paiement.sql @@ -21,7 +21,7 @@ create table llx_paiement ( rowid integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(30) NOT NULL, -- payment reference number + ref varchar(30) NULL, -- payment reference number entity integer DEFAULT 1 NOT NULL, -- Multi company id datec datetime, -- date de creation tms timestamp, diff --git a/htdocs/install/mysql/tables/llx_payment_salary.sql b/htdocs/install/mysql/tables/llx_payment_salary.sql index 4fcbc233f33..c56e6459aa0 100644 --- a/htdocs/install/mysql/tables/llx_payment_salary.sql +++ b/htdocs/install/mysql/tables/llx_payment_salary.sql @@ -19,6 +19,7 @@ create table llx_payment_salary ( rowid integer AUTO_INCREMENT PRIMARY KEY, + ref varchar(30) NOT NULL, -- payment reference number tms timestamp, datec datetime, -- Create date fk_user integer NOT NULL, @@ -28,7 +29,7 @@ create table llx_payment_salary amount double(24,8) NOT NULL DEFAULT 0, fk_projet integer DEFAULT NULL, fk_typepayment integer NOT NULL, - num_payment varchar(50), -- ref + num_payment varchar(50), -- num cheque or other label varchar(255), datesp date, -- date start period dateep date, -- date end period diff --git a/htdocs/install/mysql/tables/llx_payment_various.sql b/htdocs/install/mysql/tables/llx_payment_various.sql index e719dae7d8c..d3351287e58 100644 --- a/htdocs/install/mysql/tables/llx_payment_various.sql +++ b/htdocs/install/mysql/tables/llx_payment_various.sql @@ -19,7 +19,8 @@ create table llx_payment_various ( rowid integer AUTO_INCREMENT PRIMARY KEY, - num_payment varchar(50), -- ref + ref varchar(30) NOT NULL, -- payment reference number + num_payment varchar(50), -- num cheque or other label varchar(255), tms timestamp, datec datetime, -- Create date diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index ec2061392a1..c83bccd19ad 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -79,20 +79,20 @@ GoToListOfTimeConsumed=Go to list of time consumed GoToListOfTasks=Go to list of tasks GoToGanttView=Go to Gantt view GanttView=Gantt View -ListProposalsAssociatedProject=List of the commercial proposals associated with the project -ListOrdersAssociatedProject=List of customer orders associated with the project -ListInvoicesAssociatedProject=List of customer invoices associated with the project -ListPredefinedInvoicesAssociatedProject=List of customer template invoices associated with project -ListSupplierOrdersAssociatedProject=List of supplier orders associated with the project -ListSupplierInvoicesAssociatedProject=List of supplier invoices associated with the project -ListContractAssociatedProject=List of contracts associated with the project -ListShippingAssociatedProject=List of shippings associated with the project -ListFichinterAssociatedProject=List of interventions associated with the project -ListExpenseReportsAssociatedProject=List of expense reports associated with the project -ListDonationsAssociatedProject=List of donations associated with the project -ListVariousPaymentsAssociatedProject=List of miscellaneous payments associated with the project -ListSalariesAssociatedProject=List of salaries associated with the project -ListActionsAssociatedProject=List of events associated with the project +ListProposalsAssociatedProject=List of the commercial proposals related to the project +ListOrdersAssociatedProject=List of customer orders related to the project +ListInvoicesAssociatedProject=List of customer invoices related to the project +ListPredefinedInvoicesAssociatedProject=List of customer template invoices related to the project +ListSupplierOrdersAssociatedProject=List of supplier orders related to the project +ListSupplierInvoicesAssociatedProject=List of supplier invoices related to the project +ListContractAssociatedProject=List of contracts related to the project +ListShippingAssociatedProject=List of shippings related to the project +ListFichinterAssociatedProject=List of interventions related to the project +ListExpenseReportsAssociatedProject=List of expense reports related to the project +ListDonationsAssociatedProject=List of donations related to the project +ListVariousPaymentsAssociatedProject=List of miscellaneous payments related to the project +ListSalariesAssociatedProject=List of payments of salaries related to the project +ListActionsAssociatedProject=List of events related to the project ListTaskTimeUserProject=List of time consumed on tasks of project ListTaskTimeForTask=List of time consumed on task ActivityOnProjectToday=Activity on project today diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 2c64826853c..e0ecf9d6051 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -451,7 +451,7 @@ $listofreferent=array( 'disableamount'=>0, 'urlnew'=>DOL_URL_ROOT.'/compta/salaries/card.php?action=create&projectid='.$id, 'lang'=>'salaries', - 'buttonnew'=>'AddSalariesPayment', + 'buttonnew'=>'AddSalaryPayment', 'testnew'=>$user->rights->salaries->write, 'test'=>$conf->salaries->enabled && $user->rights->salaries->read), 'variouspayment'=>array( @@ -872,7 +872,9 @@ foreach ($listofreferent as $key => $value) { if (empty($conf->global->PROJECT_DISABLE_UNLINK_FROM_OVERVIEW) || $user->admin) // PROJECT_DISABLE_UNLINK_FROM_OVERVIEW is empty by defaut, so this test true { - print '' . img_picto($langs->trans('Unlink'), 'editdelete') . ''; + print ''; + print img_picto($langs->trans('Unlink'), 'unlink'); + print ''; } } print "\n"; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index e432fcdf7fd..bcfc7bde557 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -399,6 +399,11 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print nl2br($projectstatic->description); print ''; + // Bill time ? + print ''.$langs->trans("BillTime").''; + print yn($projectstatic->bill_time); + print ''; + // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; @@ -1090,7 +1095,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); print ''; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalvaluefield']=$totalarray['nbfield']; + if (! $i) $totalarray['totalvaluebilledfield']=$totalarray['nbfield']; $totalarray['totalvaluebilled'] += $valuebilled; } @@ -1152,6 +1157,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } elseif ($totalarray['totaldurationfield'] == $i) print ''.convertSecondToTime($totalarray['totalduration'],'allhourmin').''; elseif ($totalarray['totalvaluefield'] == $i) print ''.price($totalarray['totalvalue']).''; + elseif ($totalarray['totalvaluebilledfield'] == $i) print ''.price($totalarray['totalvaluebilled']).''; else print ''; } print ''; From 622f31fd1e1cf9cc717b5bb8cb70e650adca9b6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Oct 2018 19:01:42 +0200 Subject: [PATCH 2/3] Fix ref --- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index 40660508ad6..a7efecbdc5f 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -72,10 +72,10 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203); -ALTER TABLE llx_payment_salary ADD COLUMN ref varchar(30) NULL; +ALTER TABLE llx_payment_salary ADD COLUMN ref varchar(30) NULL after rowid; ALTER TABLE llx_payment_salary ADD COLUMN fk_projet integer DEFAULT NULL after amount; -ALTER TABLE llx_payment_various ADD COLUMN ref varchar(30) NULL; +ALTER TABLE llx_payment_various ADD COLUMN ref varchar(30) NULL after rowid; ALTER TABLE llx_categorie ADD COLUMN ref_ext varchar(255); From 461bd76f7021e3a7995ced8846bcf382a3ca4eb9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Oct 2018 23:27:29 +0200 Subject: [PATCH 3/3] Fix customer and supplier code name Fix bill time flag must be visible only if option on --- htdocs/projet/contact.php | 8 ++++++++ htdocs/projet/element.php | 12 ++++++++++-- htdocs/projet/tasks.php | 15 ++++++++++++--- htdocs/projet/tasks/time.php | 13 ++++++++----- htdocs/societe/card.php | 32 ++++++++++++++++---------------- 5 files changed, 54 insertions(+), 26 deletions(-) diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 68c9b530c88..4b9aaf58b8b 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -240,6 +240,14 @@ if ($id > 0 || ! empty($ref)) print nl2br($object->description); print ''; + // Bill time + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ''.$langs->trans("BillTime").''; + print yn($object->bill_time); + print ''; + } + // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index e0ecf9d6051..7c44fb9850b 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -217,6 +217,14 @@ print ''.$langs->trans("Description").''; print nl2br($object->description); print ''; +// Bill time +if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) +{ + print ''.$langs->trans("BillTime").''; + print yn($object->bill_time); + print ''; +} + // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; @@ -686,8 +694,8 @@ foreach ($listofreferent as $key => $value) // and the final balance print ''; print ''.$langs->trans("Profit").''; -print ''.price($balance_ht).''; -print ''.price($balance_ttc).''; +print ''.price(price2num($balance_ht, 'MT')).''; +print ''.price(price2num($balance_ttc, 'MT')).''; print ''; print ""; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index d9fcc8b642a..47c88885bc4 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -91,13 +91,14 @@ $planned_workload=$planned_workloadhour*3600+$planned_workloadmin*60; $userAccess=0; -$parameters=array('id'=>$id); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); /* * Actions */ +$parameters=array('id'=>$id); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + // Purge search criteria if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { @@ -404,6 +405,14 @@ if ($id > 0 || ! empty($ref)) print nl2br($object->description); print ''; + // Bill time + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ''.$langs->trans("BillTime").''; + print yn($object->bill_time); + print ''; + } + // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index bcfc7bde557..7ff93c7b4da 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -399,13 +399,16 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print nl2br($projectstatic->description); print ''; - // Bill time ? - print ''.$langs->trans("BillTime").''; - print yn($projectstatic->bill_time); - print ''; + // Bill time + if (! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ''.$langs->trans("BillTime").''; + print yn($projectstatic->bill_time); + print ''; + } // Categories - if($conf->categorie->enabled) { + if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id,'project',1); print ""; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index e20e37e5cdc..5935a1d01a1 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -304,13 +304,13 @@ if (empty($reshook)) if (GETPOST('getcustomercode')) { // We defined value code_client - $_POST["code_client"]="Acompleter"; + $_POST["customer_code"]="Acompleter"; } if (GETPOST('getsuppliercode')) { // We defined value code_fournisseur - $_POST["code_fournisseur"]="Acompleter"; + $_POST["supplier_code"]="Acompleter"; } if($action=='set_localtax1') @@ -417,8 +417,8 @@ if (empty($reshook)) $object->idprof5 = trim(GETPOST('idprof5', 'alpha')); $object->idprof6 = trim(GETPOST('idprof6', 'alpha')); $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); - $object->code_client = GETPOST('code_client', 'alpha'); - $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); + $object->code_client = GETPOST('customer_code', 'alpha'); + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); $object->capital = GETPOST('capital', 'alpha'); $object->barcode = GETPOST('barcode', 'alpha'); @@ -947,14 +947,14 @@ else $object->client = GETPOST('client')?GETPOST('client'):$object->client; if(empty($duplicate_code_error)) { - $object->code_client = GETPOST('code_client', 'alpha'); + $object->code_client = GETPOST('customer_code', 'alpha'); $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; } else { setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'),'', 'warnings'); } - $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); $object->town = GETPOST('town', 'alpha'); @@ -1190,7 +1190,7 @@ else print '
'; $tmpcode=$object->code_client; if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); - print ''; + print ''; print ''; $s=$modCodeClient->getToolTip($langs,$object,0); print $form->textwithpicto('',$s,1); @@ -1218,7 +1218,7 @@ else print '
'; $tmpcode=$object->code_fournisseur; if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object,1); - print ''; + print ''; print ''; $s=$modCodeFournisseur->getToolTip($langs,$object,1); print $form->textwithpicto('',$s,1); @@ -1570,9 +1570,9 @@ else $object->name = GETPOST('name', 'alpha'); $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); $object->client = GETPOST('client', 'int'); - $object->code_client = GETPOST('code_client', 'alpha'); + $object->code_client = GETPOST('customer_code', 'alpha'); $object->fournisseur = GETPOST('fournisseur', 'int'); - $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); $object->town = GETPOST('town', 'alpha'); @@ -1776,16 +1776,16 @@ else $tmpcode=$object->code_client; if (empty($tmpcode) && ! empty($object->oldcopy->code_client)) $tmpcode=$object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); - print ''; + print ''; } else if ($object->codeclient_modifiable()) { - print ''; + print ''; } else { print $object->code_client; - print ''; + print ''; } print ''; $s=$modCodeClient->getToolTip($langs,$object,0); @@ -1816,16 +1816,16 @@ else $tmpcode=$object->code_fournisseur; if (empty($tmpcode) && ! empty($object->oldcopy->code_fournisseur)) $tmpcode=$object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object,1); - print ''; + print ''; } else if ($object->codefournisseur_modifiable()) { - print ''; + print ''; } else { print $object->code_fournisseur; - print ''; + print ''; } print ''; $s=$modCodeFournisseur->getToolTip($langs,$object,1);