This commit is contained in:
florian HENRY 2016-06-30 15:49:57 +02:00
parent bdba5dce3a
commit d431e73ec8
6 changed files with 233 additions and 175 deletions

View File

@ -258,6 +258,10 @@ class Account extends CommonObject
$string .= $this->code_guichet.' '; $string .= $this->code_guichet.' ';
} elseif ($val == 'BankAccountNumberKey') { } elseif ($val == 'BankAccountNumberKey') {
$string .= $this->cle_rib.' '; $string .= $this->cle_rib.' ';
}elseif ($val == 'BIC') {
$string .= $this->bic.' ';
}elseif ($val == 'IBAN') {
$string .= $this->iban.' ';
} }
} }
@ -1151,9 +1155,9 @@ class Account extends CommonObject
if ($user->societe_id) { if ($user->societe_id) {
return 0; return 0;
} }
$nb=0; $nb=0;
$sql = "SELECT COUNT(ba.rowid) as nb"; $sql = "SELECT COUNT(ba.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE ba.rappro > 0 and ba.clos = 0"; $sql.= " WHERE ba.rappro > 0 and ba.clos = 0";
@ -1169,7 +1173,7 @@ class Account extends CommonObject
return $nb; return $nb;
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
@ -1204,7 +1208,7 @@ class Account extends CommonObject
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id.$linkclose; $link = '<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id.$linkclose;
$linkend='</a>'; $linkend='</a>';
} }
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' '); if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
$result.=$link.$this->label.$linkend; $result.=$link.$this->label.$linkend;
return $result; return $result;
@ -1324,12 +1328,16 @@ class Account extends CommonObject
if ($detailedBBAN == 0) { if ($detailedBBAN == 0) {
return array( return array(
'BankAccountNumber' 'IBAN',
'BIC',
'BankAccountNumber'
); );
} elseif ($detailedBBAN == 2) { } elseif ($detailedBBAN == 2) {
return array( return array(
'BankCode', 'IBAN',
'BankAccountNumber' 'BIC',
'BankCode',
'BankAccountNumber'
); );
} }
@ -1352,16 +1360,20 @@ class Account extends CommonObject
global $conf; global $conf;
$fieldlists = array( $fieldlists = array(
'BankCode', 'IBAN',
'DeskCode', 'BIC',
'BankAccountNumber', 'BankCode',
'BankAccountNumberKey' 'DeskCode',
'BankAccountNumber',
'BankAccountNumberKey'
); );
if (!empty($conf->global->BANK_SHOW_ORDER_OPTION)) { if (!empty($conf->global->BANK_SHOW_ORDER_OPTION)) {
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) { if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) {
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') { if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') {
$fieldlists = array( $fieldlists = array(
'IBAN',
'BIC',
'BankCode', 'BankCode',
'DeskCode', 'DeskCode',
'BankAccountNumberKey', 'BankAccountNumberKey',

View File

@ -292,7 +292,7 @@ function pdf_getHeightForLogo($logo, $url = false)
/** /**
* Function to try to calculate height of a HTML Content * Function to try to calculate height of a HTML Content
* *
* @param TCPDF $pdf PDF initialized object * @param TCPDF $pdf PDF initialized object
* @param string $htmlcontent HTML Contect * @param string $htmlcontent HTML Contect
* @see getStringHeight * @see getStringHeight
@ -315,7 +315,7 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
if ($end_page == $start_page) { if ($end_page == $start_page) {
$height = $end_y - $start_y; $height = $end_y - $start_y;
} }
else else
{ {
for ($page=$start_page; $page <= $end_page; ++$page) { for ($page=$start_page; $page <= $end_page; ++$page) {
$pdf->setPage($page); $pdf->setPage($page);
@ -331,7 +331,7 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
} }
} }
// restore previous object // restore previous object
$pdf = $pdf->rollbackTransaction(); $pdf = $pdf->rollbackTransaction();
return $height; return $height;
} }
@ -404,9 +404,9 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
{ {
$withCountry = 0; $withCountry = 0;
if (!empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) $withCountry = 1; if (!empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) $withCountry = 1;
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany, $withCountry, "\n", $outputlangs))."\n"; $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany, $withCountry, "\n", $outputlangs))."\n";
if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS)) if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
{ {
// Phone // Phone
@ -419,13 +419,13 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url); if ($sourcecompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($sourcecompany->url);
} }
} }
if ($mode == 'target' || preg_match('/targetwithdetails/',$mode)) if ($mode == 'target' || preg_match('/targetwithdetails/',$mode))
{ {
if ($usecontact) if ($usecontact)
{ {
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1)); $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1));
if (!empty($targetcontact->address)) { if (!empty($targetcontact->address)) {
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n"; $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n";
}else { }else {
@ -438,7 +438,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
else if (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) { else if (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
$stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n"; $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n";
} }
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/',$mode)) if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/',$mode))
{ {
// Phone // Phone
@ -471,7 +471,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n"; $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
// Country // Country
if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n"; if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n";
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/',$mode)) if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/',$mode))
{ {
// Phone // Phone
@ -499,13 +499,13 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
} }
} }
} }
// Intra VAT // Intra VAT
if (empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS)) if (empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))
{ {
if ($targetcompany->tva_intra) $stringaddress.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra); if ($targetcompany->tva_intra) $stringaddress.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
} }
// Professionnal Ids // Professionnal Ids
if (! empty($conf->global->MAIN_PROFID1_IN_ADDRESS) && ! empty($targetcompany->idprof1)) if (! empty($conf->global->MAIN_PROFID1_IN_ADDRESS) && ! empty($targetcompany->idprof1))
{ {
@ -543,7 +543,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1]; if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof6); $stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof6);
} }
// Public note // Public note
if (! empty($conf->global->MAIN_PUBLIC_NOTE_IN_ADDRESS)) if (! empty($conf->global->MAIN_PUBLIC_NOTE_IN_ADDRESS))
{ {
@ -558,7 +558,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
} }
} }
} }
return $stringaddress; return $stringaddress;
} }
@ -641,7 +641,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
global $mysoc, $conf; global $mysoc, $conf;
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE);
$diffsizecontent=(empty($conf->global->PDF_DIFFSIZE_CONTENT)?4:$conf->global->PDF_DIFFSIZE_CONTENT); $diffsizecontent=(empty($conf->global->PDF_DIFFSIZE_CONTENT)?4:$conf->global->PDF_DIFFSIZE_CONTENT);
$pdf->SetXY($curx, $cury); $pdf->SetXY($curx, $cury);
@ -683,7 +683,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
// number = account number // number = account number
// key = check control key used only when $usedetailedbban = 1 // key = check control key used only when $usedetailedbban = 1
if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+6); if (empty($onlynumber)) $pdf->line($curx+1, $cury+1, $curx+1, $cury+6);
foreach ($account->getFieldsToShow() as $val) foreach ($account->getFieldsToShow() as $val)
{ {
@ -706,8 +706,12 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
// Key // Key
$tmplength = 13; $tmplength = 13;
$content = $account->cle_rib; $content = $account->cle_rib;
}elseif ($val == 'IBAN' || $val == 'BIC') {
// Key
$tmplength = 0;
$content = '';
} else { } else {
dol_print_error($this->db, 'Unexpected value for getFieldsToShow: '.$val); dol_print_error($account->db, 'Unexpected value for getFieldsToShow: '.$val);
break; break;
} }
@ -720,7 +724,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
$pdf->line($curx, $cury + 1, $curx, $cury + 7); $pdf->line($curx, $cury + 1, $curx, $cury + 7);
} }
} }
$curx=$savcurx; $curx=$savcurx;
$cury+=8; $cury+=8;
} }
@ -1054,7 +1058,7 @@ function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$w,$h,$al
{ {
$reftoshow .= ' / '.$linkedobject["date_value"]; $reftoshow .= ' / '.$linkedobject["date_value"];
} }
$posy+=3; $posy+=3;
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('','', $default_font_size - 2);
@ -1095,7 +1099,7 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide
$parameters = array('pdf'=>$pdf,'i'=>$i,'outputlangs'=>$outputlangs,'w'=>$w,'h'=>$h,'posx'=>$posx,'posy'=>$posy,'hideref'=>$hideref,'hidedesc'=>$hidedesc,'issupplierline'=>$issupplierline,'special_code'=>$special_code); $parameters = array('pdf'=>$pdf,'i'=>$i,'outputlangs'=>$outputlangs,'w'=>$w,'h'=>$h,'posx'=>$posx,'posy'=>$posy,'hideref'=>$hideref,'hidedesc'=>$hidedesc,'issupplierline'=>$issupplierline,'special_code'=>$special_code);
$action=''; $action='';
$reshook=$hookmanager->executeHooks('pdf_writelinedesc',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('pdf_writelinedesc',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint; if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1415,7 +1419,7 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
$reshook = $hookmanager->executeHooks('pdf_getlinevatrate',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlinevatrate',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint; if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1451,12 +1455,12 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
$reshook = $hookmanager->executeHooks('pdf_getlineupexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineupexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint; if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
{ {
if (empty($hidedetails) || $hidedetails > 1) if (empty($hidedetails) || $hidedetails > 1)
{ {
$subprice = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_subprice : $object->lines[$i]->subprice); $subprice = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_subprice : $object->lines[$i]->subprice);
$result.=price($sign * $subprice, 0, $outputlangs); $result.=price($sign * $subprice, 0, $outputlangs);
@ -1488,7 +1492,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
$reshook = $hookmanager->executeHooks('pdf_getlineupwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineupwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint; if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1521,7 +1525,7 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineqty',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) $result=$hookmanager->resPrint; if(!empty($hookmanager->resPrint)) $result=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1555,7 +1559,7 @@ function pdf_getlineqty_asked($object,$i,$outputlangs,$hidedetails=0)
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_asked',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineqty_asked',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint; if (!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1589,7 +1593,7 @@ function pdf_getlineqty_shipped($object,$i,$outputlangs,$hidedetails=0)
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineqty_shipped',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint; if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1623,7 +1627,7 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
$reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineqty_keeptoship',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint; if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1647,7 +1651,7 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = false) function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = false)
{ {
global $langs; global $langs;
$reshook=0; $reshook=0;
$result=''; $result='';
//if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) ) //if (is_object($hookmanager) && ( (isset($object->lines[$i]->product_type) && $object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line) ) )
@ -1665,7 +1669,7 @@ function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanag
); );
$action = ''; $action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineunit', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineunit', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint; if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1702,7 +1706,7 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
$reshook = $hookmanager->executeHooks('pdf_getlineremisepercent',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineremisepercent',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint; if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1735,7 +1739,7 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
$parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code); $parameters = array('i' => $i, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails, 'special_code' => $special_code);
$action = ''; $action = '';
$reshook = $hookmanager->executeHooks('pdf_getlineprogress', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlineprogress', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint; if(!empty($hookmanager->resPrint)) return $hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1772,7 +1776,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code, 'sign'=>$sign); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code, 'sign'=>$sign);
$action=''; $action='';
$reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlinetotalexcltax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint; if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1813,7 +1817,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
$parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code); $parameters = array('i'=>$i,'outputlangs'=>$outputlangs,'hidedetails'=>$hidedetails,'special_code'=>$special_code);
$action=''; $action='';
$reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('pdf_getlinetotalwithtax',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint; if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
} }
if (empty($reshook)) if (empty($reshook))
@ -1889,7 +1893,7 @@ function pdf_getLinkedObjects($object,$outputlangs)
$linkedobjects=array(); $linkedobjects=array();
$object->fetchObjectLinked(); $object->fetchObjectLinked();
foreach($object->linkedObjects as $objecttype => $objects) foreach($object->linkedObjects as $objecttype => $objects)
{ {
if ($objecttype == 'facture') if ($objecttype == 'facture')
@ -1949,7 +1953,7 @@ function pdf_getLinkedObjects($object,$outputlangs)
if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'].=' / '; if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'].=' / ';
$linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($elementobject->ref);
//$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateShipment"); //$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateShipment");
//if (! empty($linkedobjects[$objecttype]['date_value'])) $linkedobjects[$objecttype]['date_value'].=' / '; //if (! empty($linkedobjects[$objecttype]['date_value'])) $linkedobjects[$objecttype]['date_value'].=' / ';
//$linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs); //$linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs);
} }
else else

View File

@ -233,7 +233,7 @@ class CompanyBankAccount extends Account
{ {
$rib = ''; $rib = '';
if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib) { if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib || $this->iban || $this->bic ) {
if ($this->label && $displayriblabel) { if ($this->label && $displayriblabel) {
$rib = $this->label." : "; $rib = $this->label." : ";

View File

@ -357,7 +357,7 @@ class Societe extends CommonObject
// Multicurrency // Multicurrency
var $fk_multicurrency; var $fk_multicurrency;
var $multicurrency_code; var $multicurrency_code;
/** /**
* To contains a clone of this when we need to save old properties of object * To contains a clone of this when we need to save old properties of object
* @var Societe * @var Societe
@ -406,14 +406,14 @@ class Societe extends CommonObject
if (empty($this->client)) $this->client=0; if (empty($this->client)) $this->client=0;
if (empty($this->fournisseur)) $this->fournisseur=0; if (empty($this->fournisseur)) $this->fournisseur=0;
$this->import_key = trim($this->import_key); $this->import_key = trim($this->import_key);
if (!empty($this->multicurrency_code)) $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); if (!empty($this->multicurrency_code)) $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
if (empty($this->fk_multicurrency)) if (empty($this->fk_multicurrency))
{ {
$this->multicurrency_code = ''; $this->multicurrency_code = '';
$this->fk_multicurrency = 0; $this->fk_multicurrency = 0;
} }
dol_syslog(get_class($this)."::create ".$this->name); dol_syslog(get_class($this)."::create ".$this->name);
// Check parameters // Check parameters
@ -845,7 +845,7 @@ class Societe extends CommonObject
$sql .= ",mode_reglement_supplier = ".(! empty($this->mode_reglement_supplier_id)?"'".$this->db->escape($this->mode_reglement_supplier_id)."'":"null"); $sql .= ",mode_reglement_supplier = ".(! empty($this->mode_reglement_supplier_id)?"'".$this->db->escape($this->mode_reglement_supplier_id)."'":"null");
$sql .= ",cond_reglement_supplier = ".(! empty($this->cond_reglement_supplier_id)?"'".$this->db->escape($this->cond_reglement_supplier_id)."'":"null"); $sql .= ",cond_reglement_supplier = ".(! empty($this->cond_reglement_supplier_id)?"'".$this->db->escape($this->cond_reglement_supplier_id)."'":"null");
$sql .= ",fk_shipping_method = ".(! empty($this->shipping_method_id)?"'".$this->db->escape($this->shipping_method_id)."'":"null"); $sql .= ",fk_shipping_method = ".(! empty($this->shipping_method_id)?"'".$this->db->escape($this->shipping_method_id)."'":"null");
$sql .= ",client = " . (! empty($this->client)?$this->client:0); $sql .= ",client = " . (! empty($this->client)?$this->client:0);
$sql .= ",fournisseur = " . (! empty($this->fournisseur)?$this->fournisseur:0); $sql .= ",fournisseur = " . (! empty($this->fournisseur)?$this->fournisseur:0);
$sql .= ",barcode = ".(! empty($this->barcode)?"'".$this->db->escape($this->barcode)."'":"null"); $sql .= ",barcode = ".(! empty($this->barcode)?"'".$this->db->escape($this->barcode)."'":"null");
@ -1055,7 +1055,7 @@ class Societe extends CommonObject
else if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity IN (".getEntity($this->element, 1).")";
else if ($idprof5) $sql .= " WHERE s.idprof5 = '".$this->db->escape($idprof5)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof5) $sql .= " WHERE s.idprof5 = '".$this->db->escape($idprof5)."' AND s.entity IN (".getEntity($this->element, 1).")";
else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
dol_syslog(get_class($this)."::fetch ".$sql); dol_syslog(get_class($this)."::fetch ".$sql);
if ($resql) if ($resql)
@ -1900,10 +1900,10 @@ class Societe extends CommonObject
$link.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'"'; $link.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'"';
if (empty($notooltip)) if (empty($notooltip))
{ {
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$label=$langs->trans("ShowCompany"); $label=$langs->trans("ShowCompany");
$link.=' alt="'.dol_escape_htmltag($label, 1).'"'; $link.=' alt="'.dol_escape_htmltag($label, 1).'"';
} }
$link.= ' title="'.dol_escape_htmltag($label, 1).'"'; $link.= ' title="'.dol_escape_htmltag($label, 1).'"';
$link.=' class="classfortooltip"'; $link.=' class="classfortooltip"';
@ -2195,6 +2195,7 @@ class Societe extends CommonObject
function display_rib($mode='label') function display_rib($mode='label')
{ {
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db); $bac = new CompanyBankAccount($this->db);
$bac->fetch(0,$this->id); $bac->fetch(0,$this->id);
@ -2206,6 +2207,7 @@ class Societe extends CommonObject
{ {
if (empty($bac->rum)) if (empty($bac->rum))
{ {
require_once DOL_DOCUMENT_ROOT . '/compta/prelevement/class/bonprelevement.class.php';
$prelevement = new BonPrelevement($this->db); $prelevement = new BonPrelevement($this->db);
$bac->fetch_thirdparty(); $bac->fetch_thirdparty();
$bac->rum = $prelevement->buildRumNumber($bac->thirdparty->code_client, $bac->datec, $bac->id); $bac->rum = $prelevement->buildRumNumber($bac->thirdparty->code_client, $bac->datec, $bac->id);
@ -3126,7 +3128,7 @@ class Societe extends CommonObject
} }
else return false; else return false;
} }
/** /**
* Check if we must use revenue stamps feature or not according to country (country of $mysocin most cases). * Check if we must use revenue stamps feature or not according to country (country of $mysocin most cases).
* *
@ -3355,7 +3357,7 @@ class Societe extends CommonObject
} }
/** /**
* Create a document onto disk according to template module. * Create a document onto disk according to template module.
* *
@ -3390,8 +3392,8 @@ class Societe extends CommonObject
return $result; return $result;
} }
/** /**
* Sets object to supplied categories. * Sets object to supplied categories.
* *

View File

@ -59,43 +59,70 @@ if ($action == 'update' && ! $_POST["cancel"])
// Modification // Modification
$account = new CompanyBankAccount($db); $account = new CompanyBankAccount($db);
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 (! 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); $account->fetch($id);
if (! $error)
{
$account->socid = $object->id;
$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');
$account->bank = $_POST["bank"]; $result = $account->update($user);
$account->label = $_POST["label"]; if (! $result)
$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 = $_POST["iban"];
$account->domiciliation = $_POST["domiciliation"];
$account->proprio = $_POST["proprio"];
$account->owner_address = $_POST["owner_address"];
$account->frstrecur = GETPOST('frstrecur');
$result = $account->update($user);
if (! $result)
{
setEventMessages($account->error, $account->errors, 'errors');
$_GET["action"]='edit'; // Force chargement page edition
}
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 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; $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id;
header('Location: '.$url); header('Location: '.$url);
exit; exit;
} }
}
} }
if ($action == 'add' && ! $_POST["cancel"]) if ($action == 'add' && ! $_POST["cancel"])
@ -114,6 +141,18 @@ if ($action == 'add' && ! $_POST["cancel"])
$action='create'; $action='create';
$error++; $error++;
} }
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 (! $error)
{ {
@ -122,19 +161,19 @@ if ($action == 'add' && ! $_POST["cancel"])
$account->socid = $object->id; $account->socid = $object->id;
$account->bank = $_POST["bank"]; $account->bank = GETPOST('bank','alpha');
$account->label = $_POST["label"]; $account->label = GETPOST('label','alpha');
$account->courant = $_POST["courant"]; $account->courant = GETPOST('courant','alpha');
$account->clos = $_POST["clos"]; $account->clos = GETPOST('clos','alpha');
$account->code_banque = $_POST["code_banque"]; $account->code_banque = GETPOST('code_banque','alpha');
$account->code_guichet = $_POST["code_guichet"]; $account->code_guichet = GETPOST('code_guichet','alpha');
$account->number = $_POST["number"]; $account->number = GETPOST('number','alpha');
$account->cle_rib = $_POST["cle_rib"]; $account->cle_rib = GETPOST('cle_rib','alpha');
$account->bic = $_POST["bic"]; $account->bic = GETPOST('bic','alpha');
$account->iban = $_POST["iban"]; $account->iban = GETPOST('iban','alpha');
$account->domiciliation = $_POST["domiciliation"]; $account->domiciliation = GETPOST('domiciliation','alpha');
$account->proprio = $_POST["proprio"]; $account->proprio = GETPOST('proprio','alpha');
$account->owner_address = $_POST["owner_address"]; $account->owner_address = GETPOST('owner_address','alpha');
$account->frstrecur = GETPOST('frstrecur'); $account->frstrecur = GETPOST('frstrecur');
$result = $account->update($user); // TODO Use create and include update into create method $result = $account->update($user); // TODO Use create and include update into create method
@ -161,8 +200,8 @@ if ($action == 'setasdefault')
$url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id; $url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id;
header('Location: '.$url); header('Location: '.$url);
exit; exit;
} }
else else
{ {
setEventMessages($db->lasterror, null, 'errors'); setEventMessages($db->lasterror, null, 'errors');
} }
@ -239,9 +278,9 @@ if ($socid && $action != 'edit' && $action != "create")
} }
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print load_fiche_titre($langs->trans("DefaultRIB"), '', ''); print load_fiche_titre($langs->trans("DefaultRIB"), '', '');
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
@ -265,35 +304,31 @@ if ($socid && $action != 'edit' && $action != "create")
$content = $account->number; $content = $account->number;
} elseif ($val == 'BankAccountNumberKey') { } elseif ($val == 'BankAccountNumberKey') {
$content = $account->cle_rib; $content = $account->cle_rib;
}elseif ($val == 'IBAN') {
$content = $account->iban;
if (! empty($account->iban)) {
if (! checkIbanForAccount($account)) {
$content.= img_picto($langs->trans("IbanNotValid"),'warning');
} else {
$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');
} else {
$content.= img_picto($langs->trans("SwiftValid"),'info');
}
}
} }
print '<tr><td>'.$langs->trans($val).'</td>'; print '<tr><td>'.$langs->trans($val).'</td>';
print '<td colspan="3">'.$content.'</td>'; print '<td colspan="4">'.$content.'</td>';
print '</tr>'; print '</tr>';
} }
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
print '<td colspan="4">'.$account->iban . '&nbsp;';
if (! empty($account->iban)) {
if (! checkIbanForAccount($account)) {
print img_picto($langs->trans("IbanNotValid"),'warning');
} else {
print img_picto($langs->trans("IbanValid"),'info');
}
}
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
print '<td colspan="4">'.$account->bic.'&nbsp;';
if (! empty($account->bic)) {
if (! checkSwiftForAccount($account)) {
print img_picto($langs->trans("SwiftNotValid"),'warning');
} else {
print img_picto($langs->trans("SwiftValid"),'info');
}
}
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">'; print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
print $account->domiciliation; print $account->domiciliation;
print "</td></tr>\n"; print "</td></tr>\n";
@ -315,7 +350,7 @@ if ($socid && $action != 'edit' && $action != "create")
} }
print "</div>"; print "</div>";
dol_fiche_end(); dol_fiche_end();
@ -418,9 +453,9 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"),0,'company');
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
@ -432,6 +467,8 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
// Show fields of bank account // Show fields of bank account
foreach ($account->getFieldsToShow() as $val) { foreach ($account->getFieldsToShow() as $val) {
$require=false;
if ($val == 'BankCode') { if ($val == 'BankCode') {
$name = 'code_banque'; $name = 'code_banque';
$size = 8; $size = 8;
@ -448,20 +485,23 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
$name = 'cle_rib'; $name = 'cle_rib';
$size = 3; $size = 3;
$content = $account->cle_rib; $content = $account->cle_rib;
} elseif ($val == 'IBAN') {
$name = 'iban';
$size = 30;
$content = $account->iban;
$require=true;
} elseif ($val == 'BIC') {
$name = 'bic';
$size = 12;
$content = $account->bic;
$require=true;
} }
print '<tr><td>'.$langs->trans($val).'</td>'; print '<tr><td'.($require?' class="fieldrequired" ':'').'>'.$langs->trans($val).'</td>';
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>'; print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
print '</tr>'; print '</tr>';
} }
// IBAN
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("IBAN").'</td>';
print '<td colspan="4"><input size="30" type="text" name="iban" value="'.$account->iban.'"></td></tr>';
print '<tr><td valign="top" class="fieldrequired">'.$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 '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
print '<textarea name="domiciliation" rows="4" cols="40">'; print '<textarea name="domiciliation" rows="4" cols="40">';
print $account->domiciliation; print $account->domiciliation;
@ -498,7 +538,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer)
} }
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
print '<div align="center">'; print '<div align="center">';
@ -515,9 +555,9 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"),0,'company'); dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"),0,'company');
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
@ -527,6 +567,13 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
print '<tr><td class="fieldrequired">'.$langs->trans("Bank").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("Bank").'</td>';
print '<td><input size="30" type="text" name="bank" value="'.GETPOST('bank').'"></td></tr>'; print '<td><input size="30" type="text" name="bank" value="'.GETPOST('bank').'"></td></tr>';
// IBAN
print '<tr><td valign="top" 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" class="fieldrequired">'.$langs->trans("BIC").'</td>';
print '<td colspan="4"><input size="12" type="text" name="bic" value="'.GETPOST('bic').'"></td></tr>';
// BBAN // BBAN
if ($account->useDetailedBBAN() == 1) if ($account->useDetailedBBAN() == 1)
{ {
@ -556,13 +603,6 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
print '</tr>'; print '</tr>';
} }
// IBAN
print '<tr><td valign="top">'.$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">'.$langs->trans("BIC").'</td>';
print '<td colspan="4"><input size="12" type="text" name="bic" value="'.GETPOST('bic').'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">'; print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
print '<textarea name="domiciliation" rows="4" cols="40">'; print '<textarea name="domiciliation" rows="4" cols="40">';
print GETPOST('domiciliation'); print GETPOST('domiciliation');
@ -597,7 +637,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer)
} }
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
print '<div align="center">'; print '<div align="center">';

View File

@ -106,7 +106,7 @@ if (empty($reshook))
{ {
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
} }
if ($action == 'confirm_merge' && $confirm == 'yes') if ($action == 'confirm_merge' && $confirm == 'yes')
@ -200,8 +200,8 @@ if (empty($reshook))
{ {
setEventMessages($langs->trans('ThirdpartiesMergeSuccess'), null, 'mesgs'); setEventMessages($langs->trans('ThirdpartiesMergeSuccess'), null, 'mesgs');
$db->commit(); $db->commit();
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorsThirdpartyMerge'), null, 'errors'); setEventMessages($langs->trans('ErrorsThirdpartyMerge'), null, 'errors');
@ -262,8 +262,8 @@ if (empty($reshook))
$error++; $error++;
$action='create'; $action='create';
} }
if ($action == 'update') if ($action == 'update')
{ {
$ret=$object->fetch($socid); $ret=$object->fetch($socid);
@ -340,13 +340,13 @@ if (empty($reshook))
$object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->fk_incoterms = GETPOST('incoterm_id', 'int');
$object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha');
} }
// Multicurrency // Multicurrency
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled))
{ {
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
} }
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) if ($ret < 0)
@ -1494,7 +1494,7 @@ else
print $object->ref; print $object->ref;
print '</td></tr>'; print '</td></tr>';
} }
// Name // Name
print '<tr><td class="titlefield">'.fieldLabel('ThirdPartyName','name',1).'</td>'; print '<tr><td class="titlefield">'.fieldLabel('ThirdPartyName','name',1).'</td>';
print '<td colspan="3"><input type="text" size="60" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus"></td></tr>'; print '<td colspan="3"><input type="text" size="60" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus"></td></tr>';
@ -1922,13 +1922,13 @@ else
dol_htmloutput_errors($error,$errors); dol_htmloutput_errors($error,$errors);
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">'; print '<table class="border tableforfield" width="100%">';
@ -1936,12 +1936,12 @@ else
print '<tr><td class="titlefield">'.$langs->trans('ProspectCustomer').'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans('ProspectCustomer').'</td><td>';
print $object->getLibCustProspStatut(); print $object->getLibCustProspStatut();
print '</td></tr>'; print '</td></tr>';
// Prospect/Customer // Prospect/Customer
print '<tr><td>'.$langs->trans('Supplier').'</td><td>'; print '<tr><td>'.$langs->trans('Supplier').'</td><td>';
print yn($object->fournisseur); print yn($object->fournisseur);
print '</td></tr>'; print '</td></tr>';
// Prefix // Prefix
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{ {
@ -2019,7 +2019,7 @@ else
print yn($object->tva_assuj); print yn($object->tva_assuj);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// VAT Code // VAT Code
print '<tr>'; print '<tr>';
print '<td class="nowrap">'.$langs->trans('VATIntra').'</td><td>'; print '<td class="nowrap">'.$langs->trans('VATIntra').'</td><td>';
@ -2163,13 +2163,13 @@ else
print '<tr><td>'.$langs->trans("Staff").'</td><td>'.$object->effectif.'</td></tr>'; print '<tr><td>'.$langs->trans("Staff").'</td><td>'.$object->effectif.'</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">'; print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">'; print '<table class="border tableforfield" width="100%">';
// Legal // Legal
print '<tr><td width="25%">'.$langs->trans('JuridicalStatus').'</td><td>'.$object->forme_juridique.'</td></tr>'; print '<tr><td width="25%">'.$langs->trans('JuridicalStatus').'</td><td>'.$object->forme_juridique.'</td></tr>';
@ -2244,7 +2244,7 @@ else
print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code,1) : ''; print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code,1) : '';
print '</td></tr>'; print '</td></tr>';
} }
// Other attributes // Other attributes
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -2325,10 +2325,10 @@ else
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</div></div>'; print '</div></div>';
print '<div style="clear:both"></div>'; print '<div style="clear:both"></div>';
dol_fiche_end(); dol_fiche_end();
@ -2345,13 +2345,13 @@ else
$TContact = $object->contact_array_objects(); $TContact = $object->contact_array_objects();
foreach ($TContact as &$contact) foreach ($TContact as &$contact)
{ {
if (!empty($contact->email)) if (!empty($contact->email))
{ {
$at_least_one_email_contact = true; $at_least_one_email_contact = true;
break; break;
} }
} }
if (! empty($object->email) || $at_least_one_email_contact) if (! empty($object->email) || $at_least_one_email_contact)
{ {
$langs->load("mails"); $langs->load("mails");
@ -2408,7 +2408,7 @@ else
print load_fiche_titre($langs->trans($titreform)); print load_fiche_titre($langs->trans($titreform));
dol_fiche_head(); dol_fiche_head();
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';