From 0e0197f24640f512676c3b5b9251c547bdfbf4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 16 Sep 2018 19:26:49 +0200 Subject: [PATCH 1/2] reduce complexity of cronjob class --- htdocs/cron/class/cronjob.class.php | 46 +++++++++++++---------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 26d81c08385..dc853e0da7d 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -244,8 +244,8 @@ class Cronjob extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."cronjob"); - if (! $notrigger) - { + //if (! $notrigger) + //{ // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -255,7 +255,7 @@ class Cronjob extends CommonObject //$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } + //} } // Commit or rollback @@ -430,7 +430,7 @@ class Cronjob extends CommonObject $sql.= " WHERE 1 = 1"; if ($processing >= 0) $sql.= " AND t.processing = ".(empty($processing)?'0':'1'); if ($status >= 0 && $status < 2) $sql.= " AND t.status = ".(empty($status)?'0':'1'); - if ($status == 2) $sql.= " AND t.status = 2"; + elseif ($status == 2) $sql.= " AND t.status = 2"; //Manage filter if (is_array($filter) && count($filter)>0) { foreach($filter as $key => $value) @@ -633,10 +633,8 @@ class Cronjob extends CommonObject $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) - { - if (! $notrigger) - { + //if (! $error && ! $notrigger) + //{ // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -646,8 +644,7 @@ class Cronjob extends CommonObject //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + //} // Commit or rollback if ($error) @@ -763,11 +760,11 @@ class Cronjob extends CommonObject $error++; } - if (! $error) - { + //if (! $error) + //{ - } + //} unset($this->context['createfromclone']); @@ -1304,34 +1301,33 @@ class Cronjob extends CommonObject if ($mode == 0) { - $prefix=''; if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 1) + elseif ($mode == 1) { if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); + elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); } } } From 20e245108fe940cf4b3694ca026cce591522cda7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 17 Sep 2018 13:12:04 +0200 Subject: [PATCH 2/2] clean html donateur_code.php --- htdocs/public/donations/donateurs_code.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index 3705c9945bc..9f03f9e293e 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2002 Rodolphe Quiedeville + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,7 +49,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT .'/don/class/don.class.php'; // Security check -if (empty($conf->don->enabled)) accessforbidden('',0,0,1); +if (empty($conf->don->enabled)) accessforbidden('', 0, 0, 1); $langs->load("donations"); @@ -71,13 +72,13 @@ if ($resql) if ($num) { - print ""; + print "
"; - print ''; + print ''; print ""; print ""; - print ""; - print "\n"; + print ""; + print "\n"; while ($i < $num) {
".$langs->trans("Name")." / ".$langs->trans("Company")."Date".$langs->trans("Amount")."
".$langs->trans("Amount")."