Fix #19257 error in the page Overview of a project

This commit is contained in:
Laurent Destailleur 2021-10-31 15:14:15 +01:00
parent 8064ecce73
commit e6e440e573
6 changed files with 100 additions and 32 deletions

View File

@ -683,6 +683,8 @@ if ($conf->use_javascript_ajax) {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("SOCIETE_ASK_FOR_WAREHOUSE", $arrval, $conf->global->SOCIETE_ASK_FOR_WAREHOUSE); print $form->selectarray("SOCIETE_ASK_FOR_WAREHOUSE", $arrval, $conf->global->SOCIETE_ASK_FOR_WAREHOUSE);
} }
print "</td>";
print "</tr>\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringPropal").'</td>'; print '<td>'.$langs->trans("WarehouseAskWarehouseDuringPropal").'</td>';
@ -693,6 +695,9 @@ if ($conf->use_javascript_ajax) {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL); print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL);
} }
print "</td>";
print "</tr>\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringOrder").'</td>'; print '<td>'.$langs->trans("WarehouseAskWarehouseDuringOrder").'</td>';
print '<td class="right">'; print '<td class="right">';
@ -702,10 +707,23 @@ if ($conf->use_javascript_ajax) {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER); print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER);
} }
print "</td>";
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
/*
print '<tr class="oddeven">';
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringProject").'</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT);
}
print '</td>';
print "</tr>\n";
*/
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")); print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc"));

View File

@ -505,7 +505,17 @@ class FormProjets
} }
$linkedtothirdparty = false; $linkedtothirdparty = false;
if (!in_array($table_element, array('don', 'expensereport_det', 'expensereport', 'loan', 'stock_mouvement', 'payment_salary', 'payment_various', 'chargesociales', 'entrepot'))) { if (!in_array($table_element, array(
'don',
'expensereport_det',
'expensereport', 'loan',
'stock_mouvement',
'payment_salary',
'payment_various',
'salary',
'chargesociales',
'entrepot')
)) {
$linkedtothirdparty = true; $linkedtothirdparty = true;
} }

View File

@ -6,6 +6,7 @@ CREATE_NEW_SALARY_WITHOUT_AUTO_PAYMENT=By default, leave empty the option "Autom
Salary=Salary Salary=Salary
Salaries=Salaries Salaries=Salaries
NewSalary=New salary NewSalary=New salary
AddSalary=Add salary
NewSalaryPayment=New salary card NewSalaryPayment=New salary card
AddSalaryPayment=Add salary payment AddSalaryPayment=Add salary payment
SalaryPayment=Salary payment SalaryPayment=Salary payment

View File

@ -63,6 +63,7 @@ RuleForWarehouse=Rule for warehouses
WarehouseAskWarehouseOnThirparty=Set a warehouse on Third-parties WarehouseAskWarehouseOnThirparty=Set a warehouse on Third-parties
WarehouseAskWarehouseDuringPropal=Set a warehouse on Commercial proposals WarehouseAskWarehouseDuringPropal=Set a warehouse on Commercial proposals
WarehouseAskWarehouseDuringOrder=Set a warehouse on Sale orders WarehouseAskWarehouseDuringOrder=Set a warehouse on Sale orders
WarehouseAskWarehouseDuringProject=Set a warehouse on Projects
UserDefaultWarehouse=Set a warehouse on Users UserDefaultWarehouse=Set a warehouse on Users
MainDefaultWarehouse=Default warehouse MainDefaultWarehouse=Default warehouse
MainDefaultWarehouseUser=Use a default warehouse for each user MainDefaultWarehouseUser=Use a default warehouse for each user

View File

@ -164,7 +164,7 @@ if ($id == '' && $ref == '') {
exit(); exit();
} }
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0; $mine = GETPOST('mode') == 'mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db); $object = new Project($db);
@ -368,19 +368,19 @@ $listofreferent = array(
'class'=>'Entrepot', 'class'=>'Entrepot',
'table'=>'entrepot', 'table'=>'entrepot',
'datefieldname'=>'date_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', 'lang'=>'entrepot',
'buttonnew'=>'AddWarehouse', 'buttonnew'=>'AddWarehouse',
'project_field'=>'fk_project', 'project_field'=>'fk_project',
'testnew'=>$user->rights->stock->creer, '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( 'propal'=>array(
'name'=>"Proposals", 'name'=>"Proposals",
'title'=>"ListProposalsAssociatedProject", 'title'=>"ListProposalsAssociatedProject",
'class'=>'Propal', 'class'=>'Propal',
'table'=>'propal', 'table'=>'propal',
'datefieldname'=>'datep', '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', 'lang'=>'propal',
'buttonnew'=>'AddProp', 'buttonnew'=>'AddProp',
'testnew'=>$user->rights->propal->creer, 'testnew'=>$user->rights->propal->creer,
@ -391,7 +391,7 @@ $listofreferent = array(
'class'=>'Commande', 'class'=>'Commande',
'table'=>'commande', 'table'=>'commande',
'datefieldname'=>'date_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', 'lang'=>'orders',
'buttonnew'=>'CreateOrder', 'buttonnew'=>'CreateOrder',
'testnew'=>$user->rights->commande->creer, 'testnew'=>$user->rights->commande->creer,
@ -403,7 +403,7 @@ $listofreferent = array(
'margin'=>'add', 'margin'=>'add',
'table'=>'facture', 'table'=>'facture',
'datefieldname'=>'datef', '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', 'lang'=>'bills',
'buttonnew'=>'CreateBill', 'buttonnew'=>'CreateBill',
'testnew'=>$user->rights->facture->creer, 'testnew'=>$user->rights->facture->creer,
@ -414,7 +414,7 @@ $listofreferent = array(
'class'=>'FactureRec', 'class'=>'FactureRec',
'table'=>'facture_rec', 'table'=>'facture_rec',
'datefieldname'=>'datec', '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', 'lang'=>'bills',
'buttonnew'=>'CreateBill', 'buttonnew'=>'CreateBill',
'testnew'=>$user->rights->facture->creer, 'testnew'=>$user->rights->facture->creer,
@ -425,7 +425,7 @@ $listofreferent = array(
'class'=>'SupplierProposal', 'class'=>'SupplierProposal',
'table'=>'supplier_proposal', 'table'=>'supplier_proposal',
'datefieldname'=>'date_valid', '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', 'lang'=>'supplier_proposal',
'buttonnew'=>'AddSupplierProposal', 'buttonnew'=>'AddSupplierProposal',
'testnew'=>$user->rights->supplier_proposal->creer, 'testnew'=>$user->rights->supplier_proposal->creer,
@ -436,7 +436,7 @@ $listofreferent = array(
'class'=>'CommandeFournisseur', 'class'=>'CommandeFournisseur',
'table'=>'commande_fournisseur', 'table'=>'commande_fournisseur',
'datefieldname'=>'date_commande', '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', 'lang'=>'suppliers',
'buttonnew'=>'AddSupplierOrder', 'buttonnew'=>'AddSupplierOrder',
'testnew'=>($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer), 'testnew'=>($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer),
@ -448,7 +448,7 @@ $listofreferent = array(
'margin'=>'minus', 'margin'=>'minus',
'table'=>'facture_fourn', 'table'=>'facture_fourn',
'datefieldname'=>'datef', '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', 'lang'=>'suppliers',
'buttonnew'=>'AddSupplierInvoice', 'buttonnew'=>'AddSupplierInvoice',
'testnew'=>($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), 'testnew'=>($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer),
@ -459,7 +459,7 @@ $listofreferent = array(
'class'=>'Contrat', 'class'=>'Contrat',
'table'=>'contrat', 'table'=>'contrat',
'datefieldname'=>'date_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', 'lang'=>'contracts',
'buttonnew'=>'AddContract', 'buttonnew'=>'AddContract',
'testnew'=>$user->rights->contrat->creer, 'testnew'=>$user->rights->contrat->creer,
@ -472,7 +472,7 @@ $listofreferent = array(
'datefieldname'=>'date_valid', 'datefieldname'=>'date_valid',
'disableamount'=>0, 'disableamount'=>0,
'margin'=>'minus', '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', 'lang'=>'interventions',
'buttonnew'=>'AddIntervention', 'buttonnew'=>'AddIntervention',
'testnew'=>$user->rights->ficheinter->creer, 'testnew'=>$user->rights->ficheinter->creer,
@ -483,7 +483,7 @@ $listofreferent = array(
'class'=>'Expedition', 'class'=>'Expedition',
'table'=>'expedition', 'table'=>'expedition',
'datefieldname'=>'date_valid', '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', 'lang'=>'sendings',
'buttonnew'=>'CreateShipment', 'buttonnew'=>'CreateShipment',
'testnew'=>0, 'testnew'=>0,
@ -494,7 +494,7 @@ $listofreferent = array(
'class'=>'Mo', 'class'=>'Mo',
'table'=>'mrp_mo', 'table'=>'mrp_mo',
'datefieldname'=>'date_valid', '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', 'lang'=>'mrp',
'buttonnew'=>'CreateMO', 'buttonnew'=>'CreateMO',
'testnew'=>'$user->rights->mrp->write', 'testnew'=>'$user->rights->mrp->write',
@ -508,7 +508,7 @@ $listofreferent = array(
'datefieldname'=>'dated', 'datefieldname'=>'dated',
'margin'=>'minus', 'margin'=>'minus',
'disableamount'=>1, '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', 'lang'=>'trips',
'buttonnew'=>'AddTrip', 'buttonnew'=>'AddTrip',
'testnew'=>$user->rights->deplacement->creer, 'testnew'=>$user->rights->deplacement->creer,
@ -521,7 +521,7 @@ $listofreferent = array(
'datefieldname'=>'date', 'datefieldname'=>'date',
'margin'=>'minus', 'margin'=>'minus',
'disableamount'=>0, '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', 'lang'=>'trips',
'buttonnew'=>'AddTrip', 'buttonnew'=>'AddTrip',
'testnew'=>$user->rights->expensereport->creer, 'testnew'=>$user->rights->expensereport->creer,
@ -534,7 +534,7 @@ $listofreferent = array(
'table'=>'don', 'table'=>'don',
'datefieldname'=>'datedon', 'datefieldname'=>'datedon',
'disableamount'=>0, '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', 'lang'=>'donations',
'buttonnew'=>'AddDonation', 'buttonnew'=>'AddDonation',
'testnew'=>$user->rights->don->creer, 'testnew'=>$user->rights->don->creer,
@ -547,7 +547,7 @@ $listofreferent = array(
'table'=>'loan', 'table'=>'loan',
'datefieldname'=>'datestart', 'datefieldname'=>'datestart',
'disableamount'=>0, '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', 'lang'=>'loan',
'buttonnew'=>'AddLoan', 'buttonnew'=>'AddLoan',
'testnew'=>$user->rights->loan->write, 'testnew'=>$user->rights->loan->write,
@ -560,7 +560,7 @@ $listofreferent = array(
'table'=>'chargesociales', 'table'=>'chargesociales',
'datefieldname'=>'date_ech', 'datefieldname'=>'date_ech',
'disableamount'=>0, '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', 'lang'=>'compta',
'buttonnew'=>'AddSocialContribution', 'buttonnew'=>'AddSocialContribution',
'testnew'=>$user->rights->tax->charges->lire, 'testnew'=>$user->rights->tax->charges->lire,
@ -573,7 +573,7 @@ $listofreferent = array(
'table'=>'projet_task', 'table'=>'projet_task',
'datefieldname'=>'task_date', 'datefieldname'=>'task_date',
'disableamount'=>0, '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', 'buttonnew'=>'AddTimeSpent',
'testnew'=>$user->rights->projet->creer, 'testnew'=>$user->rights->projet->creer,
'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))), 'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))),
@ -594,9 +594,9 @@ $listofreferent = array(
'datefieldname'=>'datesp', 'datefieldname'=>'datesp',
'margin'=>'minus', 'margin'=>'minus',
'disableamount'=>0, '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', 'lang'=>'salaries',
'buttonnew'=>'AddSalaryPayment', 'buttonnew'=>'AddSalary',
'testnew'=>$user->rights->salaries->write, 'testnew'=>$user->rights->salaries->write,
'test'=>$conf->salaries->enabled && $user->rights->salaries->read), 'test'=>$conf->salaries->enabled && $user->rights->salaries->read),
'variouspayment'=>array( 'variouspayment'=>array(
@ -607,7 +607,7 @@ $listofreferent = array(
'datefieldname'=>'datev', 'datefieldname'=>'datev',
'margin'=>'minus', 'margin'=>'minus',
'disableamount'=>0, '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', 'lang'=>'banks',
'buttonnew'=>'AddVariousPayment', 'buttonnew'=>'AddVariousPayment',
'testnew'=>$user->rights->banque->modifier, 'testnew'=>$user->rights->banque->modifier,
@ -620,7 +620,7 @@ $listofreferent = array(
'table'=>'actioncomm', 'table'=>'actioncomm',
'datefieldname'=>'datep', 'datefieldname'=>'datep',
'disableamount'=>1, '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', 'lang'=>'agenda',
'buttonnew'=>'AddEvent', 'buttonnew'=>'AddEvent',
'testnew'=>$user->rights->agenda->myactions->create, 'testnew'=>$user->rights->agenda->myactions->create,

View File

@ -48,6 +48,9 @@ $id = GETPOSTINT('id');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$accountid = GETPOST('accountid', 'int') > 0 ? GETPOST('accountid', 'int') : 0; $accountid = GETPOST('accountid', 'int') > 0 ? GETPOST('accountid', 'int') : 0;
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
$confirm = GETPOST('confirm'); $confirm = GETPOST('confirm');
@ -75,7 +78,6 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('salarycard', 'globalcard')); $hookmanager->initHooks(array('salarycard', 'globalcard'));
$object = new Salary($db);
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref); $object->fetch($id, $ref);
@ -97,6 +99,7 @@ $socid = GETPOSTINT('socid');
if ($user->socid) { if ($user->socid) {
$socid = $user->socid; $socid = $user->socid;
} }
restrictedArea($user, 'salaries', $object->id, 'salary', ''); restrictedArea($user, 'salaries', $object->id, 'salary', '');
@ -104,9 +107,39 @@ restrictedArea($user, 'salaries', $object->id, 'salary', '');
* Actions * Actions
*/ */
if ($cancel) { $parameters = array();
header("Location: list.php"); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
exit; if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$error = 0;
$backurlforlist = dol_buildpath('/salaries/list.php', 1);
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = dol_buildpath('/salaries/card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
}
}
}
if ($cancel) {
/*var_dump($cancel);
var_dump($backtopage);exit;*/
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;
} elseif (!empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
$action = '';
}
} }
// Link to a project // Link to a project
@ -404,8 +437,7 @@ llxHeader("", $title, $help_url);
$form = new Form($db); $form = new Form($db);
if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db); if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db);
if ($id) { if ($id > 0) {
$object = new Salary($db);
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result <= 0) { if ($result <= 0) {
dol_print_error($db); dol_print_error($db);
@ -439,6 +471,12 @@ if ($action == 'create') {
print '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
if ($backtopageforcancel) {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
}
print load_fiche_titre($langs->trans("NewSalary"), '', 'salary'); print load_fiche_titre($langs->trans("NewSalary"), '', 'salary');