Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
85ea8b4161
2
.gitignore
vendored
2
.gitignore
vendored
@ -15,3 +15,5 @@ doxygen_warnings.log
|
||||
.DS_Store
|
||||
.idea
|
||||
*.iml
|
||||
Thumbs.db
|
||||
|
||||
|
||||
@ -6511,6 +6511,7 @@ CREATE TABLE `llx_societe_rib` (
|
||||
`domiciliation` varchar(255) DEFAULT NULL,
|
||||
`proprio` varchar(60) DEFAULT NULL,
|
||||
`owner_address` text,
|
||||
`default_rib` tinyint NOT NULL DEFAULT 0,
|
||||
`import_key` varchar(14) DEFAULT NULL,
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@ -40,6 +40,7 @@ class Contact extends CommonObject
|
||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
var $id;
|
||||
var $ref_ext;
|
||||
var $civilite_id; // In fact we store civility_code
|
||||
var $lastname;
|
||||
var $firstname;
|
||||
@ -64,9 +65,13 @@ class Contact extends CommonObject
|
||||
var $code;
|
||||
var $email;
|
||||
var $skype;
|
||||
var $jabberid;
|
||||
var $phone_pro;
|
||||
var $phone_perso;
|
||||
var $phone_mobile;
|
||||
var $fax;
|
||||
|
||||
var $priv;
|
||||
|
||||
var $birthday;
|
||||
var $default_lang;
|
||||
|
||||
@ -174,7 +174,7 @@ class FormFile
|
||||
$out .= '<tr>';
|
||||
$out .= '<td valign="middle" class="nowrap">';
|
||||
$out .= $langs->trans("Link") . ': ';
|
||||
$out .= '<input type="text" name="link" id="link">';
|
||||
$out .= '<input type="text" name="link" size="'.$maxlength.'" id="link">';
|
||||
$out .= ' ' . $langs->trans("Label") . ': ';
|
||||
$out .= '<input type="text" name="label" id="label">';
|
||||
$out .= '<input type="hidden" name="objecttype" value="' . $object->element . '">';
|
||||
@ -1063,6 +1063,9 @@ class FormFile
|
||||
|
||||
// Show list of associated links
|
||||
print_titre($langs->trans("LinkedFiles"));
|
||||
|
||||
print '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">';
|
||||
|
||||
print '<table width="100%" class="liste">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre(
|
||||
@ -1076,7 +1079,7 @@ class FormFile
|
||||
$sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Size"),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
@ -1104,30 +1107,30 @@ class FormFile
|
||||
print_liste_field_titre('','','');
|
||||
print '</tr>';
|
||||
$nboflinks = count($links);
|
||||
if ($nboflinks > 0) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
}
|
||||
if ($nboflinks > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
|
||||
$var = true;
|
||||
foreach ($links as $link) {
|
||||
foreach ($links as $link)
|
||||
{
|
||||
$var =! $var;
|
||||
print '<tr ' . $bc[$var] . '>';
|
||||
//edit mode
|
||||
if ($action == 'update' && $selected === $link->id) {
|
||||
print '<form action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '" method="post">';
|
||||
if ($action == 'update' && $selected === $link->id)
|
||||
{
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
print '<input type="hidden" name="linkid" value="' . $link->id . '">';
|
||||
print '<input type="hidden" name="action" value="confirm_updateline">';
|
||||
print '<td>';
|
||||
print $langs->trans('Link') . ': <input type="text" name="link" value = "' . $link->url . '">';
|
||||
print $langs->trans('Link') . ': <input type="text" name="link" size="50" value="' . $link->url . '">';
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print $langs->trans('Label') . ': <input type="text" name="label" value = "' . $link->label . '">';
|
||||
print $langs->trans('Label') . ': <input type="text" name="label" value="' . $link->label . '">';
|
||||
print '</td>';
|
||||
print '<td align="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>';
|
||||
print '<td align="right"></td>';
|
||||
print '<td align="right" colspan="2"><input type="submit" name="save" class="button" value="' . $langs->trans('Save') . '">';
|
||||
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans('Cancel') . '"></td>';
|
||||
print '</form>';
|
||||
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans('Cancel') . '">';
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
print '<td>';
|
||||
@ -1142,7 +1145,7 @@ class FormFile
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id
|
||||
. '&id=' . $object->id . '" class="editfilelink" >' . img_edit().'</a>';
|
||||
if ($permtodelete) {
|
||||
print '<a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id
|
||||
print ' <a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id
|
||||
. '&id=' . $object->id . '" class="deletefilelink" >' . img_delete() . '</a>';
|
||||
} else {
|
||||
print ' ';
|
||||
@ -1151,13 +1154,16 @@ class FormFile
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
if ($nboflinks == 0) {
|
||||
if ($nboflinks == 0)
|
||||
{
|
||||
print '<tr ' . $bc[$var] . '><td colspan="4">';
|
||||
print $langs->trans("NoLinkFound");
|
||||
print '</td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '</form>';
|
||||
|
||||
return $nboflinks;
|
||||
}
|
||||
|
||||
|
||||
@ -442,7 +442,7 @@ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0)
|
||||
* Clean an url string
|
||||
*
|
||||
* @param string $url Url
|
||||
* @param string $http 1: keep http://, 0: remove also http://
|
||||
* @param string $http 1 = keep both http:// and https://, 0: remove http:// but not https://
|
||||
* @return string Cleaned url
|
||||
*/
|
||||
function clean_url($url,$http=1)
|
||||
|
||||
@ -20,22 +20,24 @@
|
||||
/*
|
||||
* Confirm suppression
|
||||
*/
|
||||
if ($action == 'delete') {
|
||||
$ret = $form->form_confirm(
|
||||
$_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'),
|
||||
$langs->trans('DeleteFile'),
|
||||
$langs->trans('ConfirmDeleteFile'),
|
||||
'confirm_deletefile',
|
||||
'',
|
||||
0,
|
||||
1
|
||||
);
|
||||
if ($ret == 'html') print '<br>';
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret = $form->form_confirm(
|
||||
$_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'),
|
||||
$langs->trans('DeleteFile'),
|
||||
$langs->trans('ConfirmDeleteFile'),
|
||||
'confirm_deletefile',
|
||||
'',
|
||||
0,
|
||||
1
|
||||
);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
$formfile=new FormFile($db);
|
||||
|
||||
// Show upload form
|
||||
// Show upload form (document and links)
|
||||
$formfile->form_attach_new_file(
|
||||
$_SERVER["PHP_SELF"].'?id='.$object->id,
|
||||
'',
|
||||
|
||||
@ -25,7 +25,8 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
} elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
if ($object->id) {
|
||||
$link = GETPOST('link', 'alpha');
|
||||
if ($link) {
|
||||
if ($link)
|
||||
{
|
||||
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') {
|
||||
$link = 'http://' . $link;
|
||||
}
|
||||
@ -36,11 +37,14 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
|
||||
|
||||
// Delete file/link
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes') {
|
||||
if ($object->id) {
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
$urlfile = GETPOST('urlfile', 'alpha');
|
||||
$linkid = GETPOST('linkid', 'int');
|
||||
if ($urlfile) {
|
||||
if ($urlfile)
|
||||
{
|
||||
$file = $upload_dir . "/" . $urlfile; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
|
||||
$ret = dol_delete_file($file, 0, 0, 0, $object);
|
||||
@ -49,7 +53,9 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') {
|
||||
} else {
|
||||
setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors');
|
||||
}
|
||||
} elseif ($linkid) {
|
||||
}
|
||||
elseif ($linkid)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php';
|
||||
$link = new Link($db);
|
||||
$link->id = $linkid;
|
||||
@ -65,23 +71,30 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') {
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
|
||||
exit;
|
||||
}
|
||||
} elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha')) {
|
||||
}
|
||||
elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha'))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php';
|
||||
$langs->load('link');
|
||||
$link = new Link($db);
|
||||
$link->id = GETPOST('linkid', 'int');
|
||||
$f = $link->fetch();
|
||||
if ($f) {
|
||||
if ($f)
|
||||
{
|
||||
$link->url = GETPOST('link', 'alpha');
|
||||
if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://') {
|
||||
if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://')
|
||||
{
|
||||
$link->url = 'http://' . $link->url;
|
||||
}
|
||||
$link->label = GETPOST('label', 'alpha');
|
||||
$res = $link->update($user);
|
||||
if (!$res) {
|
||||
if (!$res)
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFailedToUpdateLink", $link->label));
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
//error fetching
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,3 +357,7 @@ ALTER TABLE llx_user ADD skype VARCHAR(255) AFTER job;
|
||||
ALTER TABLE llx_socpeople ADD skype VARCHAR(255) AFTER jabberid;
|
||||
ALTER TABLE llx_societe ADD skype VARCHAR(255) AFTER email;
|
||||
ALTER TABLE llx_adherent ADD skype VARCHAR(255) AFTER email;
|
||||
|
||||
-- multi-rib
|
||||
ALTER TABLE llx_societe_rib ADD default_rib TINYINT NOT NULL DEFAULT 0 AFTER owner_address;
|
||||
UPDATE llx_societe_rib SET default_rib = 1;
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
-- Copyright (C) 2000-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
-- Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
@ -35,6 +36,7 @@ create table llx_societe_rib
|
||||
domiciliation varchar(255),
|
||||
proprio varchar(60),
|
||||
owner_address varchar(255),
|
||||
default_rib tinyint NOT NULL DEFAULT 0,
|
||||
import_key varchar(14) -- import key
|
||||
|
||||
|
||||
|
||||
@ -149,4 +149,8 @@ InputReceiptNumber=Choose the bank statement related with the conciliation. Use
|
||||
EventualyAddCategory=Eventually, specify a category in which to classify the records
|
||||
ToConciliate=To conciliate?
|
||||
ThenCheckLinesAndConciliate=Then, check the lines present in the bank statement and click
|
||||
BankDashboard=Bank accounts summary
|
||||
BankDashboard=Bank accounts summary
|
||||
DefaultRIB=Default BAN
|
||||
AllRIB=All BAN
|
||||
LabelRIB=BAN Label
|
||||
NoBANRecord=No BAN record
|
||||
|
||||
@ -12,6 +12,8 @@ OrderDate=Order date
|
||||
BuyingPrice=Buying price
|
||||
BuyingPriceMin=Minimum buying price
|
||||
BuyingPriceMinShort=Min buying price
|
||||
TotalBuyingPriceMin=Total of subproducts buying prices
|
||||
SomeSubProductHaveNoPrices=Some sub-products have no price defined
|
||||
AddSupplierPrice=Add supplier price
|
||||
ChangeSupplierPrice=Change supplier price
|
||||
ErrorQtyTooLowForThisSupplier=Quantity too low for this supplier or no price defined on this product for this supplier
|
||||
|
||||
@ -150,3 +150,7 @@ EventualyAddCategory=Eventuellement, saisissez une catégorie dans laquelle clas
|
||||
ToConciliate=A rapprocher ?
|
||||
ThenCheckLinesAndConciliate=Ensuite, cochez les lignes présentes sur le relevé et cliquez sur
|
||||
BankDashboard=Synthèse comptes bancaires
|
||||
DefaultRIB=RIB par défaut
|
||||
AllRIB=Tous les RIB
|
||||
LabelRIB=Nom du RIB
|
||||
NoBANRecord=Aucun RIB enregistré
|
||||
|
||||
@ -12,6 +12,8 @@ OrderDate=Date de commande
|
||||
BuyingPrice=Prix d'achat
|
||||
BuyingPriceMin=Prix d'achat minimum
|
||||
BuyingPriceMinShort=Prix achat min.
|
||||
TotalBuyingPriceMin=Total des prix d'achats des sous-produits
|
||||
SomeSubProductHaveNoPrices=Certains sous-produits n'ont pas de prix définis
|
||||
AddSupplierPrice=Ajouter prix fournisseur
|
||||
ChangeSupplierPrice=Modifier prix fournisseur
|
||||
ErrorQtyTooLowForThisSupplier=Quantité trop basse pour ce fournisseur ou prix de ce produit non défini pour ce fournisseur
|
||||
|
||||
@ -154,22 +154,22 @@ class Link extends CommonObject
|
||||
{
|
||||
global $langs,$conf;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$langs->load("errors");
|
||||
$error=0;
|
||||
|
||||
dol_syslog(get_class($this)."::Update id = " . $this->id . " call_trigger = " . $call_trigger);
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->url)) {
|
||||
if (empty($this->url))
|
||||
{
|
||||
$this->error = $langs->trans("NoURL");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
$this->url = clean_url($this->url,0);
|
||||
if(empty($this->label)) {
|
||||
$this->label = basename($this->url);
|
||||
}
|
||||
$this->url = clean_url($this->url,1);
|
||||
if (empty($this->label)) $this->label = basename($this->url);
|
||||
$this->label = trim($this->label);
|
||||
|
||||
|
||||
@ -189,7 +189,8 @@ class Link extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($call_trigger) {
|
||||
if ($call_trigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface = new Interfaces($this->db);
|
||||
@ -201,7 +202,8 @@ class Link extends CommonObject
|
||||
// Fin appel triggers
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (! $error)
|
||||
{
|
||||
dol_syslog(get_class($this) . "::Update success");
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -209,14 +211,19 @@ class Link extends CommonObject
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
// Doublon
|
||||
$this->error = $langs->trans("ErrorDuplicateField");
|
||||
$result = -1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $langs->trans("Error sql = " . $sql);
|
||||
dol_syslog(get_class($this) . "::Update fails update sql = " . $sql, LOG_ERR);
|
||||
dol_syslog(get_class($this) . "::Update fails update = " . $this->error, LOG_ERR);
|
||||
$result = -2;
|
||||
}
|
||||
$this->db->rollback();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
@ -71,7 +71,7 @@ $cancel <> $langs->trans("Cancel") &&
|
||||
($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
$error=0;
|
||||
for($i=0;$i<$_POST["max_prod"];$i++)
|
||||
for ($i=0; $i<$_POST["max_prod"]; $i++)
|
||||
{
|
||||
if ($_POST["prod_id_chk".$i] > 0)
|
||||
{
|
||||
@ -289,7 +289,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</tr>';
|
||||
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
{
|
||||
// Price
|
||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>';
|
||||
if ($object->price_base_type == 'TTC')
|
||||
@ -301,7 +301,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print price($object->price).' '.$langs->trans($object->price_base_type);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Price minimum
|
||||
print '<tr><td>'.$langs->trans("MinPrice").'</td><td>';
|
||||
if ($object->price_base_type == 'TTC')
|
||||
@ -328,6 +328,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// List of subproducts
|
||||
if (count($prods_arbo) > 0)
|
||||
{
|
||||
$atleastonenotdefined=0;
|
||||
print '<tr><td colspan="2">';
|
||||
print $langs->trans("ProductAssociationList").'<br>';
|
||||
print '<table class="nobordernopadding centpercent">';
|
||||
@ -341,19 +342,20 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<tr>';
|
||||
if ($value['level'] <= 1)
|
||||
{
|
||||
$notdefined=0;
|
||||
$productstatic->ref=$value['fullpath'];
|
||||
print '<td>'.$productstatic->getNomUrl(1,'composition').' ('.$value['nb'].') </td>';
|
||||
print '<td>'.$productstatic->getNomUrl(1,'composition').' ('.$value['nb'].')</td>';
|
||||
print '<td align="right">';
|
||||
if ($product_fourn->find_min_price_product_fournisseur($productstatic->id, $value['nb']) > 0)
|
||||
{
|
||||
print $langs->trans("BuyingPriceMinShort").': ';
|
||||
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0,0);
|
||||
else print $langs->trans("NotDefined");
|
||||
else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; }
|
||||
}
|
||||
print '</td>';
|
||||
$totalline=price2num($value['nb'] * $product_fourn->fourn_unitprice, 'MT');
|
||||
$total+=$totalline;
|
||||
print '<td align="right">'.price($totalline,'','',0,0,-1,$conf->currency).'</td>';
|
||||
print '<td align="right">'.($notdefined?'':price($totalline,'','',0,0,-1,$conf->currency)).'</td>';
|
||||
if (! empty($conf->stock->enabled)) print '<td align="right">'.$langs->trans("Stock").': '.$value['stock'].'</td>'; // Real stock
|
||||
}
|
||||
else {
|
||||
@ -361,18 +363,20 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td>';
|
||||
for ($i=0; $i < $value['level']; $i++)
|
||||
{
|
||||
print ' ';
|
||||
print ' ';
|
||||
}
|
||||
print $productstatic->getNomUrl(1,'composition').' ('.$value['nb'].') </td>';
|
||||
print '<td><td>';
|
||||
print '<td><td>';
|
||||
print $productstatic->getNomUrl(1,'composition').' ('.$value['nb'].')</td>';
|
||||
print '<td><td>';
|
||||
print '<td><td>';
|
||||
if (! empty($conf->stock->enabled)) print '<td align="right"></td>'; // Real stock
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("BuyingPriceMin").': '.price($total,'','',0,0,-1,$conf->currency).'</td>';
|
||||
print '<td></td>';
|
||||
print '<tr>';
|
||||
print '<td colspan="2">'.$langs->trans("TotalBuyingPriceMin").': ';
|
||||
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
|
||||
print '</td>';
|
||||
print '<td>'.($atleastonenotdefined?'':price($total,'','',0,0,-1,$conf->currency)).'</td>';
|
||||
if (! empty($conf->stock->enabled)) print '<td class="liste_total" align="right"> </td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
@ -544,26 +548,6 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Barre d'action */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
/*
|
||||
print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($action == '')
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/composition/fiche.php?action=edit&id='.$productid.'">'.$langs->trans("EditAssociate").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print "\n</div>\n";
|
||||
*/
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -34,6 +35,7 @@ class CompanyBankAccount extends Account
|
||||
var $rowid;
|
||||
var $socid;
|
||||
|
||||
var $label;
|
||||
var $bank;
|
||||
var $courant;
|
||||
var $clos;
|
||||
@ -46,6 +48,7 @@ class CompanyBankAccount extends Account
|
||||
var $iban_prefix; // deprecated
|
||||
var $proprio;
|
||||
var $owner_address;
|
||||
var $default_rib;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -60,6 +63,7 @@ class CompanyBankAccount extends Account
|
||||
$this->clos = 0;
|
||||
$this->solde = 0;
|
||||
$this->error_number = 0;
|
||||
$this->default_rib = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -79,6 +83,8 @@ class CompanyBankAccount extends Account
|
||||
{
|
||||
if ($this->db->affected_rows($resql))
|
||||
{
|
||||
$this->default_rib = 1;
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_rib");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -97,21 +103,25 @@ class CompanyBankAccount extends Account
|
||||
*/
|
||||
function update($user='')
|
||||
{
|
||||
$sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
$sql .= " WHERE fk_soc = ".$this->socid;
|
||||
// $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
// $sql .= " WHERE rowid = ".$this->id;
|
||||
//
|
||||
// $result = $this->db->query($sql);
|
||||
// if ($result)
|
||||
// {
|
||||
// if ($this->db->num_rows($result) == 0)
|
||||
// {
|
||||
// $this->create();
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// dol_print_error($this->db);
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result) == 0)
|
||||
{
|
||||
$this->create();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return 0;
|
||||
if (!$this->id) {
|
||||
$this->create();
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET ";
|
||||
@ -125,7 +135,12 @@ class CompanyBankAccount extends Account
|
||||
$sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'";
|
||||
$sql .= ",proprio = '".$this->db->escape($this->proprio)."'";
|
||||
$sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'";
|
||||
$sql .= " WHERE fk_soc = ".$this->socid;
|
||||
$sql .= ",default_rib = ".$this->default_rib;
|
||||
if (trim($this->label) != '')
|
||||
$sql .= ",label = '".$this->db->escape($this->label)."'";
|
||||
else
|
||||
$sql .= ",label = NULL";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
@ -150,10 +165,10 @@ class CompanyBankAccount extends Account
|
||||
{
|
||||
if (empty($id) && empty($socid)) return -1;
|
||||
|
||||
$sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio, owner_address";
|
||||
$sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio, owner_address, default_rib, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
if ($id) $sql.= " WHERE rowid = ".$id;
|
||||
if ($socid) $sql.= " WHERE fk_soc = ".$socid;
|
||||
if ($socid) $sql.= " WHERE fk_soc = ".$socid." AND default_rib = 1";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -175,6 +190,8 @@ class CompanyBankAccount extends Account
|
||||
$this->domiciliation = $obj->domiciliation;
|
||||
$this->proprio = $obj->proprio;
|
||||
$this->owner_address = $obj->owner_address;
|
||||
$this->label = $obj->label;
|
||||
$this->default_rib = $obj->default_rib;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -190,15 +207,18 @@ class CompanyBankAccount extends Account
|
||||
/**
|
||||
* Return RIB
|
||||
*
|
||||
* @param boolean $displayriblabel Show or Hide Label
|
||||
* @return string RIB
|
||||
*/
|
||||
function getRibLabel()
|
||||
function getRibLabel($displayriblabel = true)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib)
|
||||
{
|
||||
$rib = $this->code_banque." ".$this->code_guichet." ".$this->number;
|
||||
if ($this->label && $displayriblabel)
|
||||
$rib = $this->label." : ";
|
||||
$rib.= $this->code_banque." ".$this->code_guichet." ".$this->number;
|
||||
$rib.=($this->cle_rib?" (".$this->cle_rib.")":"");
|
||||
}
|
||||
else
|
||||
@ -208,6 +228,53 @@ class CompanyBankAccount extends Account
|
||||
|
||||
return $rib;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set RIB as Default
|
||||
*
|
||||
* @param int $id RIB id
|
||||
* @return int 0 if KO, 1 if OK
|
||||
*/
|
||||
function setAsDefault($id)
|
||||
{
|
||||
if ($id) {
|
||||
$sql1 = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
$sql1.= " WHERE rowid = ".$id;
|
||||
|
||||
$result1 = $this->db->query($sql1);
|
||||
if ($result1) {
|
||||
if ($this->db->num_rows($result1) == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
$obj = $this->db->fetch_object($result1);
|
||||
$sql2 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 0 ";
|
||||
$sql2.= "WHERE fk_soc = ".$obj->fk_soc;
|
||||
|
||||
$sql3 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 1 ";
|
||||
$sql3.= "WHERE rowid = ".$id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$result2 = $this->db->query($sql2);
|
||||
$result3 = $this->db->query($sql3);
|
||||
|
||||
if (!$result2 || !$result3) {
|
||||
dol_print_error($this->db);
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -8,7 +8,8 @@
|
||||
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1753,6 +1754,34 @@ class Societe extends CommonObject
|
||||
return $bac->getRibLabel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Array of RIB
|
||||
*
|
||||
* @return array|int 0 if KO, Array of CompanyBanckAccount if OK
|
||||
*/
|
||||
function get_all_rib()
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE fk_soc = ".$this->id;
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result) {
|
||||
$this->error++;
|
||||
$this->errors[] = $this->db->lasterror;
|
||||
return 0;
|
||||
} else {
|
||||
$num_rows = $this->db->num_rows($result);
|
||||
$rib_array = array();
|
||||
if ($num_rows) {
|
||||
while ($obj = $this->db->fetch_object($result)) {
|
||||
$rib = new CompanyBankAccount($this->db);
|
||||
$rib->fetch($obj->rowid);
|
||||
$rib_array[] = $rib;
|
||||
}
|
||||
}
|
||||
return $rib_array;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribut un code client a partir du module de controle des codes.
|
||||
* Return value is stored into this->code_client
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -52,6 +53,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
// Modification
|
||||
$account = new CompanyBankAccount($db);
|
||||
|
||||
$account->fetch($_POST["id"]);
|
||||
|
||||
$account->socid = $soc->id;
|
||||
|
||||
$account->bank = $_POST["bank"];
|
||||
@ -76,11 +79,59 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||
$url=DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id;
|
||||
header('Location: '.$url);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'add' && ! $_POST["cancel"])
|
||||
{
|
||||
// Ajout
|
||||
$account = new CompanyBankAccount($db);
|
||||
|
||||
$account->socid = $soc->id;
|
||||
|
||||
$account->bank = $_POST["bank"];
|
||||
$account->label = $_POST["label"];
|
||||
$account->courant = $_POST["courant"];
|
||||
$account->clos = $_POST["clos"];
|
||||
$account->code_banque = $_POST["code_banque"];
|
||||
$account->code_guichet = $_POST["code_guichet"];
|
||||
$account->number = $_POST["number"];
|
||||
$account->cle_rib = $_POST["cle_rib"];
|
||||
$account->bic = $_POST["bic"];
|
||||
$account->iban_prefix = $_POST["iban_prefix"];
|
||||
$account->domiciliation = $_POST["domiciliation"];
|
||||
$account->proprio = $_POST["proprio"];
|
||||
$account->owner_address = $_POST["owner_address"];
|
||||
|
||||
$result = $account->update($user);
|
||||
if (! $result)
|
||||
{
|
||||
$message=$account->error;
|
||||
$_GET["action"]='create'; // Force chargement page création
|
||||
}
|
||||
else
|
||||
{
|
||||
$url=DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id;
|
||||
header('Location: '.$url);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET['action'] == 'setasdefault')
|
||||
{
|
||||
$account = new CompanyBankAccount($db);
|
||||
$res = $account->setAsDefault($_GET['ribid']);
|
||||
if ($res) {
|
||||
$url=DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id;
|
||||
header('Location: '.$url);
|
||||
exit;
|
||||
} else {
|
||||
$message=$db->lasterror;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -93,7 +144,10 @@ $head=societe_prepare_head2($soc);
|
||||
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
$account = new CompanyBankAccount($db);
|
||||
$account->fetch(0,$soc->id);
|
||||
if (!$_GET['id'])
|
||||
$account->fetch(0,$soc->id);
|
||||
else
|
||||
$account->fetch($_GET['id']);
|
||||
if (empty($account->socid)) $account->socid=$soc->id;
|
||||
|
||||
|
||||
@ -104,10 +158,14 @@ if (empty($account->socid)) $account->socid=$soc->id;
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($_GET["socid"] && $_GET["action"] != 'edit')
|
||||
if ($_GET["socid"] && $_GET["action"] != 'edit' && $_GET["action"] != "create")
|
||||
{
|
||||
print_titre($langs->trans("DefaultRIB"));
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("LabelRIB").'</td>';
|
||||
print '<td colspan="4">'.$account->label.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top" width="35%">'.$langs->trans("Bank").'</td>';
|
||||
print '<td colspan="4">'.$account->bank.'</td></tr>';
|
||||
|
||||
@ -165,6 +223,54 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
|
||||
print '<div class="warning">'.$langs->trans("RIBControlError").'</div>';
|
||||
}
|
||||
|
||||
print "<br />";
|
||||
|
||||
print_titre($langs->trans("AllRIB"));
|
||||
|
||||
$rib_list = $soc->get_all_rib();
|
||||
$var = false;
|
||||
if (is_array($rib_list)) {
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LabelRIB"));
|
||||
print_liste_field_titre($langs->trans("Bank"));
|
||||
print_liste_field_titre($langs->trans("RIB"));
|
||||
print_liste_field_titre($langs->trans("DefaultRIB"));
|
||||
print '<td width="40"></td>';
|
||||
print '</tr>';
|
||||
|
||||
foreach ($rib_list as $rib) {
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>'.$rib->label.'</td>';
|
||||
print '<td>'.$rib->bank.'</td>';
|
||||
print '<td>'.$rib->getRibLabel(false).'</td>';
|
||||
print '<td align="center" width="70">';
|
||||
if (!$rib->default_rib) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id.'&ribid='.$rib->id.'&action=setasdefault">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
print '</a>';
|
||||
} else {
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id.'&id='.$rib->id.'&action=edit">';
|
||||
print img_picto($langs->trans("Modify"),'edit');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$var = !$var;
|
||||
}
|
||||
|
||||
if (count($rib_list) == 0) {
|
||||
print '<tr><td colspan="5" align="center">'.$langs->trans("NoBANRecord").'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
@ -176,31 +282,34 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
|
||||
if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer)
|
||||
{
|
||||
|
||||
$form = new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
print '<form action="rib.php?socid='.$soc->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$_GET["id"].'">';
|
||||
print '<form action="rib.php?socid='.$soc->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$_GET["id"].'">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td valign="top" width="35%">'.$langs->trans("Bank").'</td>';
|
||||
print '<td colspan="4"><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
|
||||
print '<tr><td valign="top" width="35%">'.$langs->trans("LabelRIB").'</td>';
|
||||
print '<td colspan="4"><input size="30" type="text" name="label" value="'.$account->label.'"></td></tr>';
|
||||
|
||||
// BBAN
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
print '<tr><td>'.$langs->trans("Bank").'</td>';
|
||||
print '<td><input size="30" type="text" name="bank" value="'.$account->bank.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// BBAN
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
@ -208,52 +317,135 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="15" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="15" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// IBAN
|
||||
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
|
||||
print '<td colspan="4"><input size="30" type="text" name="iban_prefix" value="'.$account->iban_prefix.'"></td></tr>';
|
||||
// IBAN
|
||||
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
|
||||
print '<td colspan="4"><input size="30" type="text" name="iban_prefix" value="'.$account->iban_prefix.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
|
||||
print '<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
|
||||
print '<td colspan="4"><input size="12" type="text" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
|
||||
print "<textarea name=\"domiciliation\" rows=\"4\" cols=\"40\">";
|
||||
print $account->domiciliation;
|
||||
print "</textarea></td></tr>";
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
|
||||
print "<textarea name=\"domiciliation\" rows=\"4\" cols=\"40\">";
|
||||
print $account->domiciliation;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->proprio.'"></td></tr>';
|
||||
print "</td></tr>\n";
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="4"><input size="30" type="text" name="proprio" value="'.$account->proprio.'"></td></tr>';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
|
||||
print "<textarea name=\"owner_address\" rows=\"4\" cols=\"40\">";
|
||||
print $account->owner_address;
|
||||
print "</textarea></td></tr>";
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
|
||||
print "<textarea name=\"owner_address\" rows=\"4\" cols=\"40\">";
|
||||
print $account->owner_address;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '</table><br>';
|
||||
print '</table><br>';
|
||||
|
||||
print '<center><input class="button" value="'.$langs->trans("Modify").'" type="submit">';
|
||||
print ' <input name="cancel" class="button" value="'.$langs->trans("Cancel").'" type="submit">';
|
||||
print '</center>';
|
||||
print '<center><input class="button" value="'.$langs->trans("Modify").'" type="submit">';
|
||||
print ' <input name="cancel" class="button" value="'.$langs->trans("Cancel").'" type="submit">';
|
||||
print '</center>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Création */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($_GET["socid"] && $_GET["action"] == 'create' && $user->rights->societe->creer)
|
||||
{
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
print '<form action="rib.php?socid='.$soc->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
print '<tr><td valign="top" width="35%">'.$langs->trans("LabelRIB").'</td>';
|
||||
print '<td colspan="4"><input size="30" type="text" name="label"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Bank").'</td>';
|
||||
print '<td><input size="30" type="text" name="bank"></td></tr>';
|
||||
|
||||
// BBAN
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="15" type="text" class="flat" name="number"></td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// IBAN
|
||||
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
|
||||
print '<td colspan="4"><input size="30" type="text" name="iban_prefix"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
|
||||
print '<td colspan="4"><input size="12" type="text" name="bic"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
|
||||
print "<textarea name=\"domiciliation\" rows=\"4\" cols=\"40\">";
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="4"><input size="30" type="text" name="proprio"></td></tr>';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">';
|
||||
print "<textarea name=\"owner_address\" rows=\"4\" cols=\"40\">";
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
print '<center><input class="button" value="'.$langs->trans("Add").'" type="submit">';
|
||||
print ' <input name="cancel" class="button" value="'.$langs->trans("Cancel").'" type="submit">';
|
||||
print '</center>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if ($_GET["socid"] && $_GET["action"] != 'edit')
|
||||
if ($_GET["socid"] && $_GET["action"] != 'edit' && $_GET["action"] != 'create')
|
||||
{
|
||||
/*
|
||||
* Barre d'actions
|
||||
@ -262,7 +454,7 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<a class="butAction" href="rib.php?socid='.$soc->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '<a class="butAction" href="rib.php?socid='.$soc->id.'&action=create">'.$langs->trans("Add").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -266,7 +266,7 @@ if (empty($reshook))
|
||||
$contact->state_id = $object->state_id;
|
||||
$contact->country_id = $object->country_id;
|
||||
$contact->socid = $object->id; // fk_soc
|
||||
$contact->status = 1;
|
||||
$contact->statut = 1;
|
||||
$contact->email = $object->email;
|
||||
$contact->skype = $object->skype;
|
||||
$contact->phone_pro = $object->phone;
|
||||
|
||||
@ -140,7 +140,7 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
|
||||
* testCompanyBankAccountFetch
|
||||
*
|
||||
* @param int $id Id of bank account
|
||||
* @return void
|
||||
* @return Object Bank account object
|
||||
*
|
||||
* @depends testCompanyBankAccountCreate
|
||||
* The depends says test is run only if previous is ok
|
||||
@ -161,6 +161,29 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
* testCompanyBankAccountSetAsDefault
|
||||
*
|
||||
* @param Object $localobject Bank account
|
||||
* @return int
|
||||
*
|
||||
* @depends testCompanyBankAccountFetch
|
||||
*/
|
||||
public function testCompanyBankAccountSetAsDefault($localobject)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$result=$localobject->setAsDefault($localobject->id);
|
||||
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
* testCompanyBankAccountUpdate
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user