Clean code
This commit is contained in:
parent
5280d070e3
commit
b3b0fe2444
@ -338,7 +338,7 @@ class AccountancyExport
|
||||
// PHP ZIP extension must be enabled
|
||||
if (!extension_loaded('zip')) {
|
||||
$langs->load('install');
|
||||
$this->errors[] = $langs->trans('ErrorPHPDoesNotSupport', 'ZIP');;
|
||||
$this->errors[] = $langs->trans('ErrorPHPDoesNotSupport', 'ZIP');
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -1189,8 +1189,6 @@ class Categorie extends CommonObject
|
||||
dol_syslog(get_class($this)."::get_full_arbo dol_sort_array", LOG_DEBUG);
|
||||
$this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', true, false);
|
||||
|
||||
//$this->debug_cats();
|
||||
|
||||
return $this->cats;
|
||||
}
|
||||
|
||||
@ -1201,7 +1199,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @param int $id_categ id_categ entry to update
|
||||
* @param int $protection Deep counter to avoid infinite loop
|
||||
* @return void
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @see get_full_arbo()
|
||||
*/
|
||||
private function buildPathFromId($id_categ, $protection = 1000)
|
||||
@ -1211,7 +1209,7 @@ class Categorie extends CommonObject
|
||||
if (!empty($this->cats[$id_categ]['fullpath'])) {
|
||||
// Already defined
|
||||
dol_syslog(get_class($this)."::buildPathFromId fullpath and fulllabel already defined", LOG_WARNING);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// First build full array $motherof
|
||||
@ -1238,28 +1236,7 @@ class Categorie extends CommonObject
|
||||
$nbunderscore = substr_count($this->cats[$id_categ]['fullpath'], '_');
|
||||
$this->cats[$id_categ]['level'] = ($nbunderscore ? $nbunderscore : null);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Display content of $this->cats
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function debug_cats()
|
||||
{
|
||||
// phpcs:enable
|
||||
// Display $this->cats
|
||||
foreach ($this->cats as $key => $val) {
|
||||
print 'id: '.$this->cats[$key]['id'];
|
||||
print ' label: '.$this->cats[$key]['label'];
|
||||
print ' mother: '.$this->cats[$key]['fk_parent'];
|
||||
//print ' children: '.(is_array($this->cats[$key]['id_children'])?join(',',$this->cats[$key]['id_children']):'');
|
||||
print ' fullpath: '.$this->cats[$key]['fullpath'];
|
||||
print ' fulllabel: '.$this->cats[$key]['fulllabel'];
|
||||
print "<br>\n";
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -4078,7 +4078,7 @@ class Facture extends CommonInvoice
|
||||
*
|
||||
* @param int $idline id of line to check
|
||||
* @param float $situation_percent progress percentage need to be test
|
||||
* @return false if KO, true if OK
|
||||
* @return bool false if KO, true if OK
|
||||
*/
|
||||
public function checkProgressLine($idline, $situation_percent)
|
||||
{
|
||||
@ -4097,7 +4097,7 @@ class Facture extends CommonInvoice
|
||||
if ($obj === null) {
|
||||
return true;
|
||||
} else {
|
||||
return $situation_percent < $obj->situation_percent;
|
||||
return ($situation_percent < $obj->situation_percent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4651,8 +4651,8 @@ class Facture extends CommonInvoice
|
||||
* Invoices matching the following rules are returned:
|
||||
* (validated + payment on process) or classified (payed completely or payed partiely) + not already replaced + not already a credit note
|
||||
*
|
||||
* @param int $socid Id thirdparty
|
||||
* @return array Array of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>)
|
||||
* @param int $socid Id thirdparty
|
||||
* @return array|int Array of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>)
|
||||
*/
|
||||
public function list_qualified_avoir_invoices($socid = 0)
|
||||
{
|
||||
@ -4726,8 +4726,8 @@ class Facture extends CommonInvoice
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
* @param User $user Object user
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
*/
|
||||
public function load_board($user)
|
||||
{
|
||||
|
||||
@ -742,21 +742,25 @@ if (isModEnabled('facture') && isModEnabled('commande') && $user->hasRight("comm
|
||||
|
||||
|
||||
// TODO Mettre ici recup des actions en rapport avec la compta
|
||||
$resql = '';
|
||||
if ($resql) {
|
||||
$sql = '';
|
||||
if ($sql) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><thcolspan="2">'.$langs->trans("TasksToDo").'</th>';
|
||||
print "</tr>\n";
|
||||
$i = 0;
|
||||
while ($i < $db->num_rows($resql)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven"><td>'.dol_print_date($db->jdate($obj->da), "day").'</td>';
|
||||
print '<td><a href="action/card.php">'.$obj->label.'</a></td></tr>';
|
||||
$i++;
|
||||
print '<tr class="oddeven"><td>'.dol_print_date($db->jdate($obj->da), "day").'</td>';
|
||||
print '<td><a href="action/card.php">'.$obj->label.'</a></td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
$db->free($resql);
|
||||
print "</table></div><br>";
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* \file htdocs/compta/localtax/index.php
|
||||
* \ingroup tax
|
||||
* \brief Index page of IRPF reports
|
||||
* \brief Index page of localtax reports
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -259,6 +259,9 @@ llxHeader('', $name);
|
||||
//$textnextyear=" <a href=\"index.php?localTaxType=".$localTaxType."&year=" . ($year_current+1) . "\">".img_next()."</a>";
|
||||
//print load_fiche_titre($langs->transcountry($LT,$mysoc->country_code),"$textprevyear ".$langs->trans("Year")." $year_start $textnextyear", 'bill');
|
||||
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
|
||||
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
|
||||
//report_header($name,'',$textprevyear.$langs->trans("Year")." ".$year_start.$textnextyear,'',$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
@ -271,7 +274,7 @@ print load_fiche_titre($langs->transcountry($LTSummary, $mysoc->country_code), '
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="30%">'.$langs->trans("Year")." ".$y."</td>";
|
||||
print '<td>'.$langs->trans("Year")."</td>";
|
||||
if ($CalcLT == 0) {
|
||||
print '<td class="right">'.$langs->transcountry($LTCustomer, $mysoc->country_code).'</td>';
|
||||
print '<td class="right">'.$langs->transcountry($LTSupplier, $mysoc->country_code).'</td>';
|
||||
|
||||
@ -229,6 +229,9 @@ llxHeader('', $name);
|
||||
//$textnextyear=" <a href=\"index.php?year=" . ($year_current+1) . "\">".img_next($langs->trans("Next"), 'class="valignbottom"')."</a>";
|
||||
//print load_fiche_titre($langs->transcountry("VAT", $mysoc->country_code), $textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, 'bill');
|
||||
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
|
||||
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
|
||||
//report_header($name,'',$textprevyear.$langs->trans("Year")." ".$year_start.$textnextyear,'',$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
@ -242,7 +245,7 @@ if ($refresh === true) {
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="30%">' . $langs->trans("Year") . " " . $y . '</td>';
|
||||
print '<td width="30%">' . $langs->trans("Year") . '</td>';
|
||||
print '<td class="right">' . $langs->trans("VATToPay") . '</td>';
|
||||
print '<td class="right">' . $langs->trans("VATToCollect") . '</td>';
|
||||
print '<td class="right">' . $langs->trans("Balance") . '</td>';
|
||||
|
||||
@ -481,7 +481,6 @@ class EvalMath
|
||||
*/
|
||||
class EvalMathStack
|
||||
{
|
||||
|
||||
public $stack = array();
|
||||
|
||||
public $count = 0;
|
||||
@ -489,8 +488,8 @@ class EvalMathStack
|
||||
/**
|
||||
* push
|
||||
*
|
||||
* @param string $val Val
|
||||
* @return void
|
||||
* @param string $val Val
|
||||
* @return void
|
||||
*/
|
||||
public function push($val)
|
||||
{
|
||||
@ -515,14 +514,15 @@ class EvalMathStack
|
||||
/**
|
||||
* last
|
||||
*
|
||||
* @param int $n N
|
||||
* @return mixed Stack
|
||||
* @param int $n N
|
||||
* @return mixed Stack
|
||||
*/
|
||||
public function last($n = 1)
|
||||
{
|
||||
if (isset($this->stack[$this->count - $n])) {
|
||||
return $this->stack[$this->count - $n];
|
||||
}
|
||||
return;
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -6444,7 +6444,7 @@ class Form
|
||||
* @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59
|
||||
* @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field.
|
||||
* @param datetime $adddateof Add a link "Date of invoice" using the following date.
|
||||
* @return string|void Nothing or string if nooutput is 1
|
||||
* @return string '' or HTML component string if nooutput is 1
|
||||
* @deprecated
|
||||
* @see selectDate(), form_date(), select_month(), select_year(), select_dayofweek()
|
||||
*/
|
||||
@ -6456,7 +6456,8 @@ class Form
|
||||
return $retstring;
|
||||
}
|
||||
print $retstring;
|
||||
return;
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -6990,7 +6991,7 @@ class Form
|
||||
* If 'textselect' input hour is in text and input min is a combo
|
||||
* @param integer $minunderhours If 1, show minutes selection under the hours
|
||||
* @param int $nooutput Do not output html string but return it
|
||||
* @return string|void
|
||||
* @return string HTML component
|
||||
*/
|
||||
public function select_duration($prefix, $iSecond = '', $disabled = 0, $typehour = 'select', $minunderhours = 0, $nooutput = 0)
|
||||
{
|
||||
@ -7064,7 +7065,8 @@ class Form
|
||||
}
|
||||
|
||||
print $retstring;
|
||||
return;
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1011,7 +1011,7 @@ class Lessc
|
||||
if ($list[0] == "list" && isset($list[2][$idx - 1])) {
|
||||
return $list[2][$idx - 1];
|
||||
}
|
||||
return null;
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function lib_isnumber($value)
|
||||
@ -1306,7 +1306,7 @@ class Lessc
|
||||
if (!is_null($color = $this->coerceColor($value))) {
|
||||
return isset($color[4]) ? $color[4] : 1;
|
||||
}
|
||||
return null;
|
||||
return '';
|
||||
}
|
||||
|
||||
// set the alpha of the color
|
||||
@ -1959,7 +1959,7 @@ class Lessc
|
||||
return $this->op_color_number($op, $rgt, $lft);
|
||||
}
|
||||
|
||||
return null;
|
||||
return array();
|
||||
}
|
||||
|
||||
protected function op_color_number($op, $lft, $rgt)
|
||||
|
||||
@ -55,7 +55,7 @@ abstract class Stats
|
||||
global $conf, $user, $langs;
|
||||
|
||||
if ($startyear > $endyear) {
|
||||
return -1;
|
||||
return array();
|
||||
}
|
||||
|
||||
$datay = array();
|
||||
@ -156,7 +156,7 @@ abstract class Stats
|
||||
global $conf, $user, $langs;
|
||||
|
||||
if ($startyear > $endyear) {
|
||||
return -1;
|
||||
return array();
|
||||
}
|
||||
|
||||
$datay = array();
|
||||
@ -251,7 +251,7 @@ abstract class Stats
|
||||
public function getAverageByMonthWithPrevYear($endyear, $startyear)
|
||||
{
|
||||
if ($startyear > $endyear) {
|
||||
return -1;
|
||||
return array();
|
||||
}
|
||||
|
||||
$datay = array();
|
||||
|
||||
@ -161,11 +161,10 @@ function dol_ftp_close($connect_id)
|
||||
* @param resource $connect_id Connection handler
|
||||
* @param string $file File
|
||||
* @param string $newsection $newsection
|
||||
* @return result
|
||||
* @return bool
|
||||
*/
|
||||
function dol_ftp_delete($connect_id, $file, $newsection)
|
||||
{
|
||||
|
||||
global $conf;
|
||||
|
||||
if (!empty($conf->global->FTP_CONNECT_WITH_SFTP)) {
|
||||
@ -197,7 +196,6 @@ function dol_ftp_delete($connect_id, $file, $newsection)
|
||||
*/
|
||||
function dol_ftp_get($connect_id, $localfile, $file, $newsection)
|
||||
{
|
||||
|
||||
global $conf;
|
||||
|
||||
if (!empty($conf->global->FTP_CONNECT_WITH_SFTP)) {
|
||||
@ -223,7 +221,7 @@ function dol_ftp_get($connect_id, $localfile, $file, $newsection)
|
||||
* @param string $file File name
|
||||
* @param string $localfile The path to the local file
|
||||
* @param string $newsection $newsection
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
function dol_ftp_put($connect_id, $file, $localfile, $newsection)
|
||||
{
|
||||
@ -251,7 +249,7 @@ function dol_ftp_put($connect_id, $file, $localfile, $newsection)
|
||||
* @param resource $connect_id Connection handler
|
||||
* @param string $file File
|
||||
* @param string $newsection $newsection
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
function dol_ftp_rmdir($connect_id, $file, $newsection)
|
||||
{
|
||||
@ -280,7 +278,7 @@ function dol_ftp_rmdir($connect_id, $file, $newsection)
|
||||
* @param resource $connect_id Connection handler
|
||||
* @param string $newdir Dir create
|
||||
* @param string $newsection $newsection
|
||||
* @return boolean|string
|
||||
* @return bool|string
|
||||
*/
|
||||
function dol_ftp_mkdir($connect_id, $newdir, $newsection)
|
||||
{
|
||||
|
||||
@ -322,7 +322,7 @@ $moreheadjs .= '</script>'."\n";
|
||||
|
||||
llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', '', '', $morejs, '', 0, 0);
|
||||
|
||||
$head = ecm_prepare_dasboard_head('');
|
||||
$head = ecm_prepare_dasboard_head(null);
|
||||
print dol_get_fiche_head($head, 'index', '', -1, '');
|
||||
|
||||
|
||||
|
||||
@ -387,7 +387,7 @@ if (empty($conf->global->ECM_AUTO_TREE_HIDEN)) {
|
||||
}
|
||||
}
|
||||
|
||||
$head = ecm_prepare_dasboard_head('');
|
||||
$head = ecm_prepare_dasboard_head(null);
|
||||
print dol_get_fiche_head($head, 'index_auto', '', -1, '');
|
||||
|
||||
|
||||
|
||||
@ -295,7 +295,7 @@ $moreheadjs .= '</script>'."\n";
|
||||
|
||||
llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', '', '', $morejs, '', 0, 0);
|
||||
|
||||
$head = ecm_prepare_dasboard_head('');
|
||||
$head = ecm_prepare_dasboard_head(null);
|
||||
print dol_get_fiche_head($head, 'index_medias', '', -1, '');
|
||||
|
||||
|
||||
|
||||
@ -154,6 +154,7 @@ if ($action == 'addfolder') {
|
||||
|
||||
// Action ajout d'un rep
|
||||
if ($action == 'add' && $user->rights->ftp->setup) {
|
||||
$ecmdir = new EcmDirectory($db);
|
||||
$ecmdir->ref = GETPOST("ref");
|
||||
$ecmdir->label = GETPOST("label");
|
||||
$ecmdir->description = GETPOST("desc");
|
||||
|
||||
@ -490,7 +490,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
foreach ($dashboardgroup as $groupKey => $groupElement) {
|
||||
$boards = array();
|
||||
|
||||
// Scan $groupElement and save the one with 'stats' that lust be used for Open object dashboard
|
||||
// Scan $groupElement and save the one with 'stats' that must be used for the open objects dashboard
|
||||
if (empty($conf->global->MAIN_DISABLE_NEW_OPENED_DASH_BOARD)) {
|
||||
foreach ($groupElement['stats'] as $infoKey) {
|
||||
if (!empty($valid_dashboardlines[$infoKey])) {
|
||||
@ -519,10 +519,10 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
$openedDashBoard .= ' <span class="info-box-icon bg-infobox-'.$groupKeyLowerCase.'">'."\n";
|
||||
$openedDashBoard .= ' <i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n";
|
||||
|
||||
// Show the span for the total of record
|
||||
// Show the span for the total of record. TODO This seems not used.
|
||||
if (!empty($groupElement['globalStats'])) {
|
||||
$globalStatInTopOpenedDashBoard[] = $globalStatsKey;
|
||||
$openedDashBoard .= '<span class="info-box-icon-text" title="'.$groupElement['globalStats']['text'].'">'.$nbTotal.'</span>';
|
||||
$openedDashBoard .= '<span class="info-box-icon-text" title="'.$groupElement['globalStats']['text'].'">'.$groupElement['globalStats']['nbTotal'].'</span>';
|
||||
}
|
||||
|
||||
$openedDashBoard .= '</span>'."\n";
|
||||
|
||||
@ -44,7 +44,7 @@ $langs->load("admin");
|
||||
* View
|
||||
*/
|
||||
|
||||
$formadmin = new FormAdmin(''); // Note: $db does not exist yet but we don't need it, so we put ''.
|
||||
$formadmin = new FormAdmin(null); // Note: $db does not exist yet but we don't need it, so we put ''.
|
||||
|
||||
pHeader("", "check"); // Next step = check
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ function checkLinkedElements($sourcetype, $targettype)
|
||||
/**
|
||||
* Clean data into ecm_directories table
|
||||
*
|
||||
* @return void
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function clean_data_ecm_directories()
|
||||
{
|
||||
@ -145,12 +145,14 @@ function clean_data_ecm_directories()
|
||||
$resqlupdate = $db->query($sqlupdate);
|
||||
if (!$resqlupdate) {
|
||||
dol_print_error($db, 'Failed to update');
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db, 'Failed to run request');
|
||||
return -1;
|
||||
}
|
||||
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1413,7 +1413,7 @@ if (!function_exists("llxHeader")) {
|
||||
}
|
||||
|
||||
if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup', 'aZ09')) {
|
||||
left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retrieved with a global $menumanager inside this function
|
||||
left_menu(array(), $help_url, '', '', 1, $title, 1); // $menumanager is retrieved with a global $menumanager inside this function
|
||||
}
|
||||
|
||||
// main area
|
||||
@ -2885,7 +2885,7 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_
|
||||
$selected = -1;
|
||||
if (empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) {
|
||||
$usedbyinclude = 1;
|
||||
$arrayresult = null;
|
||||
$arrayresult = array();
|
||||
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; // This set $arrayresult
|
||||
|
||||
if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
|
||||
|
||||
@ -225,5 +225,5 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG)
|
||||
print '</body></html>'."\n";
|
||||
print "\n";
|
||||
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ if (is_array($results)) {
|
||||
}
|
||||
}
|
||||
print '<b class="wordbreak">';
|
||||
print $tmpuser->getFullName(-1);
|
||||
print $tmpuser->getFullName();
|
||||
print ' '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0, 'envelope');
|
||||
print '</b>';
|
||||
print '</b><br>';
|
||||
|
||||
@ -370,6 +370,9 @@ if ($action == 'getProducts') {
|
||||
$place = GETPOST('place', 'alpha');
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
|
||||
|
||||
$object = new Facture($db);
|
||||
|
||||
$printer = new dolReceiptPrinter($db);
|
||||
$printer->sendToPrinter($object, getDolGlobalString('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$term), getDolGlobalString('TAKEPOS_PRINTER_TO_USE'.$term));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user