Merge branch 'develop' of github.com:Dolibarr/dolibarr into new_formsetup_as_default

This commit is contained in:
John BOTELLA 2022-05-21 00:38:53 +02:00
commit e48bf14dae
20 changed files with 340 additions and 72 deletions

View File

@ -1883,7 +1883,7 @@ class BookKeeping extends CommonObject
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;

View File

@ -258,6 +258,12 @@ class Categorie extends CommonObject
*/
public $motherof = array();
/**
* @var array Childs
*/
public $childs = array();
/**
* Constructor
*

View File

@ -1517,6 +1517,7 @@ class Propal extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht";
$sql .= ", p.datec";
$sql .= ", p.date_signature as dates";
$sql .= ", p.date_valid as datev";
$sql .= ", p.datep as dp";
$sql .= ", p.fin_validite as dfv";
@ -1600,6 +1601,7 @@ class Propal extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation date
$this->date_modification = $this->db->jdate($obj->date_modification); // tms
$this->date_signature = $this->db->jdate($obj->dates); // Signature date
$this->date = $this->db->jdate($obj->dp); // Proposal date
$this->datep = $this->db->jdate($obj->dp); // deprecated
$this->fin_validite = $this->db->jdate($obj->dfv);

View File

@ -281,8 +281,8 @@ if ($object->id > 0) {
}
$author = new User($db);
if ($object->user_author) {
$author->fetch($object->user_author);
if ($object->fk_user_author) {
$author->fetch($object->fk_user_author);
}
if ($type == 'bank-transfer') {

View File

@ -1468,6 +1468,7 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
$trackid = 'leav'.$objecttmp->id;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
// Sending email

View File

@ -0,0 +1,122 @@
<?php
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Cyrille de Lambert <info@auguria.net>
*
* 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 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
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/ajax/ajaxcompanies.php
* \brief File to return Ajax response on third parties request
*/
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
require '../../main.inc.php';
/*
* View
*/
// Ajout directives pour resoudre bug IE
//header('Cache-Control: Public, must-revalidate');
//header('Pragma: public');
//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
top_httphead();
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
dol_syslog(join(',', $_GET));
// Generation liste des societes
if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) {
$return_arr = array();
// Define filter on text typed
$socid = $_GET['newcompany'] ? $_GET['newcompany'] : '';
if (!$socid) $socid = $_GET['socid'] ? $_GET['socid'] : '';
if (!$socid) $socid = $_GET['id_fourn'] ? $_GET['id_fourn'] : '';
$sql = "SELECT s.rowid, s.nom, s.name_alias, s.code_client, s.code_fournisseur, s.address, s.zip, s.town, s.email, s.siren, s.siret, s.ape, s.idprof4, s.client, s.fournisseur, s.datec, s.logo";
$sql .= " , c.label as country, d.nom as departement";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON d.rowid = s.fk_departement";
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
if ($socid) {
$sql .= " AND (";
// Add criteria on name/code
if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) { // Can use index
$sql .= "s.nom LIKE '".$db->escape($socid)."%'";
$sql .= " OR s.code_client LIKE '".$db->escape($socid)."%'";
$sql .= " OR s.code_fournisseur LIKE '".$db->escape($socid)."%'";
} else {
$sql .= "s.nom LIKE '%".$db->escape($socid)."%'";
$sql .= " OR s.code_client LIKE '%".$db->escape($socid)."%'";
$sql .= " OR s.code_fournisseur LIKE '%".$db->escape($socid)."%'";
}
if (!empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) $sql .= " OR s.rowid = '".$db->escape($socid)."'";
$sql .= ")";
}
//if (GETPOST("filter")) $sql.= " AND (".GETPOST("filter", "alpha").")"; // Add other filters
$sql .= " ORDER BY s.nom ASC";
//dol_syslog("ajaxcompanies", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
while ($row = $db->fetch_array($resql)) {
$label = $row['nom'];
if ($socid) $label = $label;
$row_array['label'] = $label;
$row_array['value'] = $row['nom'];
$row_array['key'] = $row['rowid'];
$row_array['name_alias'] = $row['name_alias'];
$row_array['code_client'] = $row['code_client'];
$row_array['code_fournisseur'] = $row['code_fournisseur'];
$row_array['address'] = $row['address'];
$row_array['zip'] = $row['zip'];
$row_array['town'] = $row['town'];
$row_array['email'] = $row['email'];
$row_array['siren'] = $row['siren'];
$row_array['siret'] = $row['siret'];
$row_array['ape'] = $row['ape'];
$row_array['idprof4'] = $row['idprof4'];
$row_array['client'] = $row['client'];
$row_array['fournisseur'] = $row['fournisseur'];
$row_array['datec'] = $row['datec'];
$row_array['logo'] = $row['logo'];
$row_array['country'] = $row['country'];
$row_array['departement'] = $row['departement'];
array_push($return_arr, $row_array);
}
echo json_encode($return_arr);
} else {
echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error'));
}
} else {
echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter'));
}

View File

@ -597,7 +597,7 @@ class CMailFile
}
$sendingmode = $this->sendmode;
if ($this->context == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
if ($this->sendcontext == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
// List of sending methods
$listofmethods = array();
$listofmethods['mail'] = 'PHP mail function';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
/* Copyright (C) 2011-2022 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -216,7 +216,7 @@ class FileUpload
/**
* Set delete url
*
* @param string $file Filename
* @param object $file Filename
* @return void
*/
protected function setFileDeleteUrl($file)
@ -301,7 +301,7 @@ class FileUpload
* Enter description here ...
*
* @param string $uploaded_file Uploade file
* @param string $file File
* @param object $file File
* @param string $error Error
* @param string $index Index
* @return boolean True if OK, False if KO
@ -538,7 +538,7 @@ class FileUpload
/**
* Delete uploaded file
*
* @return void
* @return string
*/
public function delete()
{

View File

@ -240,10 +240,24 @@ class FormSetup
* saveConfFromPost
*
* @param bool $noMessageInUpdate display event message on errors and success
* @return void|null
* @return int -1 if KO, 1 if OK
*/
public function saveConfFromPost($noMessageInUpdate = false)
{
global $hookmanager;
$parameters = array();
$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfFromPost', $parameters, $this); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->setErrors($hookmanager->errors);
return -1;
}
if ($reshook > 0) {
return $reshook;
}
if (empty($this->items)) {
return null;
}
@ -265,11 +279,13 @@ class FormSetup
if (empty($noMessageInUpdate)) {
setEventMessages($this->langs->trans("SetupSaved"), null);
}
return 1;
} else {
$this->db->rollback();
if (empty($noMessageInUpdate)) {
setEventMessages($this->langs->trans("SetupNotSaved"), null, 'errors');
}
return -1;
}
}
@ -652,8 +668,22 @@ class FormSetupItem
*/
public function saveConfValue()
{
global $hookmanager;
$parameters = array();
$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfValue', $parameters, $this); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->setErrors($hookmanager->errors);
return -1;
}
if ($reshook > 0) {
return $reshook;
}
if (!empty($this->saveCallBack) && is_callable($this->saveCallBack)) {
return call_user_func($this->saveCallBack);
return call_user_func($this->saveCallBack, $this);
}
// Modify constant only if key was posted (avoid resetting key to the null value)
@ -1013,6 +1043,7 @@ class FormSetupItem
}
$out.= $this->langs->trans($template->label);
} elseif (preg_match('/category:/', $this->type)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$c = new Categorie($this->db);
$result = $c->fetch($this->fieldValue);
if ($result < 0) {

View File

@ -128,46 +128,46 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
$texttoinsert .= " 'position'=>".($val['position'] !== '' ? $val['position'] : 50).",";
$texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : $val['notnull']).",";
$texttoinsert .= " 'visible'=>".($val['visible'] !== '' ? $val['visible'] : -1).",";
if ($val['noteditable']) {
if (!empty($val['noteditable'])) {
$texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',";
}
if ($val['default'] || $val['default'] === '0') {
if (!empty($val['default']) || (isset($val['default']) && $val['default'] === '0')) {
$texttoinsert .= " 'default'=>'".$val['default']."',";
}
if ($val['index']) {
if (!empty($val['index'])) {
$texttoinsert .= " 'index'=>".$val['index'].",";
}
if ($val['foreignkey']) {
if (!empty($val['foreignkey'])) {
$texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',";
}
if ($val['searchall']) {
if (!empty($val['searchall'])) {
$texttoinsert .= " 'searchall'=>".$val['searchall'].",";
}
if ($val['isameasure']) {
if (!empty($val['isameasure'])) {
$texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',";
}
if ($val['css']) {
if (!empty($val['css'])) {
$texttoinsert .= " 'css'=>'".$val['css']."',";
}
if ($val['cssview']) {
if (!empty($val['cssview'])) {
$texttoinsert .= " 'cssview'=>'".$val['cssview']."',";
}
if ($val['csslist']) {
if (!empty($val['csslist'])) {
$texttoinsert .= " 'csslist'=>'".$val['csslist']."',";
}
if ($val['help']) {
if (!empty($val['help'])) {
$texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
}
if ($val['showoncombobox']) {
if (!empty($val['showoncombobox'])) {
$texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',";
}
if ($val['disabled']) {
if (!empty($val['disabled'])) {
$texttoinsert .= " 'disabled'=>'".$val['disabled']."',";
}
if ($val['autofocusoncreate']) {
if (!empty($val['autofocusoncreate'])) {
$texttoinsert .= " 'autofocusoncreate'=>'".$val['autofocusoncreate']."',";
}
if ($val['arrayofkeyval']) {
if (!empty($val['arrayofkeyval'])) {
$texttoinsert .= " 'arrayofkeyval'=>array(";
$i = 0;
foreach ($val['arrayofkeyval'] as $key2 => $val2) {
@ -179,10 +179,10 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
}
$texttoinsert .= "),";
}
if ($val['validate']) {
if (!empty($val['validate'])) {
$texttoinsert .= " 'validate'=>'".$val['validate']."',";
}
if ($val['comment']) {
if (!empty($val['comment'])) {
$texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
}
@ -314,7 +314,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
if ($key == 'entity') {
$texttoinsert .= ' DEFAULT 1';
} else {
if ($val['default'] != '') {
if (!empty($val['default'])) {
if (preg_match('/^null$/i', $val['default'])) {
$texttoinsert .= " DEFAULT NULL";
} elseif (preg_match('/varchar/', $type)) {

View File

@ -467,7 +467,7 @@ class modSociete extends DolibarrModules
's.nom' => "Name*",
's.name_alias' => "AliasNameShort",
's.parent' => "ParentCompany",
's.status' => "Status",
's.status' => "Status*",
's.code_client' => "CustomerCode",
's.code_fournisseur' => "SupplierCode",
's.code_compta' => "CustomerAccountancyCode",

View File

@ -523,9 +523,9 @@ class pdf_squille extends ModelePdfReception
while ($pagenb < $pageposafter) {
$pdf->setPage($pagenb);
if ($pagenb == 1) {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object);
} else {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object);
}
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pagenb++;
@ -534,9 +534,9 @@ class pdf_squille extends ModelePdfReception
}
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
if ($pagenb == 1) {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object);
} else {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object);
}
$this->_pagefoot($pdf, $object, $outputlangs, 1);
// New page
@ -550,10 +550,10 @@ class pdf_squille extends ModelePdfReception
// Show square
if ($pagenb == 1) {
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object);
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
} else {
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object);
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
@ -719,9 +719,10 @@ class pdf_squille extends ModelePdfReception
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @param Object|NULL $object Object reception to generate
* @return void
*/
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $object = null)
{
global $conf;
@ -767,7 +768,18 @@ class pdf_squille extends ModelePdfReception
$pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->posxqtytoship, $tab_top + 1);
$pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToReceive"), '', 'C');
$statusreceived = Reception::STATUS_CLOSED;
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) {
$statusreceived = Reception::STATUS_VALIDATED;
}
if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) {
$statusreceived = Reception::STATUS_CLOSED;
}
if ($object && $object->statut < $statusreceived) {
$pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyToReceive'), '', 'C');
} else {
$pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyReceived'), '', 'C');
}
}
if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) {

View File

@ -948,15 +948,14 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
var discount = parseFloat($('option:selected', this).attr('data-discount'));
if (isNaN(discount)) { discount = parseFloat(jQuery('#idprodfournprice').attr('data-discount'));}
var tva_tx = parseFloat($('option:selected', this).data('tvatx'));
/* var tva_tx = $('option:selected', this).data('tvatx'); */
console.log("We find supplier price :"+up+" qty: "+qty+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val());
console.log("We find supplier price :"+up+" qty: "+qty+" tva_tx="+tva_tx+" discount: "+discount+" for product "+jQuery('#idprodfournprice').val());
jQuery("#price_ht").val(up);
$('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true);
if (jQuery("#qty").val() < qty)
{
/* $('#tva_tx option').removeAttr('selected').filter('[value='+tva_tx+']').prop('selected', true); */
if (jQuery("#qty").val() < qty) {
jQuery("#qty").val(qty);
}
if (jQuery("#remise_percent").val() < discount)

View File

@ -166,7 +166,7 @@ if ($action == 'add') {
// on récupère les enregistrements
$object->fetch($id);
$res = $object->fetch_lines();
// on transfert les données de l'un vers l'autre
if ($object->socid > 0) {
$newinter->socid = $object->socid;
@ -178,6 +178,7 @@ if ($action == 'add') {
$newinter->entity = $object->entity;
$newinter->duree = $object->duree;
$newinter->datei = $object->date;
$newinter->description = $object->description;
$newinter->note_private = $object->note_private;
@ -194,7 +195,7 @@ if ($action == 'add') {
if ($newfichinterid > 0) {
// Now we add line of details
foreach ($object->lines as $line) {
$newinter->addline($user, $newfichinterid, $line->desc, '', $line->duree, '');
$newinter->addline($user, $newfichinterid, $line->desc, $line->datei, $line->duree, '');
}
// on update le nombre d'inter crée à partir du modèle
@ -737,7 +738,7 @@ if ($action == 'create') {
print '<div class="inline-block divButAction">';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=createfrommodel&token='.newToken().'';
print '&socid='.$object->thirdparty->id.'&id='.$object->id.'">';
print $langs->trans("CreateFichInter").'</a></div>';
print $langs->trans("AddIntervention").'</a></div>';
}
if ($user->rights->ficheinter->supprimer) {

View File

@ -1349,7 +1349,6 @@ class Fichinter extends CommonObject
$line->fetch_optionals();
$this->lines[$i] = $line;
$i++;
}
$this->db->free($resql);

View File

@ -351,7 +351,7 @@ class FichinterRec extends Fichinter
$this->lines = array();
$sql = 'SELECT l.rowid, l.fk_product, l.product_type as product_type, l.label as custom_label, l.description, ';
$sql .= ' l.price, l.qty, l.tva_tx, l.remise, l.remise_percent, l.subprice, l.duree, ';
$sql .= ' l.price, l.qty, l.tva_tx, l.remise_percent, l.subprice, l.duree, ';
$sql .= ' l.total_ht, l.total_tva, l.total_ttc,';
$sql .= ' l.rang, l.special_code,';
$sql .= ' l.fk_unit, p.ref as product_ref, p.fk_product_type as fk_product_type,';
@ -370,7 +370,6 @@ class FichinterRec extends Fichinter
$objp = $this->db->fetch_object($result);
$line = new FichinterLigne($this->db);
$line->id = $objp->rowid;
$line->label = $objp->custom_label; // Label line
$line->desc = $objp->description; // Description line
@ -390,8 +389,6 @@ class FichinterRec extends Fichinter
$line->fk_product = $objp->fk_product;
$line->date_start = $objp->date_start;
$line->date_end = $objp->date_end;
$line->date_start = $objp->date_start;
$line->date_end = $objp->date_end;
$line->info_bits = $objp->info_bits;
$line->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva;

View File

@ -1469,33 +1469,36 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
}
if (!$error) {
if (!$error && !GETPOST('regenerateclasssql')&& !GETPOST('regeneratemissing')) {
$addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'),
'label'=>GETPOST('proplabel', 'alpha'),
'type'=>GETPOST('proptype', 'alpha'),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'),
'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'),
'notnull'=>GETPOST('propnotnull', 'int'),
'index'=>GETPOST('propindex', 'int'),
'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'),
'comment'=>GETPOST('propcomment', 'alpha'),
'help'=>GETPOST('prophelp', 'alpha'),
'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example
'cssview'=>GETPOST('propcssview', 'alpha'),
'csslist'=>GETPOST('propcsslist', 'alpha'),
'default'=>GETPOST('propdefault', 'restricthtml'),
'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
'validate' => GETPOST('propvalidate', 'int')
'name'=>GETPOST('propname', 'aZ09'),
'label'=>GETPOST('proplabel', 'alpha'),
'type'=>GETPOST('proptype', 'alpha'),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'),
'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'),
'notnull'=>GETPOST('propnotnull', 'int'),
'index'=>GETPOST('propindex', 'int'),
'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'),
'comment'=>GETPOST('propcomment', 'alpha'),
'help'=>GETPOST('prophelp', 'alpha'),
'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example
'cssview'=>GETPOST('propcssview', 'alpha'),
'csslist'=>GETPOST('propcsslist', 'alpha'),
'default'=>GETPOST('propdefault', 'restricthtml'),
'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
'validate' => GETPOST('propvalidate', 'int')
);
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
}
}
} else {
$addfieldentry = array();
}
/*if (GETPOST('regeneratemissing'))

View File

@ -220,7 +220,7 @@ if ($action == "view_ticketlist") {
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
$filter = array();
$param = 'action=view_ticketlist';
$param = '&action=view_ticketlist';
if (!empty($entity) && !empty($conf->multicompany->enabled)) {
$param .= '&entity='.$entity;
}
@ -398,7 +398,7 @@ if ($action == "view_ticketlist") {
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
print_barre_liste($langs->trans('TicketList'), $page, 'public/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket');
print_barre_liste($langs->trans('TicketList'), $page, '/public/ticket/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket');
// Search bar
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'" id="searchFormList" >'."\n";

View File

@ -1308,8 +1308,102 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<span id="TypeName" class="fieldrequired">'.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).'</span>';
}
print '</td><td'.(empty($conf->global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>';
print '<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus">';
print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300');
/* Disabled. Must be implenteted by keeping the input text but calling ajax on a keydown of the input and output
data of duplicate into a div under the input. We need to keep the widgetForTranslation also for some countries.
*/
/*
print '<select class="name" name="name" id="name" style="min-width:500px"></select>';
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
$("#name").select2({
ajax: {
url: "' . DOL_URL_ROOT . '/core/ajax/ajaxcompanies.php",
dataType: "json",
delay: 250,
data: function (params) {
return {
newcompany: params.term // search term
};
},
processResults: function (data, params) {
return {
results: data
};
},
cache: true
},
placeholder: "' . $langs->trans('Name of the new third party. In the meantime we check if it already exists...') . '",
allowClear: true,
minimumInputLength: 3,
language: select2arrayoflanguage,
containerCssClass: ":all:",
selectionCssClass: ":all:",
tags: true,
templateResult: formatCustomer,
templateSelection: formatCustomerSelection
});
function formatCustomer (Customer) {
if(Customer.label === undefined) {
return Customer.text;
}
if(Customer.logo !== null ) {
logo = \'<img src="\';
logo += \'' . DOL_URL_ROOT . '/viewimage.php?modulepart=societe&amp;entity=1&amp;file=\' + Customer.key + "%2Flogos%2Fthumbs%2F" + Customer.logo.replace(".", "_mini.") + "&amp;cache=0";
logo += \'" /></div>\';
} else {
logo = \'<div class="floatleft inline-block valigntop photowithmargin" style="padding:0 10px"><div class="photosociete photoref" alt="No photo"><span class="fas fa-building" style="color: #6c6aa8;"></span></div></div>\';
}
var $container = $("<div class=\'select2-result-repository clearfix\'>" +
"<div class=\'select2-result-repository__avatar floatleft inline-block valigntop\'>" + logo +
"<div class=\'select2-result-repository__meta floatleft inline-block valigntop\'>" +
"<div class=\'select2-result-repository__title\'></div>" +
"<div class=\'select2-result-repository__name_alias\'></div>" +
"<div class=\'select2-result-repository__code_client\'></div>" +
"<div class=\'select2-result-repository__code_fournisseur\'></div>" +
"<div class=\'select2-result-repository__companies_info\'>" +
"<div class=\'select2-result-repository__email\'><i class=\'fa fa-at\'></i> </div>" +
"<div class=\'select2-result-repository__address\'><i class=\'fa fa-flag\'></i> </div>" +
"<div class=\'select2-result-repository__zip\'><i class=\'fa fa-circle-o\'></i> </div>" +
"<div class=\'select2-result-repository__country\'><i class=\'fa fa-globe-americas\'></i> </div>" +
"<div class=\'select2-result-repository__departement\'><i class=\'fa fa-circle-o\'></i> </div>" +
"<div class=\'select2-result-repository__town\'><i class=\'fa fa-circle-o\'></i> </div>" +
"<div class=\'select2-result-repository__siren\'><i class=\'fa fa-circle-o\'></i> </div>" +
"<div class=\'select2-result-repository__datec\'><i class=\'fa fa-calendar\'></i> </div>" +
"</div>" +
"</div>" +
"</div>"
);
$container.find(".select2-result-repository__title").text(Customer.label);
$container.find(".select2-result-repository__name_alias").text(Customer.name_alias ? Customer.name_alias : "");
$container.find(".select2-result-repository__code_client").text(Customer.code_client ? Customer.code_client : "");
$container.find(".select2-result-repository__code_fournisseur").text((Customer.code_fournisseur!==null) ? Customer.code_fournisseur : "");
$container.find(".select2-result-repository__email").append("' . $langs->trans('EMail') . ': " + (Customer.email !== null ? Customer.email : ""));
$container.find(".select2-result-repository__address").append("' . $langs->trans('Address') . ': " + (Customer.address !== null ? Customer.address : ""));
$container.find(".select2-result-repository__country").append("' . $langs->trans('Country') . ': " + (Customer.country !== null ? Customer.country : ""));
$container.find(".select2-result-repository__departement").append("' . $langs->trans('Region-State') . ': " + (Customer.departement !== null ? Customer.departement : ""));
$container.find(".select2-result-repository__zip").append("' . $langs->trans('Zip') . ': " + (Customer.zip !== null ? Customer.zip : ""));
$container.find(".select2-result-repository__town").append("' . $langs->trans('Town') . ': " + (Customer.town !== null ? Customer.town : ""));
$container.find(".select2-result-repository__siren").append("' . $langs->trans('Siren') . ': " + (Customer.siren !== null ? Customer.siren : ""));
$container.find(".select2-result-repository__datec").append("' . $langs->trans('Created') . ': " + (Customer.datec !== null ? Customer.datec : ""));
return $container;
}
function formatCustomerSelection (selection) {
return selection.label || selection.text;
}
});
</script>
';
*/
print '</td>';
if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
print '<td>'.$langs->trans('Prefix').'</td><td><input type="text" size="5" maxlength="5" name="prefix_comm" value="'.dol_escape_htmltag($object->prefix_comm).'"></td>';

View File

@ -2790,6 +2790,7 @@ if (!GETPOST('hide_websitemenu')) {
$htmltext .= '<br><center>'.$langs->trans("GoTo").' <a href="'.$virtualurl.'" target="_website">'.$virtualurl.'</a></center><br>';
}
if (!empty($conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER)) {
$htmltext .= '<!-- Message defined translate key set into WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER -->';
$htmltext .= '<br>'.$langs->trans($conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER);
} else {
$htmltext .= $langs->trans("SetHereVirtualHost", $dataroot);