Fix phpcs

This commit is contained in:
Laurent Destailleur 2018-12-15 13:58:39 +01:00
parent c6d76e29f1
commit dbc85b42ba
15 changed files with 255 additions and 257 deletions

View File

@ -1690,11 +1690,11 @@ class pdf_cyan extends ModelePDFPropales
/**
* Define Array Column Field
*
* @param object $object common object
* @param outputlangs $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @param object $object common object
* @param Translate $outputlangs langs
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return null
*/
function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0)

View File

@ -173,6 +173,7 @@ class doc_generic_reception_odt extends ModelePdfReception
return $texte;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@ -186,6 +187,7 @@ class doc_generic_reception_odt extends ModelePdfReception
*/
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
if (empty($srctemplatepath))
@ -517,6 +519,4 @@ class doc_generic_reception_odt extends ModelePdfReception
return -1;
}
}
}

View File

@ -406,7 +406,7 @@ class pdf_squille extends ModelePdfReception
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage();
@ -585,6 +585,7 @@ class pdf_squille extends ModelePdfReception
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Show total to pay
*
@ -597,6 +598,7 @@ class pdf_squille extends ModelePdfReception
*/
function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs,$totalOrdered)
{
// phpcs:enable
global $conf,$mysoc;
$sign=1;
@ -627,23 +629,23 @@ class pdf_squille extends ModelePdfReception
$totalWeight=$tmparray['weight'];
$totalVolume=$tmparray['volume'];
$totalToShip=$tmparray['toship'];
// Set trueVolume and volume_units not currently stored into database
if ($object->trueWidth && $object->trueHeight && $object->trueDepth)
{
$object->trueVolume= ($object->trueWidth * $object->trueHeight * $object->trueDepth);
$object->volume_units=$object->size_units * 3;
}
if ($totalWeight!='') $totalWeighttoshow=showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs);
if ($totalVolume!='') $totalVolumetoshow=showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs);
if ($object->trueWeight) $totalWeighttoshow=showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
if ($object->trueVolume) $totalVolumetoshow=showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
$pdf->SetFillColor(255,255,255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Total"), 0, 'L', 1);
@ -962,7 +964,7 @@ class pdf_squille extends ModelePdfReception
// If RECEPTION contact defined, we use it
$usecontact=false;
$arrayidcontact=$object->$origin->getIdContact('external','SHIPPING');
if (count($arrayidcontact) > 0)
{
$usecontact=true;
@ -992,7 +994,7 @@ class pdf_squille extends ModelePdfReception
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell($widthrecbox-2, 4, $carac_client, 0, 'L');
// Show recipient
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
@ -1007,8 +1009,8 @@ class pdf_squille extends ModelePdfReception
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient").":", 0, 'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show sender name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B',$default_font_size);
@ -1027,7 +1029,7 @@ class pdf_squille extends ModelePdfReception
/**
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param PDF $pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
@ -1039,6 +1041,4 @@ class pdf_squille extends ModelePdfReception
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'RECEPTION_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}
}

View File

@ -106,7 +106,7 @@ class mod_reception_beryl extends ModelNumRefReception
$sql.= " FROM ".MAIN_DB_PREFIX."reception";
$sql.= " WHERE ref like '".$this->prefix."____-%'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
if ($resql)
{
@ -141,5 +141,4 @@ class mod_reception_beryl extends ModelNumRefReception
{
return $this->getNextValue($objsoc,$objforref);
}
}
}

View File

@ -128,10 +128,8 @@ class mod_reception_moonstone extends ModelNumRefReception
* @param Object $objforref Reception object
* @return string Next free value
*/
function reception_get_num($objsoc,$objforref)
{
return $this->getNextValue($objsoc,$objforref);
}
}
function reception_get_num($objsoc,$objforref)
{
return $this->getNextValue($objsoc,$objforref);
}
}

View File

@ -32,7 +32,8 @@ abstract class ModelePdfReception extends CommonDocGenerator
var $error='';
/**
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Return list of active generation modules
*
* @param DoliDB $db Database handler
@ -41,6 +42,7 @@ abstract class ModelePdfReception extends CommonDocGenerator
*/
static function liste_modeles($db,$maxfilenamelength=0)
{
// phpcs:enable
global $conf;
$type='reception';

View File

@ -46,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->fournisseur->enabled)){
if (! empty($conf->fournisseur->enabled)){
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php';
}
@ -140,7 +140,7 @@ if (empty($reshook))
$object->fetch($id);
$result = $object->reOpen();
}
// Confirm back to draft status
if ($action == 'modif' && $user->rights->reception->creer)
{
@ -220,7 +220,7 @@ if (empty($reshook))
// Create reception
if ($action == 'add' && $user->rights->reception->creer)
{
$error = 0;
$predef = '';
@ -250,7 +250,7 @@ if (empty($reshook))
$objectsrc->fetch($object->origin_id);
$object->socid = $objectsrc->socid;
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
$object->model_pdf = GETPOST('model');
@ -293,23 +293,23 @@ if (empty($reshook))
$stockLocation = "ent1".$i."_0";
$qty = "qtyl".$i;
//var_dump(GETPOST($qty,'int')); var_dump($_POST); var_dump($batch);exit;
//reception line for product with no batch management and no multiple stock location
if (GETPOST($qty, 'int') > 0)
$totalqty += GETPOST($qty, 'int');
// Extrafields
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_options[$i] = $extrafieldsline->getOptionalsFromPost($extralabelsline, $i);
}
if ($totalqty > 0) // There is at least one thing to ship
{
@ -325,19 +325,19 @@ if (empty($reshook))
$eatby = "dlc".$i;
$sellby = "dluo".$i;
$batch = "batch".$i;
$timeFormat = '%d/%m/%Y';
if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->RECEPTION_GETS_ALL_ORDER_PRODUCTS))
{
$ent = "entl".$i;
$idl = "idl".$i;
$entrepot_id = is_numeric(GETPOST($ent, 'int')) ? GETPOST($ent, 'int') : GETPOST('entrepot_id', 'int');
if ($entrepot_id < 0)
$entrepot_id = '';
if (!($linesrc->fk_product > 0) && empty($conf->global->STOCK_SUPPORTS_SERVICES))
@ -346,9 +346,9 @@ if (empty($reshook))
$sellby = GETPOST($sellby, 'alpha');
$eatbydate = str_replace('/','-',$eatby);
$sellbydate = str_replace('/','-',$sellby);
$ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i], GETPOST($comment, 'alpha'), strtotime($eatbydate),strtotime($sellbydate), GETPOST($batch, 'alpha'));
$ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i], GETPOST($comment, 'alpha'), strtotime($eatbydate),strtotime($sellbydate), GETPOST($batch, 'alpha'));
if ($ret < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -356,15 +356,15 @@ if (empty($reshook))
}
}
}
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) $error++;
if (! $error)
{
$ret=$object->create($user); // This create reception (like Odoo picking) and line of receptions. Stock movement will when validating reception.
if ($ret <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
@ -572,14 +572,14 @@ if (empty($reshook))
{
if ($lines[$i]->id == $line_id)
{
// delete single warehouse line
$line->id = $line_id;
if (! $error && $line->delete($user) < 0)
{
$error++;
}
}
unset($_POST["lineid"]);
}
@ -620,23 +620,23 @@ if (empty($reshook))
$line->fk_product = $lines[$i]->fk_product;
if ($lines[$i]->fk_product > 0)
{
// single warehouse reception line
$stockLocation = "entl".$line_id;
$qty = "qtyl".$line_id;
$comment = "comment".$line_id;
$line->id = $line_id;
$line->fk_entrepot = GETPOST($stockLocation, 'int');
$line->qty = GETPOST($qty, 'int');
$line->comment = GETPOST($comment, 'alpha');
if(!empty($conf->productbatch->enabled)){
$batch = "batch".$line_id;
$dlc = "dlc".$line_id;
@ -649,17 +649,17 @@ if (empty($reshook))
$line->eatby = strtotime($eatbydate);
$line->sellby = strtotime($sellbydate);
}
if ($line->update($user) < 0)
{
setEventMessages($line->error, $line->errors, 'errors');
$error++;
}
}
else // Product no predefined
{
@ -759,7 +759,7 @@ if ($action == 'create')
{
if($origin == 'supplierorder')$classname = 'CommandeFournisseur';
else $classname = ucfirst($origin);
$object = new $classname($db);
if ($object->fetch($origin_id)) // This include the fetch_lines
{
@ -949,13 +949,13 @@ if ($action == 'create')
$pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount
$fk_commandefourndet = "fk_commandefourndet_".$reg[1].'_'.$reg[2];
$dispatchLines[$numAsked]=array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'),'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'));
}
// with batch module enabled
if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg))
{
$numAsked ++;
// eat-by date dispatch
// $numline=$reg[2] + 1; // line of product
@ -969,10 +969,10 @@ $numAsked ++;
$dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1].'_'.$reg[2].'month'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'day'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'year']);
$fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2];
$dispatchLines[$numAsked]=array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'),'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'),'DLC'=> $dDLC,'DLUO'=> $dDLUO,'lot'=> GETPOST($lot, 'alpha'));
}
}
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
@ -1004,7 +1004,7 @@ $numAsked ++;
// Load receptions already done for same order
$object->loadReceptions();
if ($numAsked)
{
print '<tr class="liste_titre">';
@ -1022,7 +1022,7 @@ $numAsked ++;
{
print '<td align="left">'.$langs->trans("Warehouse").' ('.$langs->trans("Stock").')</td>';
}
if (!empty($conf->productbatch->enabled))
{
@ -1044,7 +1044,7 @@ $numAsked ++;
break;
}
}
// Show product and description
$type=$line->product_type?$line->product_type:$line->fk_product_type;
@ -1055,8 +1055,8 @@ $numAsked ++;
print '<!-- line '.$line->rowid.' for product -->'."\n";
print '<tr class="oddeven">'."\n";
// Product label
if ($line->fk_product > 0) // If predefined product
{
@ -1066,13 +1066,13 @@ $numAsked ++;
print '<td>';
print '<a name="'.$line->rowid.'"></a>'; // ancre pour retourner sur la ligne
// Show product and description
$product_static->type=$line->fk_product_type;
$product_static->id=$line->fk_product;
$product_static->ref=$line->ref;
$product_static->status_batch=$line->product_tobatch;
$text=$product_static->getNomUrl(1);
$text.= ' - '.(! empty($line->label)?$line->label:$line->product_label);
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->desc));
@ -1106,7 +1106,7 @@ $numAsked ++;
print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end));
print "</td>\n";
}
// Qty
print '<td align="center">'.$line->qty;
print '<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.'" value=\''.$line->id.'\' />';
@ -1117,14 +1117,14 @@ $numAsked ++;
// Qty already received
print '<td align="center">';
$quantityDelivered = $object->receptions[$line->id];
print $quantityDelivered;
print '<input name="qtydelivered'.$indiceAsked.'" id="qtydelivered'.$indiceAsked.'" type="hidden" value="'.$quantityDelivered.'">';
print '</td>';
if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
$quantityToBeDelivered = 0;
@ -1134,18 +1134,18 @@ $numAsked ++;
$quantityToBeDelivered = $dispatchLines[$indiceAsked]['qty'];
}
$warehouse_id = $dispatchLines[$indiceAsked]['ent'];
$warehouseObject = null;
if ( !empty($conf->stock->enabled)) // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection
{
print '<!-- Case warehouse already known or product not a predefined product -->';
$stock = + $product->stock_warehouse[$dispatchLines[$indiceAsked]['ent']]->real; // Convert to number
$deliverableQty=$dispatchLines[$indiceAsked]['qty'];
// Quantity to send
print '<td align="center">';
if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
@ -1156,7 +1156,7 @@ $numAsked ++;
}
else print $langs->trans("NA");
print '</td>';
// Stock
if (! empty($conf->stock->enabled))
{
@ -1171,7 +1171,7 @@ $numAsked ++;
{
print '<!-- Show warehouse selection -->';
print $formproduct->selectWarehouses($tmpentrepot_id, 'entl'.$indiceAsked, '', 0 , 0, $line->fk_product, '', 1);
}
}
else
@ -1180,7 +1180,7 @@ $numAsked ++;
}
print '</td>';
}
if(!empty($conf->productbatch->enabled) ){
if( !empty($product->status_batch)){
print '<td><input name="batch'.$indiceAsked.'" value="'.$dispatchLines[$indiceAsked]['lot'].'"></td>';
@ -1192,19 +1192,19 @@ $numAsked ++;
print '</td>';
}else {
print '<td colspan="3"></td>';
}
}
print "</tr>\n";
}
//Display lines extrafields
@ -1257,7 +1257,7 @@ else if ($id || $ref)
$lines = $object->lines;
$num_prod = count($lines);
if ($object->id > 0)
{
if (!empty($object->origin) && $object->origin_id > 0)
@ -1273,7 +1273,7 @@ else if ($id || $ref)
$soc->fetch($object->socid);
$res = $object->fetch_optionals($object->id, $extralabels);
$head=reception_prepare_head($object);
dol_fiche_head($head, 'reception', $langs->trans("Reception"), -1, 'reception');
@ -1355,10 +1355,10 @@ else if ($id || $ref)
$linkback = '<a href="'.DOL_URL_ROOT.'/reception/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
// Ref customer reception
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
@ -1571,7 +1571,7 @@ else if ($id || $ref)
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
@ -1616,7 +1616,7 @@ else if ($id || $ref)
print '</tr>';
// Tracking Number
print '<tr><td class="titlefield">'.$form->editfieldkey("TrackingNumber",'tracking_number',$object->tracking_number,$object,$user->rights->reception->creer).'</td><td colspan="3">';
print $form->editfieldval("TrackingNumber",'tracking_number',$object->tracking_url,$object,$user->rights->reception->creer,'string',$object->tracking_number);
print '</td></tr>';
@ -1756,9 +1756,9 @@ else if ($id || $ref)
// Get list of products already sent for same source object into $alreadysent
$alreadysent = array();
$origin = 'commande_fournisseur';
if ($origin && $origin_id > 0)
{
$sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end";
@ -1779,7 +1779,7 @@ else if ($id || $ref)
$sql.= " AND ed.fk_reception !=".$object->id;
//if ($filter) $sql.= $filter;
$sql.= " ORDER BY obj.fk_product";
dol_syslog("get list of reception lines", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
@ -1828,8 +1828,8 @@ else if ($id || $ref)
print '<td>';
$text=$lines[$i]->product->getNomUrl(1);
$text.= ' - '.$label;
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->product->description));
@ -1857,7 +1857,7 @@ else if ($id || $ref)
print_date_range($lines[$i]->date_start,$lines[$i]->date_end);
print "</td>\n";
}
if ($action == 'editline' && $lines[$i]->id == $line_id)
{
print '<td ><textarea name="comment'.$line_id.'" id="comment'.$line_id.'" /> '.$lines[$i]->comment.'</textarea></td>';
@ -1889,7 +1889,7 @@ else if ($id || $ref)
$reception_static->fetch($receptionline_var['reception_id']);
print $reception_static->getNomUrl(1);
print ' - '.$receptionline_var['qty'];
$htmltext=$langs->trans("DateValidation").' : '.(empty($receptionline_var['date_valid'])?$langs->trans("Draft"):dol_print_date($receptionline_var['date_valid'], 'dayhour'));
if (! empty($conf->stock->enabled) && $receptionline_var['warehouse'] > 0)
{
@ -1927,7 +1927,7 @@ else if ($id || $ref)
print '</td>';
}
print '</tr>';
}
else
{
@ -1953,14 +1953,14 @@ else if ($id || $ref)
if (! empty($conf->stock->enabled))
{
print '<td align="left">';
if ($lines[$i]->fk_entrepot > 0)
{
$entrepot = new Entrepot($db);
$entrepot->fetch($lines[$i]->fk_entrepot);
print $entrepot->getNomUrl(1);
}
print '</td>';
}
@ -1974,13 +1974,13 @@ else if ($id || $ref)
$detail ='';
if ($lines[$i]->product->status_batch)
{
$detail.= $langs->trans("Batch").': '.$lines[$i]->batch;
$detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($lines[$i]->sellby,"day");
$detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($lines[$i]->eatby,"day");
$detail.= '<br>';
print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail);
}
else
@ -2006,7 +2006,7 @@ else if ($id || $ref)
else print '&nbsp;';
print '</td>';
if ($action == 'editline' && $lines[$i]->id == $line_id)
{
print '<td align="center" colspan="2" valign="middle">';
@ -2130,7 +2130,7 @@ else if ($id || $ref)
}
}
// Close
if ($object->statut == Reception::STATUS_VALIDATED)
{
@ -2173,7 +2173,7 @@ else if ($id || $ref)
$genallowed=$user->rights->reception->lire;
$delallowed=$user->rights->reception->creer;
print $formfile->showdocuments('reception',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
@ -2185,7 +2185,7 @@ else if ($id || $ref)
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
}
if ($action == 'presend')
{
$ref = dol_sanitizeFileName($object->ref);

View File

@ -73,7 +73,7 @@ class Reception extends CommonObject
var $trueSize;
var $date_delivery; // Date delivery planed
/**
* Effective delivery date
@ -148,10 +148,10 @@ class Reception extends CommonObject
}
$obj = new $classname();
$numref = "";
$numref = $obj->getNextValue($soc,$this);
if ( $numref != "")
{
return $numref;
@ -245,9 +245,9 @@ class Reception extends CommonObject
$sql.= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."reception");
@ -264,13 +264,13 @@ class Reception extends CommonObject
for ($i = 0; $i < $num; $i++)
{
$this->lines[$i]->fk_reception = $this->id;
if (! $this->lines[$i]->create($user) > 0)
{
$error++;
}
}
if (! $error && $this->id && $this->origin_id)
@ -349,7 +349,7 @@ class Reception extends CommonObject
}
}
/**
* Get object and lines from database
@ -449,8 +449,8 @@ class Reception extends CommonObject
* Thirparty
*/
$result=$this->fetch_thirdparty();
// Retrieve all extrafields for reception
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@ -521,17 +521,17 @@ class Reception extends CommonObject
$soc = new Societe($this->db);
$soc->fetch($this->socid);
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{
{
$numref = $this->getNextNumRef($soc);
}
else {
$numref = $this->ref;
}
$this->newref = $numref;
$now=dol_now();
@ -567,8 +567,8 @@ class Reception extends CommonObject
$sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed";
$sql.= " WHERE ed.fk_reception = ".$this->id;
$sql.= " AND cd.rowid = ed.fk_commandefourndet";
dol_syslog(get_class($this)."::valid select details", LOG_DEBUG);
$resql=$this->db->query($sql);
@ -578,9 +578,9 @@ class Reception extends CommonObject
for ($i = 0; $i < $cpt; $i++)
{
$obj = $this->db->fetch_object($resql);
$qty = $obj->qty;
if ($qty <= 0) continue;
dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid);
@ -625,7 +625,7 @@ class Reception extends CommonObject
}
}
// Change status of order to "reception in process"
$ret = $this->setStatut(4, $this->origin_id, 'commande_fournisseur');
@ -731,11 +731,11 @@ class Reception extends CommonObject
$supplierorderline = new CommandeFournisseurLigne($this->db);
$supplierorderline->fetch($id);
if (! empty($conf->stock->enabled) && ! empty($supplierorderline->fk_product))
{
$fk_product = $supplierorderline->fk_product;
if (! ($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_RECEPTIONS))
{
$langs->load("errors");
@ -743,13 +743,13 @@ class Reception extends CommonObject
return -1;
}
}
// extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
$line->array_options = $array_options;
$line->fk_product = $fk_product;
$line->fk_commande = $supplierorderline->fk_commande ;
$line->fk_user = $user->id ;
@ -876,11 +876,11 @@ class Reception extends CommonObject
{
global $conf, $langs, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error=0;
$this->error='';
$this->db->begin();
// Stock control
@ -910,11 +910,11 @@ class Reception extends CommonObject
$mouvS = new MouvementStock($this->db);
// we do not log origin because it will be deleted
$mouvS->origin = null;
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref),'', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed
}
}
else
@ -1038,7 +1038,7 @@ class Reception extends CommonObject
dol_include_once('/fourn/class/fournisseur.commande.dispatch.class.php');
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch WHERE fk_reception='.$this->id;
$resql = $db->query($sql);
if(!empty($resql)){
$this->lines = array();
while ($obj = $resql->fetch_object()){
@ -1064,23 +1064,23 @@ class Reception extends CommonObject
$line->description = '';
$line->label = $obj->label;
}
$pu_ht=($line->subprice*$line->qty)*(100-$line->remise_percent)/100;
$tva = $pu_ht*$line->tva_tx/100;
$this->total_ht += $pu_ht;
$this->total_tva += $pu_ht*$line->tva_tx/100;
$this->total_ttc += $pu_ht+$tva;
$this->lines[]=$line;
}
return 1;
}else {
return -1;
}
}
/**
@ -1252,7 +1252,7 @@ class Reception extends CommonObject
$line->desc=$langs->trans("Description")." ".$xnbp;
$line->libelle=$langs->trans("Description")." ".$xnbp;
$line->qty=10;
$line->fk_product=$this->commande->lines[$xnbp]->fk_product;
$this->lines[]=$line;
@ -1260,7 +1260,7 @@ class Reception extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Set the planned delivery date
@ -1388,7 +1388,7 @@ class Reception extends CommonObject
}
if ($resql < 0) dol_print_error($this->db,'');
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Activate delivery method.
@ -1406,7 +1406,7 @@ class Reception extends CommonObject
$resql = $this->db->query($sql);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* DesActivate delivery method.
@ -1530,16 +1530,16 @@ class Reception extends CommonObject
dol_syslog(get_class($this)."::valid select details", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$cpt = $this->db->num_rows($resql);
for ($i = 0; $i < $cpt; $i++)
{
$obj = $this->db->fetch_object($resql);
$qty = $obj->qty;
if ($qty <= 0) continue;
dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid);
@ -1557,7 +1557,7 @@ class Reception extends CommonObject
$this->errors = $mouvS->errors;
$error++; break;
}
}
else
{
@ -1565,14 +1565,14 @@ class Reception extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr",$numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch);
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
$error++; break;
}
}
}
}
else
@ -1621,10 +1621,10 @@ class Reception extends CommonObject
$error=0;
$this->db->begin();
$this->setClosed();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'reception SET billed=1';
$sql = 'UPDATE '.MAIN_DB_PREFIX.'reception SET billed=1';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
$resql=$this->db->query($sql);
@ -1693,7 +1693,7 @@ class Reception extends CommonObject
$sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed";
$sql.= " WHERE ed.fk_reception = ".$this->id;
$sql.= " AND cd.rowid = ed.fk_commandefourndet";
dol_syslog(get_class($this)."::valid select details", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
@ -1702,11 +1702,11 @@ class Reception extends CommonObject
for ($i = 0; $i < $cpt; $i++)
{
$obj = $this->db->fetch_object($resql);
$qty = $obj->qty;
if ($qty <= 0) continue;
dol_syslog(get_class($this)."::reopen reception movement index ".$i." ed.rowid=".$obj->rowid);
//var_dump($this->lines[$i]);
@ -1754,7 +1754,7 @@ class Reception extends CommonObject
$error++;
}
}
if($this->origin == 'order_supplier'){
$commande = new CommandeFournisseur($this->db);
$commande->fetch($this->origin_id);
@ -1777,8 +1777,8 @@ class Reception extends CommonObject
return -1;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Set draft status
@ -1840,10 +1840,10 @@ class Reception extends CommonObject
for ($i = 0; $i < $cpt; $i++)
{
$obj = $this->db->fetch_object($resql);
$qty = $obj->qty;
if ($qty <= 0) continue;
dol_syslog(get_class($this)."::reopen reception movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid);
@ -1861,7 +1861,7 @@ class Reception extends CommonObject
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
$error++; break;
}
}
else
@ -1876,7 +1876,7 @@ class Reception extends CommonObject
$error++; break;
}
}
}
}
else
@ -1885,7 +1885,7 @@ class Reception extends CommonObject
$error++;
}
}
if (!$error) {
// Call trigger
$result=$this->call_trigger('RECEPTION_UNVALIDATE',$user);
@ -1899,7 +1899,7 @@ class Reception extends CommonObject
$origin = $this->origin;
if ($this->$origin->statut == 4) // If order source of reception is "partially received"
{
// Check if there is no more reception validated.
// Check if there is no more reception validated.
$this->$origin->fetchObjectLinked();
$setStatut = 1;
if (!empty($this->$origin->linkedObjects['reception']))
@ -1970,7 +1970,7 @@ class Reception extends CommonObject
$modelpath = "core/modules/reception/doc/";
$this->fetch_origin();
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}

View File

@ -42,7 +42,7 @@ class ReceptionStats extends Stats
var $from;
var $field;
var $where;
/**
* Constructor
@ -55,13 +55,13 @@ class ReceptionStats extends Stats
function __construct($db, $socid, $mode, $userid=0)
{
global $user, $conf;
$this->db = $db;
$this->socid = ($socid > 0 ? $socid : 0);
$this->userid = $userid;
$this->cachefilesuffix = $mode;
$this->cachefilesuffix = $mode;
$object=new Reception($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
//$this->from.= ", ".MAIN_DB_PREFIX."societe as s";

View File

@ -52,14 +52,14 @@ if ($id > 0 || ! empty($ref))
{
$object->fetch($id, $ref);
$object->fetch_thirdparty();
if (!empty($object->origin))
{
$origin = $object->origin;
$object->fetch_origin();
$typeobject = $object->origin;
}
// Linked documents
@ -94,7 +94,7 @@ if ($action == 'addcontact' && $user->rights->reception->creer)
}
else
{
if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
$mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
@ -164,7 +164,7 @@ if ($id > 0 || ! empty($ref))
// Reception card
$linkback = '<a href="'.DOL_URL_ROOT.'/reception/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
// Ref customer reception
$morehtmlref.=$form->editfieldkey("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', 0, 1);
@ -206,11 +206,11 @@ if ($id > 0 || ! empty($ref))
}
}
$morehtmlref.='</div>';
$object->picto = 'sending';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
//print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
@ -239,23 +239,23 @@ if ($id > 0 || ! empty($ref))
print "</td>\n";
print '</tr>';
}
print "</table>";
//print '</div>';
//print '<div class="fichehalfright">';
//print '<div class="ficheaddleft">';
//print '<div class="underbanner clearboth"></div>';
//print '</div>';
//print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
// Lignes de contacts
@ -268,7 +268,7 @@ if ($id > 0 || ! empty($ref))
$res=@include dol_buildpath($reldir.'/contacts.tpl.php');
if ($res) break;
}
}

View File

@ -94,11 +94,11 @@ if ($resql)
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$reception->id=$obj->rowid;
$reception->ref=$obj->ref;
$reception->ref_supplier=$obj->ref_supplier;
$reception->ref_supplier=$obj->ref_supplier;
print '<tr class="oddeven"><td class="nowrap">';
print $reception->getNomUrl(1);
print "</td>";
@ -149,10 +149,10 @@ if ($resql)
$orderstatic->ref_supplier=$obj->ref_supplier;
$orderstatic->statut=$obj->fk_statut;
$orderstatic->facturee=0;
$companystatic->name=$obj->name;
$companystatic->id=$obj->socid;
$companystatic->id=$obj->socid;
print '<tr class="oddeven">';
print '<td class="nowrap">';
print $orderstatic->getNomUrl(1);
@ -203,16 +203,16 @@ if ( $resql )
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$orderstatic->id=$obj->rowid;
$orderstatic->ref=$obj->ref;
$orderstatic->ref_supplier=$obj->ref_supplier;
$orderstatic->statut=$obj->status;
$orderstatic->facturee=$obj->billed;
$companystatic->name=$obj->name;
$companystatic->id=$obj->socid;
$companystatic->id=$obj->socid;
print '<tr class="oddeven"><td>';
print $orderstatic->getNomUrl(1);
print '</td>';
@ -263,11 +263,11 @@ if ($resql)
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$reception->id=$obj->rowid;
$reception->ref=$obj->ref;
$reception->ref_supplier=$obj->ref_supplier;
$reception->ref_supplier=$obj->ref_supplier;
print '<tr class="oddeven"><td>';
print $reception->getNomUrl(1);
print '</td>';

View File

@ -169,7 +169,7 @@ if (empty($reshook))
$db->begin();
$errors =array();
foreach($receptions as $id_reception)
{
{
$rcp = new Reception($db);
// On ne facture que les réceptions validées
if ($rcp->fetch($id_reception) <= 0 || $rcp->statut != 1){
@ -177,14 +177,14 @@ if (empty($reshook))
$error++;
continue;
}
$object = new FactureFournisseur($db);
if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])){
$object = $TFactThird[$rcp->socid]; // If option "one bill per third" is set, we use already created reception.
if(empty($object->rowid)&&$object->id != null)$object->rowid = $object->id;
if(!empty($object->rowid))$object->fetchObjectLinked();
$rcp->fetchObjectLinked();
if (count($rcp->linkedObjectsIds['order_supplier']) > 0)
{
foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value)
@ -193,12 +193,12 @@ if (empty($reshook))
$object->add_object_linked('order_supplier', $value); // add supplier order linked object
}
}
}
else {
$object->socid = $rcp->socid;
$object->type = FactureFournisseur::TYPE_STANDARD;
$object->cond_reglement_id = $rcp->thirdparty->cond_reglement_supplier_id;
@ -219,7 +219,7 @@ if (empty($reshook))
$object->date = $datefacture;
$object->origin = 'reception';
$object->origin_id = $id_reception;
$rcp->fetchObjectLinked();
if (count($rcp->linkedObjectsIds['order_supplier']) > 0)
{
@ -228,7 +228,7 @@ if (empty($reshook))
$object->linked_objects['order_supplier'] = $value;
}
}
$res = $object->create($user);
//var_dump($object->error);exit;
if($res > 0){
@ -251,7 +251,7 @@ if (empty($reshook))
$error++;
}
}
if (! $error)
{
$lines = $rcp->lines;
@ -332,11 +332,11 @@ if (empty($reshook))
$lines[$i]->rowid,
0,
$lines[$i]->ref_supplier
);
$rcp->add_object_linked('facture_fourn_det',$result);
if ($result > 0)
{
$lineid=$result;
@ -366,7 +366,7 @@ if (empty($reshook))
// Build doc with all invoices
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
$toselect = array();
if (! $error && $validate_invoices)
{
$massaction = $action = 'builddoc';
@ -399,7 +399,7 @@ if (empty($reshook))
}
else
{
$db->rollback();
$action='create';
$_GET["origin"]=$_POST["origin"];
@ -408,7 +408,7 @@ if (empty($reshook))
$error++;
}
}
}
@ -513,7 +513,7 @@ if ($resql)
$num = $db->num_rows($resql);
$reception = new Reception($db);
$arrayofselected=is_array($toselect)?$toselect:array();
$param='';
@ -524,12 +524,12 @@ if ($resql)
if ($search_ref_liv) $param.= "&amp;search_ref_liv=".$search_ref_liv;
if ($search_company) $param.= "&amp;search_company=".$search_company;
if ($optioncss != '') $param.='&amp;optioncss='.$optioncss;
if ($search_billed != '' && $search_billed >= 0)$param.= "&amp;search_billed=".$search_billed;
if ($search_billed != '' && $search_billed >= 0)$param.= "&amp;search_billed=".$search_billed;
if ($search_town) $param.= "&amp;search_town=".$search_town;
if ($search_zip) $param.= "&amp;search_zip=".$search_zip;
if ($search_state) $param.= "&amp;search_state=".$search_state;
if ($viewstatut) $param.= "&amp;viewstatut=".$viewstatut;
if ($search_country) $param.= "&amp;search_country=".$search_country;
if ($search_country) $param.= "&amp;search_country=".$search_country;
if ($search_type_thirdparty) $param.= "&amp;search_type_thirdparty=".$search_type_thirdparty;
if ($search_ref_supplier) $param.= "&amp;search_ref_supplier=".$search_ref_supplier;
// Add $param from extra fields
@ -539,12 +539,12 @@ if ($resql)
$tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
$arrayofmassactions = array(
// 'presend'=>$langs->trans("SendByMail"),
);
if($user->rights->fournisseur->facture->creer)$arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisSupplier");
if($massaction == 'createbills') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
@ -562,7 +562,7 @@ if ($resql)
print_barre_liste($langs->trans('ListOfReceptions'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$massactionbutton,$num, $nbtotalofrecords, '', 0, '', '', $limit);
if ($massaction == 'createbills')
{
//var_dump($_REQUEST);
@ -610,7 +610,7 @@ if ($resql)
print '</div>';
print '<br>';
}
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
@ -807,7 +807,7 @@ if ($resql)
$reception->id=$obj->rowid;
$reception->ref=$obj->ref;
$companystatic->id=$obj->socid;
$companystatic->ref=$obj->name;
$companystatic->name=$obj->name;
@ -825,7 +825,7 @@ if ($resql)
$urlsource=$_SERVER['PHP_SELF'].'?id='.$reception->rowid;
print $formfile->getDocumentsLink($reception->element, $filename, $filedir);
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}

View File

@ -101,7 +101,7 @@ if ($id > 0 || ! empty($ref))
$head=reception_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans("Reception"), -1, 'sending');
// Reception card
$linkback = '<a href="'.DOL_URL_ROOT.'/reception/list.php">'.$langs->trans("BackToList").'</a>';
@ -146,13 +146,13 @@ if ($id > 0 || ! empty($ref))
}
}
$morehtmlref.='</div>';
$object->picto = 'sending';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="underbanner clearboth"></div>';
$cssclass='titlefield';
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';

View File

@ -276,17 +276,17 @@ foreach ($data as $val)
while (! empty($year) && $oldyear > $year+1)
{ // If we have empty year
$oldyear--;
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>';
/*print '<td align="right">0</td>';
print '<td align="right">0</td>';*/
print '</tr>';
}
print '<tr class="oddeven" height="24">';
print '<td align="center">';
if ($year) print '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.'">'.$year.'</a>';

View File

@ -14,7 +14,6 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
?>