Clean deprecated params on all fetch_optionals()

This commit is contained in:
Laurent Destailleur 2020-03-27 16:02:58 +01:00
parent 975f061b43
commit c27592bad2
33 changed files with 184 additions and 81 deletions

View File

@ -203,7 +203,7 @@ if (($id || $ref) && $action == 'edit')
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
{
$res = $object->fetch_optionals($object->id);
$res = $object->fetch_optionals();
$head = asset_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("Asset"), -1, 'generic');

View File

@ -726,7 +726,7 @@ if (empty($reshook))
$originLine = new $lineClassName($db);
if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0)
{
$originLine->fetch_optionals($lineId);
$originLine->fetch_optionals();
$desc = $originLine->desc;
$pu_ht = $originLine->subprice;
$qty = $originLine->qty;
@ -1523,7 +1523,7 @@ if ($action == 'create')
$dateinvoice = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $dateinvoice);
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
if (!empty($conf->multicurrency->enabled))

View File

@ -385,7 +385,7 @@ if (empty($reshook))
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if trigger used
{
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
@ -1362,7 +1362,7 @@ if (empty($reshook))
$originLine = new $lineClassName($db);
if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0)
{
$originLine->fetch_optionals($lineId);
$originLine->fetch_optionals();
$desc = $originLine->desc;
$pu_ht = $originLine->subprice;
$qty = $originLine->qty;
@ -1549,7 +1549,7 @@ if ($action == 'create' && $usercancreate)
$objectsrc->fetch_thirdparty();
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
$projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');

View File

@ -1381,7 +1381,7 @@ class Commande extends CommonOrder
$this->origin_id = $object->id;
// get extrafields from original line
$object->fetch_optionals($object->id);
$object->fetch_optionals();
$e = new ExtraFields($this->db);
$element_extrafields = $e->fetch_name_optionals_label($this->table_element);

View File

@ -287,7 +287,7 @@ if (($action == 'create' || $action == 'add') && !$error)
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}

View File

@ -1608,7 +1608,7 @@ if (empty($reshook))
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
@ -1749,7 +1749,7 @@ if (empty($reshook))
$line->origin = $object->origin;
$line->origin_id = $line->id;
$line->fk_prev_id = $line->id;
$line->fetch_optionals($line->id);
$line->fetch_optionals();
$line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note
// Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée
@ -2555,7 +2555,7 @@ if (empty($reshook))
$originLine = new $lineClassName($db);
if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0)
{
$originLine->fetch_optionals($lineId);
$originLine->fetch_optionals();
$desc = $originLine->desc;
$pu_ht = $originLine->subprice;
$qty = $originLine->qty;
@ -2810,7 +2810,7 @@ if ($action == 'create')
$remise_absolue = (!empty($expesrc->remise_absolue) ? $expesrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
//Replicate extrafields
$expesrc->fetch_optionals($expeoriginid);
$expesrc->fetch_optionals();
$object->array_options = $expesrc->array_options;
}
else
@ -2828,7 +2828,7 @@ if ($action == 'create')
}
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
}
}

View File

@ -677,7 +677,7 @@ class FactureRec extends CommonInvoice
$line->price = $objp->price;
$line->remise = $objp->remise;
$line->fetch_optionals($line->id);
$line->fetch_optionals();
// Multicurrency
$line->fk_multicurrency = $objp->fk_multicurrency;

View File

@ -1317,7 +1317,7 @@ class Facture extends CommonInvoice
$this->origin_id = $object->id;
// get extrafields from original line
$object->fetch_optionals($object->id);
$object->fetch_optionals();
foreach ($object->array_options as $options_key => $value)
$this->array_options[$options_key] = $value;

View File

@ -317,7 +317,7 @@ if (empty($reshook))
$array_options = array();
// For avoid conflicts if trigger used
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}
@ -1128,12 +1128,12 @@ if ($action == 'create')
$classname = ucfirst($subelement);
$objectsrc = new $classname($db);
$objectsrc->fetch(GETPOST('originid'));
$objectsrc->fetch($originid);
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) $objectsrc->fetch_lines();
$objectsrc->fetch_thirdparty();
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
$projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
@ -1703,7 +1703,8 @@ else
// Display lines extrafields
if (is_array($extralabelslines) && count($extralabelslines) > 0) {
$line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid);
$line->id = $objp->rowid;
$line->fetch_optionals();
print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1);
}
}
@ -1793,7 +1794,8 @@ else
if (is_array($extralabelslines) && count($extralabelslines) > 0) {
$line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid);
$line->id = $objp->rowid;
$line->fetch_optionals();
print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1);
}
}

View File

@ -744,7 +744,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$lines[$i]->fetch_optionals();
$array_options = $lines[$i]->array_options;
}

View File

@ -87,6 +87,11 @@ abstract class CommonObject
*/
public $array_options = array();
/**
* @var mixed Array to store alternative languages values of object
*/
public $array_languages = null; // Value is array() when load already tried
/**
* @var int[][] Array of linked objects ids. Loaded by ->fetchObjectLinked
*/
@ -5041,6 +5046,72 @@ abstract class CommonObject
}
/* Functions for data in other language */
/**
* Function to get alternative languages of a data into $this->array_languages
* This method is NOT called by method fetch of objects but must be called separately.
*
* @return int <0 if error, 0 if no values of alternative languages to find nor found, 1 if a value was found and loaded
*/
public function fetchValueForAlternateLanguages()
{
// To avoid SQL errors. Probably not the better solution though
if (!$this->element) {
return 0;
}
if (! ($this->id > 0)) {
return 0;
}
$this->array_languages = array();
$element = $this->element;
if ($element == 'categorie') $element = 'categories'; // For compatibility
// Request to get translation values for object
$sql = "SELECT rowid, property, lang , value";
$sql .= " FROM ".MAIN_DB_PREFIX."object_lang";
$sql .= " WHERE type_object = '".$element."'";
$sql .= " AND fk_object = ".$this->id;
//dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG); // Too verbose
$resql = $this->db->query($sql);
if ($resql)
{
$numrows = $this->db->num_rows($resql);
if ($numrows)
{
$tab = $this->db->fetch_array($resql);
foreach ($tab as $key => $value)
{
// we can add this attribute to object
if (preg_match('/date/', $key))
{
$this->array_languages[$key] = $this->db->jdate($value);
}
else
{
$this->array_languages[$key] = $value;
}
}
}
$this->db->free($resql);
if ($numrows) return $numrows;
else return 0;
}
else
{
dol_print_error($this->db);
return -1;
}
}
/* Functions for extrafields */
@ -5059,6 +5130,7 @@ abstract class CommonObject
global $extrafields;
if (empty($rowid)) $rowid = $this->id;
if (empty($rowid)) $rowid = $this->rowid;
// To avoid SQL errors. Probably not the better solution though
if (!$this->table_element) {
@ -5110,7 +5182,6 @@ abstract class CommonObject
$resql = $this->db->query($sql);
if ($resql)
{
$this->array_options = array();
$numrows = $this->db->num_rows($resql);
if ($numrows)
{

View File

@ -323,21 +323,44 @@ class Form
* @param object $object Object
* @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field.
* @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...)
* @param string $check Same coe than $check parameter of GETPOST()
* @param string $morecss More CSS
* @return string HTML code for the edit of alternative language
*/
public function widgetForTranslation($fieldname, $object, $perm, $typeofdata = 'string')
public function widgetForTranslation($fieldname, $object, $perm, $typeofdata = 'string', $check = '', $morecss = '')
{
global $conf, $langs;
$result = '';
if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) {
$result ='<div class="inline-block paddingleft field-'.$object->element.'-'.$fieldname.'">';
$langcode = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE;
$s=picto_from_langcode($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
$result .='<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';
$s=img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang');
$result .= $s;
$result .= '</div>';
$result .='<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';
$valuetoshow = GETPOSTISSET($fieldname."-".$langcode) ? GETPOST($fieldname."-".$langcode, $check) : '';
if (empty($valuetoshow)) {
$object->fetchValueForAlternateLanguages();
//var_dump($object->array_languages);
$valuetoshow = $object->array_languages[$fieldname][$langcode];
}
$s=picto_from_langcode($conf->global->PDF_USE_ALSO_LANGUAGE_CODE, 'class="pictoforlang"');
$result .= $s;
if ($typeofdata == 'textarea') {
$result .= '<textarea name="'.$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';
$result .= $object->address;
$result .= '</textarea>';
} else {
$result .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="'.$fieldname."-".$langcode.'" value="'.$valuetoshow.'">';
}
$result .= '</div>';
$result .= '<script>$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>';
}
return $result;

View File

@ -3127,11 +3127,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
} else {
$pictowithouttext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'address', 'barcode', 'bank', 'bookmark', 'building', 'cash-register', 'check', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
'filter', 'file-code', 'grip', 'grip_title', 'language', 'list', 'listlight', 'note',
'object_bookmark', 'object_list', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',

View File

@ -190,7 +190,7 @@ class doc_generic_project_odt extends ModelePDFProjects
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label($task->table_element, true);
$task->fetch_optionals($task->id);
$task->fetch_optionals();
$resarray = $this->fill_substitutionarray_with_extrafields($task, $resarray, $extrafields, 'task', $outputlangs);

View File

@ -1574,8 +1574,8 @@ if ($action == 'create')
$expLine = new ExpeditionLigne($db);
$srcLine = new OrderLine($db);
$srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline
//$line->fetch_optionals($line->id);
$srcLine->id = $line->id;
$srcLine->fetch_optionals(); // fetch extrafields also available in orderline
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
print $expLine->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1);
@ -2460,7 +2460,7 @@ elseif ($id || $ref)
if (!empty($conf->stock->enabled)) $colspan++;
$line = $lines[$i];
$line->fetch_optionals($line->id);
$line->fetch_optionals();
if ($action == 'editline' && $line->id == $line_id)
{

View File

@ -399,7 +399,7 @@ class ExpenseReport extends CommonObject
// get extrafields so they will be clone
//foreach($this->lines as $line)
//$line->fetch_optionals($line->rowid);
//$line->fetch_optionals();
// Load source object
$objFrom = clone $this;

View File

@ -1183,7 +1183,7 @@ class Fichinter extends CommonObject
// get extrafields so they will be clone
foreach ($this->lines as $line)
$line->fetch_optionals($line->rowid);
$line->fetch_optionals();
// Load source object
$objFrom = clone $this;

View File

@ -1192,7 +1192,7 @@ if (empty($reshook))
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
{
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$lines[$i]->fetch_optionals();
$array_option = $lines[$i]->array_options;
}
@ -1514,7 +1514,7 @@ if ($action == 'create')
$objectsrc->fetch_thirdparty();
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
$projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');

View File

@ -905,6 +905,12 @@ if (empty($reshook))
$objectsrc->fetch($originid);
$objectsrc->fetch_thirdparty();
if (!empty($object->origin) && !empty($object->origin_id))
{
$object->linkedObjectsIds[$object->origin] = $object->origin_id;
}
// Add also link with order if object is reception
if ($object->origin == 'reception')
{
$objectsrc->fetchObjectLinked();
@ -913,14 +919,10 @@ if (empty($reshook))
{
foreach ($objectsrc->linkedObjectsIds['order_supplier'] as $key => $value)
{
$object->linked_objects['order_supplier'] = $value;
$object->linkedObjectsIds['order_supplier'] = $value;
}
}
}
elseif (!empty($object->origin) && !empty($object->origin_id))
{
$object->linkedObjectsIds[$object->origin] = $object->origin_id;
}
$id = $object->create($user);
@ -950,7 +952,7 @@ if (empty($reshook))
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$lines[$i]->fetch_optionals();
}
// Dates
@ -1750,7 +1752,7 @@ if ($action == 'create')
$datedue = ($datetmp == '' ?-1 : $datetmp);
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
}
else

View File

@ -122,7 +122,7 @@ create table llx_object_lang
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_object integer DEFAULT 0 NOT NULL,
type_object varchar(32) NOT NULL,
type_object varchar(32) NOT NULL, -- value found into $object->element
property varchar(32) NOT NULL,
lang varchar(5) DEFAULT 0 NOT NULL,
value text,

View File

@ -23,8 +23,8 @@ create table llx_object_lang
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_object integer DEFAULT 0 NOT NULL,
type_object varchar(32) NOT NULL, -- 'thirdparty', 'contact', '...'
property varchar(32) NOT NULL,
type_object varchar(32) NOT NULL, -- value found into $object->element: 'thirdparty', 'contact', '...'
property varchar(32) NOT NULL, -- name of property
lang varchar(5) DEFAULT 0 NOT NULL,
value text,
import_key varchar(14) DEFAULT NULL

View File

@ -1021,4 +1021,5 @@ StatisticsOn=Statistics on
SelectYourGraphOptionsFirst=Select your graph options to build a graph
Measures=Measures
XAxis=X-Axis
YAxis=Y-Axis
YAxis=Y-Axis
StatusOfRefMustBe=Status of %s must be %s

View File

@ -146,6 +146,7 @@ PDFEratostheneDescription=A complete order model
PDFEdisonDescription=A simple order model
PDFProformaDescription=A complete Proforma invoice template
CreateInvoiceForThisCustomer=Bill orders
CreateInvoiceForThisSupplier=Bill orders
NoOrdersToInvoice=No orders billable
CloseProcessedOrdersAutomatically=Classify "Processed" all selected orders.
OrderCreation=Order creation

View File

@ -515,9 +515,8 @@ else // View
// Other attributes
if ($action == 'create_delivery') {
// copy from expedition
$expeditionExtrafields = new Extrafields($db);
$expeditionExtrafieldLabels = $expeditionExtrafields->fetch_name_optionals_label($expedition->table_element);
if ($expedition->fetch_optionals($object->origin_id) > 0) {
$extrafields->fetch_name_optionals_label($expedition->table_element);
if ($expedition->fetch_optionals() > 0) {
$object->array_options = array_merge($object->array_options, $expedition->array_options);
}
}
@ -625,12 +624,14 @@ else // View
$colspan = 2;
$mode = ($object->statut == 0) ? 'edit' : 'view';
$object->lines[$i]->fetch_optionals($object->lines[$i]->id);
$object->lines[$i]->fetch_optionals();
if ($action == 'create_delivery') {
$srcLine = new ExpeditionLigne($db);
$extrafields->fetch_name_optionals_label($srcLine->table_element);
$srcLine->fetch_optionals($expedition->lines[$i]->id);
$srcLine->id = $expedition->lines[$i]->id;
$srcLine->fetch_optionals();
$object->lines[$i]->array_options = array_merge($object->lines[$i]->array_options, $srcLine->array_options);
}

View File

@ -369,7 +369,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfi
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Fields title search
// --------------------------------------------------------------------

View File

@ -1175,8 +1175,9 @@ if ($action == 'create')
$extrafields->fetch_name_optionals_label($srcLine->table_element);
$extrafields->fetch_name_optionals_label($line->table_element);
$srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline
$line->fetch_optionals($object->id);
$srcLine->id = $line->id;
$srcLine->fetch_optionals(); // fetch extrafields also available in orderline
$line->fetch_optionals();
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
@ -1231,7 +1232,7 @@ elseif ($id || $ref)
$soc = new Societe($db);
$soc->fetch($object->socid);
$res = $object->fetch_optionals($object->id);
$res = $object->fetch_optionals();
$head = reception_prepare_head($object);
dol_fiche_head($head, 'reception', $langs->trans("Reception"), -1, 'reception');
@ -1986,7 +1987,8 @@ elseif ($id || $ref)
{
$colspan = empty($conf->productbatch->enabled) ? 8 : 9;
$line = new CommandeFournisseurDispatch($db);
$line->fetch_optionals($lines[$i]->id);
$line->id = $lines[$i]->id;
$line->fetch_optionals();
if ($action == 'editline' && $lines[$i]->id == $line_id)
{

View File

@ -477,7 +477,7 @@ class Reception extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label($this->table_element, true);
$this->fetch_optionals($this->id);
$this->fetch_optionals();
/*
* Lines

View File

@ -122,7 +122,7 @@ if ($resql)
}
}
else {
print '<tr><td>'.$langs->trans("None").'</td><td></td><td></td></tr>';
print '<tr><td><span class="opacitymedium">'.$langs->trans("None").'</span></td><td></td><td></td></tr>';
}
print "</table></div><br>";
@ -196,7 +196,7 @@ else dol_print_error($db);
/*
* Supplier orders to process
* Open pruchase orders to process
*/
$sql = "SELECT c.rowid, c.ref, c.ref_supplier as ref_supplier, c.fk_statut as status, c.billed as billed, s.nom as name, s.rowid as socid";
@ -221,7 +221,7 @@ if ($resql)
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("SuppliersOrdersToProcess").'</th></tr>';
print '<th colspan="3">'.$langs->trans("SuppliersOrdersToProcess").' <span class="badge">'.$num.'</span></th></tr>';
while ($i < $num)
{
$obj = $db->fetch_object($resql);

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$langs->loadLangs(array("sendings", "receptions", "deliveries", 'companies', 'bills'));
$langs->loadLangs(array("sendings", "receptions", "deliveries", 'companies', 'bills', 'orders'));
$socid = GETPOST('socid', 'int');
$massaction = GETPOST('massaction', 'alpha');
@ -172,7 +172,7 @@ if (empty($reshook))
$rcp = new Reception($db);
// On ne facture que les réceptions validées
if ($rcp->fetch($id_reception) <= 0 || $rcp->statut != 1) {
$errors[] = $langs->trans('StatusMustBeValidate', $rcp->ref);
$errors[] = $langs->trans('StatusOfRefMustBe', $rcp->ref, $langs->transnoentities("StatusSupplierOrderValidatedShort"));
$error++;
continue;
}
@ -184,12 +184,12 @@ if (empty($reshook))
if (!empty($object->rowid))$object->fetchObjectLinked();
$rcp->fetchObjectLinked();
if (count($rcp->linkedObjectsIds['order_supplier']) > 0)
if (count($rcp->linkedObjectsIds['reception']) > 0)
{
foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value)
foreach ($rcp->linkedObjectsIds['reception'] as $key => $value)
{
if (empty($object->linkedObjectsIds['order_supplier']) || !in_array($value, $object->linkedObjectsIds['order_supplier']))//Dont try to link if already linked
$object->add_object_linked('order_supplier', $value); // add supplier order linked object
if (empty($object->linkedObjectsIds['reception']) || !in_array($value, $object->linkedObjectsIds['reception']))//Dont try to link if already linked
$object->add_object_linked('reception', $value); // add supplier order linked object
}
}
}
@ -216,11 +216,11 @@ if (empty($reshook))
$object->origin_id = $id_reception;
$rcp->fetchObjectLinked();
if (count($rcp->linkedObjectsIds['order_supplier']) > 0)
if (count($rcp->linkedObjectsIds['reception']) > 0)
{
foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value)
foreach ($rcp->linkedObjectsIds['reception'] as $key => $value)
{
$object->linked_objects['order_supplier'] = $value;
$object->linked_objects['reception'] = $value;
}
}

View File

@ -1193,7 +1193,7 @@ else
print '<table class="border centpercent">';
// Name, firstname
print '<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate">';
print '<tr class="tr-field-thirdparty-name"><td class="titlefieldcreate tdtop">';
if ($object->particulier || $private)
{
print '<span id="TypeName" class="fieldrequired">'.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').'</span>';
@ -1204,7 +1204,7 @@ else
}
print '</td><td'.(empty($conf->global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>';
print '<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.$object->name.'" autofocus="autofocus">';
print $form->widgetForTranslation("name", $object, $permissiontoadd);
print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300');
print '</td>';
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
@ -1304,10 +1304,11 @@ else
print '<tr><td class="tdtop">';
print $form->editfieldkey('Address', 'address', '', $object, 0);
print '</td>';
print '<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.'" wrap="soft">';
print '<td colspan="3">';
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.'" wrap="soft">';
print $object->address;
print '</textarea>';
print $form->widgetForTranslation("address", $object, $permissiontoadd);
print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent');
print '</td></tr>';
// Zip / Town
@ -1315,9 +1316,9 @@ else
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent');
print '</td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>';
print '<td class="tdtop">'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>';
print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent');
print $form->widgetForTranslation("town", $object, $permissiontoadd);
print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent');
print '</td></tr>';
// Country

View File

@ -141,7 +141,7 @@ llxHeader('', $title, $help_url);
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
if (!empty($object->id)) $res = $object->fetch_optionals($object->id, null);
if (!empty($object->id)) $res = $object->fetch_optionals();
//if ($res < 0) { dol_print_error($db); exit; }

View File

@ -1106,7 +1106,7 @@ if ($action == 'create')
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
if (!empty($conf->multicurrency->enabled))

View File

@ -638,10 +638,10 @@ body[class*="colorblind-"] .text-success{
color : <?php print $textDanger; ?>
}
.editfielda span.fa-pencil-alt, .editfielda span.fa-trash {
.editfielda span.fa-pencil-alt, .editfielda span.fa-trash, .editfieldlang {
color: #ccc !important;
}
.editfielda span.fa-pencil-alt:hover, .editfielda span.fa-trash:hover {
.editfielda span.fa-pencil-alt:hover, .editfielda span.fa-trash:hover, .editfieldlang:hover {
color: var(--colortexttitle) !important;
}
@ -2819,7 +2819,7 @@ div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border
}
div .tdtop {
vertical-align: top !important;
/* padding-top: 8px !important; */
padding-top: 10px !important;
padding-bottom: 2px !important;
padding-bottom: 0px;
}