|
@@ -1,13 +1,13 @@
|
|
|
<?php
|
|
|
-/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
- * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
- * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
|
|
|
- * Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
|
|
|
- * Copyright (C) 2015-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
|
|
- * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
|
|
- * Copyright (C) 2016 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
|
|
- * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
|
|
- * Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr>
|
|
|
+/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
+ * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
+ * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
|
|
|
+ * Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
|
|
|
+ * Copyright (C) 2015-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
|
|
+ * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
|
|
+ * Copyright (C) 2016 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
|
|
+ * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
|
|
+ * Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr>
|
|
|
*
|
|
|
* 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
|
|
@@ -164,7 +164,7 @@ if ($id == '' && $ref == '') {
|
|
|
exit();
|
|
|
}
|
|
|
|
|
|
-$mine = (!empty($_REQUEST['mode']) && $_REQUEST['mode'] == 'mine') ? 1 : 0;
|
|
|
+$mine = GETPOST('mode') == 'mine' ? 1 : 0;
|
|
|
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
|
|
|
|
|
|
$object = new Project($db);
|
|
@@ -366,19 +366,19 @@ $listofreferent = array(
|
|
|
'class'=>'Entrepot',
|
|
|
'table'=>'entrepot',
|
|
|
'datefieldname'=>'date_entrepot',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/product/stock/card.php?action=create&projectid='.$id,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/product/stock/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'entrepot',
|
|
|
'buttonnew'=>'AddWarehouse',
|
|
|
'project_field'=>'fk_project',
|
|
|
'testnew'=>$user->rights->stock->creer,
|
|
|
- 'test'=>$conf->stock->enabled && $user->rights->stock->lire),
|
|
|
+ 'test'=>$conf->stock->enabled && $user->rights->stock->lire && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT)),
|
|
|
'propal'=>array(
|
|
|
'name'=>"Proposals",
|
|
|
'title'=>"ListProposalsAssociatedProject",
|
|
|
'class'=>'Propal',
|
|
|
'table'=>'propal',
|
|
|
'datefieldname'=>'datep',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/comm/propal/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'propal',
|
|
|
'buttonnew'=>'AddProp',
|
|
|
'testnew'=>$user->rights->propal->creer,
|
|
@@ -389,7 +389,7 @@ $listofreferent = array(
|
|
|
'class'=>'Commande',
|
|
|
'table'=>'commande',
|
|
|
'datefieldname'=>'date_commande',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/commande/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'orders',
|
|
|
'buttonnew'=>'CreateOrder',
|
|
|
'testnew'=>$user->rights->commande->creer,
|
|
@@ -401,7 +401,7 @@ $listofreferent = array(
|
|
|
'margin'=>'add',
|
|
|
'table'=>'facture',
|
|
|
'datefieldname'=>'datef',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'bills',
|
|
|
'buttonnew'=>'CreateBill',
|
|
|
'testnew'=>$user->rights->facture->creer,
|
|
@@ -412,7 +412,7 @@ $listofreferent = array(
|
|
|
'class'=>'FactureRec',
|
|
|
'table'=>'facture_rec',
|
|
|
'datefieldname'=>'datec',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/compta/facture/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'bills',
|
|
|
'buttonnew'=>'CreateBill',
|
|
|
'testnew'=>$user->rights->facture->creer,
|
|
@@ -423,7 +423,7 @@ $listofreferent = array(
|
|
|
'class'=>'SupplierProposal',
|
|
|
'table'=>'supplier_proposal',
|
|
|
'datefieldname'=>'date_valid',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), // No socid parameter here, the socid is often the customer and we create a supplier object
|
|
|
'lang'=>'supplier_proposal',
|
|
|
'buttonnew'=>'AddSupplierProposal',
|
|
|
'testnew'=>$user->rights->supplier_proposal->creer,
|
|
@@ -434,7 +434,7 @@ $listofreferent = array(
|
|
|
'class'=>'CommandeFournisseur',
|
|
|
'table'=>'commande_fournisseur',
|
|
|
'datefieldname'=>'date_commande',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/fourn/commande/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), // No socid parameter here, the socid is often the customer and we create a supplier object
|
|
|
'lang'=>'suppliers',
|
|
|
'buttonnew'=>'AddSupplierOrder',
|
|
|
'testnew'=>($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer),
|
|
@@ -446,7 +446,7 @@ $listofreferent = array(
|
|
|
'margin'=>'minus',
|
|
|
'table'=>'facture_fourn',
|
|
|
'datefieldname'=>'datef',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id, // No socid parameter here, the socid is often the customer and we create a supplier object
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/fourn/facture/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), // No socid parameter here, the socid is often the customer and we create a supplier object
|
|
|
'lang'=>'suppliers',
|
|
|
'buttonnew'=>'AddSupplierInvoice',
|
|
|
'testnew'=>($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer),
|
|
@@ -457,7 +457,7 @@ $listofreferent = array(
|
|
|
'class'=>'Contrat',
|
|
|
'table'=>'contrat',
|
|
|
'datefieldname'=>'date_contrat',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/contrat/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/contrat/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'contracts',
|
|
|
'buttonnew'=>'AddContract',
|
|
|
'testnew'=>$user->rights->contrat->creer,
|
|
@@ -470,7 +470,7 @@ $listofreferent = array(
|
|
|
'datefieldname'=>'date_valid',
|
|
|
'disableamount'=>0,
|
|
|
'margin'=>'minus',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'interventions',
|
|
|
'buttonnew'=>'AddIntervention',
|
|
|
'testnew'=>$user->rights->ficheinter->creer,
|
|
@@ -481,7 +481,7 @@ $listofreferent = array(
|
|
|
'class'=>'Expedition',
|
|
|
'table'=>'expedition',
|
|
|
'datefieldname'=>'date_valid',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/expedition/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/expedition/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'sendings',
|
|
|
'buttonnew'=>'CreateShipment',
|
|
|
'testnew'=>0,
|
|
@@ -492,7 +492,7 @@ $listofreferent = array(
|
|
|
'class'=>'Mo',
|
|
|
'table'=>'mrp_mo',
|
|
|
'datefieldname'=>'date_valid',
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/mrp/mo_card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/mrp/mo_card.php?action=create&origin=project&originid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'mrp',
|
|
|
'buttonnew'=>'CreateMO',
|
|
|
'testnew'=>'$user->rights->mrp->write',
|
|
@@ -506,7 +506,7 @@ $listofreferent = array(
|
|
|
'datefieldname'=>'dated',
|
|
|
'margin'=>'minus',
|
|
|
'disableamount'=>1,
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/deplacement/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/deplacement/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'trips',
|
|
|
'buttonnew'=>'AddTrip',
|
|
|
'testnew'=>$user->rights->deplacement->creer,
|
|
@@ -519,7 +519,7 @@ $listofreferent = array(
|
|
|
'datefieldname'=>'date',
|
|
|
'margin'=>'minus',
|
|
|
'disableamount'=>0,
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/expensereport/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/expensereport/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'trips',
|
|
|
'buttonnew'=>'AddTrip',
|
|
|
'testnew'=>$user->rights->expensereport->creer,
|
|
@@ -532,7 +532,7 @@ $listofreferent = array(
|
|
|
'table'=>'don',
|
|
|
'datefieldname'=>'datedon',
|
|
|
'disableamount'=>0,
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/don/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/don/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'donations',
|
|
|
'buttonnew'=>'AddDonation',
|
|
|
'testnew'=>$user->rights->don->creer,
|
|
@@ -545,7 +545,7 @@ $listofreferent = array(
|
|
|
'table'=>'loan',
|
|
|
'datefieldname'=>'datestart',
|
|
|
'disableamount'=>0,
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/loan/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/loan/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'loan',
|
|
|
'buttonnew'=>'AddLoan',
|
|
|
'testnew'=>$user->rights->loan->write,
|
|
@@ -558,7 +558,7 @@ $listofreferent = array(
|
|
|
'table'=>'chargesociales',
|
|
|
'datefieldname'=>'date_ech',
|
|
|
'disableamount'=>0,
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/compta/sociales/card.php?action=create&projectid='.$id,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/compta/sociales/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'compta',
|
|
|
'buttonnew'=>'AddSocialContribution',
|
|
|
'testnew'=>$user->rights->tax->charges->lire,
|
|
@@ -571,7 +571,7 @@ $listofreferent = array(
|
|
|
'table'=>'projet_task',
|
|
|
'datefieldname'=>'task_date',
|
|
|
'disableamount'=>0,
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'buttonnew'=>'AddTimeSpent',
|
|
|
'testnew'=>$user->rights->projet->creer,
|
|
|
'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))),
|
|
@@ -588,13 +588,13 @@ $listofreferent = array(
|
|
|
'name'=>"Salaries",
|
|
|
'title'=>"ListSalariesAssociatedProject",
|
|
|
'class'=>'Salary',
|
|
|
- 'table'=>'payment_salary',
|
|
|
- 'datefieldname'=>'datev',
|
|
|
+ 'table'=>'salary',
|
|
|
+ 'datefieldname'=>'datesp',
|
|
|
'margin'=>'minus',
|
|
|
'disableamount'=>0,
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/salaries/card.php?action=create&projectid='.$id,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/salaries/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'salaries',
|
|
|
- 'buttonnew'=>'AddSalaryPayment',
|
|
|
+ 'buttonnew'=>'AddSalary',
|
|
|
'testnew'=>$user->rights->salaries->write,
|
|
|
'test'=>$conf->salaries->enabled && $user->rights->salaries->read),
|
|
|
'variouspayment'=>array(
|
|
@@ -605,7 +605,7 @@ $listofreferent = array(
|
|
|
'datefieldname'=>'datev',
|
|
|
'margin'=>'minus',
|
|
|
'disableamount'=>0,
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&projectid='.$id,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'banks',
|
|
|
'buttonnew'=>'AddVariousPayment',
|
|
|
'testnew'=>$user->rights->banque->modifier,
|
|
@@ -618,7 +618,7 @@ $listofreferent = array(
|
|
|
'table'=>'actioncomm',
|
|
|
'datefieldname'=>'datep',
|
|
|
'disableamount'=>1,
|
|
|
- 'urlnew'=>DOL_URL_ROOT.'/comm/action/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
|
|
+ 'urlnew'=>DOL_URL_ROOT.'/comm/action/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id),
|
|
|
'lang'=>'agenda',
|
|
|
'buttonnew'=>'AddEvent',
|
|
|
'testnew'=>$user->rights->agenda->myactions->create,
|
|
@@ -814,7 +814,7 @@ foreach ($listofreferent as $key => $value) {
|
|
|
}
|
|
|
|
|
|
// Define $total_ht_by_line
|
|
|
- if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') {
|
|
|
+ if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'salary') {
|
|
|
$total_ht_by_line = $element->amount;
|
|
|
} elseif ($tablename == 'fichinter') {
|
|
|
$total_ht_by_line = $element->getAmount();
|
|
@@ -856,7 +856,7 @@ foreach ($listofreferent as $key => $value) {
|
|
|
}
|
|
|
|
|
|
// Define $total_ttc_by_line
|
|
|
- if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') {
|
|
|
+ if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'salary') {
|
|
|
$total_ttc_by_line = $element->amount;
|
|
|
} elseif ($tablename == 'fichinter') {
|
|
|
$total_ttc_by_line = $element->getAmount();
|
|
@@ -1073,7 +1073,7 @@ foreach ($listofreferent as $key => $value) {
|
|
|
print ''; // if $key == 'project_task', we don't want details per user
|
|
|
} elseif (in_array($tablename, array('payment_various'))) {
|
|
|
print ''; // if $key == 'payment_various', we don't have any thirdparty
|
|
|
- } elseif (in_array($tablename, array('expensereport_det', 'don', 'projet_task', 'stock_mouvement', 'payment_salary'))) {
|
|
|
+ } elseif (in_array($tablename, array('expensereport_det', 'don', 'projet_task', 'stock_mouvement', 'salary'))) {
|
|
|
print $langs->trans("User");
|
|
|
} else {
|
|
|
print $langs->trans("ThirdParty");
|
|
@@ -1231,8 +1231,8 @@ foreach ($listofreferent as $key => $value) {
|
|
|
$date = $element->date; // No draft status on lines
|
|
|
} elseif ($tablename == 'stock_mouvement') {
|
|
|
$date = $element->datem;
|
|
|
- } elseif ($tablename == 'payment_salary') {
|
|
|
- $date = $element->datev;
|
|
|
+ } elseif ($tablename == 'salary') {
|
|
|
+ $date = $element->datesp;
|
|
|
} elseif ($tablename == 'payment_various') {
|
|
|
$date = $element->datev;
|
|
|
} elseif ($tablename == 'chargesociales') {
|
|
@@ -1290,7 +1290,7 @@ foreach ($listofreferent as $key => $value) {
|
|
|
$tmpuser = new User($db);
|
|
|
$tmpuser->fetch($expensereport->fk_user_author);
|
|
|
print $tmpuser->getNomUrl(1, '', 48);
|
|
|
- } elseif ($tablename == 'payment_salary') {
|
|
|
+ } elseif ($tablename == 'salary') {
|
|
|
$tmpuser = new User($db);
|
|
|
$tmpuser->fetch($element->fk_user);
|
|
|
print $tmpuser->getNomUrl(1, '', 48);
|
|
@@ -1318,7 +1318,7 @@ foreach ($listofreferent as $key => $value) {
|
|
|
if (empty($value['disableamount'])) {
|
|
|
$total_ht_by_line = null;
|
|
|
$othermessage = '';
|
|
|
- if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') {
|
|
|
+ if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'salary') {
|
|
|
$total_ht_by_line = $element->amount;
|
|
|
} elseif ($tablename == 'fichinter') {
|
|
|
$total_ht_by_line = $element->getAmount();
|
|
@@ -1372,7 +1372,7 @@ foreach ($listofreferent as $key => $value) {
|
|
|
// Amount inc tax
|
|
|
if (empty($value['disableamount'])) {
|
|
|
$total_ttc_by_line = null;
|
|
|
- if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') {
|
|
|
+ if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'salary') {
|
|
|
$total_ttc_by_line = $element->amount;
|
|
|
} elseif ($tablename == 'fichinter') {
|
|
|
$total_ttc_by_line = $element->getAmount();
|