2004-10-20 23:06:45 +02:00
|
|
|
<?php
|
2005-08-12 23:45:18 +02:00
|
|
|
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2013-10-27 02:23:25 +02:00
|
|
|
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
2009-10-10 18:26:06 +02:00
|
|
|
*
|
2002-04-30 17:36:13 +02:00
|
|
|
* 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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2002-04-30 17:36:13 +02:00
|
|
|
* (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
|
2011-08-01 01:19:04 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2002-04-30 17:36:13 +02:00
|
|
|
*/
|
|
|
|
|
|
2005-08-12 23:45:18 +02:00
|
|
|
/**
|
2010-07-21 14:35:56 +02:00
|
|
|
* \file htdocs/product/class/service.class.php
|
2009-07-23 02:03:01 +02:00
|
|
|
* \ingroup service
|
|
|
|
|
* \brief Fichier de la classe des services predefinis
|
|
|
|
|
*/
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
2005-08-12 23:45:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2013-10-27 02:23:25 +02:00
|
|
|
* Class to manage predefined services
|
2009-07-23 02:03:01 +02:00
|
|
|
*/
|
2010-03-13 00:40:39 +01:00
|
|
|
class Service extends CommonObject
|
2005-08-12 23:45:18 +02:00
|
|
|
{
|
2009-10-10 18:26:06 +02:00
|
|
|
var $db;
|
|
|
|
|
|
|
|
|
|
var $id;
|
|
|
|
|
var $libelle;
|
|
|
|
|
var $price;
|
|
|
|
|
var $tms;
|
|
|
|
|
var $debut;
|
|
|
|
|
var $fin;
|
|
|
|
|
|
|
|
|
|
var $debut_epoch;
|
|
|
|
|
var $fin_epoch;
|
|
|
|
|
|
2012-01-04 13:54:07 +01:00
|
|
|
/**
|
|
|
|
|
* Constructor
|
|
|
|
|
*
|
|
|
|
|
* @param DoliDB $db Database handler
|
|
|
|
|
*/
|
2012-07-30 17:17:33 +02:00
|
|
|
function __construct($db)
|
2012-01-04 13:54:07 +01:00
|
|
|
{
|
|
|
|
|
$this->db = $db;
|
2009-10-10 18:26:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-12-19 18:24:49 +01:00
|
|
|
* Charge indicateurs this->nb de tableau de bord
|
2012-01-04 13:54:07 +01:00
|
|
|
*
|
|
|
|
|
* @return int <0 if KO, >0 if OK
|
2009-10-10 18:26:06 +02:00
|
|
|
*/
|
|
|
|
|
function load_state_board()
|
|
|
|
|
{
|
|
|
|
|
global $conf, $user;
|
|
|
|
|
|
|
|
|
|
$this->nb=array();
|
|
|
|
|
|
|
|
|
|
$sql = "SELECT count(p.rowid) as nb";
|
|
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
2012-07-08 23:22:22 +02:00
|
|
|
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
2012-02-11 10:18:09 +01:00
|
|
|
$sql.= " AND p.fk_product_type = 1";
|
2010-03-13 00:40:39 +01:00
|
|
|
|
2009-10-10 18:26:06 +02:00
|
|
|
$resql=$this->db->query($sql);
|
|
|
|
|
if ($resql)
|
|
|
|
|
{
|
|
|
|
|
while ($obj=$this->db->fetch_object($resql))
|
|
|
|
|
{
|
|
|
|
|
$this->nb["services"]=$obj->nb;
|
|
|
|
|
}
|
2013-06-16 21:31:21 +02:00
|
|
|
$this->db->free($resql);
|
2009-10-10 18:26:06 +02:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dol_print_error($this->db);
|
|
|
|
|
$this->error=$this->db->error();
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-04-30 17:36:13 +02:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
?>
|