diff --git a/htdocs/admin/boutique-special-all.php b/htdocs/admin/boutique-special-all.php deleted file mode 100644 index 04eb78a8ea4..00000000000 --- a/htdocs/admin/boutique-special-all.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - */ - -/** - \file htdocs/admin/boutique-special-all.php - \ingroup boutique - \brief Page d'administration/configuration du module Boutique - \version $Revision$ -*/ - -require("./pre.inc.php"); -require("../boutique/livre/livre.class.php"); -require("../boutique/editeur/editeur.class.php"); -require("../boutique/auteur/auteur.class.php"); -require("../product/promotion/promotion.class.php"); - -$langs->load("admin"); - -if (!$user->admin) - accessforbidden(); - - -llxHeader(); - - -print_barre_liste("Mise a jour de tous les livres", $page, "boutique-special-all.php"); - -$sql = "SELECT l.rowid FROM ".MAIN_DB_PREFIX."livre as l"; - -if ( $db->query($sql) ) -{ - $num = $db->num_rows(); - $i = 0; - - while ($i < $num) { - $objp = $db->fetch_object(); - - $livre = new Livre($db); - if ($livre->fetch($objp->rowid)) - { - - $prom = new Promotion($db); - $prom->create($user,$livre->oscid, 5); - - } - else - { - print "Error can't fetch"; - } - $i++; - } -} -else -{ - print $db->error(); -} - - - -llxFooter(); -?> diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 282832d471d..f098a90dea8 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -53,6 +53,7 @@ class Canvas function __construct($DB, $actiontype='view') { $this->db = $DB; + $this->actiontype = $actiontype; if ($this->actiontype == 'add') $this->actiontype='create'; if ($this->actiontype == 'update') $this->actiontype='edit'; @@ -109,32 +110,6 @@ class Canvas //print ' => template_dir='.$this->template_dir.'
'; } - /** - * Return if a canvas contains an action controller - * - * @return boolean Return if canvas contains actions (old feature. now actions should be inside hooks) - */ - function hasActions() - { - return (! is_object($this->control)); - } - - /** - * Shared method for canvas to execute actions - * - * @param string &$action Action string - * @param int $id Object id - * @return mixed Return return code of doActions of canvas - */ - function doActions(&$action='view', $id=0) - { - if (method_exists($this->control,'doActions')) - { - $ret = $this->control->doActions($action, $id); - return $ret; - } - } - /** * Shared method for canvas to assign values for templates * @@ -174,5 +149,38 @@ class Canvas include($this->template_dir.($this->card?$this->card.'_':'').$this->actiontype.'.tpl.php'); // Include native PHP template } + + // This functions should not be used anymore because canvas should contains only templates. + // http://wiki.dolibarr.org/index.php/Canvas_development + + /** + * Return if a canvas contains an action controller + * + * @return boolean Return if canvas contains actions (old feature. now actions should be inside hooks) + */ + function hasActions() + { + return (is_object($this->control)); + } + + /** + * Shared method for canvas to execute actions + * + * @param string &$action Action string + * @param int $id Object id + * @return mixed Return return code of doActions of canvas + * @deprecated This function is called if you add a doActions class inside your canvas. Try to not + * do that and add action code into a hook instead. + * @see http://wiki.dolibarr.org/index.php/Canvas_development + */ + function doActions(&$action='view', $id=0) + { + if (method_exists($this->control,'doActions')) + { + $ret = $this->control->doActions($action, $id); + return $ret; + } + } + } ?>