forked from Wavyzz/dolibarr
NEW #3510 : Working
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
@@ -46,24 +46,6 @@ $action = GETPOST('action','alpha');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
|
||||
{
|
||||
$freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
//Order display of bank account
|
||||
if ($action == 'setbankorder')
|
||||
{
|
||||
@@ -89,58 +71,13 @@ $form=new Form($db);
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
|
||||
|
||||
$head = bank_admin_prepare_head(null);
|
||||
dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), 0, 'account');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td>';
|
||||
print '<td align="center" width="60"> </td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$var=! $var;
|
||||
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
|
||||
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
print '</table>';
|
||||
print "<br>";
|
||||
|
||||
/*
|
||||
$var=!$var;
|
||||
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"set_BANK_CHEQUERECEIPT_DRAFT_WATERMARK\">";
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("WatermarkOnDraftChequeReceipt").'<br>';
|
||||
print '<input size="50" class="flat" type="text" name="BANK_CHEQUERECEIPT_DRAFT_WATERMARK" value="'.$conf->global->BANK_CHEQUERECEIPT_DRAFT_WATERMARK.'">';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
*/
|
||||
|
||||
|
||||
//Show bank account order
|
||||
print load_fiche_titre($langs->trans("BankOrderShow"));
|
||||
|
||||
@@ -202,8 +139,6 @@ print '</table>'."\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
288
htdocs/admin/chequereceipts.php
Normal file
288
htdocs/admin/chequereceipts.php
Normal file
@@ -0,0 +1,288 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/bank.php
|
||||
* \ingroup bank
|
||||
* \brief Page to setup the bank module
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("banks");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
|
||||
|
||||
if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipts_mint.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstchequereceipts=GETPOST('maskconstchequereceipts','alpha');
|
||||
$maskchequereceipts=GETPOST('maskchequereceipts','alpha');
|
||||
if ($maskconstchequereceipts) $res = dolibarr_set_const($db,$maskconstchequereceipts,$maskchequereceipts,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setmod')
|
||||
{
|
||||
dolibarr_set_const($db, "CHEQUERECEIPTS_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
|
||||
{
|
||||
$freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* view
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
llxHeader("",$langs->trans("BankSetupModule"));
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
|
||||
|
||||
$head = bank_admin_prepare_head(null);
|
||||
dol_fiche_head($head, 'checkreceipts', $langs->trans("BankSetupModule"), 0, 'account');
|
||||
|
||||
/*
|
||||
* Numbering module
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("ChequeReceiptsNumberingModule"), '', '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/cheque/");
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
|
||||
{
|
||||
$filebis = $file;
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = preg_replace('/\.php$/','',$file);
|
||||
// For compatibility
|
||||
if (! is_file($dir.$filebis))
|
||||
{
|
||||
$filebis = $file."/".$file.".modules.php";
|
||||
$classname = "mod_chequereceipt_".$file;
|
||||
}
|
||||
// Check if there is a filter on country
|
||||
preg_match('/\-(.*)_(.*)$/',$classname,$reg);
|
||||
if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
|
||||
|
||||
$classname = preg_replace('/\-.*$/','',$classname);
|
||||
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
|
||||
{
|
||||
// Charging the numbering class
|
||||
require_once $dir.$filebis;
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td width="100">';
|
||||
print (empty($module->name)?$name:$module->name);
|
||||
print "</td><td>\n";
|
||||
|
||||
print $module->info();
|
||||
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
print '<td align="center">';
|
||||
//print "> ".$conf->global->PAYMENT_ADDON." - ".$file;
|
||||
if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file)
|
||||
{
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$chequereceipts=new RemiseCheque($db);
|
||||
$chequereceipts->initAsSpecimen();
|
||||
|
||||
// Example
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc,$chequereceipts);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
|
||||
if ($conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) // If module is the one used, we show existing errors
|
||||
{
|
||||
if (! empty($module->error)) dol_htmloutput_mesg($module->error,'','error',1);
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td>';
|
||||
print '<td align="center" width="60"> </td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$var=! $var;
|
||||
|
||||
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||
print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
|
||||
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
print '</table>';
|
||||
print "<br>";
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
@@ -44,7 +44,7 @@ $action=GETPOST('action', 'alpha');
|
||||
$confirm=GETPOST('confirm', 'alpha');
|
||||
|
||||
// Security check
|
||||
$fieldname = (! empty($ref)?'number':'rowid');
|
||||
$fieldname = (! empty($ref)?'ref':'rowid');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname);
|
||||
|
||||
@@ -112,9 +112,9 @@ if ($action == 'setref' && $user->rights->banque->cheque)
|
||||
$result = $object->fetch(GETPOST('id','int'));
|
||||
if ($result > 0)
|
||||
{
|
||||
$number=GETPOST('number');
|
||||
$ref=GETPOST('ref');
|
||||
|
||||
$result=$object->set_number($user,$number);
|
||||
$result=$object->set_number($user,$ref);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@@ -280,7 +280,7 @@ else if ($action == 'remove_file' && $user->rights->banque->cheque)
|
||||
|
||||
$langs->load("other");
|
||||
|
||||
$file=$dir.get_exdir($object->number,0,1,0,$object,'cheque') . GETPOST('file');
|
||||
$file=$dir.get_exdir($object->ref,0,1,0,$object,'cheque') . GETPOST('file');
|
||||
$ret=dol_delete_file($file,0,0,0,$object);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
|
||||
@@ -576,13 +576,13 @@ else
|
||||
print '<form name="setdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setref">';
|
||||
print '<input type="text" name="number" value="'.$object->number.'">';
|
||||
print '<input type="text" name="ref" value="'.$object->ref.'">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->showrefnav($object,'ref',$linkback, 1, 'number');
|
||||
print $form->showrefnav($object,'ref',$linkback, 1, 'ref');
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
@@ -796,7 +796,7 @@ if ($action != 'new')
|
||||
if ($object->statut == 1)
|
||||
{
|
||||
$filename=dol_sanitizeFileName($object->ref);
|
||||
$filedir=$dir.get_exdir($object->number,0,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref);
|
||||
$filedir=$dir.get_exdir($object->ref,0,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref);
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
|
||||
$formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -47,7 +47,7 @@ class RemiseCheque extends CommonObject
|
||||
public $account_label;
|
||||
public $author_id;
|
||||
public $nbcheque;
|
||||
public $number;
|
||||
public $ref;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -72,14 +72,14 @@ class RemiseCheque extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.number, bc.statut, bc.nbcheque, bc.ref_ext";
|
||||
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.ref, bc.statut, bc.nbcheque, bc.ref_ext";
|
||||
$sql.= ", bc.date_bordereau as date_bordereau";
|
||||
$sql.= ", ba.label as account_label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON bc.fk_bank_account = ba.rowid";
|
||||
$sql.= " WHERE bc.entity = ".$conf->entity;
|
||||
if ($id) $sql.= " AND bc.rowid = ".$id;
|
||||
if ($ref) $sql.= " AND bc.number = '".$this->db->escape($ref)."'";
|
||||
if ($ref) $sql.= " AND bc.ref = '".$this->db->escape($ref)."'";
|
||||
|
||||
dol_syslog("RemiseCheque::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@@ -99,13 +99,12 @@ class RemiseCheque extends CommonObject
|
||||
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$this->number = "(PROV".$this->id.")";
|
||||
$this->ref = "(PROV".$this->id.")";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->number = $obj->number;
|
||||
$this->ref = $obj->ref;
|
||||
}
|
||||
$this->ref = $this->number;
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
@@ -124,7 +123,7 @@ class RemiseCheque extends CommonObject
|
||||
*
|
||||
* @param User $user User making creation
|
||||
* @param int $account_id Bank account for cheque receipt
|
||||
* @param int $limit Limit number of cheque to this
|
||||
* @param int $limit Limit ref of cheque to this
|
||||
* @param array $toRemise array with cheques to remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
@@ -146,7 +145,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= ", fk_bank_account";
|
||||
$sql.= ", statut";
|
||||
$sql.= ", amount";
|
||||
$sql.= ", number";
|
||||
$sql.= ", ref";
|
||||
$sql.= ", entity";
|
||||
$sql.= ", nbcheque";
|
||||
$sql.= ", ref_ext";
|
||||
@@ -177,7 +176,7 @@ class RemiseCheque extends CommonObject
|
||||
if ($this->id > 0 && $this->errno == 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET number='(PROV".$this->id.")'";
|
||||
$sql.= " SET ref='(PROV".$this->id.")'";
|
||||
$sql.= " WHERE rowid='".$this->id."';";
|
||||
|
||||
dol_syslog("RemiseCheque::Create", LOG_DEBUG);
|
||||
@@ -351,7 +350,7 @@ class RemiseCheque extends CommonObject
|
||||
if ($this->errno == 0 && $numref)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET statut = 1, number = '".$numref."'";
|
||||
$sql.= " SET statut = 1, ref = '".$numref."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND statut = 0";
|
||||
@@ -364,7 +363,7 @@ class RemiseCheque extends CommonObject
|
||||
|
||||
if ($num == 1)
|
||||
{
|
||||
$this->number = $numref;
|
||||
$this->ref = $numref;
|
||||
$this->statut = 1;
|
||||
}
|
||||
else
|
||||
@@ -398,7 +397,7 @@ class RemiseCheque extends CommonObject
|
||||
/**
|
||||
* Old module for cheque receipt numbering
|
||||
*
|
||||
* @return int Next number of cheque
|
||||
* @return int Next ref of cheque
|
||||
*/
|
||||
function getNextNumber()
|
||||
{
|
||||
@@ -406,14 +405,14 @@ class RemiseCheque extends CommonObject
|
||||
|
||||
$num=0;
|
||||
|
||||
// We use +0 to convert varchar to number for mysql, use ::integer for postgres.
|
||||
// We use +0 to convert varchar to ref for mysql, use ::integer for postgres.
|
||||
// We must found a generic solution (Use a $db->toint function ?)
|
||||
$sql = "SELECT ";
|
||||
if ($this->db->type == 'pgsql') $sql.="MAX(number::integer)";
|
||||
else $sql.="MAX(number+0)";
|
||||
if ($this->db->type == 'pgsql') $sql.="MAX(ref::integer)";
|
||||
else $sql.="MAX(ref+0)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " AND number not like '(%'";
|
||||
$sql.= " AND ref not like '(%'";
|
||||
|
||||
dol_syslog("Remisecheque::getNextNumber", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@@ -434,6 +433,93 @@ class RemiseCheque extends CommonObject
|
||||
return $num;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next reference of cheque receipts not already used (or last reference)
|
||||
* according to numbering module defined into constant FACTURE_ADDON
|
||||
*
|
||||
* @param Societe $soc object company
|
||||
* @param string $mode 'next' for next value or 'last' for last value
|
||||
* @return string free ref or last ref
|
||||
*/
|
||||
function getNextNumRef($mode='next')
|
||||
{
|
||||
global $conf, $db, $langs, $mysoc;
|
||||
$langs->load("bills");
|
||||
|
||||
// Clean parameters (if not defined or using deprecated value)
|
||||
if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint';
|
||||
else if ($conf->global->CHEQUERECEIPTS_ADDON=='thyme') $conf->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_thyme';
|
||||
else if ($conf->global->CHEQUERECEIPTS_ADDON=='mint') $conf->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint';
|
||||
|
||||
if (! empty($conf->global->CHEQUERECEIPTS_ADDON))
|
||||
{
|
||||
$mybool=false;
|
||||
|
||||
$file = $conf->global->CHEQUERECEIPTS_ADDON.".php";
|
||||
$classname = $conf->global->CHEQUERECEIPTS_ADDON;
|
||||
|
||||
// Include file with class
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
|
||||
$dir = dol_buildpath($reldir."core/modules/cheque/");
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
if (is_file($dir.$file) && is_readable($dir.$file))
|
||||
{
|
||||
$mybool |= include_once $dir . $file;
|
||||
}
|
||||
}
|
||||
|
||||
// For compatibility
|
||||
if (! $mybool)
|
||||
{
|
||||
$file = $conf->global->CHEQUERECEIPTS_ADDON.".php";
|
||||
$classname = "mod_chequereceipt_".$conf->global->CHEQUERECEIPTS_ADDON;
|
||||
$classname = preg_replace('/\-.*$/','',$classname);
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir = $dirroot."/core/modules/cheque/";
|
||||
|
||||
// Load file with numbering class (if found)
|
||||
if (is_file($dir.$file) && is_readable($dir.$file)) {
|
||||
$mybool |= include_once $dir . $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $mybool)
|
||||
{
|
||||
dol_print_error('',"Failed to include file ".$file);
|
||||
return '';
|
||||
}
|
||||
|
||||
$obj = new $classname();
|
||||
$numref = "";
|
||||
$numref = $obj->getNextValue($mysoc,$this);
|
||||
|
||||
/**
|
||||
* $numref can be empty in case we ask for the last value because if there is no invoice created with the
|
||||
* set up mask.
|
||||
*/
|
||||
if ($mode != 'last' && !$numref) {
|
||||
dol_print_error($db,"ChequeReceipts::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
|
||||
return $numref;
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
*
|
||||
@@ -540,7 +626,7 @@ class RemiseCheque extends CommonObject
|
||||
}
|
||||
}
|
||||
$docmodel->nbcheque = $this->nbcheque;
|
||||
$docmodel->number = $this->number;
|
||||
$docmodel->ref = $this->ref;
|
||||
$docmodel->amount = $this->amount;
|
||||
$docmodel->date = $this->date_bordereau;
|
||||
|
||||
@@ -552,7 +638,7 @@ class RemiseCheque extends CommonObject
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
// output format that does not support UTF8.
|
||||
$sav_charseSupprimert_output=$outputlangs->charset_output;
|
||||
$result=$docmodel->write_file($this, $conf->banque->dir_output.'/bordereau', $this->number, $outputlangs);
|
||||
$result=$docmodel->write_file($this, $conf->banque->dir_output.'/bordereau', $this->ref, $outputlangs);
|
||||
if ($result > 0)
|
||||
{
|
||||
//$outputlangs->charset_output=$sav_charset_output;
|
||||
@@ -838,18 +924,18 @@ class RemiseCheque extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of bordereau
|
||||
* Set the ref of bordereau
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param int $number number of bordereau
|
||||
* @param int $ref ref of bordereau
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_number($user, $number)
|
||||
function set_number($user, $ref)
|
||||
{
|
||||
if ($user->rights->banque->cheque)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET number = '".$number."'" ;
|
||||
$sql.= " SET ref = '".$ref."'" ;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("RemiseCheque::set_number", LOG_DEBUG);
|
||||
@@ -870,6 +956,29 @@ class RemiseCheque extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen($option='')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
$now=dol_now();
|
||||
$arraynow=dol_getdate($now);
|
||||
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
|
||||
|
||||
// Initialize parameters
|
||||
$this->id=0;
|
||||
$this->ref = 'SPECIMEN';
|
||||
$this->specimen=1;
|
||||
$this->date_bordereau = $nownotime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@@ -77,7 +78,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
|
||||
llxHeader('',$langs->trans("ChequesReceipts"));
|
||||
|
||||
$sql = "SELECT bc.rowid, bc.number as ref, bc.date_bordereau as dp,";
|
||||
$sql = "SELECT bc.rowid, bc.ref as ref, bc.date_bordereau as dp,";
|
||||
$sql.= " bc.nbcheque, bc.amount, bc.statut,";
|
||||
$sql.= " ba.rowid as bid, ba.label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,";
|
||||
@@ -86,7 +87,7 @@ $sql.= " WHERE bc.fk_bank_account = ba.rowid";
|
||||
$sql.= " AND bc.entity = ".$conf->entity;
|
||||
|
||||
// Search criteria
|
||||
if ($search_ref) $sql.=" AND bc.number=".$search_ref;
|
||||
if ($search_ref) $sql.=" AND bc.ref=".$search_ref;
|
||||
if ($search_account > 0) $sql.=" AND bc.fk_bank_account=".$search_account;
|
||||
if ($search_amount) $sql.=" AND bc.amount='".$db->escape(price2num(trim($search_amount)))."'";
|
||||
if ($month > 0)
|
||||
@@ -134,7 +135,7 @@ if ($resql)
|
||||
|
||||
print '<table class="liste">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.ref","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("NbOfCheques"),$_SERVER["PHP_SELF"],"bc.nbcheque","",$param,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@@ -111,6 +112,11 @@ function bank_admin_prepare_head($object)
|
||||
$head[$h][2] = 'general';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/admin/chequereceipts.php';
|
||||
$head[$h][1] = $langs->trans("CheckReceiptShort");
|
||||
$head[$h][2] = 'checkreceipts';
|
||||
$h++;
|
||||
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
|
||||
150
htdocs/core/modules/cheque/mod_chequereceipt_mint.php
Normal file
150
htdocs/core/modules/cheque/mod_chequereceipt_mint.php
Normal file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/cheque/mod_chequereceipts_mint.php
|
||||
* \ingroup cheque
|
||||
* \brief File containing class for numbering module Mint
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/cheque/modules_chequereceipts.php';
|
||||
|
||||
/**
|
||||
* Class to manage cheque receipts numbering rules Mint
|
||||
*/
|
||||
class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts
|
||||
{
|
||||
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
var $prefix='CHK';
|
||||
var $error='';
|
||||
var $name='Mint';
|
||||
|
||||
|
||||
/**
|
||||
* Return description of numbering module
|
||||
*
|
||||
* @return string Text with description
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoi un exemple de numerotation
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
return $this->prefix."0501-0001";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test si les numeros deje en vigueur dans la base ne provoquent pas de
|
||||
* de conflits qui empechera cette numerotation de fonctionner.
|
||||
*
|
||||
* @return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
|
||||
$payyymm=''; $max='';
|
||||
|
||||
$posindice=9;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " WHERE ref LIKE '".$this->prefix."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) { $payyymm = substr($row[0],0,6); $max=$row[0]; }
|
||||
}
|
||||
if ($payyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$payyymm))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorNumRefModel', $max);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Societe $objsoc Object thirdparty
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Value if KO, <0 if KO
|
||||
*/
|
||||
function getNextValue($objsoc,$object)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
// D'abord on recupere la valeur max
|
||||
$posindice=9;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " WHERE ref like '".$this->prefix."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $max = intval($obj->max);
|
||||
else $max=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//$date=time();
|
||||
$date=$object->date_bordereau;
|
||||
$yymm = strftime("%y%m",$date);
|
||||
|
||||
if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
|
||||
else $num = sprintf("%04s",$max+1);
|
||||
|
||||
dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num);
|
||||
return $this->prefix.$yymm."-".$num;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param string $objforref Object for number to search
|
||||
* @return string Next free value
|
||||
*/
|
||||
function chequereceipt_get_num($objsoc,$objforref)
|
||||
{
|
||||
return $this->getNextValue($objsoc,$objforref);
|
||||
}
|
||||
|
||||
}
|
||||
140
htdocs/core/modules/cheque/mod_chequereceipt_thyme.php
Normal file
140
htdocs/core/modules/cheque/mod_chequereceipt_thyme.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/cheque/mod_chequereceipts_thyme.php
|
||||
* \ingroup cheque
|
||||
* \brief File containing class for numbering module Thyme
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/cheque/modules_chequereceipts.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage cheque receipts numbering rules Thyme
|
||||
*/
|
||||
class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts
|
||||
{
|
||||
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
var $error = '';
|
||||
var $name = 'Thyme';
|
||||
|
||||
|
||||
/**
|
||||
* Renvoi la description du modele de numerotation
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$form = new Form($this->db);
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$texte.= '<input type="hidden" name="action" value="updateMask">';
|
||||
$texte.= '<input type="hidden" name="maskconstpayment" value="PAYMENT_THYME_MASK">';
|
||||
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
|
||||
$tooltip.=$langs->trans("GenericMaskCodes2");
|
||||
$tooltip.=$langs->trans("GenericMaskCodes3");
|
||||
$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Order"),$langs->transnoentities("Order"));
|
||||
$tooltip.=$langs->trans("GenericMaskCodes5");
|
||||
|
||||
// Parametrage du prefix
|
||||
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskpayment" value="'.$conf->global->PAYMENT_THYME_MASK.'">',$tooltip,1,1).'</td>';
|
||||
|
||||
$texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
|
||||
|
||||
$texte.= '</tr>';
|
||||
|
||||
$texte.= '</table>';
|
||||
$texte.= '</form>';
|
||||
|
||||
return $texte;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi un exemple de numerotation
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$old_code_client=$mysoc->code_client;
|
||||
$mysoc->code_client='CCCCCCCCCC';
|
||||
$numExample = $this->getNextValue($mysoc,'');
|
||||
$mysoc->code_client=$old_code_client;
|
||||
|
||||
if (! $numExample)
|
||||
{
|
||||
$numExample = $langs->trans('NotConfigured');
|
||||
}
|
||||
return $numExample;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Societe $objsoc Object thirdparty
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Value if KO, <0 if KO
|
||||
*/
|
||||
function getNextValue($objsoc,$object)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
||||
|
||||
// We get cursor rule
|
||||
$mask=$conf->global->PAYMENT_THYME_MASK;
|
||||
|
||||
if (! $mask)
|
||||
{
|
||||
$this->error='NotConfigured';
|
||||
return 0;
|
||||
}
|
||||
|
||||
$numFinal=get_next_value($db,$mask,'bordereau_cheque','ref','',$objsoc,$object->date_bordereau);
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Societe $objsoc Object third party
|
||||
* @param string $objforref Object for number to search
|
||||
* @return string Next free value
|
||||
*/
|
||||
function chequereceipt_get_num($objsoc,$objforref)
|
||||
{
|
||||
return $this->getNextValue($objsoc,$objforref);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,10 +30,92 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent
|
||||
|
||||
/**
|
||||
* \class ModeleNumRefChequeReceipts
|
||||
* \brief Cheque Receipts numbering references mother class
|
||||
*/
|
||||
abstract class ModeleNumRefChequeReceipts
|
||||
{
|
||||
var $error='';
|
||||
|
||||
/**
|
||||
* Return if a module can be used or not
|
||||
*
|
||||
* @return boolean true if module can be used
|
||||
*/
|
||||
function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default description of numbering module
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("bills");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return numbering example
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("bills");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the existing numbers in the database do not cause conflicts that would prevent this numbering run.
|
||||
*
|
||||
* @return boolean false si conflit, true si ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next value
|
||||
*
|
||||
* @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");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the module numbering version
|
||||
*
|
||||
* @return string Value
|
||||
*/
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \class ModeleChequeReceipts
|
||||
* \brief Classe mere des modeles de facture
|
||||
* \brief Classe mere des modeles de
|
||||
*/
|
||||
abstract class ModeleChequeReceipts extends CommonDocGenerator
|
||||
{
|
||||
|
||||
@@ -342,3 +342,8 @@ CREATE TABLE llx_c_accounting_category (
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code);
|
||||
|
||||
|
||||
DROP INDEX uk_bordereau_cheque ON llx_bordereau_cheque;
|
||||
ALTER TABLE llx_bordereau_cheque CHANGE number ref VARCHAR(30) NOT NULL;
|
||||
CREATE UNIQUE INDEX uk_bordereau_cheque ON llx_bordereau_cheque (ref, entity);
|
||||
|
||||
@@ -17,4 +17,4 @@
|
||||
-- ===========================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_bordereau_cheque ADD UNIQUE INDEX uk_bordereau_cheque (number, entity);
|
||||
ALTER TABLE llx_bordereau_cheque ADD UNIQUE INDEX uk_bordereau_cheque (ref, entity);
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
create table llx_bordereau_cheque
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
number varchar(16) NOT NULL, -- ref
|
||||
ref_ext varchar(255), -- ref_ext
|
||||
ref varchar(30) NOT NULL, -- ref
|
||||
ref_ext varchar(255), -- ref_ext
|
||||
datec datetime NOT NULL,
|
||||
date_bordereau date, -- A quoi sert cette date ?
|
||||
date_bordereau date,
|
||||
amount double(24,8) NOT NULL,
|
||||
nbcheque smallint NOT NULL,
|
||||
fk_bank_account integer,
|
||||
|
||||
@@ -1610,6 +1610,8 @@ BankOrderGlobal=General
|
||||
BankOrderGlobalDesc=General display order
|
||||
BankOrderES=Spanish
|
||||
BankOrderESDesc=Spanish display order
|
||||
ChequeReceiptsNumberingModule=Cheque Receipts Numbering module
|
||||
|
||||
##### Multicompany #####
|
||||
MultiCompanySetup=Multi-company module setup
|
||||
##### Suppliers #####
|
||||
|
||||
Reference in New Issue
Block a user