clean indent

This commit is contained in:
Frédéric FRANCE
2019-10-27 11:53:20 +01:00
parent e203f87c84
commit e2afcfb999
21 changed files with 132 additions and 129 deletions

View File

@@ -54,12 +54,12 @@ class Canvas
public $control; // Initialized by getCanvas with controller instance
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $actiontype Action type ('create', 'view', 'edit', 'list')
*/
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $actiontype Action type ('create', 'view', 'edit', 'list')
*/
public function __construct($db, $actiontype = 'view')
{
$this->db = $db;

View File

@@ -171,16 +171,16 @@ class Ccountry // extends CommonObject
public function fetch($id, $code = '', $code_iso = '')
{
global $langs;
$sql = "SELECT";
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.code,";
$sql.= " t.code_iso,";
$sql.= " t.label,";
$sql.= " t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_country as t";
if ($id) $sql.= " WHERE t.rowid = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
elseif ($code_iso) $sql.= " WHERE t.code_iso = '".$this->db->escape($code_iso)."'";
$sql.= " FROM ".MAIN_DB_PREFIX."c_country as t";
if ($id) $sql.= " WHERE t.rowid = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
elseif ($code_iso) $sql.= " WHERE t.code_iso = '".$this->db->escape($code_iso)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);

View File

@@ -154,7 +154,7 @@ abstract class CommonInvoice extends CommonObject
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
{
// TODO
return 0;
return 0;
}
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';

View File

@@ -182,16 +182,16 @@ abstract class CommonStickerGenerator
for($i=$x1;$i<=$x2;$i+=$Pointilles+$Pointilles) {
for($j=$i;$j<=($i+$Pointilles);$j++) {
if($j<=($x2-1)) {
$pdf->Line($j, $y1, $j+1, $y1); // on trace le pointill? du haut, point par point
$pdf->Line($j, $y2, $j+1, $y2); // on trace le pointill? du bas, point par point
$pdf->Line($j, $y1, $j+1, $y1); // on trace le pointill? du haut, point par point
$pdf->Line($j, $y2, $j+1, $y2); // on trace le pointill? du bas, point par point
}
}
}
for($i=$y1;$i<=$y2;$i+=$Pointilles+$Pointilles) {
for($j=$i;$j<=($i+$Pointilles);$j++) {
if($j<=($y2-1)) {
$pdf->Line($x1, $j, $x1, $j+1); // on trace le pointill? du haut, point par point
$pdf->Line($x2, $j, $x2, $j+1); // on trace le pointill? du bas, point par point
$pdf->Line($x1, $j, $x1, $j+1); // on trace le pointill? du haut, point par point
$pdf->Line($x2, $j, $x2, $j+1); // on trace le pointill? du bas, point par point
}
}
}

View File

@@ -392,10 +392,10 @@ class CoreObject extends CommonObject
*/
public function setDate($field, $date)
{
if (empty($date))
{
$this->{$field} = 0;
}
if (empty($date))
{
$this->{$field} = 0;
}
else
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';

View File

@@ -252,7 +252,7 @@ class Ctyperesource
$sql .= $this->db->order($sortfield, $sortorder);
}
if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit, $offset);
$sql .= ' ' . $this->db->plimit($limit, $offset);
}
$resql = $this->db->query($sql);

View File

@@ -157,7 +157,7 @@ class DolEditor
$fullpage=false;
if (isset($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT))
{
$disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed or all
$disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed or all
}
$found=0;

View File

@@ -76,13 +76,12 @@ class FormContract
if ($socid > 0)
{
// CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY))
$sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)";
elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all')
{
$sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") ";
if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) {
$sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)";
} elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') {
$sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") ";
$sql.= " OR c.fk_soc IS NULL)";
}
}
}
if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)";
$sql.= " ORDER BY c.ref ";

View File

@@ -1362,12 +1362,12 @@ class Ldap
}
}
/**
* UserAccountControl Flgs to more human understandable form...
*
* @param string $uacf UACF
* @return void
*/
/**
* UserAccountControl Flgs to more human understandable form...
*
* @param string $uacf UACF
* @return void
*/
public function parseUACF($uacf)
{
//All flags array
@@ -1408,12 +1408,12 @@ class Ldap
return($retval);
}
/**
* SamAccountType value to text
*
* @param string $samtype SamType
* @return string Sam string
*/
/**
* SamAccountType value to text
*
* @param string $samtype SamType
* @return string Sam string
*/
public function parseSAT($samtype)
{
$stypes = array(

View File

@@ -137,22 +137,21 @@ class Menubase
// an insert with a forced id.
if (in_array($this->db->type, array('pgsql')))
{
$sql = "SELECT MAX(rowid) as maxrowid FROM ".MAIN_DB_PREFIX."menu";
$resqlrowid=$this->db->query($sql);
if ($resqlrowid)
{
$obj=$this->db->fetch_object($resqlrowid);
$maxrowid=$obj->maxrowid;
$sql = "SELECT MAX(rowid) as maxrowid FROM ".MAIN_DB_PREFIX."menu";
$resqlrowid=$this->db->query($sql);
if ($resqlrowid) {
$obj=$this->db->fetch_object($resqlrowid);
$maxrowid=$obj->maxrowid;
// Max rowid can be empty if there is no record yet
if(empty($maxrowid)) $maxrowid=1;
// Max rowid can be empty if there is no record yet
if(empty($maxrowid)) $maxrowid=1;
$sql = "SELECT setval('".MAIN_DB_PREFIX."menu_rowid_seq', ".($maxrowid).")";
//print $sql; exit;
$resqlrowidset=$this->db->query($sql);
if (! $resqlrowidset) dol_print_error($this->db);
}
else dol_print_error($this->db);
$sql = "SELECT setval('".MAIN_DB_PREFIX."menu_rowid_seq', ".($maxrowid).")";
//print $sql; exit;
$resqlrowidset=$this->db->query($sql);
if (! $resqlrowidset) dol_print_error($this->db);
}
else dol_print_error($this->db);
}
// Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql

View File

@@ -571,7 +571,7 @@ class Notify
}
}
else
{
{
dol_syslog("No notification sent for ".$sendto." because email is empty");
}
$i++;

View File

@@ -556,8 +556,8 @@ class SimpleOpenID
return false;
}
else
{
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
{
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
$this->SetOpenIDServer($server);
return $server;
}

View File

@@ -94,18 +94,18 @@ function expedition_admin_prepare_head()
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
{
$head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes_shipment';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes_shipment';
$h++;
}
if (! empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
{
$head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$head[$h][2] = 'attributeslines_shipment';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$head[$h][2] = 'attributeslines_shipment';
$h++;
}
if (! empty($conf->global->MAIN_SUBMODULE_LIVRAISON))

View File

@@ -832,12 +832,12 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
if (strstr($mask, 'user_extra_'))
{
$start = "{user_extra_";
$end = "\}";
$extra= get_string_between($mask, "user_extra_", "}");
if(!empty($user->array_options['options_'.$extra])){
$mask = preg_replace('#('.$start.')(.*?)('.$end.')#si', $user->array_options['options_'.$extra], $mask);
}
$start = "{user_extra_";
$end = "\}";
$extra= get_string_between($mask, "user_extra_", "}");
if (!empty($user->array_options['options_'.$extra])) {
$mask = preg_replace('#('.$start.')(.*?)('.$end.')#si', $user->array_options['options_'.$extra], $mask);
}
}
$maskwithonlyymcode=$mask;
$maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i', $maskcounter, $maskwithonlyymcode);
@@ -1645,7 +1645,7 @@ function getListOfModels($db, $type, $maxfilenamelength = 0)
//irtoscan.=($dirtoscan?',':'').preg_replace('/[\r\n]+/',',',trim($conf->global->$const));
$dirtoscan= preg_replace('/[\r\n]+/', ',', trim($conf->global->$const));
$listoffiles=array();
$listoffiles=array();
// Now we add models found in directories scanned
$listofdir=explode(',', $dirtoscan);
@@ -1656,8 +1656,8 @@ function getListOfModels($db, $type, $maxfilenamelength = 0)
if (! $tmpdir) { unset($listofdir[$key]); continue; }
if (is_dir($tmpdir))
{
// all type of template is allowed
$tmpfiles=dol_dir_list($tmpdir, 'files', 0, '', '', 'name', SORT_ASC, 0);
// all type of template is allowed
$tmpfiles=dol_dir_list($tmpdir, 'files', 0, '', '', 'name', SORT_ASC, 0);
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles, $tmpfiles);
}
}

View File

@@ -137,11 +137,11 @@ function invoice_admin_prepare_head()
$head[$h][2] = 'payment';
$h++;
if($conf->global->INVOICE_USE_SITUATION){
$head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
$head[$h][1] = $langs->trans("InvoiceSituation");
$head[$h][2] = 'situation';
$h++;
if ($conf->global->INVOICE_USE_SITUATION) {
$head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
$head[$h][1] = $langs->trans("InvoiceSituation");
$head[$h][2] = 'situation';
$h++;
}
// Show more tabs from modules

View File

@@ -353,24 +353,24 @@ function utf82utf16($utf8)
{
// oh please oh please oh please oh please oh please
if(function_exists('mb_convert_encoding')) {
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
}
switch(strlen($utf8)) {
case 1:
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return $utf8;
// this case should never be reached, because we are in ASCII range
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return $utf8;
case 2:
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8{0}) >> 2)) . chr((0xC0 & (ord($utf8{0}) << 6)) | (0x3F & ord($utf8{1})));
// return a UTF-16 character from a 2-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr(0x07 & (ord($utf8{0}) >> 2)) . chr((0xC0 & (ord($utf8{0}) << 6)) | (0x3F & ord($utf8{1})));
case 3:
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8{0}) << 4)) | (0x0F & (ord($utf8{1}) >> 2))) . chr((0xC0 & (ord($utf8{1}) << 6)) | (0x7F & ord($utf8{2})));
// return a UTF-16 character from a 3-byte UTF-8 char
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
return chr((0xF0 & (ord($utf8{0}) << 4)) | (0x0F & (ord($utf8{1}) >> 2))) . chr((0xC0 & (ord($utf8{1}) << 6)) | (0x7F & ord($utf8{2})));
}
// ignoring UTF-32 for now, sorry

View File

@@ -1417,8 +1417,8 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
//print '>'.$outputlangs->charset_output.','.$period;
if(!empty($conf->global->ADD_HTML_FORMATING_INTO_DESC_DOC)){
$libelleproduitservice.= '<b style="color:#333666;" ><em>'."__N__</b> ".$period.'</em>';
}else{
$libelleproduitservice.="__N__".$period;
} else {
$libelleproduitservice.="__N__".$period;
}
//print $libelleproduitservice;
}
@@ -1705,8 +1705,8 @@ function pdf_getlineqty($object, $i, $outputlangs, $hidedetails = 0)
}
if (empty($reshook))
{
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) $result.=$object->lines[$i]->qty;
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) $result.=$object->lines[$i]->qty;
}
return $result;
}
@@ -2108,7 +2108,7 @@ function pdf_getLinkedObjects($object, $outputlangs)
{
if ($objecttype == 'facture')
{
// For invoice, we don't want to have a reference line on document. Image we are using recuring invoice, we will have a line longer than document width.
// For invoice, we don't want to have a reference line on document. Image we are using recuring invoice, we will have a line longer than document width.
}
elseif ($objecttype == 'propal' || $objecttype == 'supplier_proposal')
{

View File

@@ -204,15 +204,15 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$localtaxes = array(0,0,0);
$apply_tax = false;
switch($localtax1_type) {
case '2': // localtax on product or service
$apply_tax = true;
break;
case '4': // localtax on product
if ($type == 0) $apply_tax = true;
break;
case '6': // localtax on service
if ($type == 1) $apply_tax = true;
break;
case '2': // localtax on product or service
$apply_tax = true;
break;
case '4': // localtax on product
if ($type == 0) $apply_tax = true;
break;
case '6': // localtax on service
if ($type == 1) $apply_tax = true;
break;
}
if ($uselocaltax1_rate && $apply_tax) {
@@ -299,15 +299,15 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$apply_tax = false;
switch($localtax1_type) {
case '1': // localtax on product or service
$apply_tax = true;
break;
case '3': // localtax on product
if ($type == 0) $apply_tax = true;
break;
case '5': // localtax on service
if ($type == 1) $apply_tax = true;
break;
case '1': // localtax on product or service
$apply_tax = true;
break;
case '3': // localtax on product
if ($type == 0) $apply_tax = true;
break;
case '5': // localtax on service
if ($type == 1) $apply_tax = true;
break;
}
if ($uselocaltax1_rate && $apply_tax) {
$result[14] = price2num(($tot_sans_remise * (1 + ( $localtax1_rate / 100))) - $tot_sans_remise, 'MT'); // amount tax1 for total_ht_without_discount

View File

@@ -1371,7 +1371,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
{
for ($i = 0 ; $i < $numlines ; $i++)
{
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
}
}
@@ -1848,7 +1848,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
$resql = $db->query($sql2);
if ($resql)
{
$total_task = 0;
$total_task = 0;
$total_opp_amount = 0;
$ponderated_opp_amount = 0;

View File

@@ -312,17 +312,26 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
foreach($feature2 as $subfeature)
{
if (empty($user->rights->$feature->$subfeature->creer)
&& empty($user->rights->$feature->$subfeature->write)
&& empty($user->rights->$feature->$subfeature->create)) { $createok=0; $nbko++; }
else { $createok=1; break; } // Break to bypass second test if the first is ok
&& empty($user->rights->$feature->$subfeature->write)
&& empty($user->rights->$feature->$subfeature->create)) {
$createok=0;
$nbko++;
} else {
$createok=1;
// Break to bypass second test if the first is ok
break;
}
}
}
elseif (! empty($feature)) // This is for permissions on 2 levels ('creer' or 'write')
{
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write;
if (empty($user->rights->$feature->creer)
&& empty($user->rights->$feature->write)
&& empty($user->rights->$feature->create)) { $createok=0; $nbko++; }
&& empty($user->rights->$feature->write)
&& empty($user->rights->$feature->create)) {
$createok=0;
$nbko++;
}
}
}

View File

@@ -234,7 +234,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
}
if (! empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC))
{
print '<strong>' . ($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC ? $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC : $langs->trans("TicketSystem")) . '</strong>';
print '<strong>' . ($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC ? $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC : $langs->trans("TicketSystem")) . '</strong>';
}
print '</center><br>';
}
@@ -690,10 +690,10 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out.=$actionstatic->getNomUrl(1, -1).' ';
}
// if ($user->rights->agenda->allactions->read || $actionstatic->authorid == $user->id)
// {
// $out.='<a href="'.$url.'" class="timeline-btn" title="'.$langs->trans('Show').'" ><i class="fa fa-calendar" ></i>'.$langs->trans('Show').'</a>';
// }
//if ($user->rights->agenda->allactions->read || $actionstatic->authorid == $user->id)
//{
// $out.='<a href="'.$url.'" class="timeline-btn" title="'.$langs->trans('Show').'" ><i class="fa fa-calendar" ></i>'.$langs->trans('Show').'</a>';
//}
if ($user->rights->agenda->allactions->create ||
@@ -723,9 +723,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$out.="</span>\n";
// Ref
$out.='<h3 class="timeline-header">';
$out.='<h3 class="timeline-header">';
// Author of event
$out.='<span class="messaging-author">';
@@ -739,11 +737,9 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
}
$out.='</span>';
// Title
$out .= ' <span class="messaging-title">';
if($actionstatic->code == 'TICKET_MSG') {
$out .= $langs->trans('TicketNewMessage');
}