forked from Wavyzz/dolibarr
Merge remote-tracking branch 'origin/3.7' into develop
Conflicts: htdocs/core/tpl/objectline_view.tpl.php htdocs/projet/element.php
This commit is contained in:
@@ -226,6 +226,7 @@ Dolibarr better:
|
||||
- Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes
|
||||
- Fix: [ bug #1822 ] SQL error in clientfourn.php report with PostgreSQL
|
||||
- Fix: [ bug #1832 ] SQL error when adding a product with no price defined to an object
|
||||
- Fix: [ bug #1833 ] user permissions in contact/note.php not working
|
||||
- Fix: [ bug #1826 ] Supplier payment types are not translated into fourn/facture/paiement.php
|
||||
- Fix: [ bug #1830 ] Salaries payment only allows checking accounts
|
||||
- Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -347,7 +348,6 @@ if (! empty($conf->use_javascript_ajax))
|
||||
$s='';
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.='jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });' . "\n";
|
||||
$s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
|
||||
$s.='jQuery(".family_birthday").toggle();' . "\n";
|
||||
if ($action=="show_week" || $action=="show_month" || empty($action))
|
||||
@@ -361,18 +361,20 @@ if (! empty($conf->use_javascript_ajax))
|
||||
$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda").' </div>';
|
||||
if (is_array($showextcals) && count($showextcals) > 0)
|
||||
{
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {
|
||||
jQuery("table input[name^=\"check_ext\"]").click(function() {
|
||||
var name = $(this).attr("name");
|
||||
|
||||
jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
|
||||
});
|
||||
});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
|
||||
foreach ($showextcals as $val)
|
||||
{
|
||||
$htmlname = md5($val['name']);
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.=' jQuery("#check_ext' . $htmlname . '").click(function() {';
|
||||
$s.=' /* alert("'.$htmlname.'"); */';
|
||||
$s.=' jQuery(".family_ext' . $htmlname . '").toggle();';
|
||||
$s.=' });' . "\n";
|
||||
$s.='});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked="true"> ' . $val['name'] . ' </div>';
|
||||
}
|
||||
}
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>';
|
||||
|
||||
@@ -1294,7 +1294,7 @@ class BonPrelevement extends CommonObject
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum);
|
||||
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum);
|
||||
$this->total = $this->total + $obj->somme;
|
||||
$i++;
|
||||
}
|
||||
@@ -1496,6 +1496,20 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build RUM number for a customer bank account
|
||||
*
|
||||
* @param string $row_code_client Customer code (soc.code_client)
|
||||
* @param int $row_datec Creation date of bank account (rib.datec)
|
||||
* @param string $row_drum Id of customer bank account (rib.rowid)
|
||||
* @return string RUM number
|
||||
*/
|
||||
static function buildRumNumber($row_code_client, $row_datec, $row_drum)
|
||||
{
|
||||
$pre = ($row_datec > 1359673200) ? 'Rum' : '++R';
|
||||
return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write recipient of request (customer)
|
||||
*
|
||||
@@ -1514,7 +1528,7 @@ class BonPrelevement extends CommonObject
|
||||
* @param string $row_iban rib.iban_prefix AS iban,
|
||||
* @param string $row_bic rib.bic AS bic,
|
||||
* @param string $row_datec rib.datec,
|
||||
* @param string $row_drum rib.rowid AS drum
|
||||
* @param string $row_drum rib.rowid used to generate rum
|
||||
* @return string Return string with SEPA part DrctDbtTxInf
|
||||
*/
|
||||
function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
|
||||
@@ -1524,10 +1538,11 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
// Define value for RUM
|
||||
// Example: RUMCustomerCode-CustomerBankAccountId-01424448606 (note: Date is date of creation of CustomerBankAccountId)
|
||||
$Date_Rum = strtotime($row_datec);
|
||||
$Rum = $this->buildRumNumber($row_code_client, $row_datec, $row_drum);
|
||||
|
||||
// Define date of RUM signature
|
||||
$DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d');
|
||||
$pre = ($date_Rum > 1359673200) ? 'Rum' : '++R';
|
||||
$Rum = $pre.$row_code_client.$row_drum.'-0'.date('U', $Date_Rum);
|
||||
|
||||
$XML_DEBITOR ='';
|
||||
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' <PmtId>'.$CrLf;
|
||||
|
||||
@@ -373,7 +373,7 @@ if ($id)
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
if ($salpayment->rappro == 0)
|
||||
{
|
||||
if (! empty($user->rights->tax->charges->supprimer))
|
||||
if (! empty($user->rights->salaries->delete))
|
||||
{
|
||||
print '<a class="butActionDelete" href="card.php?id='.$salpayment->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ $object = new Contrat($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref)) {
|
||||
if ($id > 0 || ! empty($ref) && $action!='add') {
|
||||
$ret = $object->fetch($id, $ref);
|
||||
if ($ret > 0)
|
||||
$ret = $object->fetch_thirdparty();
|
||||
@@ -207,6 +207,13 @@ if ($action == 'add' && $user->rights->contrat->creer)
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
if ($ret < 0) {
|
||||
$error ++;
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->socid = $socid;
|
||||
@@ -356,11 +363,6 @@ if ($action == 'add' && $user->rights->contrat->creer)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
$result = $object->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
@@ -726,20 +728,19 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
|
||||
// Fill array 'array_options' with data from update form
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||
if ($ret < 0) $error++;
|
||||
if ($ret < 0)
|
||||
$error ++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result = $object->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
if (! $error) {
|
||||
|
||||
if ($error)
|
||||
{
|
||||
$result = $object->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
}
|
||||
} else if ($reshook < 0)
|
||||
$error ++;
|
||||
|
||||
if ($error) {
|
||||
$action = 'edit_extras';
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
0
htdocs/contrat/class/index.html
Normal file
0
htdocs/contrat/class/index.html
Normal file
@@ -65,7 +65,7 @@ class DolGraph
|
||||
var $bgcolorgrid=array(255,255,255); // array(R,G,B)
|
||||
var $datacolor; // array(array(R,G,B),...)
|
||||
|
||||
private $_stringtoshow; // To store string to output graph into HTML page
|
||||
protected $_stringtoshow; // To store string to output graph into HTML page
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -275,8 +275,7 @@ abstract class DoliDB implements Database
|
||||
*/
|
||||
function jdate($string, $gm=false)
|
||||
{
|
||||
if($string==0 || $string=="0000-00-00 00:00:00")
|
||||
return NULL;
|
||||
if ($string==0 || $string=="0000-00-00 00:00:00") return '';
|
||||
$string=preg_replace('/([^0-9])/i','',$string);
|
||||
$tmp=$string.'000000';
|
||||
$date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm);
|
||||
|
||||
@@ -505,7 +505,7 @@ class DoliDBSqlite3 extends DoliDB
|
||||
//return $resultset->fetch(PDO::FETCH_OBJ);
|
||||
$ret = $resultset->fetchArray(SQLITE3_ASSOC);
|
||||
if ($ret) {
|
||||
return (object)$ret;
|
||||
return (object) $ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ class DoliDBSqlite3 extends DoliDB
|
||||
//return $resultset->fetch(PDO::FETCH_ASSOC);
|
||||
$ret = $resultset->fetchArray(SQLITE3_ASSOC);
|
||||
if ($ret) {
|
||||
return (array)$ret;
|
||||
return (array) $ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1248,19 +1248,23 @@ class DoliDBSqlite3 extends DoliDB
|
||||
|
||||
/**
|
||||
* Permet le chargement d'une fonction personnalisee dans le moteur de base de donnees.
|
||||
* Note: le nom de la fonction personnalisee est prefixee par 'db_'. La fonction doit être
|
||||
* Note: le nom de la fonction personnalisee est prefixee par 'db'. La fonction doit être
|
||||
* statique et publique. Le nombre de parametres est determine automatiquement.
|
||||
* @param string $name Le nom de la fonction a definir dans Sqlite
|
||||
*
|
||||
* @param string $name Le nom de la fonction a definir dans Sqlite
|
||||
* @param int $arg_count Arg count
|
||||
* @return void
|
||||
*/
|
||||
private function addCustomFunction($name, $arg_count = -1) {
|
||||
if ($this->db) {
|
||||
$localname = __CLASS__ . '::' . 'db_' . $name;
|
||||
$localname = __CLASS__ . '::' . 'db' . $name;
|
||||
$reflectClass = new ReflectionClass(__CLASS__);
|
||||
$reflectFunction = $reflectClass->getMethod('db_' . $name);
|
||||
$reflectFunction = $reflectClass->getMethod('db' . $name);
|
||||
if ($arg_count < 0) {
|
||||
$arg_count = $reflectFunction->getNumberOfParameters();
|
||||
}
|
||||
if (!$this->db->createFunction($name, $localname , $arg_count)) {
|
||||
if (!$this->db->createFunction($name, $localname, $arg_count))
|
||||
{
|
||||
$this->error = "unable to create custom function '$name'";
|
||||
}
|
||||
}
|
||||
@@ -1268,34 +1272,54 @@ class DoliDBSqlite3 extends DoliDB
|
||||
|
||||
/**
|
||||
* Cette fonction est l'equivalent de la fonction MONTH de MySql.
|
||||
* @param string $date
|
||||
* @return integer
|
||||
*
|
||||
* @param string $date Date
|
||||
* @return integer
|
||||
*/
|
||||
public static function db_MONTH($date) {
|
||||
public static function dbMONTH($date)
|
||||
{
|
||||
return date('n', strtotime($date));
|
||||
}
|
||||
|
||||
/**
|
||||
* calcule du numéro de semaine
|
||||
*
|
||||
* @param string date
|
||||
* @param int mode
|
||||
* @param string $date Date
|
||||
* @param int $mode Mode
|
||||
* @return string
|
||||
*/
|
||||
public static function db_WEEK($date, $mode = 0) {
|
||||
public static function dbWEEK($date, $mode = 0)
|
||||
{
|
||||
$arr = date_parse($date);
|
||||
$calc_year = 0;
|
||||
return self::calc_week($arr['year'], $arr['month'], $arr['day'], self::week_mode($mode), $calc_year);
|
||||
}
|
||||
|
||||
public static function db_CURDATE() {
|
||||
/**
|
||||
* db_CURDATE
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function dbCURDATE() {
|
||||
return date('Y-m-d');
|
||||
}
|
||||
|
||||
public static function db_CURTIME() {
|
||||
/**
|
||||
* db_CURTIME
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function dbCURTIME() {
|
||||
return date('H:i:s');
|
||||
}
|
||||
|
||||
public static function db_WEEKDAY($date) {
|
||||
/**
|
||||
* dbWEEKDAY
|
||||
*
|
||||
* @param int $date Date
|
||||
* @return string
|
||||
*/
|
||||
public static function dbWEEKDAY($date) {
|
||||
$arr = date_parse($date);
|
||||
return self::calc_weekday(self::calc_daynr($arr['year'], $arr['month'], $arr['day']), 0);
|
||||
|
||||
@@ -1304,11 +1328,13 @@ class DoliDBSqlite3 extends DoliDB
|
||||
/**
|
||||
* Cette fonction est l'equivelent de la fonction date_format de MySQL.
|
||||
* @staticvar string $mysql_replacement Les symboles formatage a remplacer
|
||||
* @param string $date la date dans un format ISO
|
||||
* @param string $format la chaine de formatage
|
||||
* @return string La date formatee.
|
||||
*
|
||||
* @param string $date la date dans un format ISO
|
||||
* @param string $format la chaine de formatage
|
||||
* @return string La date formatee.
|
||||
*/
|
||||
public static function db_date_format($date, $format) {
|
||||
public static function dbdate_format($date, $format)
|
||||
{
|
||||
static $mysql_replacement;
|
||||
if (! isset($mysql_replacement)) {
|
||||
$mysql_replacement = array(
|
||||
@@ -1345,9 +1371,9 @@ class DoliDBSqlite3 extends DoliDB
|
||||
$state = 0;
|
||||
$timestamp = strtotime($date);
|
||||
$yday = date('z', $timestamp);
|
||||
$month = (integer)date("n", $timestamp);
|
||||
$year = (integer)date("Y", $timestamp);
|
||||
$day = (integer)date("d", $timestamp);
|
||||
$month = (integer) date("n", $timestamp);
|
||||
$year = (integer) date("Y", $timestamp);
|
||||
$day = (integer) date("d", $timestamp);
|
||||
for($idx = 0; $idx < $lg; ++$idx) {
|
||||
$char = $format[$idx];
|
||||
if ($state == 0) {
|
||||
@@ -1395,19 +1421,15 @@ class DoliDBSqlite3 extends DoliDB
|
||||
return date($fmt, strtotime($date));
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent de la fonction MySQL IF
|
||||
* @param boolean $test Le resultat du test
|
||||
* @param mixed $true_part Partie a retourner si vrai
|
||||
* @param mixed $false_part Partie a retourner si faux
|
||||
* @return mixed Partie selectionnee en fonction du test
|
||||
*/
|
||||
public static function db_IF($test, $true_part, $false_part) {
|
||||
return ( $test ) ? $true_part : $false_part;
|
||||
}
|
||||
|
||||
// Adapté de mytime.c des sources de mariadb
|
||||
// fonction calc_daynr
|
||||
/**
|
||||
* calc_daynr
|
||||
*
|
||||
* @param string $year Year
|
||||
* @param string $month Month
|
||||
* @param string $day Day
|
||||
* @return string La date formatee.
|
||||
*/
|
||||
private static function calc_daynr($year, $month, $day) {
|
||||
$y = $year;
|
||||
if ($y == 0 && $month == 0) return 0;
|
||||
@@ -1421,16 +1443,34 @@ class DoliDBSqlite3 extends DoliDB
|
||||
return $num + floor($y / 4) - $temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* calc_weekday
|
||||
*
|
||||
* @param string $daynr ???
|
||||
* @param string $sunday_first_day_of_week ???
|
||||
*/
|
||||
private static function calc_weekday($daynr, $sunday_first_day_of_week) {
|
||||
$ret = floor(($daynr + 5 + ($sunday_first_day_of_week ? 1 : 0)) % 7);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* calc_days_in_year
|
||||
*
|
||||
* @param string $year Year
|
||||
* @return int Nb of days in year
|
||||
*/
|
||||
private static function calc_days_in_year($year)
|
||||
{
|
||||
return (($year & 3) == 0 && ($year%100 || ($year%400 == 0 && $year)) ? 366 : 365);
|
||||
}
|
||||
|
||||
/**
|
||||
* week_mode
|
||||
*
|
||||
* @param string $mode Mode
|
||||
* @return string Week format
|
||||
*/
|
||||
private static function week_mode($mode) {
|
||||
$week_format= ($mode & 7);
|
||||
if (!($week_format & self::WEEK_MONDAY_FIRST)) {
|
||||
@@ -1439,7 +1479,16 @@ class DoliDBSqlite3 extends DoliDB
|
||||
return $week_format;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* calc_week
|
||||
*
|
||||
* @param string $year Year
|
||||
* @param string $month Month
|
||||
* @param string $day Day
|
||||
* @param string $week_behaviour Week behaviour
|
||||
* @param string $calc_year ???
|
||||
* @return string ???
|
||||
*/
|
||||
private static function calc_week($year, $month, $day, $week_behaviour, &$calc_year) {
|
||||
$daynr=self::calc_daynr($year,$month,$day);
|
||||
$first_daynr=self::calc_daynr($year,1,1);
|
||||
|
||||
@@ -52,7 +52,7 @@ if (empty($usemargins)) $usemargins=0;
|
||||
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||
<td align="center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td>
|
||||
<?php } ?>
|
||||
<td><?php $coldisplay++; ?><div id="row-<?php echo $line->id; ?>"></div>
|
||||
<td><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div>
|
||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid; ?>">
|
||||
<?php
|
||||
@@ -183,7 +183,7 @@ if (empty($usemargins)) $usemargins=0;
|
||||
<td align="center"><?php $coldisplay++; ?>
|
||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#'.$line->id; ?>">
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#line_'.$line->id; ?>">
|
||||
<?php echo img_edit(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
@@ -553,11 +553,11 @@ foreach ($listofreferent as $key => $value)
|
||||
{
|
||||
if ($key == 'order_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?socid='.$object->thirdparty->id.'&action=create&origin='.$object->element.'&originid='.$object->id.'">'.$langs->trans("AddSupplierInvoice").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?socid='.$project->thirdparty->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddSupplierOrder").'</a>';
|
||||
}
|
||||
if ($key == 'invoice_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?socid='.$object->thirdparty->id.'&action=create&origin='.$object->element.'&originid='.$object->id.'">'.$langs->trans("AddSupplierOrder").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?socid='.$project->thirdparty->id.'&action=create&origin='.$project->element.'&originid='.$project->id.'">'.$langs->trans("AddSupplierInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,10 @@ class CompanyBankAccount extends Account
|
||||
var $owner_address;
|
||||
var $default_rib;
|
||||
|
||||
var $datec;
|
||||
var $datem;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -174,7 +178,7 @@ 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, default_rib, label";
|
||||
$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, datec, tms as datem";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
if ($id) $sql.= " WHERE rowid = ".$id;
|
||||
if ($socid) $sql.= " WHERE fk_soc = ".$socid." AND default_rib = 1";
|
||||
@@ -200,6 +204,8 @@ class CompanyBankAccount extends Account
|
||||
$this->owner_address = $obj->owner_address;
|
||||
$this->label = $obj->label;
|
||||
$this->default_rib = $obj->default_rib;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->datem = $this->db->jdate($obj->datem);
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
@@ -968,7 +968,7 @@ class Societe extends CommonObject
|
||||
* @param string $idprof2 Prof id 2 of third party (Warning, this can return several records)
|
||||
* @param string $idprof3 Prof id 3 of third party (Warning, this can return several records)
|
||||
* @param string $idprof4 Prof id 4 of third party (Warning, this can return several records)
|
||||
* @return int >0 if OK, <0 if KO or if two records found for same ref or idprof.
|
||||
* @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found.
|
||||
*/
|
||||
function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='')
|
||||
{
|
||||
@@ -1025,7 +1025,7 @@ class Societe extends CommonObject
|
||||
{
|
||||
$this->error='Fetch several records found for ref='.$ref;
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
$result = -1;
|
||||
$result = -2;
|
||||
}
|
||||
if ($num)
|
||||
{
|
||||
@@ -1150,17 +1150,15 @@ class Societe extends CommonObject
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error='Fetch no third party found for id='.$rowid;
|
||||
dol_syslog($this->error, LOG_ERR);
|
||||
$result = -2;
|
||||
{
|
||||
$result = 0;
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$result = -3;
|
||||
}
|
||||
|
||||
@@ -1180,12 +1178,21 @@ class Societe extends CommonObject
|
||||
* @param boolean $case Case sensitive (true/false)
|
||||
* @param boolean $similar Add test if string inside name into database, or name into database inside string. Do not use this: Not compatible with other database.
|
||||
* @param string $clause Clause for filters
|
||||
* @return array Array of thirdparties object
|
||||
* @return array|int <0 if KO, array of thirdparties object if OK
|
||||
*/
|
||||
function searchByName($name, $type='0', $filters = array(), $exact = false, $case = false, $similar = false, $clause = 'AND')
|
||||
{
|
||||
$thirdparties = array();
|
||||
|
||||
dol_syslog("searchByName name=".$name." type=".$type." exact=".$exact);
|
||||
|
||||
// Check parameter
|
||||
if (empty($name))
|
||||
{
|
||||
$this->errors[]='ErrorBadValueForParameter';
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Generation requete recherche
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql.= " WHERE entity IN (".getEntity('category',1).")";
|
||||
@@ -1264,7 +1271,7 @@ class Societe extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.'/societe/class/companybankaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("commercial");
|
||||
@@ -191,6 +192,7 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes')
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$prelevement = new BonPrelevement($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
@@ -355,6 +357,10 @@ if ($socid && $action != 'edit' && $action != "create")
|
||||
print_liste_field_titre($langs->trans("RIB"));
|
||||
print_liste_field_titre($langs->trans("IBAN"));
|
||||
print_liste_field_titre($langs->trans("BIC"));
|
||||
if (! empty($conf->prelevement->enabled))
|
||||
{
|
||||
print '<td>RUM</td>';
|
||||
}
|
||||
print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"');
|
||||
print '<td width="40"></td>';
|
||||
print '</tr>';
|
||||
@@ -372,6 +378,12 @@ if ($socid && $action != 'edit' && $action != "create")
|
||||
print '<td>'.$rib->iban.'</td>';
|
||||
// BIC
|
||||
print '<td>'.$rib->bic.'</td>';
|
||||
|
||||
if (! empty($conf->prelevement->enabled))
|
||||
{
|
||||
print '<td>'.$prelevement->buildRumNumber($soc->code_client, $rib->datec, $rib->id).'</td>';
|
||||
}
|
||||
|
||||
// Default
|
||||
print '<td align="center" width="70">';
|
||||
if (!$rib->default_rib) {
|
||||
|
||||
Reference in New Issue
Block a user