Merge remote-tracking branch 'Upstream/develop' into 5.0-credit_note

This commit is contained in:
aspangaro 2016-10-02 21:40:30 +02:00
commit 7194e3b8dd
28 changed files with 1689 additions and 493 deletions

View File

@ -147,7 +147,7 @@ else if ($action == 'specimen') // For orders
// Activate a model
else if ($action == 'setmodel')
{
print "sssd".$value;
//print "sssd".$value;
$ret = addDocumentModel($value, $type, $label, $scandir);
}

View File

@ -28,7 +28,8 @@
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/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
$langs->load("admin");
$langs->load("companies");
@ -40,6 +41,10 @@ if (!$user->admin)
accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$type = 'bankaccount';
/*
@ -60,14 +65,103 @@ if ($action == 'setbankorder')
}
}
if ($action == 'specimen')
{
$modele=GETPOST('module','alpha');
if ($modele == 'sepamandate')
{
$object = new CompanyBankAccount($db);
}
else
{
$object = new Account($db);
}
$object->initAsSpecimen();
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/bank/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
$module = new $classname($db);
if ($module->write_file($object,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bank&file=SPECIMEN.pdf");
return;
}
else
{
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
}
else
{
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Activate a model
if ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
else if ($action == 'del')
{
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->BANKADDON_PDF == "$value") dolibarr_del_const($db, 'BANKADDON_PDF',$conf->entity);
}
}
// Set default model
else if ($action == 'setdoc')
{
if (dolibarr_set_const($db, "BANKADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->BANKADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
/*
* view
*/
llxHeader("",$langs->trans("BankSetupModule"));
$form=new Form($db);
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader("",$langs->trans("BankSetupModule"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
@ -79,7 +173,7 @@ $var=true;
$var=! $var;
//Show bank account order
print load_fiche_titre($langs->trans("BankOrderShow"));
print load_fiche_titre($langs->trans("BankOrderShow"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -137,6 +231,152 @@ while ($i < $nbofbank)
print '</table>'."\n";
print '<br><br>';
/*
* Document templates generators
*/
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
//{
print load_fiche_titre($langs->trans("BankAccountModelModule"), '', '');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
$sql .= " FROM " . MAIN_DB_PREFIX . "document_model";
$sql .= " WHERE type = '" . $type . "'";
$sql .= " AND entity = " . $conf->entity;
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows) {
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i ++;
}
} else {
dol_print_error($db);
}
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>' . $langs->trans("Name") . '</td>';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td align="center" width="60">' . $langs->trans("Status") . "</td>\n";
print '<td align="center" width="60">' . $langs->trans("Default") . "</td>\n";
print '<td align="center" width="38">' . $langs->trans("ShortInfo") . '</td>';
print '<td align="center" width="38">' . $langs->trans("Preview") . '</td>';
print "</tr>\n";
clearstatcache();
$var = true;
foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir) {
$dir = dol_buildpath($reldir . "core/modules/bank" . $valdir);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (file_exists($dir . '/' . $file)) {
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir . '/' . $file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
$modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
$modulequalified = 0;
if ($modulequalified) {
$var = ! $var;
print '<tr ' . $bc[$var] . '><td width="100">';
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info'))
print $module->info($langs);
else
print $module->description;
print '</td>';
// Active
if (in_array($name, $def)) {
print '<td align="center">' . "\n";
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=del&value=' . $name . '">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td align="center">' . "\n";
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&amp;scandir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
print "</td>";
}
// Default
print '<td align="center">';
if ($conf->global->BANKADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&amp;scandir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
}
print '</td>';
// Info
$htmltooltip = '' . $langs->trans("Name") . ': ' . $module->name;
$htmltooltip .= '<br>' . $langs->trans("Type") . ': ' . ($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf') {
$htmltooltip .= '<br>' . $langs->trans("Width") . '/' . $langs->trans("Height") . ': ' . $module->page_largeur . '/' . $module->page_hauteur;
}
$htmltooltip .= '<br><br><u>' . $langs->trans("FeaturesSupported") . ':</u>';
$htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo, 1, 1);
//$htmltooltip .= '<br>' . $langs->trans("PaymentMode") . ': ' . yn($module->option_modereg, 1, 1);
//$htmltooltip .= '<br>' . $langs->trans("PaymentConditions") . ': ' . yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang, 1, 1);
// $htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
// $htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
//$htmltooltip .= '<br>' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1);
print '<td align="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td align="center">';
if ($module->type == 'pdf') {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"), 'bill') . '</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
}
//}
dol_fiche_end();
llxFooter();

View File

@ -273,12 +273,12 @@ else if ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
* View
*/
$form=new Form($db);
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader("",$langs->trans("OrdersSetup"));
$form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("OrdersSetup"),$linkback,'title_setup');

View File

@ -363,7 +363,7 @@ if ($mode != 'marketplace')
//print '</div>';
}
print '<br><br><br>';
print '<br><br><br><br>';
// Show list of modules
@ -520,6 +520,11 @@ if ($mode != 'marketplace')
{
$text.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("Core").'<br>';
}
$text.='<br><strong>'.$langs->trans("LastActivationDate").':</strong> ';
if (! empty($conf->global->$const_name)) $text.=dol_print_date($objMod->getLastActivationDate(), 'dayhour');
else $text.=$langs->trans("Disabled");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
{
@ -650,22 +655,23 @@ if ($mode != 'marketplace')
print $form->textwithpicto('', $text, 1, 'help', 'minheight20');
// Picto warning
$version=$objMod->getVersion(0);
$versiontrans=$objMod->getVersion(1);
if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: right"');
if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: right"');
if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: right"');
// Picto external
if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: right"');
print '</td>';
// Version
print '<td align="center" valign="top" class="nowrap">';
// Picto warning
$version=$objMod->getVersion(0);
$versiontrans=$objMod->getVersion(1);
if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: left"');
if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: left"');
if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: left"');
// Picto external
if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: left"');
print $versiontrans;
print "</td>\n";
// Activate/Disable and Setup (2 columns)

View File

@ -36,6 +36,7 @@ $langs->load("withdrawals");
if (!$user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$type = 'paymentorder';
/*
@ -110,6 +111,71 @@ if ($action == "deletenotif")
exit;
}
/*
if ($action == 'specimen')
{
$modele=GETPOST('module','alpha');
$commande = new Commande($db);
$commande->initAsSpecimen();
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/paymentorders/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
$module = new $classname($db);
if ($module->write_file($commande,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=paymentorders&file=SPECIMEN.pdf");
return;
}
else
{
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
}
else
{
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Set default model
else if ($action == 'setdoc')
{
if (dolibarr_set_const($db, "PAYMENTORDER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->PAYMENTORDER_ADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
*/
/*
* View
@ -117,6 +183,8 @@ if ($action == "deletenotif")
$form=new Form($db);
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader('',$langs->trans("WithdrawalsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
@ -128,6 +196,7 @@ print '<form method="post" action="prelevement.php?action=set">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="30%">'.$langs->trans("Parameter").'</td>';
print '<td width="40%">'.$langs->trans("Value").'</td>';
@ -159,6 +228,172 @@ print '<div class="center"><input type="submit" class="button" value="'.$langs->
print '</form>';
print '<br>';
/*
* Document templates generators
*/
/*
print load_fiche_titre($langs->trans("OrdersModelModule"),'','');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
if ($resql)
{
$i = 0;
$num_rows=$db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
}
else
{
dol_print_error($db);
}
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="38">'.$langs->trans("ShortInfo").'</td>';
print '<td align="center" width="38">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/paymentorders".$valdir);
if (is_dir($dir))
{
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
$filelist[]=$file;
}
closedir($handle);
arsort($filelist);
foreach($filelist as $file)
{
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified)
{
$var = !$var;
print '<tr '.$bc[$var].'><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module,'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
print '</td>';
}
else
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
// Default
print '<td align="center">';
if ($conf->global->PAYMENTORDER_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
//$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
// Preview
print '<td align="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
}
else
{
print img_object($langs->trans("PreviewNotAvailable"),'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
}
*/
dol_fiche_end();
print '<br>';

View File

@ -1450,8 +1450,9 @@ class Account extends CommonObject
*/
function initAsSpecimen()
{
$this->specimen = 1;
$this->ref = 'MBA';
$this->label = 'My Bank account';
$this->label = 'My Big Company Bank account';
$this->bank = 'MyBank';
$this->courant = Account::TYPE_CURRENT;
$this->clos = Account::STATUS_OPEN;
@ -1461,7 +1462,7 @@ class Account extends CommonObject
$this->cle_rib = 50;
$this->bic = 'AA12';
$this->iban = 'FR999999999';
$this->domiciliation = 'The bank addresse';
$this->domiciliation = 'My bank address';
$this->proprio = 'Owner';
$this->owner_address = 'Owner address';
$this->country_id = 1;

View File

@ -1525,7 +1525,8 @@ class BonPrelevement extends CommonObject
*/
static function buildRumNumber($row_code_client, $row_datec, $row_drum)
{
$pre = ($row_datec > 1359673200) ? 'RUM-' : '++R';
global $langs;
$pre = ($row_datec > 1359673200) ? $langs->trans('RUM').'-' : '++R';
return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
}

View File

@ -3080,6 +3080,7 @@ abstract class CommonObject
/**
* Return incoterms informations
* TODO Use a cache for label get
*
* @return string incoterms info
*/
@ -3098,7 +3099,7 @@ abstract class CommonObject
}
}
$out .= ' - '.$this->location_incoterms;
$out .= (($res->code && $this->location_incoterms)?' - ':'').$this->location_incoterms;
return $out;
}

View File

@ -386,6 +386,8 @@ class Conf
if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard";
if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
if (empty($this->global->CHEQUERECEIPTS_ADDON)) $this->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint';
// Security
if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator
if (empty($this->global->MAIN_UMASK)) $this->global->MAIN_UMASK='0664'; // Default mask
@ -490,7 +492,7 @@ class Conf
if (! isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY=1;
// Define list of limited modules
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,supplier_proposal,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later.
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,societe,propal,commande,facture,categorie,supplier_proposal,fournisseur,contact,projet,contrat,ficheinter,expedition,agenda,resource,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later.
// Enable select2
if (empty($this->global->MAIN_USE_JQUERY_MULTISELECT) || $this->global->MAIN_USE_JQUERY_MULTISELECT == '1') $this->global->MAIN_USE_JQUERY_MULTISELECT='select2';

View File

@ -123,7 +123,45 @@ function societe_prepare_head(Societe $object)
$h++;
}
// Show more tabs from modules
// Related items
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fichinter->enabled) || ! empty($conf->fournisseur->enabled))
{
$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Referers");
$head[$h][2] = 'consumption';
$h++;
}
// Bank accounrs
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
{
$nbBankAccount=0;
$head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$object->id;
$head[$h][1] = $langs->trans("BankAccounts");
$sql = "SELECT COUNT(n.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib as n";
$sql.= " WHERE fk_soc = ".$object->id;
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$nbBankAccount=$obj->nb;
$i++;
}
}
else {
dol_print_error($db);
}
if ($nbBankAccount > 0) $head[$h][1].= ' <span class="badge">'.$nbBankAccount.'</span>';
$head[$h][2] = 'rib';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
@ -131,14 +169,6 @@ function societe_prepare_head(Societe $object)
if ($user->societe_id == 0)
{
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fichinter->enabled) || ! empty($conf->fournisseur->enabled))
{
$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Referers");
$head[$h][2] = 'consumption';
$h++;
}
// Notifications
if (! empty($conf->notification->enabled))
{
@ -232,14 +262,6 @@ function societe_prepare_head2($object)
$head[$h][2] = 'company';
$h++;
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
{
$head[$h][0] = DOL_URL_ROOT .'/societe/rib.php?socid='.$object->id;
$head[$h][1] = $langs->trans("BankAccount");
$head[$h][2] = 'rib';
$h++;
}
$head[$h][0] = 'commerciaux.php?socid='.$object->id;
$head[$h][1] = $langs->trans("SalesRepresentative");
$head[$h][2] = 'salesrepresentative';

View File

@ -709,7 +709,33 @@ class DolibarrModules // Can not be abstract, because we need to insta
}
}
/**
* Gives the last date of activation
*
* @return timestamp Date of last activation
*/
function getLastActivationDate()
{
global $conf;
$sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->const_name."'";
$sql.= " AND entity IN (0, ".$conf->entity.")";
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql) $err++;
else
{
$obj=$this->db->fetch_object($resql);
if ($obj) return $this->db->jdate($obj->tms);
}
return '';
}
/**
* Insert constants for module activation
*

View File

@ -0,0 +1,391 @@
<?php
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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/bank/doc/pdf_ban.modules.php
* \ingroup bank
* \brief File of class to generate document with template ban
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/**
* Classe permettant de generer les projets au modele Ban
*/
class pdf_ban extends ModeleBankAccountDoc
{
var $emetteur; // Objet societe qui emet
var $version = 'development';
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
global $conf,$langs,$mysoc;
$langs->load("main");
$langs->load("bank");
$langs->load("withdrawals");
$langs->load("companies");
$this->db = $db;
$this->name = "ban";
$this->description = $langs->trans("DocumentModelBan").' (Volunteer wanted to finish)';
// Dimension page pour format A4
$this->type = 'pdf';
$formatarray=pdf_getFormat();
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_codeproduitservice = 1; // Affiche code produit-service
// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
// Defini position des colonnes
$this->posxref=$this->marge_gauche+1;
$this->posxlabel=$this->marge_gauche+25;
$this->posxworkload=$this->marge_gauche+100;
$this->posxprogress=$this->marge_gauche+130;
$this->posxdatestart=$this->marge_gauche+150;
$this->posxdateend=$this->marge_gauche+170;
}
/**
* Fonction generant le projet sur le disque
*
* @param Project $object Object project a generer
* @param Translate $outputlangs Lang output object
* @return int 1 if OK, <=0 if KO
*/
function write_file($object,$outputlangs)
{
global $conf, $hookmanager, $langs, $user;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("projects");
if ($conf->bank->dir_output)
{
//$nblignes = count($object->lines); // This is set later with array of tasks
// Definition of $dir and $file
if ($object->specimen)
{
$dir = $conf->bank->dir_output;
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->bank->dir_output . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}
if (! file_exists($dir))
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
if (file_exists($dir))
{
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("BAN"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("BAN"));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 50;
$tab_height = 200;
$tab_top_newpage = 40;
$tab_height_newpage = 210;
// Affiche notes
if (! empty($object->note_public))
{
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($object->note_public), 0, 1);
$nexY = $pdf->GetY();
$height_note=$nexY-($tab_top-2);
// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192);
$pdf->Rect($this->marge_gauche, $tab_top-3, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
$tab_height = $tab_height - $height_note;
$tab_top = $nexY+6;
}
else
{
$height_note=0;
}
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
$pdf->SetXY($this->marge_gauche, $curY);
$pdf->MultiCell(200, 3, $outputlangs->trans("BAN").' : '.$object->account_number, 0, 'L');
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
/*
* Pied de page
*/
$this->_pagefoot($pdf,$object,$outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
$pdf->Output($file,'F');
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
return 1; // Pas d'erreur
}
else
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
$this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
return 0;
}
/**
* Show table for lines
*
* @param PDF $pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
}
/**
* Show top header of page.
*
* @param PDF $pdf Object PDF
* @param Project $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('','B', $default_font_size + 3);
$posx=$this->page_largeur-$this->marge_droite-100;
$posy=$this->marge_haute;
$pdf->SetXY($this->marge_gauche,$posy);
// Logo
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
if ($mysoc->logo)
{
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
}
else
{
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
}
}
else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L');
$pdf->SetFont('','B', $default_font_size + 3);
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("BAN")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
$pdf->SetFont('','', $default_font_size + 2);
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date(dol_now(),'day',false,$outputlangs,true), '', 'R');
/*$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
*/
$pdf->SetTextColor(0,0,60);
// Add list of linked objects
/* Removed: A project can have more than thousands linked objects (orders, invoices, proposals, etc....
$object->fetchObjectLinked();
foreach($object->linkedObjects as $objecttype => $objects)
{
var_dump($objects);exit;
if ($objecttype == 'commande')
{
$outputlangs->load('orders');
$num=count($objects);
for ($i=0;$i<$num;$i++)
{
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetFont('','', $default_font_size - 1);
$text=$objects[$i]->ref;
if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')';
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
}
}
}
*/
}
/**
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param Project $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
//return pdf_pagefoot($pdf,$outputlangs,'BANK_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}
}

View File

@ -22,9 +22,8 @@
* \brief File of class to generate document with template sepamandate
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -37,7 +36,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
class pdf_sepamandate extends ModeleBankAccountDoc
{
var $emetteur; // Objet societe qui emet
var $version = 'dolibarr';
/**
* Constructor
*
@ -48,11 +48,12 @@ class pdf_sepamandate extends ModeleBankAccountDoc
global $conf,$langs,$mysoc;
$langs->load("main");
$langs->load("projects");
$langs->load("bank");
$langs->load("withdrawals");
$langs->load("companies");
$this->db = $db;
$this->name = "baleine";
$this->name = "sepamandate";
$this->description = $langs->trans("DocumentModelSepaMandate");
// Dimension page pour format A4
@ -93,7 +94,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
*/
function write_file($object,$outputlangs)
{
global $conf, $hookmanager, $langs, $user;
global $conf, $hookmanager, $langs, $user, $mysoc;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -104,15 +105,23 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$outputlangs->load("companies");
$outputlangs->load("projects");
if ($conf->projet->dir_output)
if ($conf->bank->dir_output)
{
//$nblignes = count($object->lines); // This is set later with array of tasks
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->projet->dir_output;
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
// Definition of $dir and $file
if ($object->specimen)
{
$dir = $conf->bank->dir_output;
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->bank->dir_output . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}
if (! file_exists($dir))
{
if (dol_mkdir($dir) < 0)
@ -149,27 +158,15 @@ class pdf_sepamandate extends ModeleBankAccountDoc
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Complete object by loading several other informations
$task = new Task($this->db);
$tasksarray = $task->getTasksArray(0,0,$object->id);
if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines
{
$tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray)));
}
$object->lines=$tasksarray;
$nblignes=count($object->lines);
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Project"));
$pdf->SetSubject($outputlangs->transnoentities("SepaMandate"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project"));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("SepaMandate"));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
@ -211,87 +208,140 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
// Boucle sur les lignes
for ($i = 0 ; $i < $nblignes ; $i++)
$posY = $curY;
$pdf->SetFont('','', $default_font_size);
$pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
$posY+=2;
$pdf->SetXY($this->marge_gauche, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("RUMLong").' ('.$outputlangs->trans("RUM").')'.' : '.$object->rum, 0, 'L');
$posY=$pdf->GetY();
$posY+=2;
$pdf->SetXY($this->marge_gauche, $posY);
$ics='';
if (! empty($conf->global->PRELEVEMENT_ICS)) $ics=$conf->global->PRELEVEMENT_ICS;
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorIdentifier").' ('.$outputlangs->trans("ICS").')'.' : '.$ics, 0, 'L');
$posY=$pdf->GetY();
$posY+=1;
$pdf->SetXY($this->marge_gauche, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorName").' : '.$mysoc->name, 0, 'L');
$posY=$pdf->GetY();
$posY+=1;
$pdf->SetXY($this->marge_gauche, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L');
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $mysoc->getFullAddress(), 0, 'L');
$posY=$pdf->GetY();
$posY+=3;
$pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
$pdf->SetFont('','', $default_font_size - 1);
$posY+=8;
$pdf->SetXY($this->marge_gauche, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 8, $outputlangs->trans("SEPALegalText", $mysoc->name, $mysoc->name), 0, 'L');
// Your data form
$posY=$pdf->GetY();
$posY+=8;
$pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
$posY+=2;
$pdf->SetFont('','', $default_font_size);
$pdf->SetXY($this->marge_gauche, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFillForm"), 0, 'C');
$thirdparty=new Societe($this->db);
if ($object->socid > 0) $thirdparty->fetch($object->socid);
$sepaname = '______________________________________________';
if ($thirdparty->id > 0)
{
$curY = $nexY;
// Description of ligne
$ref=$object->lines[$i]->ref;
$libelleline=$object->lines[$i]->label;
$progress=$object->lines[$i]->progress.'%';
$datestart=dol_print_date($object->lines[$i]->date_start,'day');
$dateend=dol_print_date($object->lines[$i]->date_end,'day');
$planned_workload=convertSecondToTime($object->lines[$i]->planned_workload,'allhourmin');
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxlabel-$this->posxref, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
$pdf->SetXY($this->posxlabel, $curY);
$pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
$pdf->SetXY($this->posxworkload, $curY);
$pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $planned_workload, 0, 'R');
$pdf->SetXY($this->posxprogress, $curY);
$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R');
$pdf->SetXY($this->posxdatestart, $curY);
$pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $datestart, 0, 'C');
$pdf->SetXY($this->posxdateend, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxdateend, 3, $dateend, 0, 'C');
$pageposafter=$pdf->getPage();
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
// Add line
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
//$pdf->SetDrawColor(190,190,200);
$pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1);
$pdf->SetLineStyle(array('dash'=>0));
}
$nexY+=2; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs,1);
// New page
$pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
}
$sepaname = $thirdparty->name.' ('.$object->account_owner.')';
}
$posY=$pdf->GetY();
$posY+=3;
$pdf->SetXY($this->marge_gauche, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourName").' * : ', 0, 'L');
$pdf->SetXY(80, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $sepaname, 0, 'L');
$address = '______________________________________________';
if ($thirdparty->id > 0)
{
$address = $thirdparty->getFullAddress();
}
$posY=$pdf->GetY();
$posY+=1;
$pdf->SetXY($this->marge_gauche, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L');
$pdf->SetXY(80, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L');
if (preg_match('/_____/', $address))
{
$posY+=6;
$pdf->SetXY(80, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L');
}
$ban = '__________________________________________________';
if (! empty($object->iban)) $ban = $object->iban;
$posY=$pdf->GetY();
$posY+=1;
$pdf->SetXY($this->marge_gauche, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBAN").' * : ', 0, 'L');
$pdf->SetXY(80, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $ban, 0, 'L');
$bic = '__________________________________________________';
if (! empty($object->bic)) $bic = $object->bic;
$posY=$pdf->GetY();
$posY+=1;
$pdf->SetXY($this->marge_gauche, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBIC").' * : ', 0, 'L');
$pdf->SetXY(80, $posY);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $bic, 0, 'L');
$posY=$pdf->GetY();
$posY+=1;
$pdf->SetXY($this->marge_gauche, $posY);
$txt = $outputlangs->transnoentitiesnoconv("SEPAFrstOrRecur").' * : ';
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
$pdf->Rect(80, $posY, 5, 5);
$pdf->SetXY(80, $posY);
if ($object->frstrecur == 'FRST') $pdf->MultiCell(5, 3, 'X', 0, 'L');
$pdf->SetXY(86, $posY);
$txt = $langs->trans("ModeRECUR").' '.$langs->trans("or");
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
$posY+=6;
$pdf->Rect(80, $posY, 5, 5);
$pdf->SetXY(80, $posY);
if ($object->frstrecur == 'RECUR') $pdf->MultiCell(5, 3, 'X', 0, 'L');
$pdf->SetXY(86, $posY);
$txt = $langs->trans("ModeFRST");
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
if (empty($object->frstrecur))
{
$posY+=6;
$pdf->SetXY(80, $posY);
$txt = '('.$langs->trans("PleaseCheckOne").')';
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
}
$posY=$pdf->GetY();
$posY+=3;
$pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
$posY+=3;
// Show square
if ($pagenb == 1)
{
@ -304,6 +354,15 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
}
var_dump($tab_top);
var_dump($heightforinfotot);
var_dump($heightforfreetext);
var_dump($heightforfooter);
var_dump($bottomlasttab);
// Affiche zone infos
$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
/*
* Pied de page
*/
@ -360,36 +419,84 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetDrawColor(128,128,128);
// Rect prend une longueur en 3eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 3eme param
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size);
$pdf->SetXY($this->posxref, $tab_top+1);
$pdf->MultiCell($this->posxlabel-$this->posxref,3, $outputlangs->transnoentities("Tasks"),'','L');
$pdf->SetXY($this->posxlabel, $tab_top+1);
$pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L');
$pdf->SetXY($this->posxworkload, $tab_top+1);
$pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $outputlangs->transnoentities("PlannedWorkloadShort"), 0, 'R');
$pdf->SetXY($this->posxprogress, $tab_top+1);
$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, '%', 0, 'R');
$pdf->SetXY($this->posxdatestart, $tab_top+1);
$pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, '', 0, 'C');
$pdf->SetXY($this->posxdateend, $tab_top+1);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
}
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param PDF $pdf Object PDF
* @param Object $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return void
*/
function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
global $conf, $mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?1:$conf->global->PDF_DIFFSIZE_TITLE);
$posy+=$this->_signature_area($pdf, $object, $posy, $outputlangs);
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','', $default_font_size);
$pdf->MultiCell(100, 3, $outputlangs->trans("PleaseReturnMandate").':', 0, 'L', 0);
$posy=$pdf->GetY()+2;
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('','', $default_font_size - $diffsizetitle);
$pdf->MultiCell(100, 6, $mysoc->name, 0, 'L', 0);
$pdf->MultiCell(100, 6, $outputlangs->convToOutputCharset($mysoc->getFullAddress()), 0, 'L', 0);
$posy=$pdf->GetY()+2;
return $posy;
}
/**
* Show area for the customer to sign
*
* @param PDF $pdf Object PDF
* @param Facture $object Object invoice
* @param int $posy Position depart
* @param Translate $outputlangs Objet langs
* @return int Position pour suite
*/
function _signature_area(&$pdf, $object, $posy, $outputlangs)
{
$default_font_size = pdf_getPDFFontSize($outputlangs);
$tab_top = $posy + 4;
$tab_hl = 4;
$posx = $this->marge_gauche;
$pdf->SetXY($posx, $tab_top + 0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->MultiCell(100, 3, $outputlangs->trans("DateOfSignature"), 0, 'L', 0);
$pdf->MultiCell(100, 3, ' ');
$pdf->MultiCell(100, 3, '______________________', 0, 'L', 0);
$posx = 120;
$largcol = ($this->page_largeur - $this->marge_droite - $posx);
$useborder=0;
$index = 0;
// Total HT
$pdf->SetFillColor(255,255,255);
$pdf->SetXY($posx, $tab_top + 0);
$pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities("Signature"), 0, 'L', 1);
$pdf->SetXY($posx, $tab_top + $tab_hl);
$pdf->MultiCell($largcol, $tab_hl*3, '', 1, 'R');
return ($tab_hl*7);
}
/**
* Show top header of page.
*
@ -437,16 +544,22 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$pdf->SetFont('','B', $default_font_size + 3);
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Project")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("SepaMandate"), '', 'R');
$pdf->SetFont('','', $default_font_size + 2);
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R');
$posy+=6;
$daterum = '__________________';
if (! empty($object->date_rum))
{
$daterum = dol_print_date($object->date_rum,'day',false,$outputlangs,true);
}
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . $daterum, '', 'R');
/*$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
*/
$pdf->SetTextColor(0,0,60);
@ -489,7 +602,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'BANK_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
return pdf_pagefoot($pdf,$outputlangs,'PAYMENTORDER_FREE_TEXT',null,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}
}

View File

@ -70,7 +70,7 @@ class modBanque extends DolibarrModules
// Dependancies
$this->depends = array();
$this->requiredby = array("modComptabilite","modAccounting");
$this->requiredby = array("modComptabilite","modAccounting","modPrelevement");
$this->conflictwith = array();
$this->langfiles = array("banks","compta","bills","companies");

View File

@ -92,7 +92,7 @@ class modPrelevement extends DolibarrModules
$r=0;
$r++;
$this->rights[$r][0] = 151;
$this->rights[$r][1] = 'Read withdrawals';
$this->rights[$r][1] = 'Read direct debit payment orders';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'bons';
@ -100,7 +100,7 @@ class modPrelevement extends DolibarrModules
$r++;
$this->rights[$r][0] = 152;
$this->rights[$r][1] = 'Create/modify a withdrawals';
$this->rights[$r][1] = 'Create/modify a direct debit payment order';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'bons';
@ -108,7 +108,7 @@ class modPrelevement extends DolibarrModules
$r++;
$this->rights[$r][0] = 153;
$this->rights[$r][1] = 'Send withdrawals to bank';
$this->rights[$r][1] = 'Send/Transmit direct debit payment orders';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'bons';
@ -116,7 +116,7 @@ class modPrelevement extends DolibarrModules
$r++;
$this->rights[$r][0] = 154;
$this->rights[$r][1] = 'credit/refuse withdrawals';
$this->rights[$r][1] = 'Record Credits/Rejects of direct debit payment orders';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'bons';

View File

@ -332,6 +332,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$var=true;
if ($num)
{
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$i=0;
$contactstatic = new Contact($this->db);

View File

@ -278,6 +278,7 @@ YouCanSubmitFile=For this step, you can send package using this tool: Select mod
CurrentVersion=Dolibarr current version
CallUpdatePage=Go to the page that updates the database structure and data: %s.
LastStableVersion=Latest stable version
LastActivationDate=Last activation date
UpdateServerOffline=Update server offline
GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags could be used:<br><b>{000000}</b> corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask. <br><b>{000000+000}</b> same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s. <br><b>{000000@x}</b> same as previous but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then sequence {yy}{mm} or {yyyy}{mm} is also required. <br><b>{dd}</b> day (01 to 31).<br><b>{mm}</b> month (01 to 12).<br><b>{yy}</b>, <b>{yyyy}</b> or <b>{y}</b> year over 2, 4 or 1 numbers. <br>
GenericMaskCodes2=<b>{cccc}</b> the client code on n characters<br><b>{cccc000}</b> the client code on n characters is followed by a counter dedicated for customer. This counter dedicated to customer is reset at same time than global counter.<br><b>{tttt}</b> The code of thirdparty type on n characters (see dictionary-thirdparty types).<br>
@ -437,8 +438,8 @@ Module55Name=Barcodes
Module55Desc=Barcode management
Module56Name=Telephony
Module56Desc=Telephony integration
Module57Name=Standing orders
Module57Desc=Standing orders and withdrawal management. Also includes generation of SEPA file for european countries.
Module57Name=Direct bank payment orders
Module57Desc=Management of Direct Debit payment orders. It includes generation of SEPA file for european countries.
Module58Name=ClickToDial
Module58Desc=Integration of a ClickToDial system (Asterisk, ...)
Module59Name=Bookmark4u
@ -615,10 +616,10 @@ Permission142=Create/modify all projects and tasks (also private projects i am n
Permission144=Delete all projects and tasks (also private projects i am not contact for)
Permission146=Read providers
Permission147=Read stats
Permission151=Read standing orders
Permission152=Create/modify a standing orders request
Permission153=Transmission standing orders receipts
Permission154=Credit/refuse standing orders receipts
Permission151=Read direct debit payment orders
Permission152=Create/modify a direct debit payment orders
Permission153=Send/Transmit direct debit payment orders
Permission154=Record Credits/Rejects of direct debit payment orders
Permission161=Read contracts/subscriptions
Permission162=Create/modify contracts/subscriptions
Permission163=Activate a service/subscription of a contract
@ -1354,7 +1355,7 @@ GenbarcodeLocation=Bar code generation command line tool (used by internal engin
BarcodeInternalEngine=Internal engine
BarCodeNumberManager=Manager to auto define barcode numbers
##### Prelevements #####
WithdrawalsSetup=Withdrawal module setup
WithdrawalsSetup=Setup of module Direct debit payment orders
##### ExternalRSS #####
ExternalRSSSetup=External RSS imports setup
NewRSS=New RSS Feed

View File

@ -32,8 +32,8 @@ IbanNotValid=IBAN is Not Valid
BIC=BIC/SWIFT number
SwiftValid=BIC/SWIFT is Valid
SwiftNotValid=BIC/SWIFT is Not Valid
StandingOrders=Standing orders
StandingOrder=Standing order
StandingOrders=Direct Debit orders
StandingOrder=Direct debit order
AccountStatement=Account statement
AccountStatementShort=Statement
AccountStatements=Account statements
@ -144,3 +144,5 @@ ConfirmRejectCheck=Are you sure you want to mark this check as rejected ?
RejectCheckDate=Date the check was returned
CheckRejected=Check returned
CheckRejectedAndInvoicesReopened=Check returned and invoices reopened
BankAccountModelModule=Document templates for bank accounts
DocumentModelSepaMandate=Template of SEPA mandate. Usefull for european countries in EEC only.

View File

@ -209,8 +209,8 @@ EscompteOffered=Discount offered (payment before term)
EscompteOfferedShort=Discount
SendBillRef=Submission of invoice %s
SendReminderBillRef=Submission of invoice %s (reminder)
StandingOrders=Standing orders
StandingOrder=Standing order
StandingOrders=Direct debit orders
StandingOrder=Direct debit order
NoDraftBills=No draft invoices
NoOtherDraftBills=No other draft invoices
NoDraftInvoices=No draft invoices
@ -351,8 +351,8 @@ VarAmount=Variable amount (%% tot.)
# PaymentType
PaymentTypeVIR=Bank transfer
PaymentTypeShortVIR=Bank transfer
PaymentTypePRE=Bank's order
PaymentTypeShortPRE=Bank's order
PaymentTypePRE=Direct debit payment order
PaymentTypeShortPRE=Debit payment order
PaymentTypeLIQ=Cash
PaymentTypeShortLIQ=Cash
PaymentTypeCB=Credit card

View File

@ -175,6 +175,7 @@ ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s t
ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment.
ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal.
ErrorFailedToLoadLoginFileForMode=Failed to get the login file for mode '%s'.
ErrorModuleNotFound=File of module was not found.
# Warnings
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.

View File

@ -607,6 +607,7 @@ DisabledModules=Disabled modules
For=For
ForCustomer=For customer
Signature=Signature
DateOfSignature=Date of signature
HidePassword=Show command with password hidden
UnHidePassword=Show real command with clear password
Root=Root

View File

@ -1,27 +1,28 @@
# Dolibarr language file - Source file is en_US - withdrawals
CustomersStandingOrdersArea=Customers standing orders area
StandingOrders=Standing orders
StandingOrder=Standing orders
NewStandingOrder=New standing order
CustomersStandingOrdersArea=Direct debit payment orders area
SuppliersStandingOrdersArea=Direct credit payment orders area
StandingOrders=Direct debit payment orders
StandingOrder=Direct debit payment order
NewStandingOrder=New direct debit order
StandingOrderToProcess=To process
WithdrawalsReceipts=Withdrawal receipts
WithdrawalReceipt=Withdrawal receipt
LastWithdrawalReceipts=Latest %s withdrawal receipts
WithdrawalsLines=Withdrawal lines
RequestStandingOrderToTreat=Request for standing orders to process
RequestStandingOrderTreated=Request for standing orders processed
WithdrawalsReceipts=Direct debit orders
WithdrawalReceipt=Direct debit order
LastWithdrawalReceipts=Latest %s direct debit files
WithdrawalsLines=Direct debit order lines
RequestStandingOrderToTreat=Request for direct debit payment order to process
RequestStandingOrderTreated=Request for direct debit payment order processed
NotPossibleForThisStatusOfWithdrawReceiptORLine=Not yet possible. Withdraw status must be set to 'credited' before declaring reject on specific lines.
NbOfInvoiceToWithdraw=Nb. of invoice with withdraw request
NbOfInvoiceToWithdrawWithInfo=Nb. of invoice with withdraw request for customers having defined bank account information
InvoiceWaitingWithdraw=Invoice waiting for withdraw
NbOfInvoiceToWithdraw=Nb. of invoice with direct debit order
NbOfInvoiceToWithdrawWithInfo=Nb. of customer invoice with direct debit payment orders having defined bank account information
InvoiceWaitingWithdraw=Invoice waiting for direct debit
AmountToWithdraw=Amount to withdraw
WithdrawsRefused=Withdraws refused
WithdrawsRefused=Direct debit refused
NoInvoiceToWithdraw=No customer invoice in payment mode "withdraw" is waiting. Go on 'Withdraw' tab on invoice card to make a request.
ResponsibleUser=Responsible user
WithdrawalsSetup=Withdrawal setup
WithdrawStatistics=Withdraw's statistics
WithdrawRejectStatistics=Withdraw reject's statistics
LastWithdrawalReceipt=Latest %s withdrawal receipts
WithdrawalsSetup=Direct debit payment setup
WithdrawStatistics=Direct debit payment statistics
WithdrawRejectStatistics=Direct debit payment reject statistics
LastWithdrawalReceipt=Latest %s direct debit receipts
MakeWithdrawRequest=Make a withdraw request
ThirdPartyBankCode=Third party bank code
NoInvoiceCouldBeWithdrawed=No invoice withdrawed with success. Check that invoice are on companies with a valid BAN.
@ -46,7 +47,7 @@ StatusRefused=Refused
StatusMotif0=Unspecified
StatusMotif1=Insufficient funds
StatusMotif2=Request contested
StatusMotif3=No Withdrawal order
StatusMotif3=No direct debit payment order
StatusMotif4=Customer Order
StatusMotif5=RIB unusable
StatusMotif6=Account without balance
@ -61,28 +62,42 @@ NotifyCredit=Withdrawal Credit
NumeroNationalEmetter=National Transmitter Number
WithBankUsingRIB=For bank accounts using RIB
WithBankUsingBANBIC=For bank accounts using IBAN/BIC/SWIFT
BankToReceiveWithdraw=Bank account to receive withdraws
BankToReceiveWithdraw=Bank account to receive direct debit
CreditDate=Credit on
WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country %s (Your country is not supported)
ShowWithdraw=Show Withdraw
IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one withdrawal payment not yet processed, it won't be set as paid to allow prior withdrawal management.
DoStandingOrdersBeforePayments=This tab allows you to request a standing order. Once done, go into menu Bank->Withdrawal to manage the standing order. When standing order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null.
DoStandingOrdersBeforePayments=This tab allows you to request a direct debit payment order. Once done, go into menu Bank->Withdrawal to manage the direct debit payment order. When payment order is closed, payment on invoice will be automatically recorded, and invoice closed if remainder to pay is null.
WithdrawalFile=Withdrawal file
SetToStatusSent=Set to status "File Sent"
ThisWillAlsoAddPaymentOnInvoice=This will also apply payments to invoices and will classify them as "Paid"
StatisticsByLineStatus=Statistics by status of lines
RUM=RUM
RUMWillBeGenerated=RUM number will be generated once bank account information are saved
WithdrawMode=Withdraw mode (FRST or RECUR)
RUM=UMR
RUMLong=Unique Mandate Reference
RUMWillBeGenerated=UMR number will be generated once bank account information are saved
WithdrawMode=Direct debit mode (FRST or RECUR)
WithdrawRequestAmount=Withdraw request amount:
WithdrawRequestErrorNilAmount=Unable to create withdraw request for nil amount.
SepaMandate=SEPA Direct Debit Mandate
PleaseReturnMandate=Please return this mandate form to
SEPALegalText=By signing this mandate form, you authorize (A) %s to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with the instructions from %s. As part of your rights, you are entitled to a refund from your bank under the terms and conditions of your agreement with your bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited. Your rights regarding the above mandate are explained in a statement that you can obtain from your bank.
CreditorIdentifier=Creditor Identifier
CreditorName=Creditors Name
SEPAFillForm=(B) Please complete all the fields marked *
SEPAFormYourName=Your name
SEPAFormYourBAN=Your Bank Account Name (IBAN)
SEPAFormYourBIC=Your Bank Identifier Code (BIC)
SEPAFrstOrRecur=Type of payment
ModeRECUR=Reccurent payment
ModeFRST=One-off payment
PleaseCheckOne=Please check one only
### Notifications
InfoCreditSubject=Payment of standing order %s by the bank
InfoCreditMessage=The standing order %s has been paid by the bank<br>Data of payment: %s
InfoTransSubject=Transmission of standing order %s to bank
InfoTransMessage=The standing order %s has been sent to bank by %s %s.<br><br>
InfoCreditSubject=Payment of direct debit payment order %s by the bank
InfoCreditMessage=The direct debit payment order %s has been paid by the bank<br>Data of payment: %s
InfoTransSubject=Transmission of direct debit payment order %s to bank
InfoTransMessage=The direct debit payment order %s has been sent to bank by %s %s.<br><br>
InfoTransData=Amount: %s<br>Method: %s<br>Date: %s
InfoRejectSubject=Standing order refused
InfoRejectMessage=Hello,<br><br>the standing order of invoice %s related to the company %s, with an amount of %s has been refused by the bank.<br><br>--<br>%s
InfoRejectSubject=Direct debit payment order refused
InfoRejectMessage=Hello,<br><br>the direct debit payment order of invoice %s related to the company %s, with an amount of %s has been refused by the bank.<br><br>--<br>%s
ModeWarning=Option for real mode was not set, we stop after this simulation

View File

@ -37,6 +37,8 @@ class CompanyBankAccount extends Account
var $default_rib;
var $frstrecur;
var $rum;
var $date_rum;
var $datec;
var $datem;
@ -129,6 +131,8 @@ class CompanyBankAccount extends Account
if ($conf->prelevement->enabled)
{
$sql.= ",frstrecur = '".$this->db->escape($this->frstrecur)."'";
$sql.= ",rum = '".$this->db->escape($this->rum)."'";
$sql.= ",date_rum = ".($this->date_rum ? "'".$this->db->idate($this->date_rum)."'" : "null");
}
if (trim($this->label) != '')
$sql.= ",label = '".$this->db->escape($this->label)."'";
@ -302,5 +306,39 @@ class CompanyBankAccount extends Account
return -1;
}
}
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
function initAsSpecimen()
{
$this->specimen = 1;
$this->ref = 'CBA';
$this->label = 'CustomerCorp Bank account';
$this->bank = 'CustomerCorp Bank';
$this->courant = Account::TYPE_CURRENT;
$this->clos = Account::STATUS_OPEN;
$this->code_banque = '123';
$this->code_guichet = '456';
$this->number = 'CUST12345';
$this->cle_rib = 50;
$this->bic = 'CC12';
$this->iban = 'FR999999999';
$this->domiciliation = 'Bank address of customer corp';
$this->proprio = 'Owner';
$this->owner_address = 'Owner address';
$this->country_id = 1;
$this->rum = 'UMR-CU1212-0007-5-1475405262';
$this->date_rum =dol_now() - 10000;
$this->frstrecur = 'FRST';
$this->socid = 0;
}
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2012-2013 Philippe Berthet <berthet@systune.be>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
@ -57,7 +57,7 @@ $month = GETPOST('month','int');
$year = GETPOST('year','int');
// Clean up on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$sref='';
$sprod_fulldescr='';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
@ -29,6 +29,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
@ -38,207 +39,258 @@ $langs->load("banks");
$langs->load("bills");
// Security check
$socid = GETPOST("socid");
$socid = GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'societe','','');
$object = new Societe($db);
$object->fetch($socid);
$id=GETPOST("id","int");
$ribid=GETPOST("ribid","int");
$action=GETPOST("action");
$object = new Societe($db);
$object->fetch($socid);
$account = new CompanyBankAccount($db);
$prelevement = new BonPrelevement($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('thirdpartybancard','globalcard'));
/*
* Actions
*/
if ($action == 'update' && ! $_POST["cancel"])
{
// Modification
if (! GETPOST('label'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
$action='update';
$error++;
}
if (! GETPOST('bank'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors');
$action='update';
$error++;
}
if ($account->needIBAN() == 1)
{
if (! GETPOST('iban'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors');
$action='update';
$error++;
}
if (! GETPOST('bic'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors');
$action='update';
$error++;
}
}
$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$account->fetch($id);
if (! $error)
if (empty($reshook))
{
if ($cancel)
{
$account->socid = $object->id;
$account->bank = GETPOST('bank','alpha');
$account->label = GETPOST('label','alpha');
$account->courant = GETPOST('courant','alpha');
$account->clos = GETPOST('clos','alpha');
$account->code_banque = GETPOST('code_banque','alpha');
$account->code_guichet = GETPOST('code_guichet','alpha');
$account->number = GETPOST('number','alpha');
$account->cle_rib = GETPOST('cle_rib','alpha');
$account->bic = GETPOST('bic','alpha');
$account->iban = GETPOST('iban','alpha');
$account->domiciliation = GETPOST('domiciliation','alpha');
$account->proprio = GETPOST('proprio','alpha');
$account->owner_address = GETPOST('owner_address','alpha');
$account->frstrecur = GETPOST('frstrecur','alpha');
$result = $account->update($user);
if (! $result)
{
setEventMessages($account->error, $account->errors, 'errors');
}
else
{
// If this account is the default bank account, we disable others
if ($account->default_rib)
{
$account->setAsDefault($id); // This will make sure there is only one default rib
}
$url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id;
header('Location: '.$url);
exit;
}
$action='';
if (! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
}
}
if ($action == 'add' && ! $_POST["cancel"])
{
$error=0;
if (! GETPOST('label'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
$action='create';
$error++;
}
if (! GETPOST('bank'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors');
$action='create';
$error++;
}
if (! $error)
{
// Ajout
$account = new CompanyBankAccount($db);
$account->socid = $object->id;
$account->bank = GETPOST('bank','alpha');
$account->label = GETPOST('label','alpha');
$account->courant = GETPOST('courant','alpha');
$account->clos = GETPOST('clos','alpha');
$account->code_banque = GETPOST('code_banque','alpha');
$account->code_guichet = GETPOST('code_guichet','alpha');
$account->number = GETPOST('number','alpha');
$account->cle_rib = GETPOST('cle_rib','alpha');
$account->bic = GETPOST('bic','alpha');
$account->iban = GETPOST('iban','alpha');
$account->domiciliation = GETPOST('domiciliation','alpha');
$account->proprio = GETPOST('proprio','alpha');
$account->owner_address = GETPOST('owner_address','alpha');
$account->frstrecur = GETPOST('frstrecur');
// This test can be done only once properties were set
if ($account->needIBAN() == 1)
{
if (! GETPOST('iban'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors');
$action='create';
$error++;
}
if (! GETPOST('bic'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors');
$action='create';
$error++;
}
}
if (! $error)
{
$result = $account->update($user); // TODO Use create and include update into create method
if (! $result)
{
setEventMessages($account->error, $account->errors, 'errors');
$_GET["action"]='create'; // Force chargement page création
}
else
{
$url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id;
if ($action == 'update' && ! $_POST["cancel"])
{
// Modification
if (! GETPOST('label'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
$action='update';
$error++;
}
if (! GETPOST('bank'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors');
$action='update';
$error++;
}
if ($account->needIBAN() == 1)
{
if (! GETPOST('iban'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors');
$action='update';
$error++;
}
if (! GETPOST('bic'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors');
$action='update';
$error++;
}
}
$account->fetch($id);
if (! $error)
{
$account->socid = $object->id;
$account->bank = GETPOST('bank','alpha');
$account->label = GETPOST('label','alpha');
$account->courant = GETPOST('courant','alpha');
$account->clos = GETPOST('clos','alpha');
$account->code_banque = GETPOST('code_banque','alpha');
$account->code_guichet = GETPOST('code_guichet','alpha');
$account->number = GETPOST('number','alpha');
$account->cle_rib = GETPOST('cle_rib','alpha');
$account->bic = GETPOST('bic','alpha');
$account->iban = GETPOST('iban','alpha');
$account->domiciliation = GETPOST('domiciliation','alpha');
$account->proprio = GETPOST('proprio','alpha');
$account->owner_address = GETPOST('owner_address','alpha');
$account->frstrecur = GETPOST('frstrecur','alpha');
if (empty($account->rum))
{
$account->rum = $prelevement->buildRumNumber($object->code_client, $account->datec, $account->id);
$account->date_rum = dol_now();
}
$result = $account->update($user);
if (! $result)
{
setEventMessages($account->error, $account->errors, 'errors');
}
else
{
// If this account is the default bank account, we disable others
if ($account->default_rib)
{
$account->setAsDefault($id); // This will make sure there is only one default rib
}
$url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id;
header('Location: '.$url);
exit;
}
}
}
}
}
}
if ($action == 'add' && ! $_POST["cancel"])
{
$error=0;
if (! GETPOST('label'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
$action='create';
$error++;
}
if (! GETPOST('bank'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors');
$action='create';
$error++;
}
if (! $error)
{
// Ajout
$account = new CompanyBankAccount($db);
$account->socid = $object->id;
$account->bank = GETPOST('bank','alpha');
$account->label = GETPOST('label','alpha');
$account->courant = GETPOST('courant','alpha');
$account->clos = GETPOST('clos','alpha');
$account->code_banque = GETPOST('code_banque','alpha');
$account->code_guichet = GETPOST('code_guichet','alpha');
$account->number = GETPOST('number','alpha');
$account->cle_rib = GETPOST('cle_rib','alpha');
$account->bic = GETPOST('bic','alpha');
$account->iban = GETPOST('iban','alpha');
$account->domiciliation = GETPOST('domiciliation','alpha');
$account->proprio = GETPOST('proprio','alpha');
$account->owner_address = GETPOST('owner_address','alpha');
$account->frstrecur = GETPOST('frstrecur');
// This test can be done only once properties were set
if ($account->needIBAN() == 1)
{
if (! GETPOST('iban'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors');
$action='create';
$error++;
}
if (! GETPOST('bic'))
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors');
$action='create';
$error++;
}
}
if (! $error)
{
if (empty($account->rum))
{
$account->rum = $prelevement->buildRumNumber($object->code_client, $account->datec, $account->id);
$account->date_rum = dol_now();
}
$result = $account->update($user); // This will set the UMR number.
// TODO Use create and include update into create method
if (! $result)
{
setEventMessages($account->error, $account->errors, 'errors');
$_GET["action"]='create'; // Force chargement page création
}
else
{
$url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id;
header('Location: '.$url);
exit;
}
}
}
}
if ($action == 'setasdefault')
{
$account = new CompanyBankAccount($db);
$res = $account->setAsDefault(GETPOST('ribid','int'));
if ($res)
{
$url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id;
header('Location: '.$url);
exit;
}
else
{
setEventMessages($db->lasterror, null, 'errors');
}
}
if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes')
{
$account = new CompanyBankAccount($db);
if ($account->fetch($ribid?$ribid:$id))
{
$result = $account->delete($user);
if ($result > 0)
{
$url = $_SERVER['PHP_SELF']."?socid=".$object->id;
header('Location: '.$url);
exit;
}
else
{
setEventMessages($account->error, $account->errors, 'errors');
}
}
else
{
setEventMessages($account->error, $account->errors, 'errors');
}
}
$savid=$id;
// Actions to build doc
$id = $socid;
$upload_dir = $conf->societe->dir_output;
$permissioncreate=$user->rights->societe->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
$id = $savid;
}
if ($action == 'setasdefault')
{
$account = new CompanyBankAccount($db);
$res = $account->setAsDefault(GETPOST('ribid','int'));
if ($res)
{
$url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id;
header('Location: '.$url);
exit;
}
else
{
setEventMessages($db->lasterror, null, 'errors');
}
}
if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes')
{
$account = new CompanyBankAccount($db);
if ($account->fetch($ribid?$ribid:$id))
{
$result = $account->delete($user);
if ($result > 0)
{
$url = $_SERVER['PHP_SELF']."?socid=".$object->id;
header('Location: '.$url);
exit;
}
else
{
setEventMessages($account->error, $account->errors, 'errors');
}
}
else
{
setEventMessages($account->error, $account->errors, 'errors');
}
}
/*
@ -246,11 +298,11 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes')
*/
$form = new Form($db);
$prelevement = new BonPrelevement($db);
$formfile = new FormFile($db);
llxHeader();
$head=societe_prepare_head2($object);
$head=societe_prepare_head($object);
if (! $id)
$account->fetch(0,$object->id);
@ -258,7 +310,6 @@ else
$account->fetch($id);
if (empty($account->socid)) $account->socid=$object->id;
if ($socid && $action == 'edit' && $user->rights->societe->creer)
{
print '<form action="rib.php?socid='.$object->id.'" method="post">';
@ -303,7 +354,6 @@ if ($socid && $action != 'edit' && $action != "create")
print '<td colspan="4">'.$account->bank.'</td></tr>';
// Show fields of bank account
foreach($account->getFieldsToShow() as $val)
{
if ($val == 'BankCode') {
@ -312,24 +362,31 @@ if ($socid && $action != 'edit' && $action != "create")
$content = $account->code_guichet;
} elseif ($val == 'BankAccountNumber') {
$content = $account->number;
if (! empty($account->label)) {
if (! checkBanForAccount($account)) {
$content.= ' '.img_picto($langs->trans("NotValid"),'warning');
} else {
$content.= ' '.img_picto($langs->trans("Valid"),'info');
}
}
} elseif ($val == 'BankAccountNumberKey') {
$content = $account->cle_rib;
}elseif ($val == 'IBAN') {
$content = $account->iban;
if (! empty($account->iban)) {
if (! checkIbanForAccount($account)) {
$content.= img_picto($langs->trans("IbanNotValid"),'warning');
$content.= ' '.img_picto($langs->trans("IbanNotValid"),'warning');
} else {
$content.= img_picto($langs->trans("IbanValid"),'info');
$content.= ' '.img_picto($langs->trans("IbanValid"),'info');
}
}
}elseif ($val == 'BIC') {
$content = $account->bic;
if (! empty($account->bic)) {
if (! checkSwiftForAccount($account)) {
$content.= img_picto($langs->trans("SwiftNotValid"),'warning');
$content.= ' '.img_picto($langs->trans("SwiftNotValid"),'warning');
} else {
$content.= img_picto($langs->trans("SwiftValid"),'info');
$content.= ' '.img_picto($langs->trans("SwiftValid"),'info');
}
}
}
@ -339,26 +396,20 @@ if ($socid && $action != 'edit' && $action != "create")
print '</tr>';
}
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
print $account->domiciliation;
print "</td></tr>\n";
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td><td colspan="4">';
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td><td colspan="4">';
print $account->proprio;
print "</td></tr>\n";
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
print $account->owner_address;
print "</td></tr>\n";
print '</table>';
// Check BBAN
if ($account->label && ! checkBanForAccount($account))
{
print '<div class="warning">'.$langs->trans("RIBControlError").'</div>';
}
print "</div>";
dol_fiche_end();
@ -384,15 +435,11 @@ if ($socid && $action != 'edit' && $action != "create")
print_liste_field_titre($langs->trans("BIC"));
if (! empty($conf->prelevement->enabled))
{
print '<td>RUM</td>';
print '<td>'.$langs->trans("RUM").'</td>';
print '<td>'.$langs->trans("WithdrawMode").'</td>';
}
print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"');
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
if (! empty($conf->prelevement->enabled))
{
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
}
print "</tr>\n";
foreach ($rib_list as $rib)
@ -403,16 +450,53 @@ if ($socid && $action != 'edit' && $action != "create")
// Bank name
print '<td>'.$rib->bank.'</td>';
// Account number
print '<td>'.$rib->getRibLabel(false).'</td>';
print '<td>';
$string='';
foreach ($rib->getFieldsToShow() as $val) {
if ($val == 'BankCode') {
$string .= $rib->code_banque.' ';
} elseif ($val == 'BankAccountNumber') {
$string .= $rib->number.' ';
} elseif ($val == 'DeskCode') {
$string .= $rib->code_guichet.' ';
} elseif ($val == 'BankAccountNumberKey') {
$string .= $rib->cle_rib.' ';
/* Already output after
}elseif ($val == 'BIC') {
$string .= $rib->bic.' ';
}elseif ($val == 'IBAN') {
$string .= $rib->iban.' ';*/
}
}
print $string;
print '</td>';
// IBAN
print '<td>'.$rib->iban.'</td>';
print '<td>'.$rib->iban;
if (! empty($rib->iban)) {
if (! checkIbanForAccount($rib)) {
print ' '.img_picto($langs->trans("IbanNotValid"),'warning');
} else {
print ' '.img_picto($langs->trans("IbanValid"),'info');
}
}
print '</td>';
// BIC
print '<td>'.$rib->bic.'</td>';
print '<td>'.$rib->bic;
if (! empty($rib->bic)) {
if (! checkSwiftForAccount($rib)) {
print ' '.img_picto($langs->trans("SwiftNotValid"),'warning');
} else {
print ' '.img_picto($langs->trans("SwiftValid"),'info');
}
}
print '</td>';
if (! empty($conf->prelevement->enabled))
{
// RUM
print '<td>'.$prelevement->buildRumNumber($object->code_client, $rib->datec, $rib->id).'</td>';
//print '<td>'.$prelevement->buildRumNumber($object->code_client, $rib->datec, $rib->id).'</td>';
print '<td>'.$rib->rum.'</td>';
// FRSTRECUR
print '<td>'.$rib->frstrecur.'</td>';
@ -445,27 +529,6 @@ if ($socid && $action != 'edit' && $action != "create")
}
print '</td>';
if (! empty($conf->prelevement->enabled))
{
include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php';
$modellist=ModeleBankAccountDoc::liste_modeles($db);
print '<td>';
if (is_array($modellist) && count($modellist) == 1) // If there is only one element
{
$arraykeys=array_keys($modellist);
$modelselected=$arraykeys[0];
}
$out.= $form->selectarray('model', $modellist, $modelselected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
$out.= ajax_combobox('model');
//print $out;
$buttonlabel=$langs->trans("Generate");
$genbutton = '<input class="button buttongen" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton.= ' type="submit" value="'.$buttonlabel.'"';
$genbutton.= '>';
//print $genbutton;
print '</td>'; // TODO Add link to generate doc
}
print '</tr>';
}
@ -481,6 +544,68 @@ if ($socid && $action != 'edit' && $action != "create")
dol_print_error($db);
}
if ($socid && $action != 'edit' && $action != 'create')
{
/*
* Barre d'actions
*/
print '<div class="tabsAction">';
if ($user->rights->societe->creer)
{
print '<a class="butAction" href="rib.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("Add").'</a>';
}
print '</div>';
}
if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC))
{
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
/*
* Documents generes
*/
$filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id;
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id;
$genallowed=$user->rights->societe->creer;
$delallowed=$user->rights->societe->supprimer;
$var=true;
print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div></div></div>';
print '<br>';
}
/*
include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php';
$modellist=ModeleBankAccountDoc::liste_modeles($db);
//print '<td>';
if (is_array($modellist) && count($modellist) == 1) // If there is only one element
{
$arraykeys=array_keys($modellist);
$modelselected=$arraykeys[0];
}
$out.= $form->selectarray('model', $modellist, $modelselected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
$out.= ajax_combobox('model');
//print $out;
$buttonlabel=$langs->trans("Generate");
$genbutton = '<input class="button buttongen" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton.= ' type="submit" value="'.$buttonlabel.'"';
$genbutton.= '>';
print $genbutton;
//print '</td>'; // TODO Add link to generate doc
*/
}
// Edit
@ -497,7 +622,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
print '<tr><td valign="top" class="titlefield fieldrequired">'.$langs->trans("LabelRIB").'</td>';
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("LabelRIB").'</td>';
print '<td colspan="4"><input size="30" type="text" name="label" value="'.$account->label.'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("BankName").'</td>';
@ -637,10 +762,10 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
}
// IBAN
print '<tr><td valign="top" '.($account->needIBAN()?' class="fieldrequired" ':'').'>'.$langs->trans("IBAN").'</td>';
print '<tr><td'.($account->needIBAN()?' class="fieldrequired" ':'').'>'.$langs->trans("IBAN").'</td>';
print '<td colspan="4"><input size="30" type="text" name="iban" value="'.GETPOST('iban').'"></td></tr>';
print '<tr><td valign="top" '.($account->needIBAN()?' class="fieldrequired" ':'').'>'.$langs->trans("BIC").'</td>';
print '<tr><td'.($account->needIBAN()?' class="fieldrequired" ':'').'>'.$langs->trans("BIC").'</td>';
print '<td colspan="4"><input size="12" type="text" name="bic" value="'.GETPOST('bic').'"></td></tr>';
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
@ -697,23 +822,6 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
}
if ($socid && $action != 'edit' && $action != 'create')
{
/*
* Barre d'actions
*/
print '<div class="tabsAction">';
if ($user->rights->societe->creer)
{
print '<a class="butAction" href="rib.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("Add").'</a>';
}
print '</div>';
}
llxFooter();
$db->close();

View File

@ -2267,22 +2267,6 @@ else
print $object->showOptionals($extrafields);
}
// Ban
if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
{
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('RIB');
print '<td><td align="right">';
if ($user->rights->societe->creer) print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id.'">'.img_edit().'</a>';
else print '&nbsp;';
print '</td></tr></table>';
print '</td>';
print '<td colspan="3">';
print $object->display_rib();
print '</td></tr>';
}
// Parent company
if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY))
{

View File

@ -3974,6 +3974,9 @@ div.dataTables_length select {
/* Select2 */
/* ============================================================================== */
.select2-container .select2-choice > .select2-chosen {
margin-right: 23px;
}
.select2-container .select2-choice .select2-arrow {
border-radius: 0;
}

View File

@ -3841,6 +3841,9 @@ div.dataTables_length select {
/* Select2 */
/* ============================================================================== */
.select2-container .select2-choice > .select2-chosen {
margin-right: 23px;
}
.select2-container .select2-choice .select2-arrow {
border-radius: 0;
}