Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into 14.0

Conflicts:
	htdocs/core/class/html.formticket.class.php
	htdocs/ticket/card.php
This commit is contained in:
Laurent Destailleur 2021-10-31 14:37:33 +01:00
commit da4fe03be7
14 changed files with 46 additions and 45 deletions

View File

@ -2831,15 +2831,6 @@ if (empty($reshook)) {
* View * 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); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
@ -3816,8 +3807,16 @@ if ($action == 'create') {
print '</table>'; print '</table>';
} }
print '</form>'; print "</form>\n";
} elseif ($id > 0 || !empty($ref)) { } 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 * Show object in view mode
*/ */

View File

@ -102,10 +102,8 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter(); llxFooter();
exit; exit;
} }

View File

@ -94,10 +94,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter(); llxFooter();
exit; exit;
} }

View File

@ -64,10 +64,8 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter(); llxFooter();
exit; exit;
} }

View File

@ -71,10 +71,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
if (empty($object->id)) { if (empty($object->id)) {
llxHeader(); llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors'); $langs->load('errors');
echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'), echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter(); llxFooter();
exit; exit;
} }

View File

@ -3,10 +3,11 @@
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Juanjo Menent <jmenent@2byte.es> * 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 * 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 * 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. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -429,12 +430,14 @@ class FormTicket
} }
} }
if ($subelement != 'project') {
if (!empty($conf->projet->enabled) && !$this->ispublic) { if (!empty($conf->projet->enabled) && !$this->ispublic) {
$formproject = new FormProjets($this->db); $formproject = new FormProjets($this->db);
print '<tr><td><label for="project"><span class="">'.$langs->trans("Project").'</span></label></td><td>'; 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 img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
print '</td></tr>'; print '</td></tr>';
} }
}
// Other attributes // Other attributes
$parameters = array(); $parameters = array();

View File

@ -349,7 +349,7 @@ class modAdherent extends DolibarrModules
$this->import_fields_array[$r]['a.fk_soc'] = "ThirdParty"; $this->import_fields_array[$r]['a.fk_soc'] = "ThirdParty";
} }
// Add extra fields // 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); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -636,7 +636,7 @@ class modProduct extends DolibarrModules
// Add extra fields // Add extra fields
$import_extrafield_sample = array(); $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); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -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_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"); $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 // 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); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -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_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'); $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 // 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); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -584,7 +584,7 @@ class modService extends DolibarrModules
} }
// Add extra fields // Add extra fields
$import_extrafield_sample = array(); $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); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -496,7 +496,7 @@ class modSociete extends DolibarrModules
$this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
} }
// Add extra fields // 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); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {
@ -674,7 +674,7 @@ class modSociete extends DolibarrModules
's.note_public' => "NotePublic" 's.note_public' => "NotePublic"
); );
// Add extra fields // 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); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on an old database (during a migration for example) 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)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -298,7 +298,7 @@ class modUser extends DolibarrModules
'u.statut'=>'Status' 'u.statut'=>'Status'
); );
// Add extra fields // 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); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) { while ($obj = $this->db->fetch_object($resql)) {

View File

@ -3,6 +3,7 @@
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr> * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -208,6 +209,12 @@ if (empty($reshook)) {
} }
// Link ticket to project // Link ticket to project
if (GETPOST('origin', 'alpha') == 'projet') {
$projectid = GETPOST('originid', 'int');
} else {
$projectid = GETPOST('projectid', 'int');
}
if ($projectid > 0) { if ($projectid > 0) {
$object->setProject($projectid); $object->setProject($projectid);
} }