';
+ $url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id;
$picto = 'billr';
+ $label='';
- $label = $langs->trans("Show") . ': ' . $this->account_number . ' - ' . $this->label;
+ $label = '
' . length_accountg($this->account_number);
+ if (! empty($this->label))
+ $label .= '
' . $this->label;
+ if ($moretitle) $label.=' - '.$moretitle;
- if ($withpicto)
- $result .= ($link . img_object($label, $picto) . $linkend);
- if ($withpicto && $withpicto != 2)
- $result .= ' ';
- if ($withpicto != 2)
- require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
- $result .= $link . length_accountg($this->account_number) . ' - ' . $this->label . $linkend;
+ $linkclose='';
+ if (empty($notooltip))
+ {
+ if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
+ {
+ $label=$langs->trans("ShowAccoutingAccount");
+ $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
+ }
+ $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose.=' class="classfortooltip"';
+ }
+
+ $linkstart='
';
+
+ if ($nourl)
+ {
+ $linkstart = '';
+ $linkclose = '';
+ $linkend = '';
+ }
+
+ $label_link = length_accountg($this->account_number);
+ if ($withlabel) $label_link .= ' - ' . $this->label;
+
+ if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
+ if ($withpicto && $withpicto != 2) $result .= ' ';
+ if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
return $result;
}
diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php
index d7cc61d6418..064f56bddd6 100644
--- a/htdocs/accountancy/class/accountingjournal.class.php
+++ b/htdocs/accountancy/class/accountingjournal.class.php
@@ -82,208 +82,6 @@ class AccountingJournal extends CommonObject
}
}
- /**
- * Insert journal in database
- *
- * @param User $user Use making action
- * @param int $notrigger Disable triggers
- * @return int <0 if KO, >0 if OK
- */
- function create($user, $notrigger = 0)
- {
- global $conf;
- $error = 0;
- $now = dol_now();
-
- // Clean parameters
- if (isset($this->code))
- $this->code = trim($this->code);
- if (isset($this->label))
- $this->label = trim($this->label);
-
- // Check parameters
- if (empty($this->nature) || $this->nature == '-1')
- {
- $this->nature = '0';
- }
-
- // Insert request
- $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_journal(";
- $sql .= "code";
- $sql .= ", label";
- $sql .= ", nature";
- $sql .= ", active";
- $sql .= ") VALUES (";
- $sql .= " " . (empty($this->code) ? 'NULL' : "'" . $this->db->escape($this->code) . "'");
- $sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
- $sql .= ", " . (empty($this->nature) ? '0' : "'" . $this->db->escape($this->nature) . "'");
- $sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active));
- $sql .= ")";
-
- $this->db->begin();
-
- dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
- $resql = $this->db->query($sql);
- if (! $resql) {
- $error ++;
- $this->errors[] = "Error " . $this->db->lasterror();
- }
-
- if (! $error) {
- $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_journal");
-
- // if (! $notrigger) {
- // Uncomment this and change MYOBJECT to your own tag if you
- // want this action calls a trigger.
-
- // // Call triggers
- // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
- // $interface=new Interfaces($this->db);
- // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
- // if ($result < 0) { $error++; $this->errors=$interface->errors; }
- // // End call triggers
- // }
- }
-
- // Commit or rollback
- if ($error) {
- foreach ( $this->errors as $errmsg ) {
- dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR);
- $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
- }
- $this->db->rollback();
- return - 1 * $error;
- } else {
- $this->db->commit();
- return $this->id;
- }
- }
-
- /**
- * Update record
- *
- * @param User $user Use making update
- * @return int <0 if KO, >0 if OK
- */
- function update($user)
- {
- // Check parameters
- if (empty($this->nature) || $this->nature == '-1')
- {
- $this->nature = '0';
- }
-
- $this->db->begin();
-
- $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal ";
- $sql .= " SET code = " . ($this->code ? "'" . $this->db->escape($this->code) . "'" : "null");
- $sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null");
- $sql .= " , nature = " . ($this->nature ? "'" . $this->db->escape($this->nature) . "'" : "0");
- $sql .= " , active = '" . $this->active . "'";
- $sql .= " WHERE rowid = " . $this->id;
-
- dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
- $result = $this->db->query($sql);
- if ($result) {
- $this->db->commit();
- return 1;
- } else {
- $this->error = $this->db->lasterror();
- $this->db->rollback();
- return - 1;
- }
- }
-
- /**
- * Check usage of accounting journal
- *
- * @return int <0 if KO, >0 if OK
- */
- function checkUsage() {
- global $langs;
-
- $sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
- $sql .= " WHERE fk_code_ventilation=" . $this->id . ")";
- $sql .= "UNION";
- $sql .= "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facture_fourn_det";
- $sql .= " WHERE fk_code_ventilation=" . $this->id . ")";
-
- dol_syslog(get_class($this) . "::checkUsage sql=" . $sql, LOG_DEBUG);
- $resql = $this->db->query($sql);
-
- if ($resql) {
- $num = $this->db->num_rows($resql);
- if ($num > 0) {
- $this->error = $langs->trans('ErrorAccountingJournalIsAlreadyUse');
- return 0;
- } else {
- return 1;
- }
- } else {
- $this->error = $this->db->lasterror();
- return - 1;
- }
- }
-
- /**
- * Delete object in database
- *
- * @param User $user User that deletes
- * @param int $notrigger 0=triggers after, 1=disable triggers
- * @return int <0 if KO, >0 if OK
- */
- function delete($user, $notrigger = 0) {
- $error = 0;
-
- $result = $this->checkUsage();
-
- if ($result > 0) {
-
- $this->db->begin();
-
- // if (! $error) {
- // if (! $notrigger) {
- // Uncomment this and change MYOBJECT to your own tag if you
- // want this action calls a trigger.
-
- // // Call triggers
- // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
- // $interface=new Interfaces($this->db);
- // $result=$interface->run_triggers('ACCOUNTANCY_ACCOUNT_DELETE',$this,$user,$langs,$conf);
- // if ($result < 0) { $error++; $this->errors=$interface->errors; }
- // // End call triggers
- // }
- // }
-
- if (! $error) {
- $sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_journal";
- $sql .= " WHERE rowid=" . $this->id;
-
- dol_syslog(get_class($this) . "::delete sql=" . $sql);
- $resql = $this->db->query($sql);
- if (! $resql) {
- $error ++;
- $this->errors[] = "Error " . $this->db->lasterror();
- }
- }
-
- // Commit or rollback
- if ($error) {
- 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 * $error;
- } else {
- $this->db->commit();
- return 1;
- }
- } else {
- return - 1;
- }
- }
-
/**
* Return clicable name (with picto eventually)
*
@@ -311,64 +109,6 @@ class AccountingJournal extends CommonObject
return $result;
}
- /**
- * Deactivate journal
- *
- * @param int $id Id
- * @return int <0 if KO, >0 if OK
- */
- function journal_deactivate($id) {
- $result = $this->checkUsage();
-
- if ($result > 0) {
- $this->db->begin();
-
- $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal ";
- $sql .= "SET active = '0'";
- $sql .= " WHERE rowid = " . $this->db->escape($id);
-
- dol_syslog(get_class($this) . "::deactivate sql=" . $sql, LOG_DEBUG);
- $result = $this->db->query($sql);
-
- if ($result) {
- $this->db->commit();
- return 1;
- } else {
- $this->error = $this->db->lasterror();
- $this->db->rollback();
- return - 1;
- }
- } else {
- return - 1;
- }
- }
-
- /**
- * Activate journal
- *
- * @param int $id Id
- * @return int <0 if KO, >0 if OK
- */
- function journal_activate($id) {
- $this->db->begin();
-
- $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal ";
- $sql .= "SET active = '1'";
- $sql .= " WHERE rowid = " . $this->db->escape($id);
-
- dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG);
- $result = $this->db->query($sql);
- if ($result) {
- $this->db->commit();
- return 1;
- } else {
- $this->error = $this->db->lasterror();
- $this->db->rollback();
- return - 1;
- }
- }
-
-
/**
* Retourne le libelle du statut d'un user (actif, inactif)
*
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 754dd262369..8f31b40bc54 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -169,7 +169,15 @@ class BookKeeping extends CommonObject
if (empty($this->numero_compte) || $this->numero_compte == '-1')
{
$langs->load("errors");
- $this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet);
+ if (in_array($this->doc_type, array('bank', 'expense_report')))
+ {
+ $this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type);
+ }
+ else
+ {
+ $this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->fk_doc, $this->doc_type);
+ }
+
return -1;
}
@@ -178,11 +186,12 @@ class BookKeeping extends CommonObject
$this->piece_num = 0;
- // first check if line not yet in bookkeeping
+ // First check if line not yet already in bookkeeping
$sql = "SELECT count(*) as nb";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE doc_type = '" . $this->doc_type . "'";
- $sql .= " AND fk_docdet = " . $this->fk_docdet;
+ $sql .= " AND fk_doc = " . $this->fk_doc;
+ $sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 is record is for several lines
$sql .= " AND numero_compte = '" . $this->numero_compte . "'";
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index a015fa05929..428e490aff7 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -43,6 +43,7 @@ $langs->load("productbatch");
$account_parent = GETPOST('account_parent');
$changeaccount = GETPOST('changeaccount');
// Search Getpost
+$search_lineid = GETPOST('search_lineid', 'int');
$search_ref = GETPOST('search_ref', 'alpha');
$search_invoice = GETPOST('search_invoice', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
@@ -86,6 +87,7 @@ $formventilation = new FormVentilation($db);
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{
+ $search_lineid = '';
$search_ref = '';
$search_invoice = '';
$search_label = '';
@@ -151,7 +153,7 @@ print '';
diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php
index d44407324c0..ca2b7b5c76f 100644
--- a/htdocs/categories/index.php
+++ b/htdocs/categories/index.php
@@ -125,7 +125,7 @@ if ($catname || $id > 0)
print '';
print "\n";
print "\t\t
\n";
print "\t\n";
}
@@ -162,7 +162,7 @@ foreach($fulltree as $key => $val)
'rowid'=>$val['rowid'],
'fk_menu'=>$val['fk_parent'],
'entry'=>'
'
);
@@ -181,13 +181,13 @@ $nbofentries=(count($data) - 1);
if ($nbofentries > 0)
{
- print '
';
print '| '.img_picto_common('','treemenu/branchbottom.gif').' | ';
print '';
print $langs->trans("NoCategoryYet");
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index fc4fc218971..30b13bc3007 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -337,7 +337,7 @@ if ($action == 'add')
unset($_SESSION['assignedtouser']);
$moreparam='';
- if ($user->id != $object->userownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view.
+ if ($user->id != $object->userownerid) $moreparam="filtert=-1"; // We force to remove filter so created record is visible when going back to per user view.
$db->commit();
if (! empty($backtopage))
@@ -706,7 +706,7 @@ if ($action == 'create')
if (GETPOST('complete') == '0' || GETPOST("afaire") == 1) $percent='0';
else if (GETPOST('complete') == 100 || GETPOST("afaire") == 2) $percent=100;
}
- $formactions->form_select_status_action('formaction',$percent,1,'complete');
+ $formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print ' | ';
// Location
@@ -1428,7 +1428,7 @@ if ($id > 0)
} else {
$value = $object->array_options["options_" . $key];
}
- print '| '.$label.' | ';
+ print ' | | '.$label.' | ';
print $extrafields->showOutputField($key,$value);
print " | \n";
}
@@ -1491,7 +1491,7 @@ if ($id > 0)
{
if (empty($conf->global->AGENDA_DISABLE_BUILDDOC))
{
- print '
';
+ print ' ';
print ' '; // ancre
/*
@@ -1512,8 +1512,6 @@ if ($id > 0)
print ' ';
-
- print ' ';
}
}
}
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index d365acef38b..47ef8093c1a 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -43,8 +43,8 @@ if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MA
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
-$filter=GETPOST("filter",'',3);
-$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
+$filter = GETPOST("filter",'',3);
+$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
@@ -1155,21 +1155,6 @@ else // View by day
echo ' ';
}
-
-/* TODO Export
- print '
-
-
-
-
-
-';
-*/
-
llxFooter();
$db->close();
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php
index 8b1dc424239..3e6224e0c41 100644
--- a/htdocs/comm/action/listactions.php
+++ b/htdocs/comm/action/listactions.php
@@ -64,8 +64,8 @@ $dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth'), GETPOST('dateendday'), GET
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
-$filter=GETPOST("filter",'',3);
-$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
+$filter = GETPOST("filter",'',3);
+$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php
index 4f4ef6a580c..544da904cdc 100644
--- a/htdocs/comm/action/pertype.php
+++ b/htdocs/comm/action/pertype.php
@@ -38,8 +38,8 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
-$filter=GETPOST("filter",'',3);
-$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
+$filter = GETPOST("filter",'',3);
+$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
@@ -250,7 +250,7 @@ $picto='calendarweek';
$nav.=' |