Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/langs/en_US/stocks.lang htdocs/product/stats/card.php htdocs/projet/element.php htdocs/salaries/card.php
This commit is contained in:
commit
d891dd8ddc
@ -199,7 +199,7 @@ if ($action == 'update') {
|
||||
$nb_exists = $db->num_rows($resql_exists);
|
||||
if ($nb_exists <= 0) {
|
||||
// insert
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, '" . $db->escape($accountancy_field_name) . "')";
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, " . $db->escape($accountancy_field_name) . ")";
|
||||
$sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')";
|
||||
} else {
|
||||
$obj_exists = $db->fetch_object($resql_exists);
|
||||
|
||||
@ -237,7 +237,7 @@ if (empty($mysoc->country_code)) {
|
||||
|
||||
$sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <>0 OR t.localtax2 <>0)";
|
||||
$sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')";
|
||||
$sql .= " ORDER BY t.taux ASC";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@ -683,6 +683,8 @@ if ($conf->use_javascript_ajax) {
|
||||
$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 "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
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"));
|
||||
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 '<td>'.$langs->trans("WarehouseAskWarehouseDuringOrder").'</td>';
|
||||
print '<td class="right">';
|
||||
@ -702,10 +707,23 @@ if ($conf->use_javascript_ajax) {
|
||||
$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 "</td>";
|
||||
print '</td>';
|
||||
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 '<td>';
|
||||
print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc"));
|
||||
|
||||
@ -1976,6 +1976,12 @@ class Categorie extends CommonObject
|
||||
if ($type == 'bank_account') {
|
||||
$type = 'account';
|
||||
}
|
||||
if ($type == 'customer') {
|
||||
$type = 'societe';
|
||||
}
|
||||
if ($type == 'supplier') {
|
||||
$type = 'fournisseur';
|
||||
}
|
||||
|
||||
if (empty($searchList) && !is_array($searchList)) {
|
||||
return "";
|
||||
|
||||
@ -2846,15 +2846,6 @@ if (empty($reshook)) {
|
||||
* View
|
||||
*/
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$head = facture_prepare_head($object);
|
||||
$langs->load('errors');
|
||||
echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'),
|
||||
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
@ -3828,8 +3819,16 @@ if ($action == 'create') {
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
print "</form>\n";
|
||||
} elseif ($id > 0 || !empty($ref)) {
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Show object in view mode
|
||||
*/
|
||||
|
||||
@ -102,10 +102,8 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$head = facture_prepare_head($object);
|
||||
$langs->load('errors');
|
||||
echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'),
|
||||
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -94,10 +94,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$head = facture_prepare_head($object);
|
||||
$langs->load('errors');
|
||||
echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'),
|
||||
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -64,10 +64,8 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$head = facture_prepare_head($object);
|
||||
$langs->load('errors');
|
||||
echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'),
|
||||
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -79,10 +79,8 @@ if (empty($reshook)) {
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$head = facture_prepare_head($object);
|
||||
$langs->load('errors');
|
||||
echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'),
|
||||
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -514,7 +514,17 @@ class FormProjets
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2015 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2013-2015 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
@ -508,11 +509,13 @@ class FormTicket
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (!empty($conf->projet->enabled) && !$this->ispublic) {
|
||||
$formproject = new FormProjets($this->db);
|
||||
print '<tr><td><label for="project"><span class="">'.$langs->trans("Project").'</span></label></td><td>';
|
||||
print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print '</td></tr>';
|
||||
if ($subelement != 'project') {
|
||||
if (!empty($conf->projet->enabled) && !$this->ispublic) {
|
||||
$formproject = new FormProjets($this->db);
|
||||
print '<tr><td><label for="project"><span class="">'.$langs->trans("Project").'</span></label></td><td>';
|
||||
print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
|
||||
@ -349,7 +349,7 @@ class modAdherent extends DolibarrModules
|
||||
$this->import_fields_array[$r]['a.fk_soc'] = "ThirdParty";
|
||||
}
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'adherent' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) { // This can fail when class is used on old database (during migration for example)
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
@ -638,7 +638,7 @@ class modProduct extends DolibarrModules
|
||||
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'product' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) { // This can fail when class is used on old database (during migration for example)
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
@ -296,7 +296,7 @@ class modProjet extends DolibarrModules
|
||||
$this->import_tables_array[$r] = array('t'=>MAIN_DB_PREFIX.'projet_task', 'extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r] = array('t.fk_projet'=>'ProjectRef*', 't.ref'=>'RefTask*', 't.label'=>'LabelTask*', 't.dateo'=>"DateStart", 't.datee'=>"DateEnd", 't.planned_workload'=>"PlannedWorkload", 't.progress'=>"Progress", 't.note_private'=>"NotePrivate", 't.note_public'=>"NotePublic", 't.datec'=>"DateCreation");
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) { // This can fail when class is used on old database (during migration for example)
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
@ -268,7 +268,7 @@ class modResource extends DolibarrModules
|
||||
$this->import_tables_array[$r] = array('r'=>MAIN_DB_PREFIX.'resource', 'extra'=>MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r] = array('r.ref'=>"ResourceFormLabel_ref*", 'r.fk_code_type_resource'=>'ResourceTypeCode', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>'DateCreation');
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'resource' AND entity IN (0,".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'resource' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) { // This can fail when class is used on old database (during migration for example)
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
@ -584,7 +584,7 @@ class modService extends DolibarrModules
|
||||
}
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0,".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'product' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) { // This can fail when class is used on old database (during migration for example)
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
@ -496,7 +496,7 @@ class modSociete extends DolibarrModules
|
||||
$this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
|
||||
}
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) { // This can fail when class is used on old database (during migration for example)
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
@ -674,7 +674,7 @@ class modSociete extends DolibarrModules
|
||||
's.note_public' => "NotePublic"
|
||||
);
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) { // This can fail when class is used on an old database (during a migration for example)
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
@ -298,7 +298,7 @@ class modUser extends DolibarrModules
|
||||
'u.statut'=>'Status'
|
||||
);
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'user' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) { // This can fail when class is used on old database (during migration for example)
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
|
||||
@ -2093,7 +2093,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
// Test we can delete
|
||||
$this->fetchObjectLinked(null, 'order_supplier');
|
||||
if (!empty($this->linkedObjects)) {
|
||||
if (!empty($this->linkedObjects) && array_key_exists('reception', $this->linkedObjects)) {
|
||||
foreach ($this->linkedObjects['reception'] as $element) {
|
||||
if ($element->statut >= 0) {
|
||||
$this->errors[] = $langs->trans('ReceptionExist');
|
||||
|
||||
@ -465,7 +465,7 @@ if ($step == 2 && $datatoimport) {
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Module
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Module").'</td>';
|
||||
print '<td>';
|
||||
$titleofmodule = $objimport->array_import_module[0]['module']->getName();
|
||||
// Special cas for import common to module/services
|
||||
@ -571,10 +571,10 @@ if ($step == 3 && $datatoimport) {
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<table width="100%" class="border tableforfield">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Module
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Module").'</td>';
|
||||
print '<td>';
|
||||
$titleofmodule = $objimport->array_import_module[0]['module']->getName();
|
||||
// Special cas for import common to module/services
|
||||
@ -603,7 +603,7 @@ if ($step == 3 && $datatoimport) {
|
||||
print '<table width="100%" class="border tableforfield">';
|
||||
|
||||
// Source file format
|
||||
print '<tr><td class="titlefield">'.$langs->trans("SourceFileFormat").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("SourceFileFormat").'</td>';
|
||||
print '<td class="nowraponall">';
|
||||
$text = $objmodelimport->getDriverDescForKey($format);
|
||||
print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text);
|
||||
@ -733,8 +733,8 @@ if ($step == 3 && $datatoimport) {
|
||||
$relativepath = $file;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="16">'.img_mime($file).'</td>';
|
||||
print '<td>';
|
||||
print img_mime($file, '', 'pictofixedwidth');
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=3'.$param.'" target="_blank">';
|
||||
print $file;
|
||||
print '</a>';
|
||||
@ -876,7 +876,7 @@ if ($step == 4 && $datatoimport) {
|
||||
print '<table width="100%" class="border tableforfield">';
|
||||
|
||||
// Module
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Module").'</td>';
|
||||
print '<td>';
|
||||
$titleofmodule = $objimport->array_import_module[0]['module']->getName();
|
||||
// Special cas for import common to module/services
|
||||
@ -905,7 +905,7 @@ if ($step == 4 && $datatoimport) {
|
||||
print '<table width="100%" class="border tableforfield">';
|
||||
|
||||
// Source file format
|
||||
print '<tr><td class="titlefield">'.$langs->trans("SourceFileFormat").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("SourceFileFormat").'</td>';
|
||||
print '<td>';
|
||||
$text = $objmodelimport->getDriverDescForKey($format);
|
||||
print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text);
|
||||
@ -926,8 +926,8 @@ if ($step == 4 && $datatoimport) {
|
||||
print $langs->trans("Separator").' : ';
|
||||
print '<input type="text" size="1" name="separator" value="'.dol_escape_htmltag($separator).'"/>';
|
||||
print ' '.$langs->trans("Enclosure").' : ';
|
||||
print '<input type="text" size="1" name="enclosure" value="'.dol_escape_htmltag($enclosure).'"/>';
|
||||
print '<input name="update" type="submit" value="'.$langs->trans('Update').'" class="button" />';
|
||||
print '<input type="text" size="1" name="enclosure" value="'.dol_escape_htmltag($enclosure).'"/> ';
|
||||
print '<input name="update" type="submit" value="'.$langs->trans('Update').'" class="button small" />';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -938,6 +938,7 @@ if ($step == 4 && $datatoimport) {
|
||||
$modulepart = 'import';
|
||||
$relativepath = GETPOST('filetoimport');
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">';
|
||||
print img_mime($file, '', 'pictofixedwidth');
|
||||
print $filetoimport;
|
||||
print '</a>';
|
||||
print '</td></tr>';
|
||||
@ -1385,7 +1386,7 @@ if ($step == 5 && $datatoimport) {
|
||||
print '<table width="100%" class="border tableforfield">';
|
||||
|
||||
// Module
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Module").'</td>';
|
||||
print '<td>';
|
||||
$titleofmodule = $objimport->array_import_module[0]['module']->getName();
|
||||
// Special cas for import common to module/services
|
||||
@ -1414,7 +1415,7 @@ if ($step == 5 && $datatoimport) {
|
||||
print '<table width="100%" class="border tableforfield">';
|
||||
|
||||
// Source file format
|
||||
print '<tr><td class="titlefield">'.$langs->trans("SourceFileFormat").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("SourceFileFormat").'</td>';
|
||||
print '<td>';
|
||||
$text = $objmodelimport->getDriverDescForKey($format);
|
||||
print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text);
|
||||
@ -1435,6 +1436,7 @@ if ($step == 5 && $datatoimport) {
|
||||
$modulepart = 'import';
|
||||
$relativepath = GETPOST('filetoimport');
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">';
|
||||
print img_mime($file, '', 'pictofixedwidth');
|
||||
print $filetoimport;
|
||||
print '</a>';
|
||||
print '</td></tr>';
|
||||
@ -1509,7 +1511,7 @@ if ($step == 5 && $datatoimport) {
|
||||
print '<table width="100%" class="border tableforfield">';
|
||||
|
||||
// Tables imported
|
||||
print '<tr><td class="titlefield">';
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
print $langs->trans("TablesTarget");
|
||||
print '</td><td>';
|
||||
$listtables = array();
|
||||
@ -1675,10 +1677,15 @@ if ($step == 5 && $datatoimport) {
|
||||
print '<div class="center">'.img_picto($langs->trans("OK"), 'tick').' <b>'.$langs->trans("NoError").'</b></div><br><br>';
|
||||
print '<div class="ok">';
|
||||
print $langs->trans("NbInsert", empty($obj->nbinsert) ? 0 : $obj->nbinsert).'<br>';
|
||||
print $langs->trans("NbUpdate", empty($obj->nbupdate) ? 0 : $obj->nbupdate).'<br><br>';
|
||||
print $langs->trans("NbUpdate", empty($obj->nbupdate) ? 0 : $obj->nbupdate).'<br>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
} else {
|
||||
print $langs->trans("NbOfLinesOK", $nbok).'<br><br>';
|
||||
print '<br>';
|
||||
print '<div class="info">';
|
||||
print $langs->trans("NbOfLinesOK", $nbok).'<br>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
// Show Errors
|
||||
@ -1823,7 +1830,7 @@ if ($step == 6 && $datatoimport) {
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
// Module
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Module").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Module").'</td>';
|
||||
print '<td>';
|
||||
$titleofmodule = $objimport->array_import_module[0]['module']->getName();
|
||||
// Special cas for import common to module/services
|
||||
@ -1852,7 +1859,7 @@ if ($step == 6 && $datatoimport) {
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
// Source file format
|
||||
print '<tr><td class="titlefield">'.$langs->trans("SourceFileFormat").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("SourceFileFormat").'</td>';
|
||||
print '<td>';
|
||||
$text = $objmodelimport->getDriverDescForKey($format);
|
||||
print $form->textwithpicto($objmodelimport->getDriverLabelForKey($format), $text);
|
||||
@ -1875,6 +1882,7 @@ if ($step == 6 && $datatoimport) {
|
||||
$modulepart = 'import';
|
||||
$relativepath = GETPOST('filetoimport');
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank">';
|
||||
print img_mime($file, '', 'pictofixedwidth');
|
||||
print $filetoimport;
|
||||
print '</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -6,6 +6,7 @@ CREATE_NEW_SALARY_WITHOUT_AUTO_PAYMENT=By default, leave empty the option "Autom
|
||||
Salary=Salary
|
||||
Salaries=Salaries
|
||||
NewSalary=New salary
|
||||
AddSalary=Add salary
|
||||
NewSalaryPayment=New salary card
|
||||
AddSalaryPayment=Add salary payment
|
||||
SalaryPayment=Salary payment
|
||||
|
||||
@ -63,6 +63,7 @@ RuleForWarehouse=Rule for warehouses
|
||||
WarehouseAskWarehouseOnThirparty=Set a warehouse on Third-parties
|
||||
WarehouseAskWarehouseDuringPropal=Set a warehouse on Commercial proposals
|
||||
WarehouseAskWarehouseDuringOrder=Set a warehouse on Sales Orders
|
||||
WarehouseAskWarehouseDuringProject=Set a warehouse on Projects
|
||||
UserDefaultWarehouse=Set a warehouse on Users
|
||||
MainDefaultWarehouse=Default warehouse
|
||||
MainDefaultWarehouseUser=Use a default warehouse for each user
|
||||
@ -262,4 +263,4 @@ ErrorSameBatchNumber=Same batch number found in inventory list
|
||||
ProductBatchDoesNotExist=Product with batch/serial does not exist
|
||||
ProductBarcodeDoesNotExist=Product with barcode does not exist
|
||||
WarehouseId=Warehouse ID
|
||||
WarehouseRef=Warehouse Ref
|
||||
WarehouseRef=Warehouse Ref
|
||||
|
||||
@ -178,7 +178,7 @@ $arrayofmode = array(
|
||||
'facture' => 'Facture'
|
||||
);
|
||||
$title .= ' '.$form->selectarray('mode', $arrayofmode, $mode, 1);
|
||||
$title .= ' <input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">';
|
||||
$title .= ' <input type="submit" class="button small" name="refresh" value="'.$langs->trans("Refresh").'">';
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -198,7 +198,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'p.fk_product_type', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder);
|
||||
|
||||
@ -45,6 +45,7 @@ $ref = GETPOST('ref', 'alpha');
|
||||
$mode = (GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'byunit');
|
||||
$search_year = GETPOST('search_year', 'int');
|
||||
$search_categ = GETPOST('search_categ', 'int');
|
||||
$notab = GETPOST('notab', 'int');
|
||||
|
||||
$error = 0;
|
||||
$mesg = '';
|
||||
@ -56,7 +57,7 @@ if (!empty($user->socid)) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
$fieldvalue = (!empty($id) ? $id : $ref);
|
||||
$fieldvalue = ($id > 0 ? $id : $ref);
|
||||
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@ -69,6 +70,11 @@ if (empty($search_year)) {
|
||||
}
|
||||
$moreforfilter = "";
|
||||
|
||||
$object = new Product($db);
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$result = $object->fetch($id, $ref);
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
|
||||
|
||||
|
||||
@ -85,9 +91,10 @@ $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product
|
||||
|
||||
$form = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
$object = new Product($db);
|
||||
|
||||
if (!$id && empty($ref)) {
|
||||
if (!($id > 0) && empty($ref) || $notab) {
|
||||
$notab = 1;
|
||||
|
||||
llxHeader("", $langs->trans("ProductStatistics"));
|
||||
|
||||
$type = GETPOST('type', 'int');
|
||||
@ -132,7 +139,7 @@ if (!$id && empty($ref)) {
|
||||
}
|
||||
|
||||
|
||||
if ($result && (!empty($id) || !empty($ref))) {
|
||||
if ($result && ($id > 0 || !empty($ref)) && empty($notab)) {
|
||||
$head = product_prepare_head($object);
|
||||
$titre = $langs->trans("CardProduct".$object->type);
|
||||
$picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
||||
@ -145,11 +152,11 @@ if ($result && (!empty($id) || !empty($ref))) {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
}
|
||||
if (empty($id) && empty($ref)) {
|
||||
if ((!($id > 0) && empty($ref)) || $notab) {
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stats/card.php'.($type != '' ? '?type='.$type : '');
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stats/card.php'.($type != '' ? '?type='.((int) $type) : '');
|
||||
$head[$h][1] = $langs->trans("Chart");
|
||||
$head[$h][2] = 'chart';
|
||||
$h++;
|
||||
@ -162,7 +169,7 @@ if (empty($id) && empty($ref)) {
|
||||
$title = $langs->trans("ListProductByPopularity");
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/popuprop.php'.($type != '' ? '?type='.$type : '');
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/popuprop.php'.($type != '' ? '?type='.((int) $type) : '');
|
||||
$head[$h][1] = $langs->trans("ProductsPerPopularity");
|
||||
$head[$h][2] = 'popularity';
|
||||
$h++;
|
||||
@ -171,21 +178,29 @@ if (empty($id) && empty($ref)) {
|
||||
}
|
||||
|
||||
|
||||
if ($result || empty($id)) {
|
||||
if ($result || !($id > 0)) {
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
if (empty($id) || $notab) {
|
||||
print '<input type="hidden" name="notab" value="1">';
|
||||
}
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
|
||||
if (empty($id)) {
|
||||
if (!($id > 0) || $notab) {
|
||||
// Type
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductsAndServices").'</td><td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>';
|
||||
$array = array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
|
||||
print $form->selectarray('type', $array, $type);
|
||||
print '</td></tr>';
|
||||
|
||||
// Product
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductOrService").'</td><td>';
|
||||
print img_picto('', 'product', 'class="pictofixedwidth"');
|
||||
print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, 'maxwidth500');
|
||||
print '</td></tr>';
|
||||
|
||||
// Tag
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
||||
@ -194,6 +209,8 @@ if ($result || empty($id)) {
|
||||
print $moreforfilter;
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
}
|
||||
|
||||
// Year
|
||||
@ -224,7 +241,7 @@ if ($result || empty($id)) {
|
||||
}
|
||||
|
||||
if ($mode == 'bynumber') {
|
||||
print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id') ?GETPOST('id') : $object->id).($type != '' ? '&type='.$type : '').'&mode=byunit&search_year='.$search_year.'">';
|
||||
print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?'.(GETPOSTISSET('id') ? 'id='.GETPOST('id', 'int') : 'id='.$object->id).(($type != '' && $type != '-1') ? '&type='.((int) $type) : '').'&mode=byunit&search_year='.((int) $search_year).($notab ? '¬ab='.$notab : '').'">';
|
||||
} else {
|
||||
print '<span class="a-mesure marginleftonly marginrightonly">';
|
||||
}
|
||||
@ -240,7 +257,7 @@ if ($result || empty($id)) {
|
||||
}
|
||||
|
||||
if ($mode == 'byunit') {
|
||||
print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id') ?GETPOST('id') : $object->id).($type != '' ? '&type='.$type : '').'&mode=bynumber&search_year='.$search_year.'">';
|
||||
print '<a class="a-mesure-disabled marginleftonly marginrightonly reposition" href="'.$_SERVER["PHP_SELF"].'?'.(GETPOSTISSET('id') ? 'id='.GETPOST('id', 'int') : 'id='.$object->id).(($type != '' && $type != '-1') ? '&type='.((int) $type) : '').'&mode=bynumber&search_year='.((int) $search_year).($notab ? '¬ab='.$notab : '').'">';
|
||||
} else {
|
||||
print '<span class="a-mesure marginleftonly marginrightonly">';
|
||||
}
|
||||
@ -258,9 +275,7 @@ if ($result || empty($id)) {
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
//print '<table width="100%">';
|
||||
|
||||
// Generation des graphs
|
||||
// Generation of graphs
|
||||
$dir = (!empty($conf->product->multidir_temp[$object->entity]) ? $conf->product->multidir_temp[$object->entity] : $conf->service->multidir_temp[$object->entity]);
|
||||
if ($object->id > 0) { // We are on statistics for a dedicated product
|
||||
if (!file_exists($dir.'/'.$object->id)) {
|
||||
@ -385,7 +400,7 @@ if ($result || empty($id)) {
|
||||
$px->SetShading(3);
|
||||
//print 'x '.$key.' '.$graphfiles[$key]['file'];
|
||||
|
||||
$url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.$object->entity.'&file='.urlencode($graphfiles[$key]['file']);
|
||||
$url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.((int) $object->entity).'&file='.urlencode($graphfiles[$key]['file']).($notab ? '¬ab='.$notab : '');
|
||||
$px->draw($dir."/".$graphfiles[$key]['file'], $url);
|
||||
|
||||
$graphfiles[$key]['total'] = $px->total();
|
||||
@ -446,7 +461,9 @@ if ($result || empty($id)) {
|
||||
} else {
|
||||
$dategenerated = ($mesg ? '<span class="error">'.$mesg.'</span>' : $langs->trans("ChartNotGenerated"));
|
||||
}
|
||||
$linktoregenerate = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id') ?GETPOST('id') : $object->id).((string) $type != '' ? '&type='.$type : '').'&action=recalcul&mode='.$mode.'&search_year='.$search_year.'&search_categ='.$search_categ.'">'.img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')', 'refresh').'</a>';
|
||||
$linktoregenerate = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?'.(GETPOSTISSET('id') ? 'id='.GETPOST('id', 'int') : 'id='.$object->id).(((string) $type != '' && $type != '-1') ? '&type='.((int) $type) : '').'&action=recalcul&mode='.urlencode($mode).'&search_year='.((int) $search_year).($search_categ > 0 ? '&search_categ='.((int) $search_categ) : '').'">';
|
||||
$linktoregenerate .= img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')', 'refresh');
|
||||
$linktoregenerate .= '</a>';
|
||||
|
||||
// Show graph
|
||||
print '<table class="noborder centpercent">';
|
||||
@ -480,7 +497,7 @@ if ($result || empty($id)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!$id) {
|
||||
if (!($id > 0)) {
|
||||
print dol_get_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
@ -195,6 +195,7 @@ $now = dol_now();
|
||||
$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||
$title = $langs->trans("ListOfWarehouses");
|
||||
|
||||
$totalarray = array();
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
@ -566,7 +567,6 @@ print '</tr>'."\n";
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
|
||||
$warehouse = new Entrepot($db);
|
||||
|
||||
|
||||
@ -358,12 +358,14 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product AND s.fk_entrepot IN ('.$db->sanitize($listofqualifiedwarehousesid).')';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
|
||||
$list_warehouse = (empty($listofqualifiedwarehousesid) ? '0' : $listofqualifiedwarehousesid);
|
||||
$sql .= ' AND s.fk_entrepot IN ('.$db->sanitize($list_warehouse) .')';
|
||||
|
||||
//$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')';
|
||||
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.((int) $fk_entrepot).')';
|
||||
}
|
||||
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -577,6 +579,9 @@ print load_fiche_titre($langs->trans('Replenishment'), '', 'stock');
|
||||
print dol_get_fiche_head($head, 'replenish', '', -1, '');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n";
|
||||
|
||||
//$link = '<a title=' .$langs->trans("MenuNewWarehouse"). ' href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("MenuNewWarehouse").'</a>';
|
||||
|
||||
if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."\n";
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -48,6 +48,8 @@ $id = GETPOSTINT('id');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
|
||||
$confirm = GETPOST('confirm');
|
||||
|
||||
$label = GETPOST('label', 'alphanohtml');
|
||||
@ -76,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
|
||||
$hookmanager->initHooks(array('salarycard', 'globalcard'));
|
||||
|
||||
$object = new Salary($db);
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
@ -98,6 +99,7 @@ $socid = GETPOSTINT('socid');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
restrictedArea($user, 'salaries', $object->id, 'salary', '');
|
||||
|
||||
|
||||
@ -105,9 +107,39 @@ restrictedArea($user, 'salaries', $object->id, 'salary', '');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($cancel) {
|
||||
header("Location: list.php");
|
||||
exit;
|
||||
$parameters = array();
|
||||
$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');
|
||||
}
|
||||
|
||||
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
|
||||
@ -405,8 +437,7 @@ llxHeader("", $title, $help_url);
|
||||
$form = new Form($db);
|
||||
if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db);
|
||||
|
||||
if ($id) {
|
||||
$object = new Salary($db);
|
||||
if ($id > 0) {
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db);
|
||||
@ -440,6 +471,12 @@ if ($action == 'create') {
|
||||
print '<form name="salary" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
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');
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.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
|
||||
@ -232,6 +233,12 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Link ticket to project
|
||||
if (GETPOST('origin', 'alpha') == 'projet') {
|
||||
$projectid = GETPOST('originid', 'int');
|
||||
} else {
|
||||
$projectid = GETPOST('projectid', 'int');
|
||||
}
|
||||
|
||||
if ($projectid > 0) {
|
||||
$object->setProject($projectid);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user