Merge branch 'GPCsolutions-review' into develop

This commit is contained in:
Laurent Destailleur 2015-01-17 19:25:56 +01:00
commit ded86d4031
26 changed files with 227 additions and 182 deletions

View File

@ -27,7 +27,7 @@
/**
* Class to manage accounting accounts
*/
class AccountingAccount
class AccountingAccount extends CommonObject
{
var $db;
var $error;
@ -126,6 +126,7 @@ class AccountingAccount
{
global $conf, $langs;
$error = 0;
$now = dol_now();
$now=dol_now();
@ -447,4 +448,4 @@ class AccountingAccount
return - 1;
}
}
}
}

View File

@ -712,4 +712,4 @@ class BookKeepingLine
var $fk_user_author;
var $code_journal;
var $piece_num;
}
}

View File

@ -235,4 +235,4 @@ if ($result) {
}
$db->close();
llxFooter();
llxFooter();

View File

@ -143,9 +143,9 @@ if ($result) {
$obj = $db->fetch_object($result);
$tabcompany[$obj->rowid] = array(
'id' => $obj->socid,
'name' => $obj->name,
'code_client' => $obj->code_compta
'id' => $obj->socid,
'name' => $obj->name,
'code_client' => $obj->code_compta
);
// Controls
@ -169,84 +169,130 @@ if ($result) {
}
$links = $object->get_url($obj->rowid);
foreach ( $links as $key => $val )
// get_url may return -1 which is not traversable
if (is_array($links))
{
$tabtype[$obj->rowid] = $links[$key]['type'];
foreach ($links as $key => $val)
{
$tabtype[$obj->rowid] = $links[$key]['type'];
if ($links[$key]['type'] == 'payment')
{
$paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
}
else if ($links[$key]['type'] == 'payment_supplier')
{
$paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
}
else if ($links[$key]['type'] == 'company')
{
$societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
}
else if ($links[$key]['type'] == 'sc')
{
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
}
else
if ($links[$key]['type'] == 'payment')
{
$chargestatic->lib = $links[$key]['label'];
$paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid)
else if ($links[$key]['type'] == 'payment_supplier')
{
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
$paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
}
else if ($links[$key]['type'] == 'company')
{
$societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
}
else if ($links[$key]['type'] == 'sc')
{
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
}
else if ($links[$key]['type'] == 'company')
{
$societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
}
else if ($links[$key]['type'] == 'sc')
{
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
}
else
{
$chargestatic->lib = $links[$key]['label'];
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid)
{
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
}
}
else if ($links[$key]['type'] == 'payment_vat')
{
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
else if ($links[$key]['type'] == 'payment_salary')
{
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
}
else if ($links[$key]['type'] == 'banktransfert')
{
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/
}
else if ($links[$key]['type'] == 'payment_vat')
{
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
else if ($links[$key]['type'] == 'payment_salary')
{
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
}
else if ($links[$key]['type'] == 'banktransfert')
{
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/
}
else if ($links[$key]['type'] == 'payment_vat')
{
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
else if ($links[$key]['type'] == 'payment_salary')
{
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
}
else if ($links[$key]['type'] == 'banktransfert')
{
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/
}
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
@ -265,10 +311,10 @@ if ($result) {
if ($action == 'writeBookKeeping')
{
$error = 0;
foreach ( $tabpay as $key => $val )
foreach ($tabpay as $key => $val)
{
// Bank
foreach ( $tabbq[$key] as $k => $mt )
foreach ($tabbq[$key] as $k => $mt)
{
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
@ -320,7 +366,7 @@ if ($action == 'writeBookKeeping')
}
}
// Third party
foreach ( $tabtp[$key] as $k => $mt )
foreach ($tabtp[$key] as $k => $mt)
{
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];

View File

@ -131,7 +131,8 @@ if ($result) {
$tabtype = array ();
$i = 0;
while ( $i < $num ) {
while ($i < $num)
{
$obj = $db->fetch_object($result);
// controls
@ -155,65 +156,61 @@ if ($result) {
}
$links = $object->get_url($obj->rowid);
foreach ( $links as $key => $val ) {
// get_url may return -1 which is not traversable
if (is_array($links))
{
foreach ( $links as $key => $val )
{
$tabtype[$obj->rowid] = $links[$key]['type'];
$tabtype[$obj->rowid] = $links[$key]['type'];
if ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
} else if ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
} else if ($links[$key]['type'] == 'company') {
if ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
} else if ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
} else if ($links[$key]['type'] == 'company') {
$societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
} else if ($links[$key]['type'] == 'sc') {
$societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
} else if ($links[$key]['type'] == 'sc') {
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
} else {
$chargestatic->lib = $links[$key]['label'];
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
} else {
$chargestatic->lib = $links[$key]['label'];
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$cptsociale] += $obj->amount;
}*/
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
}
} else if ($links[$key]['type'] == 'payment_vat') {
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
} else if ($links[$key]['type'] == 'banktransfert') {
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$cptsociale] += $obj->amount;
}*/
}
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
@ -229,11 +226,14 @@ if ($result) {
*/
// write bookkeeping
if ($action == 'writeBookKeeping') {
if ($action == 'writeBookKeeping')
{
$error = 0;
foreach ( $tabpay as $key => $val ) {
foreach ( $tabpay as $key => $val )
{
// cash
foreach ( $tabbq[$key] as $k => $mt ) {
foreach ( $tabbq[$key] as $k => $mt )
{
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"];
@ -249,8 +249,8 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->credit = ($mt < 0 ? - $mt : 0);
$bookkeeping->code_journal = $conf->global->ACCOUNTING_CASH_JOURNAL;
if ($tabtype[$key] == 'payment') {
if ($tabtype[$key] == 'payment')
{
$sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
@ -528,4 +528,4 @@ if ($action == 'export_csv') {
// End of page
llxFooter();
}
$db->close();
$db->close();

View File

@ -241,7 +241,7 @@ if ($action == 'writebookkeeping') {
* View
*/
$companystatic = new Societe($db);
$companystatic = new Fournisseur($db);
// export csv
if ($action == 'export_csv')
@ -406,7 +406,6 @@ if ($action == 'export_csv')
$r = '';
$invoicestatic = new FactureFournisseur($db);
$companystatic = new Fournisseur($db);
foreach ( $tabfac as $key => $val ) {
$invoicestatic->id = $key;
@ -469,4 +468,4 @@ if ($action == 'export_csv')
// End of page
llxFooter();
}
$db->close();
$db->close();

View File

@ -994,7 +994,7 @@ elseif ($action == 'show_week') // View by week
{
// Show days of the current week
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
$tmparray = dol_getdate($curtime,'fast');
$tmparray = dol_getdate($curtime, true);
$tmpday = $tmparray['mday'];
$tmpmonth = $tmparray['mon'];
$tmpyear = $tmparray['year'];

View File

@ -900,9 +900,9 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$newcolor = ''; //init
if (empty($event->fulldayevent))
{
$a = dol_mktime((int) $h,0,0,$month,$day,$year,false,false);
$b = dol_mktime((int) $h,30,0,$month,$day,$year,false,false);
$c = dol_mktime((int) $h+1,0,0,$month,$day,$year,false,false);
$a = dol_mktime((int) $h,0,0,$month,$day,$year,false,0);
$b = dol_mktime((int) $h,30,0,$month,$day,$year,false,0);
$c = dol_mktime((int) $h+1,0,0,$month,$day,$year,false,0);
$dateendtouse=$event->date_end_in_calendar;
if ($dateendtouse==$event->date_start_in_calendar) $dateendtouse++;

View File

@ -164,10 +164,10 @@ class Account extends CommonObject
* TODO Move this into AccountLine
* Return array with links from llx_bank_url
*
* @param int $fk_bank To search using bank transaction id
* @param int $url_id To search using link to
* @param string $type To search using type
* @return array Array of links
* @param int $fk_bank To search using bank transaction id
* @param int $url_id To search using link to
* @param string $type To search using type
* @return array|-1 Array of links or -1 on error
*/
function get_url($fk_bank='', $url_id='', $type='')
{

View File

@ -2546,7 +2546,7 @@ abstract class CommonObject
*/
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0)
{
global $conf,$langs,$user,$object,$hookmanager;
global $conf, $hookmanager, $inputalsopricewithtax, $langs, $user;
print '<tr class="liste_titre nodrag nodrop">';

View File

@ -190,4 +190,4 @@ function length_exportsage($txt, $len, $end)
}
}
return $res;
}
}

View File

@ -900,7 +900,7 @@ function dol_strftime($fmt, $ts=false, $is_gmt=false)
* @param string $tzoutput true or 'gmt' => string is for Greenwich location
* false or 'tzserver' => output string is for local PHP server TZ usage
* 'tzuser' => output string is for local browser TZ usage
* @param Tranlsate $outputlangs Object lang that contains language for text translation.
* @param Translate $outputlangs Object lang that contains language for text translation.
* @param boolean $encodetooutput false=no convert into output pagecode
* @return string Formated date or '' if time is null
*

View File

@ -218,7 +218,7 @@ if (! function_exists('json_decode'))
*
* @param string $json Json encoded to PHP Object or Array
* @param bool $assoc False return an object, true return an array. Try to always use it with true !
* @return mixed Object or Array
* @return mixed Object or Array or false on error
*/
function dol_json_decode($json, $assoc=false)
{

View File

@ -192,10 +192,10 @@ abstract class DolibarrModules
* Enables a module.
* Inserts all informations into database
*
* @param string[] $array_sql SQL requests to be executed when enabling module
* @param string $options String with options when disabling module ('newboxdefonly|noboxes')
* @param string[]|array $array_sql SQL requests to be executed when enabling module
* @param string $options String with options when disabling module ('newboxdefonly|noboxes')
*
* @return int 1 if OK, 0 if KO
* @return int 1 if OK, 0 if KO
*/
function _init($array_sql, $options='')
{

View File

@ -127,7 +127,7 @@ class CommActionRapport
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
$parameters=array('file'=>$file, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks

View File

@ -111,7 +111,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
}
}
$_file = $dir . "/bordereau-".$number.".pdf";
$file = $dir . "/bordereau-".$number.".pdf";
// Add pdfgeneration hook
if (! is_object($hookmanager))
@ -120,7 +120,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
$parameters=array('file'=>$file, 'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@ -177,7 +177,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->Close();
$pdf->Output($_file,'F');
$pdf->Output($file,'F');
// Add pdfgeneration hook
if (! is_object($hookmanager))
@ -191,7 +191,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$reshook=$hookmanager->executeHooks('adterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (! empty($conf->global->MAIN_UMASK))
@chmod($_file, octdec($conf->global->MAIN_UMASK));
@chmod($file, octdec($conf->global->MAIN_UMASK));
$outputlangs->charset_output=$sav_charset_output;
return 1; // Pas d'erreur

View File

@ -106,7 +106,7 @@ class pdf_soleil extends ModelePDFFicheinter
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$mysoc;
global $conf, $hookmanager, $langs, $user;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO

View File

@ -50,7 +50,7 @@ class modSyslog extends DolibarrModules
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Activate debug logs (syslog)";
// Can be enabled / disabled only in the main company
$this->core_enabled = 1;
$this->core_enabled = true;
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)

View File

@ -49,7 +49,7 @@ class modUser extends DolibarrModules
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Gestion des utilisateurs (requis)";
$this->always_enabled = 1; // Can't be disabled
$this->always_enabled = true; // Can't be disabled
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';

View File

@ -92,7 +92,7 @@ class pdf_baleine extends ModelePDFProjects
*/
function write_file($object,$outputlangs)
{
global $user,$langs,$conf;
global $conf, $hookmanager, $langs, $user;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO

View File

@ -91,7 +91,7 @@ class pdf_paiement
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
global $user,$langs,$conf;
global $conf, $hookmanager, $langs, $user;
$socid=0;
if ($user->societe_id) $socid=$user->societe_id;
@ -126,7 +126,7 @@ class pdf_paiement
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
$parameters=array('file'=>$file,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks

View File

@ -1074,25 +1074,25 @@ class CommandeFournisseur extends CommonOrder
* Add order line
*
* @param string $desc Description
* @param double $pu_ht Unit price
* @param double $qty Quantity
* @param double $txtva Taux tva
* @param double $txlocaltax1 Localtax1 tax
* @param double $txlocaltax2 Localtax2 tax
* @param float $pu_ht Unit price
* @param float $qty Quantity
* @param float $txtva Taux tva
* @param float $txlocaltax1 Localtax1 tax
* @param float $txlocaltax2 Localtax2 tax
* @param int $fk_product Id produit
* @param int $fk_prod_fourn_price Id supplier price
* @param string $fourn_ref Supplier reference
* @param double $remise_percent Remise
* @param float $remise_percent Remise
* @param string $price_base_type HT or TTC
* @param double $pu_ttc Unit price TTC
* @param float $pu_ttc Unit price TTC
* @param int $type Type of line (0=product, 1=service)
* @param int $info_bits More information
* @param int $notrigger Disable triggers
* @param timestamp $date_start Date start of service
* @param timestamp $date_end Date end of service
* @param bool $notrigger Disable triggers
* @param int $date_start Date start of service
* @param int $date_end Date end of service
* @return int <=0 if KO, >0 if OK
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $type=0, $info_bits=0, $notrigger=false, $date_start='', $date_end='')
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null)
{
global $langs,$mysoc;

View File

@ -67,7 +67,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
}
// Customer or supplier selected in drop box
$thirdTypeSelect = GETPOST("third_select_id");
$type_element = GETPOST('type_element')?GETPOST('type_element'):$type_element;
$type_element = GETPOST('type_element')?GETPOST('type_element'):'';
$langs->load("companies");

View File

@ -189,7 +189,7 @@ class UserGroup extends CommonObject
*
* @param string $excludefilter Filter to exclude
* @param int $mode 0=Return array of user instance, 1=Return array of users id only
* @return array Array of users
* @return mixed Array of users or -1 on error
*/
function listUsersForGroup($excludefilter='', $mode=0)
{

View File

@ -164,7 +164,6 @@ if ($resql) {
header('Content-Disposition: attachment;filename=export_csv.csv');
$obj = $db->fetch_object($resql);
$var = ! $var;
print '"' . $obj->compta . '",';
print '"' . $obj->address . '",';
@ -237,4 +236,4 @@ if ($resql) {
}
llxFooter();
$db->close();
$db->close();