Merge branch 'develop' of local repository into dev_fix5353
This commit is contained in:
commit
32e954c8d8
@ -324,6 +324,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
|
|||||||
if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) $qualifiedforclean=0;
|
if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0;
|
if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0;
|
if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0;
|
||||||
|
if (preg_match('/CardProduct/', $value)) $qualifiedforclean=0;
|
||||||
|
|
||||||
if (preg_match('/sms/i', $value)) $qualifiedforclean=0;
|
if (preg_match('/sms/i', $value)) $qualifiedforclean=0;
|
||||||
if (preg_match('/TF_/i', $value)) $qualifiedforclean=0;
|
if (preg_match('/TF_/i', $value)) $qualifiedforclean=0;
|
||||||
|
|||||||
@ -16,9 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/admin/categories.php
|
* \file htdocs/accountancy/admin/categories.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Page to assign mass categories to accounts
|
* \brief Page to assign mass categories to accounts
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
@ -36,10 +36,10 @@ $langs->load("accountancy");
|
|||||||
$mesg = '';
|
$mesg = '';
|
||||||
$action = GETPOST('action');
|
$action = GETPOST('action');
|
||||||
$cat_id = GETPOST('account_category');
|
$cat_id = GETPOST('account_category');
|
||||||
$selectcpt = GETPOST('cpt_bk');
|
$selectcpt = GETPOST('cpt_bk', 'array');
|
||||||
$cpt_id = GETPOST('cptid');
|
$cpt_id = GETPOST('cptid');
|
||||||
|
|
||||||
if($cat_id == 0){
|
if ($cat_id == 0) {
|
||||||
$cat_id = null;
|
$cat_id = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,27 +54,26 @@ if (! $user->admin)
|
|||||||
$AccCat = new AccountancyCategory($db);
|
$AccCat = new AccountancyCategory($db);
|
||||||
|
|
||||||
// si ajout de comptes
|
// si ajout de comptes
|
||||||
if(!empty($selectcpt)){
|
if (! empty($selectcpt)) {
|
||||||
$cpts = array();
|
$cpts = array ();
|
||||||
$i = 0;
|
foreach ( $selectcpt as $selectedOption ) {
|
||||||
foreach ($selectcpt as $selectedOption){
|
if (! array_key_exists($selectedOption, $cpts))
|
||||||
$cpts[$i] = "'".$selectedOption."'";
|
$cpts[$selectedOption] = "'" . $selectedOption . "'";
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($AccCat->updateAccAcc($cat_id, $cpts)){
|
$return= $AccCat->updateAccAcc($cat_id, $cpts);
|
||||||
|
|
||||||
|
if ($return<0) {
|
||||||
|
setEventMessages($langs->trans('errors'), $AccCat->errors, 'errors');
|
||||||
|
} else {
|
||||||
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
setEventMessages($langs->trans('Saved'), null, 'mesgs');
|
||||||
}else{
|
|
||||||
setEventMessages($langs->trans('errors'), null, 'errors');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($action == 'delete') {
|
if ($action == 'delete') {
|
||||||
if($cpt_id){
|
if ($cpt_id) {
|
||||||
if($AccCat->deleteCptCat($cpt_id)){
|
if ($AccCat->deleteCptCat($cpt_id)) {
|
||||||
setEventMessages($langs->trans('Deleted'), null, 'mesgs');
|
setEventMessages($langs->trans('Deleted'), null, 'mesgs');
|
||||||
}else{
|
} else {
|
||||||
setEventMessages($langs->trans('errors'), null, 'errors');
|
setEventMessages($langs->trans('errors'), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,63 +87,67 @@ llxheader('', $langs->trans('AccountAccounting'));
|
|||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans('Categories'));
|
print load_fiche_titre($langs->trans('Categories'));
|
||||||
|
|
||||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="display">';
|
print '<input type="hidden" name="action" value="display">';
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
// Category
|
// Category
|
||||||
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$formaccounting->select_accounting_category($cat_id, 'account_category', 1);
|
$formaccounting->select_accounting_category($cat_id, 'account_category', 1);
|
||||||
print '<input class="button" type="submit" value="' . $langs->trans("Display") . '">';
|
print '<input class="button" type="submit" value="' . $langs->trans("Display") . '">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
if (! empty($cat_id)) {
|
||||||
if(!empty($cat_id)){
|
$return = $AccCat->getCptBK($cat_id);
|
||||||
$obj = $AccCat->getCptBK($cat_id);
|
if ($return < 0) {
|
||||||
print '<tr><td>' . $langs->trans("AddCompteFromBK") . '</td>';
|
setEventMessages(null, $AccCat->errors, 'errors');
|
||||||
print '<td>';
|
|
||||||
if(!empty($obj)){
|
|
||||||
print '<select size="'.count($obj).'" name="cpt_bk[]" multiple>';
|
|
||||||
foreach ( $obj as $cpt ) {
|
|
||||||
print '<option value="'.length_accountg($cpt->numero_compte).'">' . length_accountg($cpt->numero_compte) . ' ('.$cpt->label_compte.' '.$cpt->doc_ref.')</option>';
|
|
||||||
|
|
||||||
}
|
|
||||||
print '</select> - <input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("add") . '"> ';
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
}
|
||||||
|
print '<tr><td>' . $langs->trans("AddCompteFromBK") . '</td>';
|
||||||
|
print '<td>';
|
||||||
|
if (is_array($AccCat->lines_cptbk) && count($AccCat->lines_cptbk) > 0) {
|
||||||
|
print '<select size="' . count($obj) . '" name="cpt_bk[]" multiple>';
|
||||||
|
foreach ( $AccCat->lines_cptbk as $cpt ) {
|
||||||
|
print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
|
||||||
|
}
|
||||||
|
print '</select> - <input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("add") . '"> ';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
if ($action == 'display' || $action == 'delete') {
|
if ($action == 'display' || $action == 'delete') {
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans("Numerocompte").'</th><th class="liste_titre">'.$langs->trans("Description").'</th><th class="liste_titre" width="60" align="center">Action</th></tr>';
|
print '<tr class="liste_titre"><th class="liste_titre">' . $langs->trans("Numerocompte") . '</th><th class="liste_titre">' . $langs->trans("Description") . '</th><th class="liste_titre" width="60" align="center">Action</th></tr>';
|
||||||
|
|
||||||
if(!empty($cat_id)){
|
if (! empty($cat_id)) {
|
||||||
$obj = $AccCat->display($cat_id);
|
$return = $AccCat->display($cat_id);
|
||||||
$j=1;
|
if ($return < 0) {
|
||||||
if(!empty($obj)){
|
setEventMessages(null, $AccCat->errors, 'errors');
|
||||||
foreach ( $obj as $cpt ) {
|
}
|
||||||
|
$j = 1;
|
||||||
|
if (is_array($AccCat->lines_display) && count($AccCat->lines_display) > 0) {
|
||||||
|
foreach ( $AccCat->lines_display as $cpt ) {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print '<tr'. $bc[$var].'>';
|
print '<tr' . $bc[$var] . '>';
|
||||||
print '<td>' . length_accountg($cpt->account_number) . '</td>';
|
print '<td>' . length_accountg($cpt->account_number) . '</td>';
|
||||||
print '<td>' . $cpt->label . '</td>';
|
print '<td>' . $cpt->label . '</td>';
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?account_category=$cat_id&cptid=".$cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete".$j);
|
print $form->formconfirm($_SERVER["PHP_SELF"] . "?account_category=$cat_id&cptid=" . $cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete" . $j);
|
||||||
print '<td><input class="button" type="button" id="action-delete'.$j.'" value="' . $langs->trans("Delete") . '"></td>';
|
print '<td><input class="button" type="button" id="action-delete' . $j . '" value="' . $langs->trans("Delete") . '"></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$j++;
|
$j ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,9 +18,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/bookkeeping/card.php
|
* \file htdocs/accountancy/bookkeeping/card.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Page to show book-entry
|
* \brief Page to show book-entry
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
foreach ( $book->linesmvt as $line ) {
|
foreach ( $book->linesmvt as $line ) {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print '<tr'. $bc[$var].'>';
|
print '<tr' . $bc[$var] . '>';
|
||||||
|
|
||||||
$total_debit += $line->debit;
|
$total_debit += $line->debit;
|
||||||
$total_credit += $line->credit;
|
$total_credit += $line->credit;
|
||||||
@ -392,15 +392,13 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
if ($total_debit != $total_credit) {
|
if ($total_debit != $total_credit) {
|
||||||
setEventMessages(null, array (
|
setEventMessages(null, array (
|
||||||
'MvtNotCorrectlyBalanced',
|
$langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)
|
||||||
$total_credit,
|
|
||||||
$total_debit
|
|
||||||
), 'errors');
|
), 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == "" || $action == 'add') {
|
if ($action == "" || $action == 'add') {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print '<tr'. $bc[$var].'>';
|
print '<tr' . $bc[$var] . '>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
|
print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -202,14 +202,22 @@ if ($action == 'delbookkeeping') {
|
|||||||
if ($action == 'delbookkeepingyearconfirm') {
|
if ($action == 'delbookkeepingyearconfirm') {
|
||||||
|
|
||||||
$delyear = GETPOST('delyear', 'int');
|
$delyear = GETPOST('delyear', 'int');
|
||||||
|
if ($delyear==-1) {
|
||||||
|
$delyear=0;
|
||||||
|
}
|
||||||
|
$deljournal = GETPOST('deljournal','alpha');
|
||||||
|
if ($deljournal==-1) {
|
||||||
|
$deljournal=0;
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($delyear)) {
|
|
||||||
$result = $object->deleteByYear($delyear);
|
if (! empty($delyear) || ! empty($deljournal)) {
|
||||||
|
$result = $object->deleteByYearAndJournal($delyear,$deljournal);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
Header("Location: list.php");
|
Header("Location: list.php");
|
||||||
exit();
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($action == 'delmouvconfirm') {
|
if ($action == 'delmouvconfirm') {
|
||||||
@ -222,7 +230,7 @@ if ($action == 'delmouvconfirm') {
|
|||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
Header("Location: list.php");
|
Header("Location: list.php");
|
||||||
exit();
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($action == 'export_csv') {
|
if ($action == 'export_csv') {
|
||||||
@ -276,11 +284,13 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
|
|
||||||
$form_question = array ();
|
$form_question = array ();
|
||||||
$delyear = GETPOST('delyear');
|
$delyear = GETPOST('delyear');
|
||||||
|
$deljournal = GETPOST('deljournal');
|
||||||
|
|
||||||
if (empty($delyear)) {
|
if (empty($delyear)) {
|
||||||
$delyear = dol_print_date(dol_now(), '%Y');
|
$delyear = dol_print_date(dol_now(), '%Y');
|
||||||
}
|
}
|
||||||
$year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
|
$year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
|
||||||
|
$journal_array = $formventilation->selectjournal_accountancy_bookkepping($deljournal, 'deljournal', 0, 'array');
|
||||||
|
|
||||||
$form_question['delyear'] = array (
|
$form_question['delyear'] = array (
|
||||||
'name' => 'delyear',
|
'name' => 'delyear',
|
||||||
@ -289,6 +299,13 @@ if ($action == 'delbookkeepingyear') {
|
|||||||
'values' => $year_array,
|
'values' => $year_array,
|
||||||
'default' => $delyear
|
'default' => $delyear
|
||||||
);
|
);
|
||||||
|
$form_question['deljournal'] = array (
|
||||||
|
'name' => 'deljournal',
|
||||||
|
'type' => 'select',
|
||||||
|
'label' => $langs->trans('DelJournal'),
|
||||||
|
'values' => $journal_array,
|
||||||
|
'default' => $deljournal
|
||||||
|
);
|
||||||
|
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
|
|||||||
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/class/accountancycategory.class.php
|
* \file htdocs/accountancy/class/accountancycategory.class.php
|
||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief File of class to manage categories of an accounting category_type
|
* \brief File of class to manage categories of an accounting category_type
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Class
|
// Class
|
||||||
@ -32,18 +32,20 @@ class AccountancyCategory
|
|||||||
{
|
{
|
||||||
private $db;
|
private $db;
|
||||||
public $error;
|
public $error;
|
||||||
public $errors = array();
|
public $errors = array ();
|
||||||
//public $element='accounting_category';
|
public $element = 'accounting_category';
|
||||||
//public $table_element='c_accounting_category';
|
public $table_element = 'c_accounting_category';
|
||||||
public $id;
|
public $id;
|
||||||
|
public $lines_cptbk;
|
||||||
|
public $lines_display;
|
||||||
|
public $sdc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
public function __construct($db)
|
public function __construct($db) {
|
||||||
{
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -52,122 +54,136 @@ class AccountancyCategory
|
|||||||
/**
|
/**
|
||||||
* Function to select all accounting accounts from an accounting category
|
* Function to select all accounting accounts from an accounting category
|
||||||
*
|
*
|
||||||
* @param int $id Id
|
* @param int $id Id
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function display($id)
|
public function display($id) {
|
||||||
{
|
|
||||||
$sql = "SELECT t.rowid, t.account_number, t.label";
|
$sql = "SELECT t.rowid, t.account_number, t.label";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||||
$sql.= " WHERE t.fk_accounting_category = " . $id;
|
$sql .= " WHERE t.fk_accounting_category = " . $id;
|
||||||
|
|
||||||
|
$this->lines_display = array ();
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$i = 0;
|
|
||||||
$obj = '';
|
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
if ($num) {
|
if ($num) {
|
||||||
while ( $i < $num ) {
|
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||||
$obj[$i] = $this->db->fetch_object($resql);
|
$this->lines_display[] = $obj;
|
||||||
$i ++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $obj;
|
return $num;
|
||||||
} else {
|
} else {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
$this->errors[] = $this->error;
|
||||||
|
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return -1;
|
return - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to select accountiing category of an accounting account present in chart of accounts
|
* Function to select accountiing category of an accounting account present in chart of accounts
|
||||||
*
|
*
|
||||||
* @param int $id Id category
|
* @param int $id Id category
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function getCptBK($id)
|
public function getCptBK($id) {
|
||||||
{
|
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref";
|
$sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||||
$sql.= " WHERE t.numero_compte NOT IN (";
|
$sql .= " WHERE t.numero_compte NOT IN (";
|
||||||
$sql.= " SELECT t.account_number";
|
$sql .= " SELECT t.account_number";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||||
$sql.= " WHERE t.fk_accounting_category = " . $id .")";
|
$sql .= " WHERE t.fk_accounting_category = " . $id . ")";
|
||||||
$sql.= " AND t.numero_compte IN (";
|
$sql .= " AND t.numero_compte IN (";
|
||||||
$sql.= " SELECT DISTINCT aa.account_number";
|
$sql .= " SELECT DISTINCT aa.account_number";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
$sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||||
$sql.= " AND aa.active = 1)";
|
$sql .= " AND aa.active = 1)";
|
||||||
$sql.= " GROUP BY t.numero_compte";
|
$sql .= " GROUP BY t.numero_compte, t.label_compte, t.doc_ref";
|
||||||
|
$sql .= " ORDER BY t.numero_compte";
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
$this->lines_CptBk = array ();
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$i = 0;
|
|
||||||
$obj = '';
|
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
if ($num) {
|
if ($num) {
|
||||||
while ( $i < $num ) {
|
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||||
$obj[$i] = $this->db->fetch_object($resql);
|
$this->lines_cptbk[] = $obj;
|
||||||
$i ++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $obj;
|
return $num;
|
||||||
} else {
|
} else {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
$this->errors[] = $this->error;
|
||||||
|
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return -1;
|
return - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to add an accounting account in an accounting category
|
* Function to add an accounting account in an accounting category
|
||||||
*
|
*
|
||||||
* @param int $id_cat Id category
|
* @param int $id_cat Id category
|
||||||
* @param array $cpts list of accounts array
|
* @param array $cpts list of accounts array
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function updateAccAcc($id_cat, $cpts = array())
|
public function updateAccAcc($id_cat, $cpts = array()) {
|
||||||
{
|
|
||||||
global $conf;
|
global $conf;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa";
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
|
||||||
$sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
|
||||||
$sql.= " AND aa.active = 1";
|
|
||||||
$sql.= " SET fk_accounting_category=" . $id_cat;
|
|
||||||
$sql.= " WHERE aa.account_number IN (" . join(',',$cpts) .")";
|
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
$sql = "SELECT aa.rowid,aa.account_number ";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
|
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||||
|
$sql .= " AND aa.active = 1";
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = "Error " . $this->db->lasterror();
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
while ( $obj = $this->db->fetch_object($resql)) {
|
||||||
|
if (array_key_exists(length_accountg($obj->account_number), $cpts)) {
|
||||||
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account";
|
||||||
|
$sql .= " SET fk_accounting_category=" . $id_cat;
|
||||||
|
$sql .= " WHERE rowid=".$obj->rowid;
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error) {
|
if ($error) {
|
||||||
foreach ($this->errors as $errmsg) {
|
foreach ( $this->errors as $errmsg ) {
|
||||||
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
||||||
$this->error.=($this->error ? ', ' . $errmsg : $errmsg);
|
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|
||||||
return -1 * $error;
|
return - 1 * $error;
|
||||||
} else {
|
} else {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
@ -178,17 +194,16 @@ class AccountancyCategory
|
|||||||
/**
|
/**
|
||||||
* Function to delete an accounting account from an accounting category
|
* Function to delete an accounting account from an accounting category
|
||||||
*
|
*
|
||||||
* @param int $cpt_id Id of accounting account
|
* @param int $cpt_id Id of accounting account
|
||||||
*
|
*
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function deleteCptCat($cpt_id)
|
public function deleteCptCat($cpt_id) {
|
||||||
{
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||||
$sql.= " SET fk_accounting_category= 0";
|
$sql .= " SET fk_accounting_category= 0";
|
||||||
$sql.= " WHERE aa.rowid= " . $cpt_id;
|
$sql .= " WHERE aa.rowid= " . $cpt_id;
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
@ -200,13 +215,13 @@ class AccountancyCategory
|
|||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error) {
|
if ($error) {
|
||||||
foreach ($this->errors as $errmsg) {
|
foreach ( $this->errors as $errmsg ) {
|
||||||
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
||||||
$this->error.=($this->error ? ', ' . $errmsg : $errmsg);
|
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
}
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|
||||||
return -1 * $error;
|
return - 1 * $error;
|
||||||
} else {
|
} else {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
@ -217,57 +232,51 @@ class AccountancyCategory
|
|||||||
/**
|
/**
|
||||||
* Function to know all category from accounting account
|
* Function to know all category from accounting account
|
||||||
*
|
*
|
||||||
* @return array Result in table
|
* @return array Result in table
|
||||||
*/
|
*/
|
||||||
public function getCatsCpts()
|
public function getCatsCpts() {
|
||||||
{
|
|
||||||
global $mysoc;
|
global $mysoc;
|
||||||
$sql = "";
|
$sql = "";
|
||||||
|
|
||||||
if (empty($mysoc->country_id) && empty($mysoc->country_code))
|
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||||
{
|
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
||||||
dol_print_error('','Call to select_accounting_account with mysoc country not yet defined');
|
exit();
|
||||||
exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($mysoc->country_id))
|
if (! empty($mysoc->country_id)) {
|
||||||
{
|
|
||||||
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens ";
|
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens ";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat";
|
||||||
$sql.= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
|
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
||||||
$sql.= " WHERE c.active = 1";
|
$sql .= " WHERE c.active = 1";
|
||||||
$sql.= " AND c.fk_country = ".$mysoc->country_id.")";
|
$sql .= " AND c.fk_country = " . $mysoc->country_id . ")";
|
||||||
$sql.= " AND cat.rowid = t.fk_accounting_category";
|
$sql .= " AND cat.rowid = t.fk_accounting_category";
|
||||||
$sql.= " ORDER BY cat.position ASC";
|
$sql .= " ORDER BY cat.position ASC";
|
||||||
}
|
} else {
|
||||||
else
|
$sql = "SELECT c.rowid, c.code, c.label, c.category_type ";
|
||||||
{
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
|
||||||
$sql = "SELECT c.rowid, c.code, c.label, c.category_type ";
|
$sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
|
||||||
$sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
$sql .= " ORDER BY c.position ASC";
|
||||||
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
}
|
||||||
$sql.= " ORDER BY c.position ASC";
|
|
||||||
}
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$obj = '';
|
$obj = '';
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$data = array();
|
$data = array ();
|
||||||
if ($num) {
|
if ($num) {
|
||||||
while ( $i < $num ) {
|
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
$name_cat = $obj->name_cat;
|
$name_cat = $obj->name_cat;
|
||||||
$data[$name_cat][$i] = array(
|
$data[$name_cat][$i] = array (
|
||||||
'id' => $obj->rowid,
|
'id' => $obj->rowid,
|
||||||
'code' => $obj->code,
|
'code' => $obj->code,
|
||||||
'position' => $obj->position,
|
'position' => $obj->position,
|
||||||
'account_number' => $obj->account_number,
|
'account_number' => $obj->account_number,
|
||||||
'name_cpt' => $obj->name_cpt,
|
'name_cpt' => $obj->name_cpt,
|
||||||
'sens' => $obj->sens,
|
'sens' => $obj->sens
|
||||||
);
|
);
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,29 +285,28 @@ class AccountancyCategory
|
|||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||||
|
|
||||||
return -1;
|
return - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to show result of an accounting account from the general ledger with a sens and a period
|
* Function to show result of an accounting account from the general ledger with a sens and a period
|
||||||
*
|
*
|
||||||
* @param int $cpt Id accounting account
|
* @param int $cpt Id accounting account
|
||||||
* @param string $month Specifig month - Can be empty
|
* @param string $month Specifig month - Can be empty
|
||||||
* @param string $year Specific year
|
* @param string $year Specific year
|
||||||
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
|
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
|
||||||
*
|
*
|
||||||
* @return array Result in table
|
* @return array Result in table
|
||||||
*/
|
*/
|
||||||
public function getResult($cpt, $month, $year, $sens)
|
public function getResult($cpt, $month, $year, $sens) {
|
||||||
{
|
|
||||||
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||||
$sql.= " WHERE t.numero_compte = " . $cpt;
|
$sql .= " WHERE t.numero_compte = '" . $cpt."'";
|
||||||
$sql.= " AND YEAR(t.doc_date) = " . $year;
|
$sql .= " AND YEAR(t.doc_date) = " . $year;
|
||||||
|
|
||||||
if(! empty($month)){
|
if (! empty($month)) {
|
||||||
$sql.= " AND MONTH(t.doc_date) = " . $month;
|
$sql .= " AND MONTH(t.doc_date) = " . $month;
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
@ -306,81 +314,77 @@ class AccountancyCategory
|
|||||||
|
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$sdc = 0;
|
$this->sdc = 0;
|
||||||
if ($num) {
|
if ($num) {
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
if($sens == 1){
|
if ($sens == 1) {
|
||||||
$sdc = $obj->debit - $obj->credit;
|
$this->sdc = $obj->debit - $obj->credit;
|
||||||
}else{
|
} else {
|
||||||
$sdc = $obj->credit - $obj->debit;
|
$this->sdc = $obj->credit - $obj->debit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $sdc;
|
return $num;
|
||||||
} else {
|
} else {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||||
|
|
||||||
return -1;
|
return - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to call category from a specific country
|
* Function to call category from a specific country
|
||||||
*
|
*
|
||||||
* @return array Result in table
|
* @return array Result in table
|
||||||
*/
|
*/
|
||||||
public function getCatsCal()
|
public function getCatsCal() {
|
||||||
{
|
global $db, $langs, $user, $mysoc;
|
||||||
global $db,$langs,$user,$mysoc;
|
|
||||||
|
|
||||||
if (empty($mysoc->country_id) && empty($mysoc->country_code))
|
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||||
{
|
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
||||||
dol_print_error('','Call to select_accounting_account with mysoc country not yet defined');
|
exit();
|
||||||
exit;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($mysoc->country_id))
|
if (! empty($mysoc->country_id)) {
|
||||||
{
|
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
||||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
$sql .= " WHERE c.active = 1 AND c.category_type = 1 ";
|
||||||
$sql.= " WHERE c.active = 1 AND c.category_type = 1 ";
|
$sql .= " AND c.fk_country = " . $mysoc->country_id;
|
||||||
$sql.= " AND c.fk_country = ".$mysoc->country_id;
|
$sql .= " ORDER BY c.position ASC";
|
||||||
$sql.= " ORDER BY c.position ASC";
|
} else {
|
||||||
}
|
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
||||||
else
|
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
|
||||||
{
|
$sql .= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid";
|
||||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
$sql .= " ORDER BY c.position ASC";
|
||||||
$sql.= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid";
|
}
|
||||||
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
|
||||||
$sql.= " ORDER BY c.position ASC";
|
|
||||||
}
|
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$obj = '';
|
$obj = '';
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
$data = array();
|
$data = array ();
|
||||||
if ($num) {
|
if ($num) {
|
||||||
while ( $i < $num ) {
|
while ( $i < $num ) {
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$position = $obj->position;
|
$position = $obj->position;
|
||||||
$data[$position] = array(
|
$data[$position] = array (
|
||||||
'code' => $obj->code,
|
'code' => $obj->code,
|
||||||
'label' => $obj->label,
|
'label' => $obj->label,
|
||||||
'formula' => $obj->formula
|
'formula' => $obj->formula
|
||||||
);
|
);
|
||||||
$i ++;
|
$i ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
} else {
|
} else {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
$this->errors[] = $this->error;
|
||||||
|
dol_syslog(__METHOD__ . " " . implode(',' . $this->errors), LOG_ERR);
|
||||||
|
|
||||||
return -1;
|
return - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,6 +43,7 @@ class AccountancyExport
|
|||||||
public static $EXPORT_TYPE_CIEL = 5;
|
public static $EXPORT_TYPE_CIEL = 5;
|
||||||
public static $EXPORT_TYPE_QUADRATUS = 6;
|
public static $EXPORT_TYPE_QUADRATUS = 6;
|
||||||
public static $EXPORT_TYPE_EBP = 7;
|
public static $EXPORT_TYPE_EBP = 7;
|
||||||
|
public static $EXPORT_TYPE_COGILOG = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -91,6 +92,7 @@ class AccountancyExport
|
|||||||
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
|
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
|
||||||
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
|
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
|
||||||
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
|
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
|
||||||
|
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +139,9 @@ class AccountancyExport
|
|||||||
case self::$EXPORT_TYPE_EBP :
|
case self::$EXPORT_TYPE_EBP :
|
||||||
$this->exportEbp($TData);
|
$this->exportEbp($TData);
|
||||||
break;
|
break;
|
||||||
|
case self::$EXPORT_TYPE_COGILOG :
|
||||||
|
$this->exportCogilog($TData);
|
||||||
|
break;
|
||||||
default :
|
default :
|
||||||
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
||||||
break;
|
break;
|
||||||
@ -188,6 +193,37 @@ class AccountancyExport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export format : COGILOG
|
||||||
|
*
|
||||||
|
* @param array $objectLines data
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function exportCogilog($objectLines) {
|
||||||
|
foreach ( $objectLines as $line ) {
|
||||||
|
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||||
|
|
||||||
|
print $line->code_journal . $this->separator;
|
||||||
|
print $date . $this->separator;
|
||||||
|
print $line->piece_num . $this->separator;
|
||||||
|
print length_accountg($line->numero_compte) . $this->separator;
|
||||||
|
print '' . $this->separator;
|
||||||
|
print $line->label_compte . $this->separator;
|
||||||
|
print $date . $this->separator;
|
||||||
|
if ($line->sens=='D') {
|
||||||
|
print price($line->montant) . $this->separator;
|
||||||
|
print '' . $this->separator;
|
||||||
|
}elseif ($line->sens=='C') {
|
||||||
|
print '' . $this->separator;
|
||||||
|
print price($line->montant) . $this->separator;
|
||||||
|
}
|
||||||
|
print $line->doc_ref . $this->separator;
|
||||||
|
print $line->label_compte . $this->separator;
|
||||||
|
print $this->end_line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export format : COALA
|
* Export format : COALA
|
||||||
*
|
*
|
||||||
|
|||||||
@ -109,6 +109,8 @@ class BookKeeping extends CommonObject
|
|||||||
public function create(User $user, $notrigger = false) {
|
public function create(User $user, $notrigger = false) {
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
global $langs;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@ -166,11 +168,11 @@ class BookKeeping extends CommonObject
|
|||||||
// first check if line not yet in bookkeeping
|
// first check if line not yet in bookkeeping
|
||||||
$sql = "SELECT count(*) as nb";
|
$sql = "SELECT count(*) as nb";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= " WHERE doc_type = '" . $this->doc_type . "'";
|
$sql .= " WHERE doc_type = '" . $this->db->escape($this->doc_type) . "'";
|
||||||
$sql .= " AND fk_docdet = " . $this->fk_docdet;
|
$sql .= " AND fk_docdet = " . $this->fk_docdet;
|
||||||
$sql .= " AND numero_compte = '" . $this->numero_compte . "'";
|
$sql .= " AND numero_compte = '" . $this->db->escape($this->numero_compte) . "'";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . ":: create ", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -202,11 +204,12 @@ class BookKeeping extends CommonObject
|
|||||||
$this->piece_num = $objnum->maxpiecenum;
|
$this->piece_num = $objnum->maxpiecenum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG);
|
|
||||||
if (empty($this->piece_num)) {
|
if (empty($this->piece_num)) {
|
||||||
$this->piece_num = 1;
|
$this->piece_num = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG);
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
if (empty($this->date_create)) {
|
if (empty($this->date_create)) {
|
||||||
$this->date_create = $now;
|
$this->date_create = $now;
|
||||||
@ -233,26 +236,26 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
|
|
||||||
$sql .= "'" . $this->doc_date . "'";
|
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
||||||
$sql .= ",'" . $this->doc_type . "'";
|
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
||||||
$sql .= ",'" . $this->doc_ref . "'";
|
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
||||||
$sql .= "," . $this->fk_doc;
|
$sql .= "," . $this->fk_doc;
|
||||||
$sql .= "," . $this->fk_docdet;
|
$sql .= "," . $this->fk_docdet;
|
||||||
$sql .= ",'" . $this->code_tiers . "'";
|
$sql .= ",'" . $this->db->escape($this->code_tiers) . "'";
|
||||||
$sql .= ",'" . $this->numero_compte . "'";
|
$sql .= ",'" . $this->db->escape($this->numero_compte) . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->label_compte) . "'";
|
$sql .= ",'" . $this->db->escape($this->label_compte) . "'";
|
||||||
$sql .= "," . $this->debit;
|
$sql .= "," . $this->debit;
|
||||||
$sql .= "," . $this->credit;
|
$sql .= "," . $this->credit;
|
||||||
$sql .= "," . $this->montant;
|
$sql .= "," . $this->montant;
|
||||||
$sql .= ",'" . $this->sens . "'";
|
$sql .= ",'" . $this->db->escape($this->sens) . "'";
|
||||||
$sql .= ",'" . $this->fk_user_author . "'";
|
$sql .= ",'" . $this->fk_user_author . "'";
|
||||||
$sql .= ",'" . $this->date_create . "'";
|
$sql .= ",'" . $this->date_create . "'";
|
||||||
$sql .= ",'" . $this->code_journal . "'";
|
$sql .= ",'" . $this->db->escape($this->code_journal) . "'";
|
||||||
$sql .= "," . $this->piece_num;
|
$sql .= "," . $this->piece_num;
|
||||||
|
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . ":: create", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||||
@ -264,25 +267,25 @@ class BookKeeping extends CommonObject
|
|||||||
$result = - 2;
|
$result = - 2;
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error Create Error ' . $result . ' lecture ID';
|
$this->errors[] = 'Error Create Error ' . $result . ' lecture ID';
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = - 1;
|
$result = - 1;
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = - 3;
|
$result = - 3;
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = $langs->trans('BookeppingLineAlreayExists');
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' $result='.$result.' ' . implode(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$result = - 5;
|
$result = - 5;
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' $result='.$result.' '. implode(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
@ -944,6 +947,49 @@ class BookKeeping extends CommonObject
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete bookkepping by year
|
||||||
|
*
|
||||||
|
* @param string $delyear year to delete
|
||||||
|
* @param string $deljournal journal to delete
|
||||||
|
* @return int Result
|
||||||
|
*/
|
||||||
|
function deleteByYearAndJournal($delyear,$deljournal) {
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$sqlwhere=array();
|
||||||
|
|
||||||
|
// first check if line not yet in bookkeeping
|
||||||
|
$sql = "DELETE";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||||
|
if (!empty($delyear)) {
|
||||||
|
$sqlwhere[] .= " YEAR(doc_date) = " . $delyear;
|
||||||
|
}
|
||||||
|
if (!empty($deljournal)) {
|
||||||
|
$sqlwhere[] .= " code_journal = '" . $this->db->escape($deljournal)."'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($sqlwhere)>0) {
|
||||||
|
$sql.=" WHERE ".implode(' AND ', $sqlwhere);
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
if (! $resql) {
|
||||||
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
|
foreach ( $this->errors as $errmsg ) {
|
||||||
|
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
|
||||||
|
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete bookkepping by piece number
|
* Delete bookkepping by piece number
|
||||||
*
|
*
|
||||||
|
|||||||
@ -246,7 +246,7 @@ class FormVentilation extends Form
|
|||||||
// Auxiliary supplier account
|
// Auxiliary supplier account
|
||||||
$sql = "SELECT DISTINCT code_compta_fournisseur, nom ";
|
$sql = "SELECT DISTINCT code_compta_fournisseur, nom ";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||||
$sql .= " ORDER BY code_compta";
|
$sql .= " ORDER BY code_compta_fournisseur";
|
||||||
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
|
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -284,7 +284,7 @@ class FormVentilation extends Form
|
|||||||
|
|
||||||
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
|
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||||
$sql .= " ORDER BY doc_date";
|
$sql .= " ORDER BY date_format(doc_date,'%Y')";
|
||||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
@ -304,4 +304,40 @@ class FormVentilation extends Form
|
|||||||
return $out_array;
|
return $out_array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return HTML combo list of years existing into book keepping
|
||||||
|
*
|
||||||
|
* @param string $selected Preselected value
|
||||||
|
* @param string $htmlname Name of HTML select object
|
||||||
|
* @param int $useempty Affiche valeur vide dans liste
|
||||||
|
* @param string $output_format (html/opton (for option html only)/array (to return options arrays
|
||||||
|
* @return string/array
|
||||||
|
*/
|
||||||
|
function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'journalid', $useempty = 0, $output_format = 'html')
|
||||||
|
{
|
||||||
|
$out_array = array();
|
||||||
|
|
||||||
|
$sql = "SELECT DISTINCT code_journal";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||||
|
$sql .= " ORDER BY code_journal";
|
||||||
|
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
if (!$resql) {
|
||||||
|
$this->error = "Error ".$this->db->lasterror();
|
||||||
|
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
while ($obj = $this->db->fetch_object($resql)) {
|
||||||
|
$out_array[$obj->code_journal] = $obj->code_journal;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
if ($output_format == 'html') {
|
||||||
|
return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"');
|
||||||
|
} else {
|
||||||
|
return $out_array;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -138,7 +138,7 @@ if ($result) {
|
|||||||
//Define array for display vat tx
|
//Define array for display vat tx
|
||||||
$def_tva[$obj->rowid]=price($obj->tva_tx);
|
$def_tva[$obj->rowid]=price($obj->tva_tx);
|
||||||
|
|
||||||
$tabfac[$obj->rowid]["date"] = $obj->df;
|
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||||
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
||||||
$tabfac[$obj->rowid]["refsologest"] = $obj->ref;
|
$tabfac[$obj->rowid]["refsologest"] = $obj->ref;
|
||||||
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
|
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
|
||||||
@ -192,7 +192,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur'];
|
$bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur'];
|
||||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers");
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers");
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
|
||||||
@ -224,7 +224,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->code_tiers = '';
|
||||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . utf8_decode($accountingaccount->label);
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label;
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
@ -255,7 +255,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_doc = $key;
|
$bookkeeping->fk_doc = $key;
|
||||||
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->code_tiers = '';
|
||||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key];
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key];
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||||
@ -296,7 +296,7 @@ if ($action == 'export_csv') {
|
|||||||
$sep = ";";
|
$sep = ";";
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
foreach ( $tabfac as $key => $val ) {
|
||||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
$date = dol_print_date($val["date"], '%d%m%Y');
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
@ -339,7 +339,7 @@ if ($action == 'export_csv') {
|
|||||||
print length_accounta(html_entity_decode($k)) . $sep;
|
print length_accounta(html_entity_decode($k)) . $sep;
|
||||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||||
print utf8_decode($companystatic->name) . $sep;
|
print $companystatic->name . $sep;
|
||||||
print $val["ref"];
|
print $val["ref"];
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ if ($action == 'export_csv') {
|
|||||||
$invoicestatic->type = $val["type"];
|
$invoicestatic->type = $val["type"];
|
||||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||||
|
|
||||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
@ -369,7 +369,7 @@ if ($action == 'export_csv') {
|
|||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||||
@ -383,7 +383,7 @@ if ($action == 'export_csv') {
|
|||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
// print '"' . $langs->trans("VAT") . '"' . $sep;
|
// print '"' . $langs->trans("VAT") . '"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -395,8 +395,7 @@ if ($action == 'export_csv') {
|
|||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
// print '"' . utf8_decode($companystatic->name) . '"' . $sep;
|
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||||
}
|
}
|
||||||
@ -478,7 +477,7 @@ if ($action == 'export_csv') {
|
|||||||
$invoicestatic->type = $val["type"];
|
$invoicestatic->type = $val["type"];
|
||||||
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
|
||||||
|
|
||||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
// Product / Service
|
// Product / Service
|
||||||
foreach ( $tabht[$key] as $k => $mt ) {
|
foreach ( $tabht[$key] as $k => $mt ) {
|
||||||
|
|||||||
@ -161,7 +161,7 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Invoice lines
|
// Invoice lines
|
||||||
$tabfac[$obj->rowid]["date"] = $obj->df;
|
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||||
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
||||||
@ -220,7 +220,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
|
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
|
||||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
// $bookkeeping->label_compte = $tabcompany[$key]['name'];
|
// $bookkeeping->label_compte = $tabcompany[$key]['name'];
|
||||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
|
||||||
@ -250,7 +250,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_docdet = $val["fk_facturedet"];
|
$bookkeeping->fk_docdet = $val["fk_facturedet"];
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->code_tiers = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode($accountingaccount->label);
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
||||||
@ -280,7 +280,7 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_docdet = $val["fk_facturedet"];
|
$bookkeeping->fk_docdet = $val["fk_facturedet"];
|
||||||
$bookkeeping->code_tiers = '';
|
$bookkeeping->code_tiers = '';
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key];
|
$bookkeeping->label_compte = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key];
|
||||||
$bookkeeping->montant = $mt;
|
$bookkeeping->montant = $mt;
|
||||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||||
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
||||||
@ -324,7 +324,7 @@ if ($action == 'export_csv') {
|
|||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = $val["ref"];
|
||||||
|
|
||||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
$date = dol_print_date($val["date"], '%d%m%Y');
|
||||||
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
print $date . $sep;
|
print $date . $sep;
|
||||||
@ -333,8 +333,7 @@ if ($action == 'export_csv') {
|
|||||||
print length_accounta(html_entity_decode($k)) . $sep;
|
print length_accounta(html_entity_decode($k)) . $sep;
|
||||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||||
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep;
|
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep;
|
||||||
// print utf8_decode($companystatic->name) . $sep;
|
|
||||||
print $val["ref"];
|
print $val["ref"];
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
@ -349,8 +348,7 @@ if ($action == 'export_csv') {
|
|||||||
print $sep;
|
print $sep;
|
||||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||||
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode(utf8_decode($accountingaccount_static->label)) . $sep;
|
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount_static->label . $sep;
|
||||||
// print dol_trunc($accountingaccount_static->label, 32) . $sep;
|
|
||||||
print $val["ref"];
|
print $val["ref"];
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
@ -365,7 +363,7 @@ if ($action == 'export_csv') {
|
|||||||
print $sep;
|
print $sep;
|
||||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||||
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep;
|
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep;
|
||||||
// print $langs->trans("VAT") . $sep;
|
// print $langs->trans("VAT") . $sep;
|
||||||
print $val["ref"];
|
print $val["ref"];
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -382,14 +380,13 @@ if ($action == 'export_csv') {
|
|||||||
$invoicestatic->id = $key;
|
$invoicestatic->id = $key;
|
||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = $val["ref"];
|
||||||
|
|
||||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||||
// print '"' . utf8_decode($companystatic->name) . '"' . $sep;
|
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -404,8 +401,7 @@ if ($action == 'export_csv') {
|
|||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
|
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||||
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -418,8 +414,7 @@ if ($action == 'export_csv') {
|
|||||||
print '"' . $date . '"' . $sep;
|
print '"' . $date . '"' . $sep;
|
||||||
print '"' . $val["ref"] . '"' . $sep;
|
print '"' . $val["ref"] . '"' . $sep;
|
||||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||||
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||||
// print '"' . $langs->trans("VAT") . '"' . $sep;
|
|
||||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -497,7 +492,7 @@ if ($action == 'export_csv') {
|
|||||||
$invoicestatic->ref = $val["ref"];
|
$invoicestatic->ref = $val["ref"];
|
||||||
$invoicestatic->type = $val["type"];
|
$invoicestatic->type = $val["type"];
|
||||||
|
|
||||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
$date = dol_print_date($val["date"], 'day');
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
@ -527,7 +522,7 @@ if ($action == 'export_csv') {
|
|||||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||||
print "<td>" . length_accountg($k) . "</td>";
|
print "<td>" . length_accountg($k) . "</td>";
|
||||||
// print "<td>" . $accountingaccount->label . "</td>";
|
// print "<td>" . $accountingaccount->label . "</td>";
|
||||||
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode(utf8_decode($accountingaccount->label)) . "</td>";
|
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|||||||
@ -123,8 +123,21 @@ if(!empty($cats))
|
|||||||
$position = $cpt['position'];
|
$position = $cpt['position'];
|
||||||
$code = $cpt['code'];
|
$code = $cpt['code'];
|
||||||
|
|
||||||
$resultNP = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
||||||
$resultN = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
if ($return < 0) {
|
||||||
|
setEventMessages(null, $AccCat->errors, 'errors');
|
||||||
|
$resultNP=0;
|
||||||
|
} else {
|
||||||
|
$resultNP=$AccCat->sdc;
|
||||||
|
}
|
||||||
|
|
||||||
|
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
||||||
|
if ($return < 0) {
|
||||||
|
setEventMessages(null, $AccCat->errors, 'errors');
|
||||||
|
$resultN=0;
|
||||||
|
} else {
|
||||||
|
$resultN=$AccCat->sdc;
|
||||||
|
}
|
||||||
$sommes[$code]['NP'] += $resultNP;
|
$sommes[$code]['NP'] += $resultNP;
|
||||||
$sommes[$code]['N'] += $resultN;
|
$sommes[$code]['N'] += $resultN;
|
||||||
print '<tr'. $bc[$var].'>';
|
print '<tr'. $bc[$var].'>';
|
||||||
@ -134,7 +147,13 @@ if(!empty($cats))
|
|||||||
print '<td>' . price($resultN) . '</td>';
|
print '<td>' . price($resultN) . '</td>';
|
||||||
|
|
||||||
foreach($months as $k => $v){
|
foreach($months as $k => $v){
|
||||||
$resultM = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
||||||
|
if ($return < 0) {
|
||||||
|
setEventMessages(null, $AccCat->errors, 'errors');
|
||||||
|
$resultM=0;
|
||||||
|
} else {
|
||||||
|
$resultM=$AccCat->sdc;
|
||||||
|
}
|
||||||
$sommes[$code]['M'][$k] += $resultM;
|
$sommes[$code]['M'][$k] += $resultM;
|
||||||
print '<td align="right">' . price($resultM) . '</td>';
|
print '<td align="right">' . price($resultM) . '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,8 +61,14 @@ $originid=GETPOST('originid','int');
|
|||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
|
|
||||||
$fulldayevent=GETPOST('fullday');
|
$fulldayevent=GETPOST('fullday');
|
||||||
$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
|
|
||||||
$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year"));
|
$aphour = GETPOST('aphour');
|
||||||
|
$apmin = GETPOST('apmin');
|
||||||
|
$p2hour = GETPOST('p2hour');
|
||||||
|
$p2min = GETPOST('p2min');
|
||||||
|
|
||||||
|
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
|
||||||
|
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year"));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
@ -92,7 +98,6 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
|||||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('actioncard','globalcard'));
|
$hookmanager->initHooks(array('actioncard','globalcard'));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -781,7 +786,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||||
|
|
||||||
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid');
|
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1),GETPOST("projectid")?GETPOST("projectid"):'','projectid');
|
||||||
if ($numproject==0)
|
if ($numproject==0)
|
||||||
{
|
{
|
||||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
|
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create">'.$langs->trans("AddProject").'</a>';
|
||||||
|
|||||||
@ -406,7 +406,7 @@ class ActionComm extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function add(User $user, $notrigger = 0)
|
public function add(User $user, $notrigger = 0)
|
||||||
{
|
{
|
||||||
$this->create($user, $notrigger);
|
return $this->create($user, $notrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -423,7 +423,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
|
|||||||
$companystatic->code_client = $obj->code_client;
|
$companystatic->code_client = $obj->code_client;
|
||||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||||
$companystatic->canvas=$obj->canvas;
|
$companystatic->canvas=$obj->canvas;
|
||||||
print $companystatic->getNomUrl(1,'customer',16);
|
print $companystatic->getNomUrl(1,'supplier',16);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
|
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
|
||||||
$i++;
|
$i++;
|
||||||
@ -729,7 +729,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
|||||||
$companystatic->code_client = $obj->code_client;
|
$companystatic->code_client = $obj->code_client;
|
||||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||||
$companystatic->canvas=$obj->canvas;
|
$companystatic->canvas=$obj->canvas;
|
||||||
print $companystatic->getNomUrl(1, 'company', 44);
|
print $companystatic->getNomUrl(1, 'customer', 44);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
|
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
|
||||||
@ -828,7 +828,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
|||||||
$companystatic->code_client = $obj->code_client;
|
$companystatic->code_client = $obj->code_client;
|
||||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||||
$companystatic->canvas=$obj->canvas;
|
$companystatic->canvas=$obj->canvas;
|
||||||
print $companystatic->getNomUrl(1, 'company', 44);
|
print $companystatic->getNomUrl(1, 'customer', 44);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
|
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
|
||||||
|
|||||||
@ -221,7 +221,7 @@ if ($action == 'add') {
|
|||||||
if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) {
|
if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) {
|
||||||
// Add targets into database
|
// Add targets into database
|
||||||
$obj = new mailing_advthirdparties($db);
|
$obj = new mailing_advthirdparties($db);
|
||||||
$result = $obj->add_to_target($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines);
|
$result = $obj->add_to_target_spec($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines);
|
||||||
} else {
|
} else {
|
||||||
$result = 0;
|
$result = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,10 +36,10 @@ $id=GETPOST('account');
|
|||||||
$ref=GETPOST('ref');
|
$ref=GETPOST('ref');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldid = (! empty($ref)?$ref:$id);
|
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
|
||||||
$fieldname = isset($ref)?'ref':'rowid';
|
$fieldtype = (! empty($ref) ? 'ref' :'rowid');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result=restrictedArea($user,'banque',$fieldid,'bank_account','','',$fieldname);
|
$result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype);
|
||||||
|
|
||||||
$year_start=GETPOST('year_start');
|
$year_start=GETPOST('year_start');
|
||||||
$year_current = strftime("%Y",time());
|
$year_current = strftime("%Y",time());
|
||||||
@ -146,7 +146,7 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("B
|
|||||||
// Ref
|
// Ref
|
||||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
|
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
if ($_GET["account"])
|
if (!empty($id))
|
||||||
{
|
{
|
||||||
if (! preg_match('/,/', $id))
|
if (! preg_match('/,/', $id))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3555,6 +3555,10 @@ class Facture extends CommonInvoice
|
|||||||
$prodids[$i] = $row[0];
|
$prodids[$i] = $row[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Avoid php warning Warning: mt_rand(): max(0) is smaller than min(1) when no product exists
|
||||||
|
if (empty($num_prods)) {
|
||||||
|
$num_prods=1;
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize parameters
|
// Initialize parameters
|
||||||
$this->id=0;
|
$this->id=0;
|
||||||
|
|||||||
@ -919,7 +919,10 @@ class BonPrelevement extends CommonObject
|
|||||||
$row = $this->db->fetch_row($resql);
|
$row = $this->db->fetch_row($resql);
|
||||||
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1,0,2),2,"0",STR_PAD_LEFT);
|
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1,0,2),2,"0",STR_PAD_LEFT);
|
||||||
|
|
||||||
$this->filename = $conf->prelevement->dir_output.'/receipts/'.$ref.'.xml';
|
$dir=$conf->prelevement->dir_output.'/receipts';
|
||||||
|
if (! is_dir($dir)) dol_mkdir($dir);
|
||||||
|
|
||||||
|
$this->filename = $dir.'/receipts/'.$ref.'.xml';
|
||||||
|
|
||||||
// Create withdraw receipt in database
|
// Create withdraw receipt in database
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
|
||||||
@ -935,10 +938,6 @@ class BonPrelevement extends CommonObject
|
|||||||
{
|
{
|
||||||
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
|
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
|
||||||
$this->id = $prev_id;
|
$this->id = $prev_id;
|
||||||
|
|
||||||
$dir=$conf->prelevement->dir_output.'/receipts';
|
|
||||||
$file=$filebonprev;
|
|
||||||
if (! is_dir($dir)) dol_mkdir($dir);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1034,7 +1033,7 @@ class BonPrelevement extends CommonObject
|
|||||||
// Generation of SEPA file
|
// Generation of SEPA file
|
||||||
$this->generate();
|
$this->generate();
|
||||||
}
|
}
|
||||||
dol_syslog(__METHOD__."::End withdraw receipt, file ".$filebonprev, LOG_DEBUG);
|
dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -167,12 +167,14 @@ class box_actions extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||||
|
$out='';
|
||||||
if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE))
|
if (! empty($conf->global->SHOW_DIALOG_HOMEPAGE))
|
||||||
{
|
{
|
||||||
$actioncejour=false;
|
$actioncejour=false;
|
||||||
@ -183,8 +185,8 @@ class box_actions extends ModeleBoxes
|
|||||||
$bcx[1] = 'class="box_impair"';
|
$bcx[1] = 'class="box_impair"';
|
||||||
if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo"))
|
if ($contents[0][0]['text'] != $langs->trans("NoActionsToDo"))
|
||||||
{
|
{
|
||||||
print '<div id="dialogboxaction" title="'.$nblines." ".$langs->trans("ActionsToDo").'">';
|
$out.= '<div id="dialogboxaction" title="'.$nblines." ".$langs->trans("ActionsToDo").'">';
|
||||||
print '<table width=100%>';
|
$out.= '<table width=100%>';
|
||||||
for ($line=0, $n=$nblines; $line < $n; $line++)
|
for ($line=0, $n=$nblines; $line < $n; $line++)
|
||||||
{
|
{
|
||||||
if (isset($contents[$line]))
|
if (isset($contents[$line]))
|
||||||
@ -202,40 +204,45 @@ class box_actions extends ModeleBoxes
|
|||||||
$urlsoc=$contents[$line][3]['url'];
|
$urlsoc=$contents[$line][3]['url'];
|
||||||
$dateligne=$contents[$line][4]['text'];
|
$dateligne=$contents[$line][4]['text'];
|
||||||
$percentage=$contents[$line][5]['text'];
|
$percentage=$contents[$line][5]['text'];
|
||||||
print '<tr '.$bcx[$var].'>';
|
$out.= '<tr '.$bcx[$var].'>';
|
||||||
print '<td align=center>';
|
$out.= '<td align=center>';
|
||||||
print img_object("",$logo);
|
$out.= img_object("",$logo);
|
||||||
print '</td>';
|
$out.= '</td>';
|
||||||
print '<td align=center><a href="'.$urlevent.'">'.$label.'</a></td>';
|
$out.= '<td align=center><a href="'.$urlevent.'">'.$label.'</a></td>';
|
||||||
print '<td align=center><a href="'.$urlsoc.'">'.img_object("",$logosoc)." ".$nomsoc.'</a></td>';
|
$out.= '<td align=center><a href="'.$urlsoc.'">'.img_object("",$logosoc)." ".$nomsoc.'</a></td>';
|
||||||
print '<td align=center>'.$dateligne.'</td>';
|
$out.= '<td align=center>'.$dateligne.'</td>';
|
||||||
print '<td align=center>'.$percentage.'</td>';
|
$out.= '<td align=center>'.$percentage.'</td>';
|
||||||
print '</tr>';
|
$out.= '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</table>';
|
$out.= '</table>';
|
||||||
|
|
||||||
}
|
}
|
||||||
print '</div>';
|
$out.= '</div>';
|
||||||
if ($actioncejour)
|
if ($actioncejour)
|
||||||
{
|
{
|
||||||
print '<script>';
|
$out.= '<script>';
|
||||||
print '$("#dialogboxaction").dialog({ autoOpen: true });';
|
$out.= '$("#dialogboxaction").dialog({ autoOpen: true });';
|
||||||
if ($conf->global->SHOW_DIALOG_HOMEPAGE > 1) // autoclose after this delay
|
if ($conf->global->SHOW_DIALOG_HOMEPAGE > 1) // autoclose after this delay
|
||||||
{
|
{
|
||||||
print 'setTimeout(function(){';
|
$out.= 'setTimeout(function(){';
|
||||||
print '$("#dialogboxaction").dialog("close");';
|
$out.= '$("#dialogboxaction").dialog("close");';
|
||||||
print '}, '.($conf->global->SHOW_DIALOG_HOMEPAGE*1000).');';
|
$out.= '}, '.($conf->global->SHOW_DIALOG_HOMEPAGE*1000).');';
|
||||||
}
|
}
|
||||||
print '</script>';
|
$out.= '</script>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<script>';
|
$out.= '<script>';
|
||||||
print '$("#dialogboxaction").dialog({ autoOpen: false });';
|
$out.= '$("#dialogboxaction").dialog({ autoOpen: false });';
|
||||||
print '</script>';
|
$out.= '</script>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($nooutput) return $out;
|
||||||
|
else print $out;
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -455,10 +455,11 @@ class box_activity extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -135,11 +135,12 @@ class box_bookmarks extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,11 +157,12 @@ class box_clients extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,11 +176,12 @@ class box_commandes extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,11 +169,12 @@ class box_comptes extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,11 +163,12 @@ class box_contacts extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,11 +157,12 @@ class box_contracts extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -184,11 +184,12 @@ class box_external_rss extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -180,11 +180,12 @@ class box_factures extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
* @return void
|
* @param int $nooutput No print, only return string
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -189,11 +189,12 @@ class box_factures_fourn extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -186,11 +186,12 @@ class box_factures_fourn_imp extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -182,11 +182,12 @@ class box_factures_imp extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -144,11 +144,12 @@ class box_ficheinter extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -139,11 +139,12 @@ class box_fournisseurs extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -158,11 +158,12 @@ class box_goodcustomers extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -263,11 +263,12 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -262,11 +262,12 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -263,11 +263,12 @@ class box_graph_orders_permonth extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -262,11 +262,12 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -390,11 +390,12 @@ class box_graph_product_distribution extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -264,11 +264,12 @@ class box_graph_propales_permonth extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -169,11 +169,12 @@ class box_members extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -192,11 +192,12 @@ class box_produits extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -199,11 +199,12 @@ class box_produits_alerte_stock extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -173,11 +173,12 @@ class box_project extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -166,11 +166,12 @@ class box_propales extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -167,11 +167,12 @@ class box_prospect extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,11 +175,12 @@ class box_services_contracts extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,11 +147,12 @@ class box_services_expired extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -171,11 +171,12 @@ class box_supplier_orders extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
* @return void
|
* @param int $nooutput No print, only return string
|
||||||
*/
|
* @return void
|
||||||
function showBox($head = null, $contents = null)
|
*/
|
||||||
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -137,10 +137,11 @@ class box_task extends ModeleBoxes
|
|||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @param int $nooutput No print, only return string
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function showBox($head = null, $contents = null)
|
function showBox($head = null, $contents = null, $nooutput=0)
|
||||||
{
|
{
|
||||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -885,7 +885,7 @@ abstract class CommonObject
|
|||||||
if ($order == 'position') $order.=',code';
|
if ($order == 'position') $order.=',code';
|
||||||
|
|
||||||
$tab = array();
|
$tab = array();
|
||||||
$sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle";
|
$sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle, tc.position";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||||
$sql.= " WHERE tc.element='".$this->element."'";
|
$sql.= " WHERE tc.element='".$this->element."'";
|
||||||
if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active types
|
if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active types
|
||||||
@ -4489,7 +4489,7 @@ abstract class CommonObject
|
|||||||
|
|
||||||
if (! $db->query($sql))
|
if (! $db->query($sql))
|
||||||
{
|
{
|
||||||
if ($ignoreerrors) return true;
|
if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
|
||||||
//$this->errors = $db->lasterror();
|
//$this->errors = $db->lasterror();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||||
|
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||||
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -687,7 +688,7 @@ class FormFile
|
|||||||
*
|
*
|
||||||
* @param string $modulepart propal, facture, facture_fourn, ...
|
* @param string $modulepart propal, facture, facture_fourn, ...
|
||||||
* @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
|
* @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
|
||||||
* @param string $filedir Directory to scan
|
* @param string $filedir Full path to directory to scan
|
||||||
* @param string $filter Filter filenames on this regex string (Example: '\.pdf$')
|
* @param string $filter Filter filenames on this regex string (Example: '\.pdf$')
|
||||||
* @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles
|
* @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles
|
||||||
*/
|
*/
|
||||||
@ -720,9 +721,6 @@ class FormFile
|
|||||||
if ($modulepart == 'export') {
|
if ($modulepart == 'export') {
|
||||||
$relativepath = $file["name"];
|
$relativepath = $file["name"];
|
||||||
}
|
}
|
||||||
if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_fournisseur') {
|
|
||||||
$relativepath = get_exdir($modulesubdir, 2,0,0,null,'invoice_supplier'). $modulesubdir. "/" . $file["name"];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show file name with link to download
|
// Show file name with link to download
|
||||||
$out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
$out.= '<a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||||
|
|||||||
@ -46,7 +46,7 @@ function emailing_prepare_head(Mailing $object)
|
|||||||
$head[$h][2] = 'targets';
|
$head[$h][2] = 'targets';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) // Still need debug
|
if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
||||||
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
||||||
|
|||||||
@ -1480,7 +1480,10 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
*/
|
*/
|
||||||
function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
|
function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
global $hookmanager;
|
global $hookmanager,$conf;
|
||||||
|
|
||||||
|
$sign=1;
|
||||||
|
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
$reshook=0;
|
$reshook=0;
|
||||||
@ -1497,7 +1500,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
}
|
}
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
if (empty($hidedetails) || $hidedetails > 1) $result.=price($sign * (($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100), 0, $outputlangs);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -1805,7 +1808,10 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
*/
|
*/
|
||||||
function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
|
function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
global $hookmanager;
|
global $hookmanager,$conf;
|
||||||
|
|
||||||
|
$sign=1;
|
||||||
|
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||||
|
|
||||||
$reshook=0;
|
$reshook=0;
|
||||||
$result='';
|
$result='';
|
||||||
@ -1826,7 +1832,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0)
|
|||||||
{
|
{
|
||||||
$result.=$outputlangs->transnoentities("Option");
|
$result.=$outputlangs->transnoentities("Option");
|
||||||
}
|
}
|
||||||
elseif (empty($hidedetails) || $hidedetails > 1) $result.=price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
elseif (empty($hidedetails) || $hidedetails > 1) $result.=price($sign * ($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -310,6 +310,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
|
|||||||
$expedition->id=$objp->sendingid;
|
$expedition->id=$objp->sendingid;
|
||||||
$expedition->fetchObjectLinked($expedition->id,$expedition->element);
|
$expedition->fetchObjectLinked($expedition->id,$expedition->element);
|
||||||
//var_dump($expedition->linkedObjects);
|
//var_dump($expedition->linkedObjects);
|
||||||
|
|
||||||
$receiving='';
|
$receiving='';
|
||||||
if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link
|
if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link
|
||||||
|
|
||||||
|
|||||||
@ -538,15 +538,18 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$pdf->SetXY($this->postotalht, $curY);
|
$pdf->SetXY($this->postotalht, $curY);
|
||||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
|
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
|
||||||
|
|
||||||
|
|
||||||
|
$sign=1;
|
||||||
|
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||||
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
|
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
|
||||||
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
|
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
|
||||||
if ($prev_progress > 0) // Compute progress from previous situation
|
if ($prev_progress > 0) // Compute progress from previous situation
|
||||||
{
|
{
|
||||||
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
|
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
|
||||||
else $tvaligne = $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
|
else $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
|
||||||
} else {
|
} else {
|
||||||
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva;
|
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne= $sign * $object->lines[$i]->multicurrency_total_tva;
|
||||||
else $tvaligne=$object->lines[$i]->total_tva;
|
else $tvaligne= $sign * $object->lines[$i]->total_tva;
|
||||||
}
|
}
|
||||||
|
|
||||||
$localtax1ligne=$object->lines[$i]->total_localtax1;
|
$localtax1ligne=$object->lines[$i]->total_localtax1;
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class mailing_advthirdparties extends MailingTargets
|
|||||||
* @param array $contactid Array of contact id to add
|
* @param array $contactid Array of contact id to add
|
||||||
* @return int <0 if error, number of emails added if ok
|
* @return int <0 if error, number of emails added if ok
|
||||||
*/
|
*/
|
||||||
function add_to_target($mailing_id,$socid,$type_of_target, $contactid)
|
function add_to_target_spec($mailing_id,$socid,$type_of_target, $contactid)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ class mailing_advthirdparties extends MailingTargets
|
|||||||
*
|
*
|
||||||
* @return int Nb of recipients
|
* @return int Nb of recipients
|
||||||
*/
|
*/
|
||||||
function getNbOfRecipients()
|
function getNbOfRecipients($sql)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class modAccounting extends DolibarrModules
|
|||||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||||
$this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module
|
$this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module
|
||||||
$this->phpmin = array(5, 3); // Minimum version of PHP required by module
|
$this->phpmin = array(5, 3); // Minimum version of PHP required by module
|
||||||
$this->need_dolibarr_version = array(3, 7); // Minimum version of Dolibarr required by module
|
$this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module
|
||||||
$this->langfiles = array("accountancy");
|
$this->langfiles = array("accountancy");
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
|
|||||||
@ -743,9 +743,9 @@ if (! empty($id) && $action != 'edit')
|
|||||||
// Delete
|
// Delete
|
||||||
if ($user->rights->don->supprimer)
|
if ($user->rights->don->supprimer)
|
||||||
{
|
{
|
||||||
if ($don->statut == -1 || $don->statut == 0)
|
if ($object->statut == -1 || $object->statut == 0)
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$don->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1304,7 +1304,7 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type";
|
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type";
|
||||||
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
|
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
|
||||||
$sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent";
|
$sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
|
||||||
$sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
|
$sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
|
||||||
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
|
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
|
||||||
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
|
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
|
||||||
@ -1375,6 +1375,8 @@ class Expedition extends CommonObject
|
|||||||
$line->volume = $obj->volume;
|
$line->volume = $obj->volume;
|
||||||
$line->volume_units = $obj->volume_units;
|
$line->volume_units = $obj->volume_units;
|
||||||
|
|
||||||
|
$line->pa_ht = $obj->pa_ht;
|
||||||
|
|
||||||
// For invoicing
|
// For invoicing
|
||||||
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0
|
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0
|
||||||
$line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements)
|
$line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements)
|
||||||
|
|||||||
@ -448,6 +448,18 @@ if ($object->id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO move to DAO class
|
// TODO move to DAO class
|
||||||
|
$sql = "SELECT count(p.rowid) as total";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
|
||||||
|
$sql.= " WHERE p.fk_soc =".$object->id;
|
||||||
|
$sql.= " AND p.entity =".$conf->entity;
|
||||||
|
$sql.= " ORDER BY p.date_commande DESC";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$object_count = $db->fetch_object($resql);
|
||||||
|
$num = $object_count->total;
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc";
|
$sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
|
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p ";
|
||||||
$sql.= " WHERE p.fk_soc =".$object->id;
|
$sql.= " WHERE p.fk_soc =".$object->id;
|
||||||
@ -458,7 +470,6 @@ if ($object->id > 0)
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$i = 0 ;
|
$i = 0 ;
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
@ -474,7 +485,7 @@ if ($object->id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$var = True;
|
$var = True;
|
||||||
while ($i < $num && $i <= $MAXLIST)
|
while ($i < $num && $i < $MAXLIST)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|||||||
@ -751,9 +751,12 @@ if ($resql)
|
|||||||
|
|
||||||
print $facturestatic->getNomUrl(1);
|
print $facturestatic->getNomUrl(1);
|
||||||
$filename=dol_sanitizeFileName($obj->ref);
|
$filename=dol_sanitizeFileName($obj->ref);
|
||||||
|
|
||||||
$filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
|
$filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
|
||||||
print $formfile->getDocumentsLink('facture_fournisseur', $filename, $filedir);
|
$subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref);
|
||||||
print "</td>\n";
|
print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir);
|
||||||
|
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,5 +25,5 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE','Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1);
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1,'VTE','Ventes de marchandises', '707xxx', 0, 0, '', '10', 1, 1);
|
||||||
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR','Coût d\'achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2,'MAR','Coût d achats marchandises vendues', '603xxx | 607xxx | 609xxx', 0, 0, '', '20', 1, 1);
|
||||||
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE','Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1);
|
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE','Marge commerciale', '', 0, 1, '1 + 2', '30', 1, 1);
|
||||||
@ -56,16 +56,12 @@ CREATE OR REPLACE FUNCTION dol_util_triggerall(DoEnable boolean) RETURNS integer
|
|||||||
CREATE OR REPLACE FUNCTION update_modified_column_tms() RETURNS TRIGGER AS $$ BEGIN NEW.tms = now(); RETURN NEW; END; $$ LANGUAGE plpgsql;
|
CREATE OR REPLACE FUNCTION update_modified_column_tms() RETURNS TRIGGER AS $$ BEGIN NEW.tms = now(); RETURN NEW; END; $$ LANGUAGE plpgsql;
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accounting_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accounting_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accounting_fiscalyear FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accounting_fiscalyear FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_accountingtransaction FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_actioncomm_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_adherent_type_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplier_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_askpricesupplierdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_bank_account_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||||
|
|||||||
@ -84,6 +84,11 @@ AccountingCategory=Accounting category
|
|||||||
|
|
||||||
NotMatch=Not Set
|
NotMatch=Not Set
|
||||||
|
|
||||||
|
DeleteMvt=Delete general ledger lines
|
||||||
|
DelYear=Year to delete
|
||||||
|
DelJournal=Journal to delete
|
||||||
|
ConfirmDeleteMvt=This will delete all line of of the general ledger for year and/or from a specifics journal
|
||||||
|
|
||||||
DelBookKeeping=Delete the records of the general ledger
|
DelBookKeeping=Delete the records of the general ledger
|
||||||
|
|
||||||
DescSellsJournal=Sales journal
|
DescSellsJournal=Sales journal
|
||||||
@ -142,6 +147,7 @@ Modelcsv_bob50=Export towards Sage BOB 50
|
|||||||
Modelcsv_ciel=Export towards Sage Ciel Compta or Compta Evolution
|
Modelcsv_ciel=Export towards Sage Ciel Compta or Compta Evolution
|
||||||
Modelcsv_quadratus=Export towards Quadratus QuadraCompta
|
Modelcsv_quadratus=Export towards Quadratus QuadraCompta
|
||||||
Modelcsv_ebp=Export towards EBP
|
Modelcsv_ebp=Export towards EBP
|
||||||
|
Modelcsv_cogilog=Export towards Cogilog
|
||||||
|
|
||||||
## Tools - Init accounting account on product / service
|
## Tools - Init accounting account on product / service
|
||||||
InitAccountancy=Init accountancy
|
InitAccountancy=Init accountancy
|
||||||
@ -160,3 +166,4 @@ Formula=Formula
|
|||||||
## Error
|
## Error
|
||||||
ErrorNoAccountingCategoryForThisCountry=No accounting category are available for this country
|
ErrorNoAccountingCategoryForThisCountry=No accounting category are available for this country
|
||||||
ExportNotSupported=The export format setuped is not supported into this page
|
ExportNotSupported=The export format setuped is not supported into this page
|
||||||
|
BookeppingLineAlreayExists=Lines already existing into bookeeping
|
||||||
|
|||||||
@ -534,6 +534,8 @@ Module59000Name=Margins
|
|||||||
Module59000Desc=Module to manage margins
|
Module59000Desc=Module to manage margins
|
||||||
Module60000Name=Commissions
|
Module60000Name=Commissions
|
||||||
Module60000Desc=Module to manage commissions
|
Module60000Desc=Module to manage commissions
|
||||||
|
Module63000Name=Resources
|
||||||
|
Module63000Desc=Manage resources (printers, cars, room, ...) you can then share into events
|
||||||
Permission11=Read customer invoices
|
Permission11=Read customer invoices
|
||||||
Permission12=Create/modify customer invoices
|
Permission12=Create/modify customer invoices
|
||||||
Permission13=Unvalidate customer invoices
|
Permission13=Unvalidate customer invoices
|
||||||
|
|||||||
@ -32,6 +32,8 @@ ServicesOnSellAndOnBuy=Services for sale and for purchase
|
|||||||
LastModifiedProductsAndServices=Latest %s modified products/services
|
LastModifiedProductsAndServices=Latest %s modified products/services
|
||||||
LastRecordedProducts=Latest %s recorded products
|
LastRecordedProducts=Latest %s recorded products
|
||||||
LastRecordedServices=Latest %s recorded services
|
LastRecordedServices=Latest %s recorded services
|
||||||
|
CardProduct0=Product card
|
||||||
|
CardProduct1=Service card
|
||||||
Stock=Stock
|
Stock=Stock
|
||||||
Stocks=Stocks
|
Stocks=Stocks
|
||||||
Movements=Movements
|
Movements=Movements
|
||||||
|
|||||||
@ -140,6 +140,7 @@ class MultiCurrency extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -184,9 +185,10 @@ class MultiCurrency extends CommonObject
|
|||||||
$sql = 'SELECT';
|
$sql = 'SELECT';
|
||||||
$sql .= ' c.rowid, c.name, c.code, c.entity, c.date_create, c.fk_user';
|
$sql .= ' c.rowid, c.name, c.code, c.entity, c.date_create, c.fk_user';
|
||||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' AS c';
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' AS c';
|
||||||
if (!empty($code)) $sql .= ' WHERE c.code = "'.$this->db->escape($code).'"';
|
if (!empty($code)) $sql .= ' WHERE c.code = \''.$this->db->escape($code).'\'';
|
||||||
else $sql .= ' WHERE c.rowid = ' . $id;
|
else $sql .= ' WHERE c.rowid = ' . $id;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -226,8 +228,6 @@ class MultiCurrency extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function fetchAllCurrencyRate()
|
public function fetchAllCurrencyRate()
|
||||||
{
|
{
|
||||||
dol_syslog('Currency::fetchAllCurrencyRate', LOG_DEBUG);
|
|
||||||
|
|
||||||
$sql = 'SELECT cr.rowid';
|
$sql = 'SELECT cr.rowid';
|
||||||
$sql.= ' FROM ' . MAIN_DB_PREFIX . $this->table_element_line. ' as cr';
|
$sql.= ' FROM ' . MAIN_DB_PREFIX . $this->table_element_line. ' as cr';
|
||||||
$sql.= ' WHERE cr.fk_multicurrency = '.$this->id;
|
$sql.= ' WHERE cr.fk_multicurrency = '.$this->id;
|
||||||
@ -235,6 +235,7 @@ class MultiCurrency extends CommonObject
|
|||||||
|
|
||||||
$this->rates = array();
|
$this->rates = array();
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
@ -284,10 +285,11 @@ class MultiCurrency extends CommonObject
|
|||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
||||||
$sql .= ' name="'.$this->db->escape($this->name).'"';
|
$sql .= ' name=\''.$this->db->escape($this->name).'\'';
|
||||||
$sql .= ' code="'.$this->db->escape($this->code).'"';
|
$sql .= ' code=\''.$this->db->escape($this->code).'\'';
|
||||||
$sql .= ' WHERE rowid=' . $this->id;
|
$sql .= ' WHERE rowid=' . $this->id;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -347,6 +349,7 @@ class MultiCurrency extends CommonObject
|
|||||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
|
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
|
||||||
$sql .= ' WHERE rowid=' . $this->id;
|
$sql .= ' WHERE rowid=' . $this->id;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -425,7 +428,9 @@ class MultiCurrency extends CommonObject
|
|||||||
$currency->code = $code;
|
$currency->code = $code;
|
||||||
$currency->name = $code;
|
$currency->name = $code;
|
||||||
|
|
||||||
$sql = 'SELECT label FROM '.MAIN_DB_PREFIX.'c_currencies WHERE code_iso = "'.$db->escape($code).'"';
|
$sql = 'SELECT label FROM '.MAIN_DB_PREFIX.'c_currencies WHERE code_iso = \''.$db->escape($code).'\'';
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql && ($line = $db->fetch_object($resql)))
|
if ($resql && ($line = $db->fetch_object($resql)))
|
||||||
{
|
{
|
||||||
@ -475,6 +480,7 @@ class MultiCurrency extends CommonObject
|
|||||||
$sql.= ' WHERE cr.fk_multicurrency = '.$this->id;
|
$sql.= ' WHERE cr.fk_multicurrency = '.$this->id;
|
||||||
$sql.= ' AND cr.date_sync >= ALL (SELECT cr2.date_sync FROM '.MAIN_DB_PREFIX.$this->table_element_line.' AS cr2 WHERE cr.rowid = cr2.rowid)';
|
$sql.= ' AND cr.date_sync >= ALL (SELECT cr2.date_sync FROM '.MAIN_DB_PREFIX.$this->table_element_line.' AS cr2 WHERE cr.rowid = cr2.rowid)';
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql && ($obj = $this->db->fetch_object($resql))) {
|
if ($resql && ($obj = $this->db->fetch_object($resql))) {
|
||||||
$this->rate = new CurrencyRate($this->db);
|
$this->rate = new CurrencyRate($this->db);
|
||||||
@ -493,7 +499,9 @@ class MultiCurrency extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public static function getIdFromCode(&$db, $code)
|
public static function getIdFromCode(&$db, $code)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = "'.$db->escape($code).'"';
|
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE code = \''.$db->escape($code).'\'';
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql && $obj = $db->fetch_object($resql)) return $obj->rowid;
|
if ($resql && $obj = $db->fetch_object($resql)) return $obj->rowid;
|
||||||
else return 0;
|
else return 0;
|
||||||
@ -512,10 +520,11 @@ class MultiCurrency extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m';
|
$sql = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)';
|
||||||
$sql.= ' WHERE m.code = "'.$db->escape($code).'"';
|
$sql.= ' WHERE m.code = \''.$db->escape($code).'\'';
|
||||||
$sql.= " AND m.entity IN (".getEntity('multicurrency', 1).")";
|
$sql.= " AND m.entity IN (".getEntity('multicurrency', 1).")";
|
||||||
$sql.= ' ORDER BY mc.date_sync DESC LIMIT 1';
|
$sql.= ' ORDER BY mc.date_sync DESC LIMIT 1';
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql && $obj = $db->fetch_object($resql)) return array($obj->rowid, $obj->rate);
|
if ($resql && $obj = $db->fetch_object($resql)) return array($obj->rowid, $obj->rate);
|
||||||
else return array(0, 1);
|
else return array(0, 1);
|
||||||
@ -556,6 +565,8 @@ class MultiCurrency extends CommonObject
|
|||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$sql = 'SELECT multicurrency_tx FROM '.MAIN_DB_PREFIX.$table.' WHERE rowid = '.$fk_facture;
|
$sql = 'SELECT multicurrency_tx FROM '.MAIN_DB_PREFIX.$table.' WHERE rowid = '.$fk_facture;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql && ($line = $db->fetch_object($resql)))
|
if ($resql && ($line = $db->fetch_object($resql)))
|
||||||
{
|
{
|
||||||
@ -721,6 +732,7 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -765,6 +777,7 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' AS cr';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' AS cr';
|
||||||
$sql .= ' WHERE cr.rowid = ' . $id;
|
$sql .= ' WHERE cr.rowid = ' . $id;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$numrows = $this->db->num_rows($resql);
|
$numrows = $this->db->num_rows($resql);
|
||||||
@ -816,6 +829,7 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -866,6 +880,7 @@ class CurrencyRate extends CommonObjectLine
|
|||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql .= ' WHERE rowid='.$this->id;
|
$sql .= ' WHERE rowid='.$this->id;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__,LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
|
|||||||
@ -1314,7 +1314,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Custom code
|
// Custom code
|
||||||
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
|
if (! $object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.$object->customcode.'"></td>';
|
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.$object->customcode.'"></td>';
|
||||||
// Origin country
|
// Origin country
|
||||||
|
|||||||
@ -666,9 +666,13 @@ else
|
|||||||
$filteronlist='';
|
$filteronlist='';
|
||||||
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
|
if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST;
|
||||||
$text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300');
|
$text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), '', 0, 0, 'minwidth300');
|
||||||
$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
|
if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
|
||||||
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2);
|
{
|
||||||
print '</td></tr>';
|
$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
|
||||||
|
print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2);
|
||||||
|
}
|
||||||
|
else print $text;
|
||||||
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visibility
|
// Visibility
|
||||||
|
|||||||
@ -1145,6 +1145,7 @@ class Project extends CommonObject
|
|||||||
|
|
||||||
// Load source object
|
// Load source object
|
||||||
$clone_project->fetch($fromid);
|
$clone_project->fetch($fromid);
|
||||||
|
$clone_project->fetch_optionals();
|
||||||
$clone_project->fetch_thirdparty();
|
$clone_project->fetch_thirdparty();
|
||||||
|
|
||||||
$orign_dt_start=$clone_project->date_start;
|
$orign_dt_start=$clone_project->date_start;
|
||||||
|
|||||||
@ -53,7 +53,7 @@ $projectstatic = new Project($db);
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'addtimespent' && $user->rights->projet->creer)
|
if ($action == 'addtimespent' && $user->rights->projet->lire)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
|||||||
@ -3469,17 +3469,17 @@ class Societe extends CommonObject
|
|||||||
* Because this function is meant to be executed within a transaction, we won't take care of it.
|
* Because this function is meant to be executed within a transaction, we won't take care of it.
|
||||||
*/
|
*/
|
||||||
$sql = 'SELECT rowid
|
$sql = 'SELECT rowid
|
||||||
FROM llx_societe_commerciaux
|
FROM '.MAIN_DB_PREFIX.'societe_commerciaux
|
||||||
WHERE fk_soc = '.(int) $dest_id.' AND fk_user IN (
|
WHERE fk_soc = '.(int) $dest_id.' AND fk_user IN (
|
||||||
SELECT fk_user
|
SELECT fk_user
|
||||||
FROM llx_societe_commerciaux
|
FROM '.MAIN_DB_PREFIX.'societe_commerciaux
|
||||||
WHERE fk_soc = '.(int) $origin_id.'
|
WHERE fk_soc = '.(int) $origin_id.'
|
||||||
);';
|
);';
|
||||||
|
|
||||||
$query = $db->query($sql);
|
$query = $db->query($sql);
|
||||||
|
|
||||||
while ($result = $db->fetch_object($query)) {
|
while ($result = $db->fetch_object($query)) {
|
||||||
$db->query('DELETE FROM llx_societe_commerciaux WHERE rowid = '.$result->rowid);
|
$db->query('DELETE FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE rowid = '.$result->rowid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -276,7 +276,7 @@ if ($type_element == 'contract')
|
|||||||
$thirdTypeSelect='customer';
|
$thirdTypeSelect='customer';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sql_select)
|
if (!empty($sql_select))
|
||||||
{
|
{
|
||||||
$sql = $sql_select;
|
$sql = $sql_select;
|
||||||
$sql.= ' d.description as description,';
|
$sql.= ' d.description as description,';
|
||||||
|
|||||||
@ -141,8 +141,7 @@ class UserBankAccount extends Account
|
|||||||
$sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
|
$sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
|
||||||
$sql.= " owner_address, label, datec, tms as datem";
|
$sql.= " owner_address, label, datec, tms as datem";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user_rib";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user_rib";
|
||||||
if ($id) $sql.= " WHERE rowid = ".$id;
|
$sql.= " WHERE rowid = ".$id;
|
||||||
if ($socid) $sql.= " WHERE fk_user = ".$userid;
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user