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

This commit is contained in:
Laurent Destailleur 2019-03-06 11:49:52 +01:00
commit 5a07281bb3
36 changed files with 149 additions and 91 deletions

View File

@ -288,15 +288,16 @@ class Members extends DolibarrApi
return $member; return $member;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Remove the subscriptions because they are handled as a subresource. // Remove the subscriptions because they are handled as a subresource.

View File

@ -266,15 +266,16 @@ class MembersTypes extends DolibarrApi
return $membertype; return $membertype;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->array_options); unset($object->array_options);

View File

@ -274,7 +274,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id; $upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id;
} }
else if ($modulepart == 'adherent' || $modulepart == 'member') elseif ($modulepart == 'adherent' || $modulepart == 'member')
{ {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@ -290,7 +290,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member'); $upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member');
} }
else if ($modulepart == 'propal' || $modulepart == 'proposal') elseif ($modulepart == 'propal' || $modulepart == 'proposal')
{ {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
@ -306,7 +306,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal'); $upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal');
} }
else if ($modulepart == 'commande' || $modulepart == 'order') elseif ($modulepart == 'commande' || $modulepart == 'order')
{ {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -322,7 +322,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->commande->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'commande'); $upload_dir = $conf->commande->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'commande');
} }
else if ($modulepart == 'shipment' || $modulepart == 'expedition') elseif ($modulepart == 'shipment' || $modulepart == 'expedition')
{ {
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
@ -338,7 +338,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->expedition->dir_output . "/sending/" . get_exdir(0, 0, 0, 1, $object, 'shipment'); $upload_dir = $conf->expedition->dir_output . "/sending/" . get_exdir(0, 0, 0, 1, $object, 'shipment');
} }
else if ($modulepart == 'facture' || $modulepart == 'invoice') elseif ($modulepart == 'facture' || $modulepart == 'invoice')
{ {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@ -354,7 +354,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice'); $upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice');
} }
else if ($modulepart == 'produit' || $modulepart == 'product') elseif ($modulepart == 'produit' || $modulepart == 'product')
{ {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@ -370,7 +370,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product'); $upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product');
} }
else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
{ {
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@ -600,7 +600,8 @@ class Documents extends DolibarrApi
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
private function _validate_file($data) { private function _validate_file($data)
{
// phpcs:enable // phpcs:enable
$result = array(); $result = array();
foreach (Documents::$DOCUMENT_FIELDS as $field) { foreach (Documents::$DOCUMENT_FIELDS as $field) {

View File

@ -273,14 +273,16 @@ class Setup extends DolibarrApi
return $list; return $list;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->error); unset($object->error);

View File

@ -283,14 +283,16 @@ class BillOfMaterialsApi extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
/*unset($object->note); /*unset($object->note);

View File

@ -261,15 +261,16 @@ class Categories extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param Categorie $object Object to clean * @param Categorie $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Remove fields not relevent to categories // Remove fields not relevent to categories

View File

@ -313,15 +313,16 @@ class AgendaEvents extends DolibarrApi
return $event; return $event;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->usermod); unset($object->usermod);

View File

@ -782,15 +782,16 @@ class Proposals extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->note); unset($object->note);

View File

@ -838,15 +838,16 @@ class Orders extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->note); unset($object->note);

View File

@ -248,14 +248,16 @@ class BankAccounts extends DolibarrApi
return $account; return $account;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->rowid); unset($object->rowid);

View File

@ -1417,15 +1417,16 @@ class Invoices extends DolibarrApi
return $paiement_id; return $paiement_id;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->note); unset($object->note);

View File

@ -633,15 +633,16 @@ class Contracts extends DolibarrApi
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->address); unset($object->address);

View File

@ -54,6 +54,12 @@ if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/com
class pdf_beluga extends ModelePDFProjects class pdf_beluga extends ModelePDFProjects
{ {
/**
* Page orientation
* @var string 'P' or 'Portait' (default), 'L' or 'Landscape'
*/
private $orientation = '';
/** /**
* Issuer * Issuer
* @var Societe * @var Societe
@ -79,8 +85,14 @@ class pdf_beluga extends ModelePDFProjects
// Dimension page pour format A4 // Dimension page pour format A4
$this->type = 'pdf'; $this->type = 'pdf';
$formatarray=pdf_getFormat(); $formatarray=pdf_getFormat();
$this->orientation = 'L';
if ($this->orientation == 'L' || $this->orientation == 'Landscape') {
$this->page_largeur = $formatarray['height'];
$this->page_hauteur = $formatarray['width'];
} else {
$this->page_largeur = $formatarray['width']; $this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height']; $this->page_hauteur = $formatarray['height'];
}
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
@ -96,12 +108,21 @@ class pdf_beluga extends ModelePDFProjects
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined
// Defini position des colonnes // Defini position des colonnes
if ($this->orientation == 'L' || $this->orientation == 'Landscape') {
$this->posxref=$this->marge_gauche+1;
$this->posxdate=$this->marge_gauche+105;
$this->posxsociety=$this->marge_gauche+125;
$this->posxamountht=$this->marge_gauche+190;
$this->posxamountttc=$this->marge_gauche+215;
$this->posxstatut=$this->marge_gauche+245;
} else {
$this->posxref=$this->marge_gauche+1; $this->posxref=$this->marge_gauche+1;
$this->posxdate=$this->marge_gauche+25; $this->posxdate=$this->marge_gauche+25;
$this->posxsociety=$this->marge_gauche+45; $this->posxsociety=$this->marge_gauche+45;
$this->posxamountht=$this->marge_gauche+110; $this->posxamountht=$this->marge_gauche+110;
$this->posxamountttc=$this->marge_gauche+135; $this->posxamountttc=$this->marge_gauche+135;
$this->posxstatut=$this->marge_gauche+165; $this->posxstatut=$this->marge_gauche+165;
}
if ($this->page_largeur < 210) // To work with US executive format if ($this->page_largeur < 210) // To work with US executive format
{ {
$this->posxref-=20; $this->posxref-=20;
@ -217,7 +238,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
// New page // New page
$pdf->AddPage(); $pdf->AddPage($this->orientation);
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++; $pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs); $this->_pagehead($pdf, $object, 1, $outputlangs);
@ -433,7 +454,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$pdf->setTopMargin($tab_top_newpage); $pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage(); $pageposbefore=$pdf->getPage();
// Description of line // Description of line
@ -469,7 +490,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->rollbackTransaction(true); $pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore; $pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit; //print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
// Label // Label
$pdf->SetXY($this->posxref, $curY); $pdf->SetXY($this->posxref, $curY);
$posybefore=$pdf->GetY(); $posybefore=$pdf->GetY();
@ -480,7 +501,7 @@ class pdf_beluga extends ModelePDFProjects
{ {
if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page
{ {
$pdf->AddPage('', '', true); $pdf->AddPage($this->orientation, '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1); $pdf->setPage($pageposafter+1);
@ -495,9 +516,9 @@ class pdf_beluga extends ModelePDFProjects
{ {
$pdf->rollbackTransaction(true); $pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore; $pageposafter=$pageposbefore;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->AddPage('', '', true); $pdf->AddPage($this->orientation, '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1); $pdf->setPage($pageposafter+1);
@ -505,7 +526,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$curY = $tab_top_newpage + $heightoftitleline + 1; $curY = $tab_top_newpage + $heightoftitleline + 1;
// Label // Label
@ -528,7 +549,7 @@ class pdf_beluga extends ModelePDFProjects
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore); $pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute); $pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page // We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
@ -628,7 +649,7 @@ class pdf_beluga extends ModelePDFProjects
$this->_pagefoot($pdf, $object, $outputlangs, 1); $this->_pagefoot($pdf, $object, $outputlangs, 1);
$pagenb++; $pagenb++;
$pdf->setPage($pagenb); $pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation($this->orientation, 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
} }
} }

View File

@ -326,15 +326,16 @@ class Donations extends DolibarrApi
return $this->_cleanObjectDatas($this->don); return $this->_cleanObjectDatas($this->don);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->note); unset($object->note);

View File

@ -610,15 +610,16 @@ class Shipments extends DolibarrApi
} }
*/ */
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->thirdparty); // id already returned unset($object->thirdparty); // id already returned

View File

@ -489,15 +489,16 @@ class ExpenseReports extends DolibarrApi
); );
}*/ }*/
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->barcode_type); unset($object->barcode_type);

View File

@ -417,15 +417,16 @@ class Interventions extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->statuts_short); unset($object->statuts_short);

View File

@ -333,15 +333,16 @@ class SupplierInvoices extends DolibarrApi
); );
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param Object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->rowid); unset($object->rowid);

View File

@ -330,15 +330,16 @@ class SupplierOrders extends DolibarrApi
); );
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param Object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->rowid); unset($object->rowid);

View File

@ -280,14 +280,16 @@ class MyModuleApi extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
/*unset($object->note); /*unset($object->note);

View File

@ -186,7 +186,7 @@ class mymodulewidget1 extends ModeleBoxes
'tr' => 'class="left"', 'tr' => 'class="left"',
'text' => '' 'text' => ''
), ),
0 => array( // TR 1 => array( // TR
'tr' => 'class="left"', 'tr' => 'class="left"',
'text' => '' 'text' => ''
) )

View File

@ -468,15 +468,16 @@ class Products extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->regeximgext); unset($object->regeximgext);

View File

@ -274,15 +274,16 @@ class StockMovements extends DolibarrApi
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param MouvementStock $object Object to clean * @param MouvementStock $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Remove useless data // Remove useless data

View File

@ -243,15 +243,16 @@ class Warehouses extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param Entrepot $object Object to clean * @param Entrepot $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Remove the subscriptions because they are handled as a subresource. // Remove the subscriptions because they are handled as a subresource.

View File

@ -534,15 +534,16 @@ class Projects extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->titre); unset($object->titre);

View File

@ -547,15 +547,16 @@ class Tasks extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->barcode_type); unset($object->barcode_type);

View File

@ -379,15 +379,16 @@ class Contacts extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param Object $object Object to clean * @param Object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->total_ht); unset($object->total_ht);

View File

@ -1626,14 +1626,16 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array(
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->nom); // ->name already defined and nom deprecated unset($object->nom); // ->name already defined and nom deprecated

View File

@ -190,15 +190,16 @@ class Supplierproposals extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->name); unset($object->name);

View File

@ -1839,7 +1839,7 @@ a.tmenuimage {
$found=1; $found=1;
break; break;
} }
else if (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité elseif (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité
{ {
$url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); $url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
$found=1; $found=1;

View File

@ -1819,7 +1819,7 @@ foreach($mainmenuusedarray as $val)
$found=1; $found=1;
break; break;
} }
else if (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité elseif (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité
{ {
$url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); $url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1);
$found=1; $found=1;

View File

@ -513,7 +513,7 @@ class Tickets extends DolibarrApi
return $ticket; return $ticket;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
@ -523,9 +523,9 @@ class Tickets extends DolibarrApi
* @todo use an array for properties to clean * @todo use an array for properties to clean
* *
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Other attributes to clean // Other attributes to clean

View File

@ -528,9 +528,12 @@ class Ticket extends CommonObject
$this->severity_label = $label_severity; $this->severity_label = $label_severity;
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_read = $this->db->jdate($obj->date_read); $this->date_read = $this->db->jdate($obj->date_read);
$this->date_validation = $this->db->jdate($obj->date_read);
$this->date_close = $this->db->jdate($obj->date_close); $this->date_close = $this->db->jdate($obj->date_close);
$this->tms = $this->db->jdate($obj->tms); $this->tms = $this->db->jdate($obj->tms);
$this->date_modification = $this->db->jdate($obj->tms);
$this->fetch_optionals(); $this->fetch_optionals();

View File

@ -580,7 +580,7 @@ foreach($object->fields as $key => $val)
if ($key == 'fk_statut') $cssforfield.=($cssforfield?' ':'').'center'; if ($key == 'fk_statut') $cssforfield.=($cssforfield?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) if (! empty($arrayfields['t.'.$key]['checked']))
{ {
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n";
} }
} }
// Extra fields // Extra fields

View File

@ -354,14 +354,16 @@ class Users extends DolibarrApi
return $this->useraccount->delete(DolibarrApiAccess::$user); return $this->useraccount->delete(DolibarrApiAccess::$user);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
private function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
global $conf; global $conf;
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);

View File

@ -162,27 +162,27 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase
// Do a list of movement into warehouse 1 // Do a list of movement into warehouse 1
// Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9 // Create an input movement (type = 3) of price 9.9 -> should update PMP to 9.9
$result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.9, 'Movement for unit test 1', '', '', '', '', 0, 'Inventory Code Test'); $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.9, 'Movement for unit test 1', '', '', '', '', 0, 'Inventory Code Test');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 // Create an input movement (type = 3) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.7, 'Movement for unit test 2', '', '', '', '', 0, 'Inventory Code Test'); $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.7, 'Movement for unit test 2', '', '', '', '', 0, 'Inventory Code Test');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 // Create an output movement (type = 2) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->livraison($user, $product1id, $warehouse1id, 5, 999, 'Movement for unit test 3', '', '', '', '', 0, 'Inventory Code Test'); $result=$localobject->livraison($user, $product1id, $warehouse1id, 5, 999, 'Movement for unit test 3', '', '', '', '', 0, 'Inventory Code Test');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->_create($user, $product1id, $warehouse1id, 1, 0, 0, 'Input from transfer', 'Transfert X'); $result=$localobject->_create($user, $product1id, $warehouse1id, 1, 0, 0, 'Input from transfer', 'Transfert X');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->_create($user, $product1id, $warehouse1id, -2, 1, 0, 'Output from transfer', 'Transfert Y'); $result=$localobject->_create($user, $product1id, $warehouse1id, -2, 1, 0, 'Output from transfer', 'Transfert Y');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
@ -190,27 +190,27 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase
// Do same but into warehouse 2 // Do same but into warehouse 2
// Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9 // Create an input movement (type = 3) of price 9.9 -> should update PMP to 9.9
$result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.9, 'Movement for unit test 1 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.9, 'Movement for unit test 1 wh 2', '', '', '', '', 0, 'Inventory Code Test 2');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 // Create an input movement (type = 3) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.7, 'Movement for unit test 2 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.7, 'Movement for unit test 2 wh 2', '', '', '', '', 0, 'Inventory Code Test 2');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 // Create an output movement (type = 2) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->livraison($user, $product1id, $warehouse2id, 5, 999, 'Movement for unit test 3 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); $result=$localobject->livraison($user, $product1id, $warehouse2id, 5, 999, 'Movement for unit test 3 wh 2', '', '', '', '', 0, 'Inventory Code Test 2');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->_create($user, $product1id, $warehouse2id, 1, 0, 0, 'Input from transfer wh 2', 'Transfert X 2'); $result=$localobject->_create($user, $product1id, $warehouse2id, 1, 0, 0, 'Input from transfer wh 2', 'Transfert X 2');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
// Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8
$result=$localobject->_create($user, $product1id, $warehouse2id, -2, 1, 0, 'Output from transfer wh 2', 'Transfert Y 2'); $result=$localobject->_create($user, $product1id, $warehouse2id, -2, 1, 0, 'Output from transfer wh 2', 'Transfert Y 2');
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);