dolibarr/htdocs/core/modules/commande/modules_commande.php

154 lines
4.1 KiB
PHP
Raw Normal View History

<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
2012-12-30 14:13:49 +00:00
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
2006-02-08 14:32:08 +00:00
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* 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 3 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
2011-07-31 23:24:38 +00:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/commande/modules_commande.php
* \ingroup commande
2016-01-07 09:07:05 +00:00
* \brief File that contains parent class for orders models
* and parent class for orders numbering models
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
2016-01-07 09:07:05 +00:00
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
/**
2016-01-07 09:07:05 +00:00
* Parent class for orders models
*/
abstract class ModelePDFCommandes extends CommonDocGenerator
{
2018-09-06 17:03:09 +00:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
* Return list of active generation modules
*
2012-03-13 08:38:00 +00:00
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
2012-03-13 08:38:00 +00:00
* @return array List of templates
*/
2018-08-13 15:26:32 +00:00
static function liste_modeles($db, $maxfilenamelength=0)
{
2018-09-06 17:03:09 +00:00
// phpcs:enable
global $conf;
2018-08-13 15:26:32 +00:00
$type = 'order';
$list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2018-08-13 15:26:32 +00:00
$list = getListOfModels($db, $type, $maxfilenamelength);
2018-08-13 15:26:32 +00:00
return $list;
}
}
/**
* \class ModeleNumRefCommandes
* \brief Classe mere des modeles de numerotation des references de commandes
*/
2011-09-29 08:08:26 +00:00
abstract class ModeleNumRefCommandes
{
2018-08-17 16:35:51 +00:00
/**
* @var string Error code (or message)
*/
public $error='';
/**
* Return if a module can be used or not
2011-09-12 17:08:02 +00:00
*
* @return boolean true if module can be used
*/
function isEnabled()
{
return true;
}
/**
* Renvoie la description par defaut du modele de numerotation
2011-09-12 17:08:02 +00:00
*
* @return string Texte descripif
*/
function info()
{
global $langs;
$langs->load("orders");
return $langs->trans("NoDescription");
}
/**
* Renvoie un exemple de numerotation
2011-09-12 17:08:02 +00:00
*
* @return string Example
*/
function getExample()
{
global $langs;
$langs->load("orders");
return $langs->trans("NoExample");
}
/**
* Test si les numeros deja en vigueur dans la base ne provoquent pas de conflits qui empecheraient cette numerotation de fonctionner.
2011-09-12 17:08:02 +00:00
*
* @return boolean false si conflit, true si ok
*/
function canBeActivated()
{
return true;
}
/**
* Renvoie prochaine valeur attribuee
2011-09-12 17:08:02 +00:00
*
* @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @return string Valeur
*/
function getNextValue($objsoc,$object)
{
global $langs;
return $langs->trans("NotAvailable");
}
/**
* Renvoie version du module numerotation
2011-09-12 17:08:02 +00:00
*
* @return string Valeur
*/
function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
if ($this->version == 'dolibarr') return DOL_VERSION;
if ($this->version) return $this->version;
return $langs->trans("NotAvailable");
}
2018-08-13 15:26:32 +00:00
}