dolibarr/htdocs/core/modules/reception/modules_reception.php

144 lines
3.5 KiB
PHP
Raw Normal View History

2018-10-03 10:22:41 +00:00
<?php
/* Copyright (C) 2018 Quentin Vial-Gouteyron <quentin.vial-gouteyron@atm-consulting.fr>
*
* 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
2019-09-23 19:55:30 +00:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
2018-10-03 10:22:41 +00:00
*/
/**
* \file htdocs/core/modules/reception/modules_reception.php
* \ingroup reception
* \brief File that contains parent class for sending receipts models
* and parent class for sending receipts numbering models
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
/**
* Parent class of sending receipts models
*/
abstract class ModelePdfReception extends CommonDocGenerator
{
public $error = '';
2018-10-03 10:22:41 +00:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
2018-10-03 10:22:41 +00:00
* Return list of active generation modules
*
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
2018-10-03 10:22:41 +00:00
*/
2019-02-28 21:07:48 +00:00
public static function liste_modeles($db, $maxfilenamelength = 0)
2018-10-03 10:22:41 +00:00
{
2018-12-15 12:58:39 +00:00
// phpcs:enable
2018-10-03 10:22:41 +00:00
global $conf;
$type = 'reception';
2021-02-09 13:13:12 +00:00
$list = array();
2018-10-03 10:22:41 +00:00
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2021-02-09 13:13:12 +00:00
$list = getListOfModels($db, $type, $maxfilenamelength);
2018-10-03 10:22:41 +00:00
2021-02-09 13:13:12 +00:00
return $list;
2018-10-03 10:22:41 +00:00
}
}
/**
* Parent Class of numbering models of sending receipts references
*/
abstract class ModelNumRefReception
{
public $error = '';
2018-10-03 10:22:41 +00:00
/** Return if a model can be used or not
*
* @return boolean true if model can be used
*/
2019-02-28 21:07:48 +00:00
public function isEnabled()
2018-10-03 10:22:41 +00:00
{
return true;
}
/**
* Return default description of numbering model
*
* @return string text description
*/
2019-02-28 21:07:48 +00:00
public function info()
2018-10-03 10:22:41 +00:00
{
global $langs;
$langs->load("reception");
return $langs->trans("NoDescription");
}
/**
* Returns numbering example
*
* @return string Example
*/
2019-02-28 21:07:48 +00:00
public function getExample()
2018-10-03 10:22:41 +00:00
{
global $langs;
$langs->load("reception");
return $langs->trans("NoExample");
}
/**
* Test if existing numbers make problems with numbering
*
* @return boolean false if conflit, true if ok
*/
2019-02-28 21:07:48 +00:00
public function canBeActivated()
2018-10-03 10:22:41 +00:00
{
return true;
}
/**
* Returns next value assigned
*
* @param Societe $objsoc Third party object
* @param Object $reception Reception object
2018-10-03 10:22:41 +00:00
* @return string Value
*/
public function getNextValue($objsoc, $reception)
2018-10-03 10:22:41 +00:00
{
global $langs;
return $langs->trans("NotAvailable");
}
/**
* Returns version of the numbering model
*
* @return string Value
*/
2019-02-28 21:07:48 +00:00
public function getVersion()
2018-10-03 10:22:41 +00:00
{
global $langs;
$langs->load("admin");
2021-02-23 21:03:23 +00:00
if ($this->version == 'development') {
return $langs->trans("VersionDevelopment");
} elseif ($this->version == 'experimental') {
return $langs->trans("VersionExperimental");
} elseif ($this->version == 'dolibarr') {
return DOL_VERSION;
} elseif ($this->version) {
return $this->version;
}
2018-10-03 10:22:41 +00:00
return $langs->trans("NotAvailable");
}
}