Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into new_event_with_multi_contact

This commit is contained in:
phf 2017-06-08 12:03:59 +02:00
commit d6d451b54a
113 changed files with 3315 additions and 3345 deletions

View File

@ -6,6 +6,7 @@ English Dolibarr ChangeLog
For developers: For developers:
NEW: Add a lot of API REST: dictionaryevents, memberstypes, ... NEW: Add a lot of API REST: dictionaryevents, memberstypes, ...
NEW: Big refactorization of multicompany transverse mode
NEW: getEntity function use true $shared value by default NEW: getEntity function use true $shared value by default
WARNING: WARNING:
@ -22,6 +23,7 @@ Following changes may create regression for some external modules, but were nece
* Removed Societe::set_commnucation_level (was deprecated in 4.0). Was not used. * Removed Societe::set_commnucation_level (was deprecated in 4.0). Was not used.
* Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still * Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still
exists, but if an external module need action on it, it must provides itself its trigger file. exists, but if an external module need action on it, it must provides itself its trigger file.
* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode
* Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx') * Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx')
***** ChangeLog for 5.0.3 compared to 5.0.2 ***** ***** ChangeLog for 5.0.3 compared to 5.0.2 *****

View File

@ -466,7 +466,7 @@ print '</td>';
print '<td align="right">'; print '<td align="right">';
print price($total_credit); print price($total_credit);
print '</td>'; print '</td>';
print '<td></td>'; print '<td colspan="2"></td>';
print '</tr>'; print '</tr>';
print "</table>"; print "</table>";

View File

@ -85,6 +85,7 @@ class BookKeeping extends CommonObject
public $fk_user_author; public $fk_user_author;
public $import_key; public $import_key;
public $code_journal; public $code_journal;
public $journal_label;
public $piece_num; public $piece_num;
/** /**
@ -156,6 +157,9 @@ class BookKeeping extends CommonObject
if (isset($this->code_journal)) { if (isset($this->code_journal)) {
$this->code_journal = trim($this->code_journal); $this->code_journal = trim($this->code_journal);
} }
if (isset($this->journal_label)) {
$this->journal_label = trim($this->journal_label);
}
if (isset($this->piece_num)) { if (isset($this->piece_num)) {
$this->piece_num = trim($this->piece_num); $this->piece_num = trim($this->piece_num);
} }
@ -250,6 +254,7 @@ class BookKeeping extends CommonObject
$sql .= ", fk_user_author"; $sql .= ", fk_user_author";
$sql .= ", import_key"; $sql .= ", import_key";
$sql .= ", code_journal"; $sql .= ", code_journal";
$sql .= ", journal_label";
$sql .= ", piece_num"; $sql .= ", piece_num";
$sql .= ', entity'; $sql .= ', entity';
$sql .= ") VALUES ("; $sql .= ") VALUES (";
@ -268,6 +273,7 @@ class BookKeeping extends CommonObject
$sql .= ",'" . $this->fk_user_author . "'"; $sql .= ",'" . $this->fk_user_author . "'";
$sql .= ",'" . $this->db->idate($this->date_create). "'"; $sql .= ",'" . $this->db->idate($this->date_create). "'";
$sql .= ",'" . $this->code_journal . "'"; $sql .= ",'" . $this->code_journal . "'";
$sql .= ",'" . $this->journal_label . "'";
$sql .= "," . $this->piece_num; $sql .= "," . $this->piece_num;
$sql .= ", " . (! isset($this->entity) ? '1' : $this->entity); $sql .= ", " . (! isset($this->entity) ? '1' : $this->entity);
$sql .= ")"; $sql .= ")";
@ -384,6 +390,9 @@ class BookKeeping extends CommonObject
if (isset($this->code_journal)) { if (isset($this->code_journal)) {
$this->code_journal = trim($this->code_journal); $this->code_journal = trim($this->code_journal);
} }
if (isset($this->journal_label)) {
$this->journal_label = trim($this->journal_label);
}
if (isset($this->piece_num)) { if (isset($this->piece_num)) {
$this->piece_num = trim($this->piece_num); $this->piece_num = trim($this->piece_num);
} }
@ -410,6 +419,7 @@ class BookKeeping extends CommonObject
$sql .= 'fk_user_author,'; $sql .= 'fk_user_author,';
$sql .= 'import_key,'; $sql .= 'import_key,';
$sql .= 'code_journal,'; $sql .= 'code_journal,';
$sql .= 'journal_label,';
$sql .= 'piece_num,'; $sql .= 'piece_num,';
$sql .= 'entity'; $sql .= 'entity';
$sql .= ') VALUES ('; $sql .= ') VALUES (';
@ -428,6 +438,7 @@ class BookKeeping extends CommonObject
$sql .= ' ' . $user->id . ','; $sql .= ' ' . $user->id . ',';
$sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ','; $sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ',';
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ','; $sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->piece_num).','; $sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->piece_num).',';
$sql .= ' ' . (! isset($this->entity) ? '1' : $this->entity); $sql .= ' ' . (! isset($this->entity) ? '1' : $this->entity);
$sql .= ')'; $sql .= ')';
@ -497,6 +508,7 @@ class BookKeeping extends CommonObject
$sql .= " t.fk_user_author,"; $sql .= " t.fk_user_author,";
$sql .= " t.import_key,"; $sql .= " t.import_key,";
$sql .= " t.code_journal,"; $sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num"; $sql .= " t.piece_num";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
$sql .= ' WHERE 1 = 1'; $sql .= ' WHERE 1 = 1';
@ -530,6 +542,7 @@ class BookKeeping extends CommonObject
$this->fk_user_author = $obj->fk_user_author; $this->fk_user_author = $obj->fk_user_author;
$this->import_key = $obj->import_key; $this->import_key = $obj->import_key;
$this->code_journal = $obj->code_journal; $this->code_journal = $obj->code_journal;
$this->journal_label = $obj->journal_label;
$this->piece_num = $obj->piece_num; $this->piece_num = $obj->piece_num;
} }
$this->db->free($resql); $this->db->free($resql);
@ -581,6 +594,7 @@ class BookKeeping extends CommonObject
$sql .= " t.fk_user_author,"; $sql .= " t.fk_user_author,";
$sql .= " t.import_key,"; $sql .= " t.import_key,";
$sql .= " t.code_journal,"; $sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num"; $sql .= " t.piece_num";
// Manage filter // Manage filter
$sqlwhere = array (); $sqlwhere = array ();
@ -643,6 +657,7 @@ class BookKeeping extends CommonObject
$line->fk_user_author = $obj->fk_user_author; $line->fk_user_author = $obj->fk_user_author;
$line->import_key = $obj->import_key; $line->import_key = $obj->import_key;
$line->code_journal = $obj->code_journal; $line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num; $line->piece_num = $obj->piece_num;
$this->lines[] = $line; $this->lines[] = $line;
@ -693,6 +708,7 @@ class BookKeeping extends CommonObject
$sql .= " t.fk_user_author,"; $sql .= " t.fk_user_author,";
$sql .= " t.import_key,"; $sql .= " t.import_key,";
$sql .= " t.code_journal,"; $sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num"; $sql .= " t.piece_num";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
// Manage filter // Manage filter
@ -752,6 +768,7 @@ class BookKeeping extends CommonObject
$line->fk_user_author = $obj->fk_user_author; $line->fk_user_author = $obj->fk_user_author;
$line->import_key = $obj->import_key; $line->import_key = $obj->import_key;
$line->code_journal = $obj->code_journal; $line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num; $line->piece_num = $obj->piece_num;
$this->lines[] = $line; $this->lines[] = $line;
@ -903,6 +920,9 @@ class BookKeeping extends CommonObject
if (isset($this->code_journal)) { if (isset($this->code_journal)) {
$this->code_journal = trim($this->code_journal); $this->code_journal = trim($this->code_journal);
} }
if (isset($this->journal_label)) {
$this->journal_label = trim($this->journal_label);
}
if (isset($this->piece_num)) { if (isset($this->piece_num)) {
$this->piece_num = trim($this->piece_num); $this->piece_num = trim($this->piece_num);
} }
@ -927,6 +947,7 @@ class BookKeeping extends CommonObject
$sql .= ' fk_user_author = ' . (isset($this->fk_user_author) ? $this->fk_user_author : "null") . ','; $sql .= ' fk_user_author = ' . (isset($this->fk_user_author) ? $this->fk_user_author : "null") . ',';
$sql .= ' import_key = ' . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . ','; $sql .= ' import_key = ' . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . ',';
$sql .= ' code_journal = ' . (isset($this->code_journal) ? "'" . $this->db->escape($this->code_journal) . "'" : "null") . ','; $sql .= ' code_journal = ' . (isset($this->code_journal) ? "'" . $this->db->escape($this->code_journal) . "'" : "null") . ',';
$sql .= ' journal_label = ' . (isset($this->journal_label) ? "'" . $this->db->escape($this->journal_label) . "'" : "null") . ',';
$sql .= ' piece_num = ' . (isset($this->piece_num) ? $this->piece_num : "null"); $sql .= ' piece_num = ' . (isset($this->piece_num) ? $this->piece_num : "null");
$sql .= ' WHERE rowid=' . $this->id; $sql .= ' WHERE rowid=' . $this->id;
@ -1185,6 +1206,7 @@ class BookKeeping extends CommonObject
$this->fk_user_author = $user->id; $this->fk_user_author = $user->id;
$this->import_key = ''; $this->import_key = '';
$this->code_journal = ''; $this->code_journal = '';
$this->journal_label = '';
$this->piece_num = ''; $this->piece_num = '';
} }
@ -1197,7 +1219,7 @@ class BookKeeping extends CommonObject
public function fetchPerMvt($piecenum) { public function fetchPerMvt($piecenum) {
global $conf; global $conf;
$sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type"; $sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE piece_num = " . $piecenum; $sql .= " WHERE piece_num = " . $piecenum;
$sql .= " AND entity IN (" . getEntity('accountancy') . ")"; $sql .= " AND entity IN (" . getEntity('accountancy') . ")";
@ -1209,6 +1231,7 @@ class BookKeeping extends CommonObject
$this->piece_num = $obj->piece_num; $this->piece_num = $obj->piece_num;
$this->code_journal = $obj->code_journal; $this->code_journal = $obj->code_journal;
$this->journal_label = $obj->journal_label;
$this->doc_date = $this->db->jdate($obj->doc_date); $this->doc_date = $this->db->jdate($obj->doc_date);
$this->doc_ref = $obj->doc_ref; $this->doc_ref = $obj->doc_ref;
$this->doc_type = $obj->doc_type; $this->doc_type = $obj->doc_type;
@ -1260,7 +1283,7 @@ class BookKeeping extends CommonObject
$sql = "SELECT rowid, doc_date, doc_type,"; $sql = "SELECT rowid, doc_date, doc_type,";
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,"; $sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
$sql .= " numero_compte, label_compte, debit, credit,"; $sql .= " numero_compte, label_compte, debit, credit,";
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE piece_num = " . $piecenum; $sql .= " WHERE piece_num = " . $piecenum;
$sql .= " AND entity IN (" . getEntity('accountancy') . ")"; $sql .= " AND entity IN (" . getEntity('accountancy') . ")";
@ -1288,6 +1311,7 @@ class BookKeeping extends CommonObject
$line->montant = $obj->montant; $line->montant = $obj->montant;
$line->sens = $obj->sens; $line->sens = $obj->sens;
$line->code_journal = $obj->code_journal; $line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num; $line->piece_num = $obj->piece_num;
$this->linesmvt[] = $line; $this->linesmvt[] = $line;
@ -1533,5 +1557,6 @@ class BookKeepingLine
public $fk_user_author; public $fk_user_author;
public $import_key; public $import_key;
public $code_journal; public $code_journal;
public $journal_label;
public $piece_num; public $piece_num;
} }

View File

@ -45,10 +45,13 @@ $langs->load("compta");
$langs->load("banks"); $langs->load("banks");
$langs->load("loans"); $langs->load("loans");
/* /*
* Actions * Actions
*/ */
// None
/* /*
* View * View
@ -73,35 +76,31 @@ print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n";
print "<br>\n";
print $langs->trans("AccountancyAreaDescActionOnceBis"); print $langs->trans("AccountancyAreaDescActionOnceBis");
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>'; $textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
print "<br>\n"; print "<br>\n";
print "<br>\n";
if (! empty($conf->tax->enabled)) if (! empty($conf->tax->enabled))
{ {
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>'; $textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>';
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n"; print "<br>\n";
print "<br>\n";
} }
/*if (! empty($conf->salaries->enabled)) /*if (! empty($conf->salaries->enabled))
{ {
@ -116,7 +115,6 @@ if (! empty($conf->expensereport->enabled)) // TODO Move this in the default ac
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n";
} }
/* /*
if (! empty($conf->loan->enabled)) if (! empty($conf->loan->enabled))
@ -124,26 +122,22 @@ if (! empty($conf->loan->enabled))
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n";
} }
if (! empty($conf->don->enabled)) if (! empty($conf->don->enabled))
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n";
}*/ }*/
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
print "<br>\n"; print "<br>\n";
print "<br>\n";
$step++; $step++;
$textlink='<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>'; $textlink='<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>';
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink);
print "<br>\n"; print "<br>\n";
print "<br>\n";
print "<br>\n"; print "<br>\n";
@ -155,19 +149,19 @@ $step = 0;
$langs->loadLangs(array('bills', 'trips')); $langs->loadLangs(array('bills', 'trips'));
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;

View File

@ -28,8 +28,6 @@
* \brief Page with bank journal * \brief Page with bank journal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
@ -53,8 +51,6 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php'; require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
// Langs
$langs->load("companies"); $langs->load("companies");
$langs->load("other"); $langs->load("other");
$langs->load("compta"); $langs->load("compta");
@ -77,6 +73,7 @@ $date_endyear = GETPOST('date_endyear');
$action = GETPOST('action','aZ09'); $action = GETPOST('action','aZ09');
$now = dol_now(); $now = dol_now();
$action = GETPOST('action','aZ09');
// Security check // Security check
if ($user->societe_id > 0 && empty($id_journal)) if ($user->societe_id > 0 && empty($id_journal))
@ -140,6 +137,7 @@ $paymentexpensereportstatic = new PaymentExpenseReport($db);
$accountingjournalstatic = new AccountingJournal($db); $accountingjournalstatic = new AccountingJournal($db);
$accountingjournalstatic->fetch($id_journal); $accountingjournalstatic->fetch($id_journal);
$journal = $accountingjournalstatic->code; $journal = $accountingjournalstatic->code;
$journal_label = $accountingjournalstatic->label;
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG); dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -361,6 +359,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->debit = ($mt >= 0 ? $mt : 0); $bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? - $mt : 0); $bookkeeping->credit = ($mt < 0 ? - $mt : 0);
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create = $now; $bookkeeping->date_create = $now;
@ -454,6 +453,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0 ? - $mt : 0); $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create = $now; $bookkeeping->date_create = $now;

View File

@ -27,8 +27,6 @@
* \brief Page with expense reports journal * \brief Page with expense reports journal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
@ -38,7 +36,6 @@ require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
// Langs
$langs->load("compta"); $langs->load("compta");
$langs->load("bills"); $langs->load("bills");
$langs->load("other"); $langs->load("other");
@ -46,8 +43,8 @@ $langs->load("main");
$langs->load("accountancy"); $langs->load("accountancy");
$langs->load("trips"); $langs->load("trips");
// Multi journal
$id_journal = GETPOST('id_journal', 'int'); $id_journal = GETPOST('id_journal', 'int');
$action = GETPOST('action','aZ09');
$date_startmonth = GETPOST('date_startmonth'); $date_startmonth = GETPOST('date_startmonth');
$date_startday = GETPOST('date_startday'); $date_startday = GETPOST('date_startday');
@ -62,16 +59,15 @@ $now = dol_now();
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
$action = GETPOST('action','aZ09');
/* /*
* Actions * Actions
*/ */
// Get code of finance journal
// Get informations of journal
$accountingjournalstatic = new AccountingJournal($db); $accountingjournalstatic = new AccountingJournal($db);
$accountingjournalstatic->fetch($id_journal); $accountingjournalstatic->fetch($id_journal);
$journal = $accountingjournalstatic->code; $journal = $accountingjournalstatic->code;
$journal_label = $accountingjournalstatic->label;
$year_current = strftime("%Y", dol_now()); $year_current = strftime("%Y", dol_now());
$pastmonth = strftime("%m", dol_now()) - 1; $pastmonth = strftime("%m", dol_now()) - 1;
@ -187,6 +183,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt <= 0) ? $mt : 0; $bookkeeping->debit = ($mt <= 0) ? $mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
@ -233,6 +230,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
@ -277,6 +275,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
@ -444,7 +443,7 @@ if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("ExpenseReportsJournal")); llxHeader('', $langs->trans("ExpenseReportsJournal"));
$nom = $langs->trans("ExpenseReportsJournal"); $nom = $langs->trans("ExpenseReportsJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1);
$nomlink = ''; $nomlink = '';
$periodlink = ''; $periodlink = '';
$exportlink = ''; $exportlink = '';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* *
@ -27,23 +27,24 @@
* \brief Page with purchases journal * \brief Page with purchases journal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
// Langs
$langs->load("compta"); $langs->load("compta");
$langs->load("bills"); $langs->load("bills");
$langs->load("other"); $langs->load("other");
$langs->load("main"); $langs->load("main");
$langs->load("accountancy"); $langs->load("accountancy");
$id_journal = GETPOST('id_journal', 'int');
$action = GETPOST('action','aZ09');
$date_startmonth = GETPOST('date_startmonth'); $date_startmonth = GETPOST('date_startmonth');
$date_startday = GETPOST('date_startday'); $date_startday = GETPOST('date_startday');
$date_startyear = GETPOST('date_startyear'); $date_startyear = GETPOST('date_startyear');
@ -57,13 +58,16 @@ $now = dol_now();
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
$action = GETPOST('action','aZ09');
/* /*
* Actions * Actions
*/ */
// Get informations of journal
$accountingjournalstatic = new AccountingJournal($db);
$accountingjournalstatic->fetch($id_journal);
$journal = $accountingjournalstatic->code;
$journal_label = $accountingjournalstatic->label;
$year_current = strftime("%Y", dol_now()); $year_current = strftime("%Y", dol_now());
$pastmonth = strftime("%m", dol_now()) - 1; $pastmonth = strftime("%m", dol_now()) - 1;
$pastmonthyear = $year_current; $pastmonthyear = $year_current;
@ -217,7 +221,8 @@ if ($action == 'writebookkeeping') {
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt <= 0) ? $mt : 0; $bookkeeping->debit = ($mt <= 0) ? $mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
@ -263,7 +268,8 @@ if ($action == 'writebookkeeping') {
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
@ -307,7 +313,8 @@ if ($action == 'writebookkeeping') {
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
@ -337,7 +344,6 @@ if ($action == 'writebookkeeping') {
{ {
$db->rollback(); $db->rollback();
} }
} }
if (empty($error) && count($tabpay)) { if (empty($error) && count($tabpay)) {
@ -351,7 +357,6 @@ if ($action == 'writebookkeeping') {
{ {
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
} }
$action=''; $action='';
} }
@ -488,7 +493,7 @@ if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("PurchasesJournal")); llxHeader('', $langs->trans("PurchasesJournal"));
$nom = $langs->trans("PurchasesJournal"); $nom = $langs->trans("PurchasesJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1);
$nomlink = ''; $nomlink = '';
$periodlink = ''; $periodlink = '';
$exportlink = ''; $exportlink = '';
@ -503,7 +508,9 @@ if (empty($action) || $action == 'view') {
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); $varlink = 'id_journal=' . $id_journal;
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) { /*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>'; print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
@ -537,7 +544,6 @@ if (empty($action) || $action == 'view') {
$i = 0; $i = 0;
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
// /print "<td>".$langs->trans("JournalNum")."</td>";
print "<td></td>"; print "<td></td>";
print "<td>" . $langs->trans("Date") . "</td>"; print "<td>" . $langs->trans("Date") . "</td>";
print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>"; print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")</td>";
@ -590,6 +596,7 @@ if (empty($action) || $action == 'view') {
print "</tr>"; print "</tr>";
} }
} }
// VAT // VAT
foreach ( $tabtva[$key] as $k => $mt ) { foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) { if ($mt) {

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -29,17 +29,15 @@
* \brief Page with sells journal * \brief Page with sells journal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
// Langs
$langs->load("commercial"); $langs->load("commercial");
$langs->load("compta"); $langs->load("compta");
$langs->load("bills"); $langs->load("bills");
@ -47,6 +45,9 @@ $langs->load("other");
$langs->load("main"); $langs->load("main");
$langs->load("accountancy"); $langs->load("accountancy");
$id_journal = GETPOST('id_journal', 'int');
$action = GETPOST('action','aZ09');
$date_startmonth = GETPOST('date_startmonth'); $date_startmonth = GETPOST('date_startmonth');
$date_startday = GETPOST('date_startday'); $date_startday = GETPOST('date_startday');
$date_startyear = GETPOST('date_startyear'); $date_startyear = GETPOST('date_startyear');
@ -60,13 +61,17 @@ $now = dol_now();
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
$action = GETPOST('action','aZ09');
/* /*
* Actions * Actions
*/ */
// Get informations of journal
$accountingjournalstatic = new AccountingJournal($db);
$accountingjournalstatic->fetch($id_journal);
$journal = $accountingjournalstatic->code;
$journal_label = $accountingjournalstatic->label;
$year_current = strftime("%Y", dol_now()); $year_current = strftime("%Y", dol_now());
$pastmonth = strftime("%m", dol_now()) - 1; $pastmonth = strftime("%m", dol_now()) - 1;
$pastmonthyear = $year_current; $pastmonthyear = $year_current;
@ -234,7 +239,8 @@ if ($action == 'writebookkeeping') {
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->debit = ($mt >= 0) ? $mt : 0;
$bookkeeping->credit = ($mt < 0) ? $mt : 0; $bookkeeping->credit = ($mt < 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
@ -278,7 +284,8 @@ if ($action == 'writebookkeeping') {
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? $mt : 0; $bookkeeping->debit = ($mt < 0) ? $mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
@ -321,7 +328,8 @@ if ($action == 'writebookkeeping') {
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? $mt : 0; $bookkeeping->debit = ($mt < 0) ? $mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
@ -505,7 +513,7 @@ if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("SellsJournal")); llxHeader('', $langs->trans("SellsJournal"));
$nom = $langs->trans("SellsJournal"); $nom = $langs->trans("SellsJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1);
$nomlink = ''; $nomlink = '';
$periodlink = ''; $periodlink = '';
$exportlink = ''; $exportlink = '';
@ -518,7 +526,9 @@ if (empty($action) || $action == 'view') {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); $varlink = 'id_journal=' . $id_journal;
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) { /*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>'; print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';

View File

@ -948,20 +948,6 @@ else
print $object->showOptionals($extrafields,'edit'); print $object->showOptionals($extrafields,'edit');
} }
/*
// Third party Dolibarr
if (! empty($conf->societe->enabled))
{
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td class="valeur">';
print $form->select_company($object->fk_soc,'socid','',1);
print '</td></tr>';
}
// Login Dolibarr
print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td class="valeur">';
print $form->select_dolusers($object->user_id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '</td></tr>';
*/
print '<tbody>'; print '<tbody>';
print "</table>\n"; print "</table>\n";
@ -1061,12 +1047,12 @@ else
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td class="valeur" colspan="2">'.$object->id.'</td></tr>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td class="valeur">'.$object->id.'</td></tr>';
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{ {
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td colspan="2"><input type="text" name="login" class="maxwidth200" value="'.(isset($_POST["login"])?GETPOST("login",'alpha',2):$object->login).'"></td></tr>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="maxwidth200" value="'.(isset($_POST["login"])?GETPOST("login",'alpha',2):$object->login).'"></td></tr>';
} }
// Password // Password
@ -1095,7 +1081,7 @@ else
print "</td></tr>"; print "</td></tr>";
// Company // Company
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.(isset($_POST["societe"])?GETPOST("societe",'',2):$object->societe).'"></td></tr>'; print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth100" value="'.(isset($_POST["societe"])?GETPOST("societe",'',2):$object->societe).'"></td></tr>';
// Civility // Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>'; print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
@ -1104,11 +1090,11 @@ else
print '</tr>'; print '</tr>';
// Lastname // Lastname
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" size="40" value="'.(isset($_POST["lastname"])?GETPOST("lastname",'',2):$object->lastname).'"></td>'; print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth100" value="'.(isset($_POST["lastname"])?GETPOST("lastname",'',2):$object->lastname).'"></td>';
print '</tr>'; print '</tr>';
// Firstname // Firstname
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" size="40" value="'.(isset($_POST["firstname"])?GETPOST("firstname",'',3):$object->firstname).'"></td>'; print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth100" value="'.(isset($_POST["firstname"])?GETPOST("firstname",'',3):$object->firstname).'"></td>';
print '</tr>'; print '</tr>';
// Photo // Photo
@ -1131,7 +1117,7 @@ else
// Address // Address
print '<tr><td>'.$langs->trans("Address").'</td><td>'; print '<tr><td>'.$langs->trans("Address").'</td><td>';
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(isset($_POST["address"])?GETPOST("address",'',2):$object->address).'</textarea>'; print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.(isset($_POST["address"])?GETPOST("address",'',2):$object->address).'</textarea>';
print '</td></tr>'; print '</td></tr>';
// Zip / Town // Zip / Town
@ -1143,7 +1129,7 @@ else
// Country // Country
//$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined //$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>'; print '<tr><td>'.$langs->trans('Country').'</td><td>';
print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'country_id'); print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td></tr>'; print '</td></tr>';
@ -1168,7 +1154,7 @@ else
// Skype // Skype
if (! empty($conf->skype->enabled)) if (! empty($conf->skype->enabled))
{ {
print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="skype" size="40" value="'.(isset($_POST["skype"])?GETPOST("skype"):$object->skype).'"></td></tr>'; print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="skype" class="minwidth100" value="'.(isset($_POST["skype"])?GETPOST("skype"):$object->skype).'"></td></tr>';
} }
// Birthday // Birthday
@ -1185,7 +1171,7 @@ else
if (! empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) if (! empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire ))
{ {
print '<tr><td>' . fieldLabel('Categories', 'memcats') . '</td>'; print '<tr><td>' . fieldLabel('Categories', 'memcats') . '</td>';
print '<td colspan="2">'; print '<td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1);
$c = new Categorie($db); $c = new Categorie($db);
$cats = $c->containing($object->id, Categorie::TYPE_MEMBER); $cats = $c->containing($object->id, Categorie::TYPE_MEMBER);
@ -1197,7 +1183,7 @@ else
} }
// Other attributes // Other attributes
$parameters=array("colspan"=>2); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
@ -1488,12 +1474,7 @@ else
} }
// Other attributes // Other attributes
$parameters=array('colspan'=>2); include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields, 'view', $parameters);
}
// Date end subscription // Date end subscription
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">'; print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';

View File

@ -647,12 +647,8 @@ if ($rowid > 0)
} }
// Other attributes // Other attributes
$parameters=array('colspan'=>2); $cols=2;
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields, 'view', $parameters);
}
// Date end subscription // Date end subscription
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">'; print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';

View File

@ -337,13 +337,7 @@ if ($rowid > 0)
print nl2br($object->mail_valid)."</td></tr>"; print nl2br($object->mail_valid)."</td></tr>";
// Other attributes // Other attributes
$parameters=array(); include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
// View extrafields
print $object->showOptionals($extrafields);
}
print '</table>'; print '</table>';
print '</div>'; print '</div>';
@ -674,6 +668,10 @@ if ($rowid > 0)
// Other attributes // Other attributes
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields,'edit');
}
print '</table>'; print '</table>';

View File

@ -235,7 +235,7 @@ $sql = "SELECT b.rowid, b.box_id, b.position, b.box_order,";
$sql.= " bd.rowid as boxid"; $sql.= " bd.rowid as boxid";
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd";
$sql.= " WHERE b.box_id = bd.rowid"; $sql.= " WHERE b.box_id = bd.rowid";
$sql.= " AND b.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; $sql.= " AND b.entity IN (0,".$conf->entity.")";
$sql.= " AND b.fk_user=0"; $sql.= " AND b.fk_user=0";
$sql.= " ORDER by b.position, b.box_order"; $sql.= " ORDER by b.position, b.box_order";

View File

@ -148,7 +148,6 @@ print "</tr>\n";
foreach ($list as $key) foreach ($list as $key)
{ {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param

View File

@ -1165,14 +1165,14 @@ if ($id)
if ($value == 'country') if ($value == 'country')
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth150 maxwidthonsmartphone');
print '</td>'; print '</td>';
$filterfound++; $filterfound++;
} }
elseif ($value == 'code') elseif ($value == 'code')
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" name="search_code" value="'.dol_escape_htmltag($search_code).'">'; print '<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).'">';
print '</td>'; print '</td>';
$filterfound++; $filterfound++;
} }

View File

@ -547,7 +547,6 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
// print products on fichinter // print products on fichinter
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
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="set_FICHINTER_PRINT_PRODUCTS">'; print '<input type="hidden" name="action" value="set_FICHINTER_PRINT_PRODUCTS">';

View File

@ -131,7 +131,7 @@ print '<table class="noborder" width="100%">';
$sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault"; $sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" $sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
$sql.= " AND entity IN (".(! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; $sql.= " AND entity = ".$conf->entity;
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
$sql.= " ORDER BY r.module, r.id"; $sql.= " ORDER BY r.module, r.id";

View File

@ -173,6 +173,7 @@ print '<tr><td>'.$langs->trans("In").'</td><td>';
print $form->select_all_categories($type,$object->fk_parent,'parent',64,$object->id); print $form->select_all_categories($type,$object->fk_parent,'parent',64,$object->id);
print '</td></tr>'; print '</td></tr>';
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {

View File

@ -235,11 +235,8 @@ print $langs->trans("Color").'</td><td>';
print $formother->showColor($object->color); print $formother->showColor($object->color);
print '</td></tr>'; print '</td></tr>';
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook // Other attributes
if (empty($reshook) && ! empty($extrafields->attribute_label)) include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
{
print $object->showOptionals($extrafields);
}
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@ -835,12 +835,9 @@ if ($action == 'create')
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$parameters=array('id'=>$object->id); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
print $object->showOptionals($extrafields,'edit'); print $object->showOptionals($extrafields,'edit');
@ -1171,7 +1168,7 @@ if ($id > 0)
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$parameters=array('id'=>$object->id); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
@ -1425,36 +1422,11 @@ if ($id > 0)
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$object->id); $cols=3;
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';
//Extra field
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print '<br><br>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
foreach($extrafields->attribute_label as $key=>$label)
{
if (isset($_POST["options_" . $key])) {
if (is_array($_POST["options_" . $key])) {
// $_POST["options"] is an array but following code expects a comma separated string
$value = implode(",", $_POST["options_" . $key]);
} else {
$value = $_POST["options_" . $key];
}
} else {
$value = $object->array_options["options_" . $key];
}
print '<tr><td class="titlefield">'.$label.'</td><td>';
print $extrafields->showOutputField($key,$value);
print "</td></tr>\n";
}
print '</table>';
}
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -432,13 +432,8 @@ if ($id > 0)
} }
// Other attributes // Other attributes
$parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('socid'=>$object->id);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields);
}
// Sales representative // Sales representative
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';

View File

@ -767,16 +767,15 @@ if ($object->fetch($id) >= 0) {
} else { } else {
$std_soc = new Societe($db); $std_soc = new Societe($db);
$action_search = 'query'; $action_search = 'query';
// 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
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db); $hookmanager = new HookManager($db);
$hookmanager->initHooks(array ( $hookmanager->initHooks(array ('thirdpartycard'));
'thirdpartycard'
)); $parameters=array();
if (! empty($advTarget->id)) { if (! empty($advTarget->id)) {
$parameters = array ( $parameters = array('array_query' => $advTarget->filtervalue);
'array_query' => $advTarget->filtervalue
);
} }
// Module extrafield feature // Module extrafield feature
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search);

View File

@ -895,12 +895,7 @@ else
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$parameters=array(); include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields);
}
print '</table>'; print '</table>';

View File

@ -1170,27 +1170,12 @@ if (empty($reshook))
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) $error++; if ($ret < 0) $error++;
if (! $error) if (! $error)
{ {
// Actions on extra fields (by external module or standard code)
// TODO le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('propaldao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been
// modified by
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields();
if ($result < 0) { if ($result < 0) $error++;
$error ++;
} }
} else if ($reshook < 0) if ($error) $action = 'edit_extras';
$error ++;
}
if ($error)
$action = 'edit_extras';
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer)
@ -1355,10 +1340,10 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference // Reference
print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>'; print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td>' . $langs->trans("Draft") . '</td></tr>';
// Ref customer // Ref customer
print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td>';
print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>'; print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
print '</tr>'; print '</tr>';
@ -1366,7 +1351,7 @@ if ($action == 'create')
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>'; print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
if ($socid > 0) { if ($socid > 0) {
print '<td colspan="2">'; print '<td>';
print $soc->getNomUrl(1); print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="' . $soc->id . '">'; print '<input type="hidden" name="socid" value="' . $soc->id . '">';
print '</td>'; print '</td>';
@ -1374,7 +1359,7 @@ if ($action == 'create')
$shipping_method_id = $soc->shipping_method_id; $shipping_method_id = $soc->shipping_method_id;
} }
} else { } else {
print '<td colspan="2">'; print '<td>';
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty'); print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
@ -1396,7 +1381,7 @@ if ($action == 'create')
// Contacts (ask contact only if thirdparty already defined). TODO do this also into order and invoice. // Contacts (ask contact only if thirdparty already defined). TODO do this also into order and invoice.
if ($socid > 0) if ($socid > 0)
{ {
print "<tr><td>" . $langs->trans("DefaultContact") . '</td><td colspan="2">'; print "<tr><td>" . $langs->trans("DefaultContact") . '</td><td>';
$form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist); $form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist);
print '</td></tr>'; print '</td></tr>';
} }
@ -1404,7 +1389,7 @@ if ($action == 'create')
if ($socid > 0) if ($socid > 0)
{ {
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>' . $langs->trans('Discounts') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('Discounts') . '</td><td>';
if ($soc->remise_percent) if ($soc->remise_percent)
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
else else
@ -1420,26 +1405,26 @@ if ($action == 'create')
} }
// Date // Date
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">'; print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td>';
$form->select_date('', '', '', '', '', "addprop", 1, 1); $form->select_date('', '', '', '', '', "addprop", 1, 1);
print '</td></tr>'; print '</td></tr>';
// Validaty duration // Validaty duration
print '<tr><td class="fieldrequired">' . $langs->trans("ValidityDuration") . '</td><td colspan="2"><input name="duree_validite" size="5" value="' . $conf->global->PROPALE_VALIDITY_DURATION . '"> ' . $langs->trans("days") . '</td></tr>'; print '<tr><td class="fieldrequired">' . $langs->trans("ValidityDuration") . '</td><td><input name="duree_validite" size="5" value="' . $conf->global->PROPALE_VALIDITY_DURATION . '"> ' . $langs->trans("days") . '</td></tr>';
// Terms of payment // Terms of payment
print '<tr><td class="nowrap fieldrequired">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">'; print '<tr><td class="nowrap fieldrequired">' . $langs->trans('PaymentConditionsShort') . '</td><td>';
$form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id'); $form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id');
print '</td></tr>'; print '</td></tr>';
// Mode of payment // Mode of payment
print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td>';
$form->select_types_paiements($soc->mode_reglement_id, 'mode_reglement_id'); $form->select_types_paiements($soc->mode_reglement_id, 'mode_reglement_id');
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) { if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && ! empty($conf->banque->enabled)) {
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('BankAccount') . '</td><td>';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1); $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>'; print '</td></tr>';
} }
@ -1450,20 +1435,20 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Delivery delay // Delivery delay
print '<tr class="fielddeliverydelay"><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">'; print '<tr class="fielddeliverydelay"><td>' . $langs->trans('AvailabilityPeriod') . '</td><td>';
$form->selectAvailabilityDelay('', 'availability_id', '', 1); $form->selectAvailabilityDelay('', 'availability_id', '', 1);
print '</td></tr>'; print '</td></tr>';
// Shipping Method // Shipping Method
if (! empty($conf->expedition->enabled)) { if (! empty($conf->expedition->enabled)) {
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td>';
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1); print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
print '</td></tr>'; print '</td></tr>';
} }
// Delivery date (or manufacturing) // Delivery date (or manufacturing)
print '<tr><td>' . $langs->trans("DeliveryDate") . '</td>'; print '<tr><td>' . $langs->trans("DeliveryDate") . '</td>';
print '<td colspan="2">'; print '<td>';
if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") { if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") {
$tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
$syear = date("Y", $tmpdte); $syear = date("Y", $tmpdte);
@ -1483,7 +1468,7 @@ if ($action == 'create')
$langs->load("projects"); $langs->load("projects");
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">'; print '<td>' . $langs->trans("Project") . '</td><td>';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>'; print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td>'; print '</td>';
@ -1495,7 +1480,7 @@ if ($action == 'create')
{ {
print '<tr>'; print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->libelle_incoterms, 1).'</label></td>'; print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->libelle_incoterms, 1).'</label></td>';
print '<td colspan="3" class="maxwidthonsmartphone">'; print '<td class="maxwidthonsmartphone">';
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:'')); print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:''));
print '</td></tr>'; print '</td></tr>';
} }
@ -1503,7 +1488,7 @@ if ($action == 'create')
// Template to use by default // Template to use by default
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("DefaultModel") . '</td>'; print '<td>' . $langs->trans("DefaultModel") . '</td>';
print '<td colspan="2">'; print '<td>';
$liste = ModelePDFPropales::liste_modeles($db); $liste = ModelePDFPropales::liste_modeles($db);
print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF)); print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF));
print "</td></tr>"; print "</td></tr>";
@ -1513,7 +1498,7 @@ if ($action == 'create')
{ {
print '<tr>'; print '<tr>';
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>'; print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">'; print '<td class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
print '</td></tr>'; print '</td></tr>';
} }
@ -1521,7 +1506,7 @@ if ($action == 'create')
// Public note // Public note
print '<tr>'; print '<tr>';
print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>'; print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top">';
$note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null)); $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null));
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
@ -1531,7 +1516,7 @@ if ($action == 'create')
{ {
print '<tr>'; print '<tr>';
print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>'; print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top">';
$note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null)); $note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null));
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
@ -1540,10 +1525,8 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$parameters = array('colspan' => ' colspan="3"'); $parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// by
// hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) { if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit');
} }
@ -1578,19 +1561,19 @@ if ($action == 'create')
elseif ($newclassname == 'Fichinter') elseif ($newclassname == 'Fichinter')
$newclassname = 'Intervention'; $newclassname = 'Intervention';
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>'; print '<tr><td>' . $langs->trans($newclassname) . '</td><td>' . $objectsrc->getNomUrl(1) . '</td></tr>';
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '</td></tr>'; print '<tr><td>' . $langs->trans('TotalHT') . '</td><td>' . price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '</td></tr>';
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>"; print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td>' . price($objectsrc->total_tva, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>";
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0 ) // Localtax1 if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0 ) // Localtax1
{ {
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>"; print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>";
} }
if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2
{ {
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>"; print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>";
} }
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>"; print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td>' . price($objectsrc->total_ttc, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>";
} }
print "</table>\n"; print "</table>\n";
@ -2036,43 +2019,6 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
} }
// Project
/*
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Project') . '</td>';
if ($user->rights->propal->creer)
{
if ($action != 'classify')
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="5">';
if ($action == 'classify') {
$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1);
} else {
$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0);
}
print '</td></tr>';
} else {
print '</td></tr></table>';
if (! empty($object->fk_project)) {
print '<td colspan="3">';
$proj = new Project($db);
$proj->fetch($object->fk_project);
print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
print $proj->ref;
print '</a>';
print '</td>';
} else {
print '<td colspan="3">&nbsp;</td>';
}
}
print '</tr>';
}*/
if ($soc->outstanding_limit) if ($soc->outstanding_limit)
{ {
// Outstanding Bill // Outstanding Bill
@ -2129,7 +2075,6 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';

View File

@ -1457,10 +1457,10 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference // Reference
print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>'; print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td>' . $langs->trans("Draft") . '</td></tr>';
// Reference client // Reference client
print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td>';
if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER) && ! empty($origin) && ! empty($originid)) if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER) && ! empty($origin) && ! empty($originid))
print '<input type="text" name="ref_client" value="'.$ref_client.'"></td>'; print '<input type="text" name="ref_client" value="'.$ref_client.'"></td>';
else else
@ -1471,12 +1471,12 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>'; print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
if ($socid > 0) { if ($socid > 0) {
print '<td colspan="2">'; print '<td>';
print $soc->getNomUrl(1); print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="' . $soc->id . '">'; print '<input type="hidden" name="socid" value="' . $soc->id . '">';
print '</td>'; print '</td>';
} else { } else {
print '<td colspan="2">'; print '<td>';
print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty'); print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
@ -1497,12 +1497,12 @@ if ($action == 'create' && $user->rights->commande->creer)
// Contact of order // Contact of order
if ($socid > 0) { if ($socid > 0) {
print "<tr><td>" . $langs->trans("DefaultContact") . '</td><td colspan="2">'; print "<tr><td>" . $langs->trans("DefaultContact") . '</td><td>';
$form->select_contacts($soc->id, $setcontact, 'contactid', 1, $srccontactslist); $form->select_contacts($soc->id, $setcontact, 'contactid', 1, $srccontactslist);
print '</td></tr>'; print '</td></tr>';
// Ligne info remises tiers // Ligne info remises tiers
print '<tr><td>' . $langs->trans('Discounts') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('Discounts') . '</td><td>';
if ($soc->remise_percent) if ($soc->remise_percent)
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
else else
@ -1517,12 +1517,12 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</td></tr>'; print '</td></tr>';
} }
// Date // Date
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">'; print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td>';
$form->select_date('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date $form->select_date('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date
print '</td></tr>'; print '</td></tr>';
// Delivery date planed // Delivery date planed
print "<tr><td>".$langs->trans("DateDeliveryPlanned").'</td><td colspan="2">'; print "<tr><td>".$langs->trans("DateDeliveryPlanned").'</td><td>';
if (empty($datedelivery)) if (empty($datedelivery))
{ {
if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
@ -1532,31 +1532,31 @@ if ($action == 'create' && $user->rights->commande->creer)
print "</td></tr>"; print "</td></tr>";
// Conditions de reglement // Conditions de reglement
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">'; print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td>';
$form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', - 1, 1); $form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', - 1, 1);
print '</td></tr>'; print '</td></tr>';
// Mode de reglement // Mode de reglement
print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td>';
$form->select_types_paiements($mode_reglement_id, 'mode_reglement_id'); $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id');
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled))
{ {
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('BankAccount') . '</td><td>';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1); $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>'; print '</td></tr>';
} }
// Delivery delay // Delivery delay
print '<tr class="fielddeliverydelay"><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">'; print '<tr class="fielddeliverydelay"><td>' . $langs->trans('AvailabilityPeriod') . '</td><td>';
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1); $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1);
print '</td></tr>'; print '</td></tr>';
// Shipping Method // Shipping Method
if (! empty($conf->expedition->enabled)) { if (! empty($conf->expedition->enabled)) {
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td>';
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1); print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
print '</td></tr>'; print '</td></tr>';
} }
@ -1565,13 +1565,13 @@ if ($action == 'create' && $user->rights->commande->creer)
if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct=new FormProduct($db); $formproduct=new FormProduct($db);
print '<tr><td>' . $langs->trans('Warehouse') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('Warehouse') . '</td><td>';
print $formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1); print $formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1);
print '</td></tr>'; print '</td></tr>';
} }
// What trigger creation // What trigger creation
print '<tr><td>' . $langs->trans('Source') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('Source') . '</td><td>';
$form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1); $form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1);
print '</td></tr>'; print '</td></tr>';
@ -1582,7 +1582,7 @@ if ($action == 'create' && $user->rights->commande->creer)
{ {
$langs->load("projects"); $langs->load("projects");
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">'; print '<td>' . $langs->trans("Project") . '</td><td>';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>'; print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td>'; print '</td>';
@ -1594,7 +1594,7 @@ if ($action == 'create' && $user->rights->commande->creer)
{ {
print '<tr>'; print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->libelle_incoterms, 1).'</label></td>'; print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->libelle_incoterms, 1).'</label></td>';
print '<td colspan="3" class="maxwidthonsmartphone">'; print '<td class="maxwidthonsmartphone">';
$incoterm_id = GETPOST('incoterm_id'); $incoterm_id = GETPOST('incoterm_id');
$incoterm_location = GETPOST('location_incoterms'); $incoterm_location = GETPOST('location_incoterms');
if (empty($incoterm_id)) if (empty($incoterm_id))
@ -1607,16 +1607,15 @@ if ($action == 'create' && $user->rights->commande->creer)
} }
// Other attributes // Other attributes
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid); $parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
// hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) { if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit');
} }
// Template to use by default // Template to use by default
print '<tr><td>' . $langs->trans('DefaultModel') . '</td>'; print '<tr><td>' . $langs->trans('DefaultModel') . '</td>';
print '<td colspan="2">'; print '<td>';
include_once DOL_DOCUMENT_ROOT . '/core/modules/commande/modules_commande.php'; include_once DOL_DOCUMENT_ROOT . '/core/modules/commande/modules_commande.php';
$liste = ModelePDFCommandes::liste_modeles($db); $liste = ModelePDFCommandes::liste_modeles($db);
print $form->selectarray('model', $liste, $conf->global->COMMANDE_ADDON_PDF); print $form->selectarray('model', $liste, $conf->global->COMMANDE_ADDON_PDF);
@ -1627,7 +1626,7 @@ if ($action == 'create' && $user->rights->commande->creer)
{ {
print '<tr>'; print '<tr>';
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>'; print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">'; print '<td class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '</td></tr>'; print '</td></tr>';
} }
@ -1635,7 +1634,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Note public // Note public
print '<tr>'; print '<tr>';
print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>'; print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>';
print '<td colspan="2">'; print '<td>';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
@ -1646,7 +1645,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if (empty($user->societe_id)) { if (empty($user->societe_id)) {
print '<tr>'; print '<tr>';
print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>'; print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
print '<td colspan="2">'; print '<td>';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
@ -1689,26 +1688,26 @@ if ($action == 'create' && $user->rights->commande->creer)
$newclassname = $classname; $newclassname = $classname;
} }
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>'; print '<tr><td>' . $langs->trans($newclassname) . '</td><td>' . $objectsrc->getNomUrl(1) . '</td></tr>';
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>'; print '<tr><td>' . $langs->trans('TotalHT') . '</td><td>' . price($objectsrc->total_ht) . '</td></tr>';
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva) . "</td></tr>"; print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td>' . price($objectsrc->total_tva) . "</td></tr>";
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
{ {
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax1) . "</td></tr>"; print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax1) . "</td></tr>";
} }
if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 IRPF if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 IRPF
{ {
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>"; print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax2) . "</td></tr>";
} }
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>"; print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td>' . price($objectsrc->total_ttc) . "</td></tr>";
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled))
{ {
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>'; print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td>' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>"; print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td>' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>"; print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td>' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
} }
} }
@ -2269,7 +2268,7 @@ if ($action == 'create' && $user->rights->commande->creer)
else print '&nbsp;'; else print '&nbsp;';
print '</td></tr></table>'; print '</td></tr></table>';
print '</td>'; print '</td>';
print '<td colspan="3">'; print '<td>';
if ($action != 'editincoterm') if ($action != 'editincoterm')
{ {
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
@ -2291,7 +2290,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if ($action != 'editbankaccount' && $user->rights->commande->creer) if ($action != 'editbankaccount' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td>';
if ($action == 'editbankaccount') { if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
} else { } else {
@ -2302,7 +2301,6 @@ if ($action == 'create' && $user->rights->commande->creer)
} }
// Other attributes // Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';

View File

@ -411,17 +411,17 @@ if ($action == 'create' && !$error)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
// Third party // Third party
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td><td colspan="2">'; print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td><td>';
print $soc->getNomUrl(1); print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="'.$soc->id.'">'; print '<input type="hidden" name="socid" value="'.$soc->id.'">';
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
// Type // Type
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">'; print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Type').'</td><td>';
print '<table class="nobordernopadding">'."\n"; print '<table class="nobordernopadding">'."\n";
// Standard invoice // Standard invoice
@ -434,15 +434,15 @@ if ($action == 'create' && !$error)
print '</table>'; print '</table>';
// Date invoice // Date invoice
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">'; print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
$html->select_date('','','','','',"add",1,1); $html->select_date('','','','','',"add",1,1);
print '</td></tr>'; print '</td></tr>';
// Payment term // Payment term
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">'; print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
$html->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id'); $html->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id');
print '</td></tr>'; print '</td></tr>';
// Payment mode // Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
$html->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id'); $html->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id');
print '</td></tr>'; print '</td></tr>';
// Project // Project
@ -451,7 +451,7 @@ if ($action == 'create' && !$error)
$formproject=new FormProjets($db); $formproject=new FormProjets($db);
$langs->load('projects'); $langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Project').'</td><td>';
$formproject->select_projects($soc->id, $projectid, 'projectid'); $formproject->select_projects($soc->id, $projectid, 'projectid');
print '</td></tr>'; print '</td></tr>';
} }
@ -469,9 +469,8 @@ if ($action == 'create' && !$error)
} }
// Other attributes // Other attributes
$parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders, 'colspan' => ' colspan="3"'); $parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
$object=new Facture($db); $object=new Facture($db);
@ -489,8 +488,8 @@ if ($action == 'create' && !$error)
// Public note // Public note
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top">';
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'; print '<textarea name="note_public" class="quatrevingtpercent" rows="'.ROWS_3.'">';
print $langs->trans("Orders").": ".implode(', ', $listoforders); print $langs->trans("Orders").": ".implode(', ', $listoforders);
@ -500,8 +499,8 @@ if ($action == 'create' && !$error)
{ {
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
print '<td valign="top" colspan="2">'; print '<td valign="top">';
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'; print '<textarea name="note" class="quatrevingtpercent" rows="'.ROWS_3.'">';
print '</textarea></td></tr>'; print '</textarea></td></tr>';
} }

View File

@ -324,21 +324,21 @@ if ($action == 'create')
// Ref // Ref
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>'; print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.(GETPOST("ref")?GETPOST("ref",'alpha'):$object->ref).'" maxlength="12"></td></tr>'; print '<td><input size="8" type="text" class="flat" name="ref" value="'.(GETPOST("ref")?GETPOST("ref",'alpha'):$object->ref).'" maxlength="12"></td></tr>';
// Label // Label
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.GETPOST("label", 'alpha').'"></td></tr>'; print '<td><input size="30" type="text" class="flat" name="label" value="'.GETPOST("label", 'alpha').'"></td></tr>';
// Type // Type
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<td colspan="3">'; print '<td>';
$formbank->selectTypeOfBankAccount(isset($_POST["type"])?$_POST["type"]: Account::TYPE_CURRENT,"type"); $formbank->selectTypeOfBankAccount(isset($_POST["type"])?$_POST["type"]: Account::TYPE_CURRENT,"type");
print '</td></tr>'; print '</td></tr>';
// Currency // Currency
print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>';
print '<td colspan="3">'; print '<td>';
$selectedcode=$object->currency_code; $selectedcode=$object->currency_code;
if (! $selectedcode) $selectedcode=$conf->currency; if (! $selectedcode) $selectedcode=$conf->currency;
print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code'); print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
@ -348,7 +348,7 @@ if ($action == 'create')
// Status // Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td colspan="3">'; print '<td>';
print $form->selectarray("clos", $object->status,(isset($_POST["clos"])?$_POST["clos"]:$object->clos)); print $form->selectarray("clos", $object->status,(isset($_POST["clos"])?$_POST["clos"]:$object->clos));
print '</td></tr>'; print '</td></tr>';
@ -362,13 +362,13 @@ if ($action == 'create')
$object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
print '<tr><td class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
print '<td colspan="3">'; print '<td>';
print $form->select_country($selectedcode,'account_country_id'); print $form->select_country($selectedcode,'account_country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td></tr>'; print '</td></tr>';
// State // State
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">'; print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($selectedcode) if ($selectedcode)
{ {
$formcompany->select_departement(isset($_POST["account_state_id"])?$_POST["account_state_id"]:'',$selectedcode,'account_state_id'); $formcompany->select_departement(isset($_POST["account_state_id"])?$_POST["account_state_id"]:'',$selectedcode,'account_state_id');
@ -381,12 +381,12 @@ if ($action == 'create')
// Web // Web
print '<tr><td>'.$langs->trans("Web").'</td>'; print '<tr><td>'.$langs->trans("Web").'</td>';
print '<td colspan="3"><input class="minwidth300" type="text" class="flat" name="url" value="'.GETPOST("url").'"></td></tr>'; print '<td><input class="minwidth300" type="text" class="flat" name="url" value="'.GETPOST("url").'"></td></tr>';
// Tags-Categories // Tags-Categories
if ($conf->categorie->enabled) if ($conf->categorie->enabled)
{ {
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">'; print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
$c = new Categorie($db); $c = new Categorie($db);
$cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT); $cats = $c->containing($object->id,Categorie::TYPE_ACCOUNT);
@ -399,7 +399,7 @@ if ($action == 'create')
// Comment // Comment
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>'; print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
print '<td colspan="3">'; print '<td>';
// Editor wysiwyg // Editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,'90%'); $doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,'90%');
@ -407,7 +407,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$parameters=array('colspan' => 3); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
@ -422,18 +422,18 @@ if ($action == 'create')
// Sold // Sold
print '<tr><td class="titlefieldcreate">'.$langs->trans("InitialBankBalance").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("InitialBankBalance").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde")?GETPOST("solde"):price2num($object->solde)).'"></td></tr>'; print '<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde")?GETPOST("solde"):price2num($object->solde)).'"></td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td>'; print '<tr><td>'.$langs->trans("Date").'</td>';
print '<td colspan="3">'; print '<td>';
$form->select_date('', 're', 0, 0, 0, 'formsoc'); $form->select_date('', 're', 0, 0, 0, 'formsoc');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>'; print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(GETPOST("account_min_allowed")?GETPOST("account_min_allowed"):$object->min_allowed).'"></td></tr>'; print '<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(GETPOST("account_min_allowed")?GETPOST("account_min_allowed"):$object->min_allowed).'"></td></tr>';
print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>'; print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.(GETPOST("account_min_desired")?GETPOST("account_min_desired"):$object->min_desired).'"></td></tr>'; print '<td><input size="12" type="text" class="flat" name="account_min_desired" value="'.(GETPOST("account_min_desired")?GETPOST("account_min_desired"):$object->min_desired).'"></td></tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
@ -444,7 +444,7 @@ if ($action == 'create')
// If bank account // If bank account
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.(GETPOST('bank')?GETPOST('bank','alpha'):$object->bank).'"></td>'; print '<td><input size="30" type="text" class="flat" name="bank" value="'.(GETPOST('bank')?GETPOST('bank','alpha'):$object->bank).'"></td>';
print '</tr>'; print '</tr>';
// Show fields of bank account // Show fields of bank account
@ -477,21 +477,21 @@ if ($action == 'create')
// IBAN // IBAN
print '<tr><td>'.$langs->trans($ibankey).'</td>'; print '<tr><td>'.$langs->trans($ibankey).'</td>';
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOST('iban')?GETPOST('iban','alpha'):$object->iban).'"></td></tr>'; print '<td><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOST('iban')?GETPOST('iban','alpha'):$object->iban).'"></td></tr>';
print '<tr><td>'.$langs->trans($bickey).'</td>'; print '<tr><td>'.$langs->trans($bickey).'</td>';
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOST('bic')?GETPOST('bic','alpha'):$object->bic).'"></td></tr>'; print '<td><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOST('bic')?GETPOST('bic','alpha'):$object->bic).'"></td></tr>';
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">"; print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
print (GETPOST('domiciliation')?GETPOST('domiciliation'):$object->domiciliation); print (GETPOST('domiciliation')?GETPOST('domiciliation'):$object->domiciliation);
print "</textarea></td></tr>"; print "</textarea></td></tr>";
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>'; print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.(GETPOST('proprio')?GETPOST('proprio','alpha'):$object->proprio).'">'; print '<td><input size="30" type="text" class="flat" name="proprio" value="'.(GETPOST('proprio')?GETPOST('proprio','alpha'):$object->proprio).'">';
print '</td></tr>'; print '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">'; print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">"; print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
print (GETPOST('owner_address')?GETPOST('owner_address','alpha'):$object->owner_address); print (GETPOST('owner_address')?GETPOST('owner_address','alpha'):$object->owner_address);
print "</textarea></td></tr>"; print "</textarea></td></tr>";
@ -515,7 +515,7 @@ if ($action == 'create')
else else
{ {
print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>'; print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$object->account_number).'"></td></tr>'; print '<td><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$object->account_number).'"></td></tr>';
} }
// Accountancy journal // Accountancy journal
@ -565,7 +565,7 @@ else
// Onglets // Onglets
$head=bank_prepare_head($object); $head=bank_prepare_head($object);
dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');
$formconfirm = ''; $formconfirm = '';
@ -595,7 +595,7 @@ else
// Ref // Ref
/* /*
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'; print '<td>';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref'); print $form->showrefnav($object, 'ref', $linkback, 1, 'ref');
print '</td></tr>';*/ print '</td></tr>';*/
@ -726,7 +726,7 @@ else
} }
print '<tr><td>'.$langs->trans($val).'</td>'; print '<tr><td>'.$langs->trans($val).'</td>';
print '<td colspan="3">'.$content.'</td>'; print '<td>'.$content.'</td>';
print '</tr>'; print '</tr>';
} }
@ -944,12 +944,13 @@ else
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$parameters=array('colspan' => 3); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
print $object->showOptionals($extrafields,'edit'); print $object->showOptionals($extrafields,'edit');
} }
print '</table>'; print '</table>';
print '<br>'; print '<br>';

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * 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
@ -2028,6 +2028,7 @@ class AccountLine extends CommonObject
$result.=$langs->trans("BankAccount").': '; $result.=$langs->trans("BankAccount").': ';
$accountstatic=new Account($this->db); $accountstatic=new Account($this->db);
$accountstatic->id=$this->fk_account; $accountstatic->id=$this->fk_account;
$accountstatic->ref=$this->bank_account_ref;
$accountstatic->label=$this->bank_account_label; $accountstatic->label=$this->bank_account_label;
$result.=$accountstatic->getNomUrl(0).', '; $result.=$accountstatic->getNomUrl(0).', ';
} }

View File

@ -282,7 +282,7 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="1"'); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
@ -372,8 +372,8 @@ if ($id)
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="1"'); $parameters=array('socid'=>$object->id);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';

View File

@ -251,7 +251,7 @@ if ($action == 'create')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print "<tr>"; print "<tr>";
print '<td width="25%" class="fieldrequired">'.$langs->trans("Type").'</td><td>'; print '<td class="fieldrequired">'.$langs->trans("Type").'</td><td>';
$form->select_type_fees(GETPOST('type','int'),'type',1); $form->select_type_fees(GETPOST('type','int'),'type',1);
print '</td></tr>'; print '</td></tr>';
@ -277,7 +277,7 @@ if ($action == 'create')
// Public note // Public note
print '<tr>'; print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>'; print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td valign="top" colspan="2">'; print '<td>';
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8,'90%'); $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8,'90%');
print $doleditor->Create(1); print $doleditor->Create(1);
@ -289,7 +289,7 @@ if ($action == 'create')
{ {
print '<tr>'; print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>'; print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td valign="top" colspan="2">'; print '<td>';
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
@ -298,7 +298,7 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="2"'); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
@ -340,7 +340,7 @@ else if ($id)
// Ref // Ref
print "<tr>"; print "<tr>";
print '<td width="20%">'.$langs->trans("Ref").'</td><td>'; print '<td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $object->ref; print $object->ref;
print '</td></tr>'; print '</td></tr>';
@ -374,7 +374,7 @@ else if ($id)
// Public note // Public note
print '<tr><td class="tdtop">'.$langs->trans("NotePublic").'</td>'; print '<tr><td class="tdtop">'.$langs->trans("NotePublic").'</td>';
print '<td valign="top" colspan="3">'; print '<td>';
$doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); $doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
@ -385,7 +385,7 @@ else if ($id)
if (empty($user->societe_id)) if (empty($user->societe_id))
{ {
print '<tr><td class="tdtop">'.$langs->trans("NotePrivate").'</td>'; print '<tr><td class="tdtop">'.$langs->trans("NotePrivate").'</td>';
print '<td valign="top" colspan="3">'; print '<td>';
$doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); $doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
@ -394,7 +394,7 @@ else if ($id)
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
@ -502,8 +502,8 @@ else if ($id)
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"', 'showblocbydefault' => 1); $parameters=array('socid'=>$object->id);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print "</table><br>"; print "</table><br>";

View File

@ -2589,9 +2589,8 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"'); $parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="2"', 'cols'=>2);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) { if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit');
} }

View File

@ -200,7 +200,7 @@ if ($action == 'create')
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n"; print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="1"'); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
@ -237,20 +237,20 @@ if ($id)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print "<tr>"; print "<tr>";
print '<td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'; print '<td width="25%">'.$langs->trans("Ref").'</td><td>';
print $vatpayment->ref; print $vatpayment->ref;
print '</td></tr>'; print '</td></tr>';
print "<tr>"; print "<tr>";
print '<td>'.$langs->trans("DatePayment").'</td><td colspan="3">'; print '<td>'.$langs->trans("DatePayment").'</td><td>';
print dol_print_date($vatpayment->datep,'day'); print dol_print_date($vatpayment->datep,'day');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("DateValue").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateValue").'</td><td>';
print dol_print_date($vatpayment->datev,'day'); print dol_print_date($vatpayment->datev,'day');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="3">'.price($vatpayment->amount).'</td></tr>'; print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($vatpayment->amount).'</td></tr>';
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
@ -261,7 +261,7 @@ if ($id)
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>'; print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td colspan="3">'; print '<td>';
print $bankline->getNomUrl(1,0,'showall'); print $bankline->getNomUrl(1,0,'showall');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -269,7 +269,7 @@ if ($id)
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$vatpayment,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$vatpayment,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* *
@ -115,21 +115,20 @@ if ($result)
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"');
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"","","",'align="center"');
print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. $db->escape($search_ref).'"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. $db->escape($search_ref).'"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"');
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"","","",'align="center"');
print "</tr>\n";
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {

View File

@ -94,9 +94,7 @@ llxHeader('', $langs->trans("NewStandingOrder"));
if (prelevement_check_config() < 0) if (prelevement_check_config() < 0)
{ {
$langs->load("errors"); $langs->load("errors");
print '<div class="error">'; setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors');
print $langs->trans("ErrorModuleSetupNotComplete");
print '</div>';
} }
/*$h=0; /*$h=0;
@ -148,7 +146,7 @@ if ($nb)
} }
else else
{ {
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw")).'">'.$langs->trans("CreateAll")."</a>\n"; print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."</a>\n";
} }
print "</div>\n"; print "</div>\n";

View File

@ -157,7 +157,7 @@ if ($resql)
} }
else else
{ {
print '<tr '.$bc[false].'><td colspan="2" class="opacitymedium">'.$langs->trans("NoInvoiceToWithdraw").'</td></tr>'; print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders")).'</td></tr>';
} }
print "</table><br>"; print "</table><br>";
} }

View File

@ -134,6 +134,20 @@ if ($result)
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'. dol_escape_htmltag($search_line).'" size="6"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'. dol_escape_htmltag($search_bon).'" size="6"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'. dol_escape_htmltag($search_company).'" size="6"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'. dol_escape_htmltag($search_code).'" size="6"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"]); print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"]);
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref"); print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref");
@ -145,20 +159,6 @@ if ($result)
print_liste_field_titre(''); print_liste_field_titre('');
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_line" value="'. dol_escape_htmltag($search_line).'" size="6"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'. dol_escape_htmltag($search_bon).'" size="6"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'. dol_escape_htmltag($search_company).'" size="6"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'. dol_escape_htmltag($search_code).'" size="6"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
print '</tr>';
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> /* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com> * Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
@ -300,7 +300,7 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="1"'); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
@ -351,24 +351,24 @@ if ($id)
print '<tr><td class="titlefield">'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
print "<tr>"; print "<tr>";
print '<td>'.$langs->trans("DateStartPeriod").'</td><td colspan="3">'; print '<td>'.$langs->trans("DateStartPeriod").'</td><td>';
print dol_print_date($object->datesp,'day'); print dol_print_date($object->datesp,'day');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("DateEndPeriod").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateEndPeriod").'</td><td>';
print dol_print_date($object->dateep,'day'); print dol_print_date($object->dateep,'day');
print '</td></tr>'; print '</td></tr>';
print "<tr>"; print "<tr>";
print '<td>'.$langs->trans("DatePayment").'</td><td colspan="3">'; print '<td>'.$langs->trans("DatePayment").'</td><td>';
print dol_print_date($object->datep,'day'); print dol_print_date($object->datep,'day');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("DateValue").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateValue").'</td><td>';
print dol_print_date($object->datev,'day'); print dol_print_date($object->datev,'day');
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="3">'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
@ -379,7 +379,7 @@ if ($id)
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>'; print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td colspan="3">'; print '<td>';
print $bankline->getNomUrl(1,0,'showall'); print $bankline->getNomUrl(1,0,'showall');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -387,7 +387,7 @@ if ($id)
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
@ -405,7 +405,7 @@ if ($id)
{ {
if (! empty($user->rights->salaries->delete)) if (! empty($user->rights->salaries->delete))
{ {
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
} }
else else
{ {

View File

@ -282,7 +282,7 @@ if ($action == 'create')
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n"; print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="1"'); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';
@ -349,7 +349,8 @@ if ($id)
} }
// Other attributes // Other attributes
$reshook=$hookmanager->executeHooks('formObjectOptions','',$object,$action); // Note that $action and $object may have been modified by hook $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';

View File

@ -324,14 +324,4 @@ $dolibarr_nocsrfcheck='0';
// External module // External module
//############################## //##############################
// multicompany_transverse_mode
// Prerequisite: Need external module "multicompany"
// Pyramidal (0): The rights and groups are managed in each entity. Each user belongs to the entity he was created into.
// Transversal (1): The user is created and managed only into master entity but can login to all entities if he is admmin
// of entity or belongs to at least one user group created into entity.
// Default value: 0 (pyramidal)
// Examples:
// $multicompany_transverse_mode='1';

View File

@ -664,7 +664,7 @@ else
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $parameters=array('colspan' => ' colspan="3"','cols'=>3);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
@ -932,7 +932,7 @@ else
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $parameters=array('colspan' => ' colspan="3"', 'cols'=>3);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
@ -1102,18 +1102,6 @@ else
print $object->LibPubPriv($object->priv); print $object->LibPubPriv($object->priv);
print '</td></tr>'; print '</td></tr>';
// Note Public
/*
print '<tr><td class="tdtop">'.$langs->trans("NotePublic").'</td><td>';
print nl2br($object->note_public);
print '</td></tr>';
// Note Private
print '<tr><td class="tdtop">'.$langs->trans("NotePrivate").'</td><td>';
print nl2br($object->note_private);
print '</td></tr>';
*/
print '</table>'; print '</table>';
print '</div>'; print '</div>';
@ -1131,13 +1119,9 @@ else
} }
// Other attributes // Other attributes
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"'); $cols = 3;
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $parameyers=array('socid'=>$socid);
print $hookmanager->resPrint; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields);
}
$object->load_ref_elements(); $object->load_ref_elements();

View File

@ -1209,7 +1209,7 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$parameters=array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"'); $parameters=array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"', 'cols'=>3);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
// Other attributes // Other attributes

View File

@ -4104,8 +4104,8 @@ abstract class CommonObject
* Function to get extra fields of a member into $this->array_options * Function to get extra fields of a member into $this->array_options
* This method is in most cases called by method fetch of objects but you can call it separately. * This method is in most cases called by method fetch of objects but you can call it separately.
* *
* @param int $rowid Id of line * @param int $rowid Id of line. Use the id of object if not defined. Deprecated. Function must be called without parameters.
* @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label() * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters.
* @return int <0 if error, 0 if no optionals to find nor found, 1 if a line is found and optional loaded * @return int <0 if error, 0 if no optionals to find nor found, 1 if a line is found and optional loaded
*/ */
function fetch_optionals($rowid=null,$optionsArray=null) function fetch_optionals($rowid=null,$optionsArray=null)
@ -4119,10 +4119,21 @@ abstract class CommonObject
if (! is_array($optionsArray)) if (! is_array($optionsArray))
{ {
// optionsArray not already loaded, so we load it // $extrafields is not a known object, we initialize it. Best practice is to have $extrafields defined into card.php or list.php page.
// TODO Use of existing extrafield is not yet ready (must mutualize code that use extrafields in form first)
// global $extrafields;
//if (! is_object($extrafields))
//{
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db); $extrafields = new ExtraFields($this->db);
$optionsArray = $extrafields->fetch_name_optionals_label($this->table_element); //}
// Load array of extrafields for elementype = $this->table_element
if (empty($extrafields->attributes[$this->table_element]['loaded']))
{
$extrafields->fetch_name_optionals_label($this->table_element);
}
$optionsArray = $extrafields->attributes[$this->table_element]['label'];
} }
// Request to get complementary values // Request to get complementary values
@ -4130,13 +4141,16 @@ abstract class CommonObject
{ {
$sql = "SELECT rowid"; $sql = "SELECT rowid";
foreach ($optionsArray as $name => $label) foreach ($optionsArray as $name => $label)
{
if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || $extrafields->attributes[$this->table_element]['type'][$name] != 'separate')
{ {
$sql.= ", ".$name; $sql.= ", ".$name;
} }
}
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields";
$sql.= " WHERE fk_object = ".$rowid; $sql.= " WHERE fk_object = ".$rowid;
dol_syslog(get_class($this)."::fetch_optionals", LOG_DEBUG); dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -132,14 +132,7 @@ class Conf
$sql = "SELECT ".$db->decrypt('name')." as name,"; $sql = "SELECT ".$db->decrypt('name')." as name,";
$sql.= " ".$db->decrypt('value')." as value, entity"; $sql.= " ".$db->decrypt('value')." as value, entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " FROM ".MAIN_DB_PREFIX."const";
if (! empty($this->multicompany->transverse_mode))
{
$sql.= " WHERE entity IN (0,1,".$this->entity.")";
}
else
{
$sql.= " WHERE entity IN (0,".$this->entity.")"; $sql.= " WHERE entity IN (0,".$this->entity.")";
}
$sql.= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite. $sql.= " ORDER BY entity"; // This is to have entity 0 first, then entity 1 that overwrite.
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -69,6 +69,9 @@ class ExtraFields
// Array to store if extra field is hidden // Array to store if extra field is hidden
var $attribute_hidden; // warning, do not rely on this. If your module need a hidden data, it must use its own table. var $attribute_hidden; // warning, do not rely on this. If your module need a hidden data, it must use its own table.
// New array to store extrafields definition
var $attributes;
var $error; var $error;
var $errno; var $errno;
@ -149,7 +152,7 @@ class ExtraFields
// Create field into database except for separator type which is not stored in database // Create field into database except for separator type which is not stored in database
if ($type != 'separate') if ($type != 'separate')
{ {
$result=$this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list, $copmputed); $result=$this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list, $computed);
} }
$err1=$this->errno; $err1=$this->errno;
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
@ -640,11 +643,11 @@ class ExtraFields
/** /**
* Load array this->attribute_xxx like attribute_label, attribute_type, ... * Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
* *
* @param string $elementtype Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...) * @param string $elementtype Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED. Deprecated. Should not be required.
* @return array Array of attributes for all extra fields * @return array Array of attributes keys+label for all extra fields.
*/ */
function fetch_name_optionals_label($elementtype,$forceload=false) function fetch_name_optionals_label($elementtype,$forceload=false)
{ {
@ -657,9 +660,12 @@ class ExtraFields
$array_name_label=array(); $array_name_label=array();
// For avoid conflicts with external modules // To avoid conflicts with external modules. TODO Remove this.
if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label; if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
// We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management.
dol_syslog("fetch_name_optionals_label elementtype=".$elementtype);
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,list,ishidden,fielddefault,fieldcomputed"; $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,list,ishidden,fielddefault,fieldcomputed";
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
$sql.= " WHERE entity IN (0,".$conf->entity.")"; $sql.= " WHERE entity IN (0,".$conf->entity.")";
@ -673,12 +679,13 @@ class ExtraFields
{ {
while ($tab = $this->db->fetch_object($resql)) while ($tab = $this->db->fetch_object($resql))
{ {
// we can add this attribute to adherent object // We can add this attribute to object. TODO Remove this and return $this->attributes[$elementtype]['label']
if ($tab->type != 'separate') if ($tab->type != 'separate')
{ {
$array_name_label[$tab->name]=$tab->label; $array_name_label[$tab->name]=$tab->label;
} }
// Old usage
$this->attribute_type[$tab->name]=$tab->type; $this->attribute_type[$tab->name]=$tab->type;
$this->attribute_label[$tab->name]=$tab->label; $this->attribute_label[$tab->name]=$tab->label;
$this->attribute_size[$tab->name]=$tab->size; $this->attribute_size[$tab->name]=$tab->size;
@ -693,8 +700,25 @@ class ExtraFields
$this->attribute_perms[$tab->name]=$tab->perms; $this->attribute_perms[$tab->name]=$tab->perms;
$this->attribute_list[$tab->name]=$tab->list; $this->attribute_list[$tab->name]=$tab->list;
$this->attribute_hidden[$tab->name]=$tab->ishidden; $this->attribute_hidden[$tab->name]=$tab->ishidden;
// New usage
$this->attributes[$tab->elementtype]['type'][$tab->name]=$tab->type;
$this->attributes[$tab->elementtype]['label'][$tab->name]=$tab->label;
$this->attributes[$tab->elementtype]['size'][$tab->name]=$tab->size;
$this->attributes[$tab->elementtype]['elementtype'][$tab->name]=$tab->elementtype;
$this->attributes[$tab->elementtype]['default'][$tab->name]=$tab->fielddefault;
$this->attributes[$tab->elementtype]['computed'][$tab->name]=$tab->fieldcomputed;
$this->attributes[$tab->elementtype]['unique'][$tab->name]=$tab->fieldunique;
$this->attributes[$tab->elementtype]['required'][$tab->name]=$tab->fieldrequired;
$this->attributes[$tab->elementtype]['param'][$tab->name]=($tab->param ? unserialize($tab->param) : '');
$this->attributes[$tab->elementtype]['pos'][$tab->name]=$tab->pos;
$this->attributes[$tab->elementtype]['alwayseditable'][$tab->name]=$tab->alwayseditable;
$this->attributes[$tab->elementtype]['perms'][$tab->name]=$tab->perms;
$this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list;
$this->attributes[$tab->elementtype]['ishidden'][$tab->name]=$tab->ishidden;
} }
} }
if ($elementtype) $this->attributes[$elementtype]['loaded']=1;
} }
else else
{ {

View File

@ -59,8 +59,7 @@ class HookManager
/** /**
* Init array $this->hooks with instantiated action controlers. * Init array $this->hooks with instantiated action controlers.
* First, a hook is declared by a module by adding a constant MAIN_MODULE_MYMODULENAME_HOOKS * First, a hook is declared by a module by adding a constant MAIN_MODULE_MYMODULENAME_HOOKS with value 'nameofcontext1:nameofcontext2:...' into $this->const of module descriptor file.
* with value 'nameofcontext1:nameofcontext2:...' into $this->const of module descriptor file.
* This makes $conf->hooks_modules loaded with an entry ('modulename'=>array(nameofcontext1,nameofcontext2,...)) * This makes $conf->hooks_modules loaded with an entry ('modulename'=>array(nameofcontext1,nameofcontext2,...))
* When initHooks function is called, with initHooks(list_of_contexts), an array $this->hooks is defined with instance of controler * When initHooks function is called, with initHooks(list_of_contexts), an array $this->hooks is defined with instance of controler
* class found into file /mymodule/class/actions_mymodule.class.php (if module has declared the context as a managed context). * class found into file /mymodule/class/actions_mymodule.class.php (if module has declared the context as a managed context).

View File

@ -984,6 +984,7 @@ class Form
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo) if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo)
{ {
// No immediate load of all database
$placeholder=''; $placeholder='';
if ($selected && empty($selected_input_value)) if ($selected && empty($selected_input_value))
{ {
@ -1016,6 +1017,7 @@ class Form
} }
else else
{ {
// Immediate load of all database
$out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam); $out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam);
} }
@ -1023,7 +1025,8 @@ class Form
} }
/** /**
* Output html form to select a third party * Output html form to select a third party.
* Note, you must use the select_company to get the component to select a third party. This function must only be called by select_company.
* *
* @param string $selected Preselected type * @param string $selected Preselected type
* @param string $htmlname Name of field in form * @param string $htmlname Name of field in form
@ -1085,8 +1088,6 @@ class Form
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$events = null;
if ($conf->use_javascript_ajax && ! $forcecombo) if ($conf->use_javascript_ajax && ! $forcecombo)
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
@ -1474,7 +1475,7 @@ class Form
} }
else else
{ {
if (! empty($conf->multicompany->transverse_mode)) if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{ {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " ON ug.fk_user = u.rowid"; $sql.= " ON ug.fk_user = u.rowid";
@ -1571,7 +1572,7 @@ class Form
$moreinfo++; $moreinfo++;
} }
} }
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {
if ($obj->admin && ! $obj->entity) if ($obj->admin && ! $obj->entity)
{ {
@ -6202,7 +6203,7 @@ class Form
$out.= '>'; $out.= '>';
$out.= $obj->name; $out.= $obj->name;
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1) if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1)
{ {
$out.= " (".$obj->label.")"; $out.= " (".$obj->label.")";
} }

View File

@ -60,7 +60,7 @@ class InfoBox
$sql.= " d.rowid as box_id, d.file, d.note, d.tms"; $sql.= " d.rowid as box_id, d.file, d.note, d.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as d";
$sql.= " WHERE b.box_id = d.rowid"; $sql.= " WHERE b.box_id = d.rowid";
$sql.= " AND b.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; $sql.= " AND b.entity IN (0,".$conf->entity.")";
if ($zone >= 0) $sql.= " AND b.position = ".$zone; if ($zone >= 0) $sql.= " AND b.position = ".$zone;
if (is_object($user)) $sql.= " AND b.fk_user IN (0,".$user->id.")"; if (is_object($user)) $sql.= " AND b.fk_user IN (0,".$user->id.")";
else $sql.= " AND b.fk_user = 0"; else $sql.= " AND b.fk_user = 0";
@ -70,7 +70,7 @@ class InfoBox
{ {
$sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms"; $sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms";
$sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d"; $sql.= " FROM ".MAIN_DB_PREFIX."boxes_def as d";
$sql.= " WHERE d.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; $sql.= " WHERE d.entity IN (0,".$conf->entity.")";
} }
dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')."", LOG_DEBUG); dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user)?$user->id:'')."", LOG_DEBUG);

View File

@ -508,7 +508,7 @@ class Menubase
$sql = "SELECT m.rowid, m.type, m.module, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu, m.position"; $sql = "SELECT m.rowid, m.type, m.module, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu, m.position";
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
$sql.= " WHERE m.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; $sql.= " WHERE m.entity IN (0,".$conf->entity.")";
$sql.= " AND m.menu_handler IN ('".$menu_handler."','all')"; $sql.= " AND m.menu_handler IN ('".$menu_handler."','all')";
if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)"; if ($type_user == 0) $sql.= " AND m.usertype IN (0,2)";
if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)"; if ($type_user == 1) $sql.= " AND m.usertype IN (1,2)";

View File

@ -1539,7 +1539,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
$sql = "SELECT nom as id, nom as lib, libelle as label, description as description"; $sql = "SELECT nom as id, nom as lib, libelle as label, description as description";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; $sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'"; $sql.= " WHERE type = '".$type."'";
$sql.= " AND entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; $sql.= " AND entity IN (0,".$conf->entity.")";
$sql.= " ORDER BY description DESC"; $sql.= " ORDER BY description DESC";
dol_syslog('/core/lib/function2.lib.php::getListOfModels', LOG_DEBUG); dol_syslog('/core/lib/function2.lib.php::getListOfModels', LOG_DEBUG);

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -238,8 +238,6 @@ function group_prepare_head($object)
return $head; return $head;
} }
/** /**
* Prepare array with list of tabs * Prepare array with list of tabs
* *
@ -283,32 +281,6 @@ function user_admin_prepare_head()
return $head; return $head;
} }
/**
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @param array $aEntities Entities array
* @return array Array of tabs
*/
function entity_prepare_head($object, $aEntities)
{
global $mc;
$head = array();
foreach($aEntities as $entity)
{
$mc->getInfo($entity);
$head[$entity][0] = $_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;entity='.$entity;
$head[$entity][1] = $mc->label;
$head[$entity][2] = $entity;
}
return $head;
}
/** /**
* Show list of themes. Show all thumbs of themes * Show list of themes. Show all thumbs of themes
* *
@ -782,4 +754,3 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print '</table>'; print '</table>';
} }

View File

@ -39,7 +39,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
// Force master entity in transversal mode // Force master entity in transversal mode
$entity=$entitytotest; $entity=$entitytotest;
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) $entity=1; if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $entity=1;
$login=''; $login='';

View File

@ -45,7 +45,7 @@ function check_user_password_ldap($usertotest,$passwordtotest,$entitytotest)
// Force master entity in transversal mode // Force master entity in transversal mode
$entity=$entitytotest; $entity=$entitytotest;
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) $entity=1; if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $entity=1;
$login=''; $login='';
$resultFetchUser=''; $resultFetchUser='';

View File

@ -63,9 +63,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Home - Menu users and groups -- Home - Menu users and groups
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 402__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/user/card.php?leftmenu=users&amp;action=create', 'NewUser', 2, 'users', '$user->rights->user->user->creer || $user->admin', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 402__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/user/card.php?leftmenu=users&amp;action=create', 'NewUser', 2, 'users', '($user->rights->user->user->creer || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 403__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/group/index.php?leftmenu=users', 'Groups', 1, 'users', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 403__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/group/index.php?leftmenu=users', 'Groups', 1, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 404__+MAX_llx_menu__, 'home', '', 403__+MAX_llx_menu__, '/user/group/card.php?leftmenu=users&amp;action=create', 'NewGroup', 2, 'users', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 404__+MAX_llx_menu__, 'home', '', 403__+MAX_llx_menu__, '/user/group/card.php?leftmenu=users&amp;action=create', 'NewGroup', 2, 'users', '(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)', '', 2, 0, __ENTITY__);
-- Third parties -- Third parties
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
@ -211,7 +211,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__);
-- Setup -- Setup
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_journal', 2451__+MAX_llx_menu__, '/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingJournals', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 10, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2454__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_journal', 2451__+MAX_llx_menu__, '/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingJournals', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 10, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 40, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 40, __ENTITY__);

View File

@ -597,12 +597,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($usemenuhider || empty($leftmenu) || $leftmenu=="users") if ($usemenuhider || empty($leftmenu) || $leftmenu=="users")
{ {
$newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); $newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin);
$newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin, '', 'home'); $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"),2, ($user->rights->user->user->creer || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home');
$newmenu->add("/user/index.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin); $newmenu->add("/user/index.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin);
$newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin); $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin);
$newmenu->add("", $langs->trans("Groups"), 1, $user->rights->user->user->lire || $user->admin); $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin); $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/index.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin); $newmenu->add("/user/group/index.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, (($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
} }
} }

View File

@ -17,22 +17,28 @@
* *
* Need to have following variables defined: * Need to have following variables defined:
* $object (invoice, order, ...) * $object (invoice, order, ...)
* $action
* $conf * $conf
* $langs * $langs
* *
* $parameters
* $cols * $cols
*/ */
?> ?>
<!-- BEGIN PHP TEMPLATE admin_extrafields_view.tpl.php --> <!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php -->
<?php <?php
//$res = $object->fetch_optionals($object->id, $extralabels); if (! is_array($parameters)) $parameters = array();
$parameters = array('colspan' => ' colspan="'.$cols.'"', 'cols' => $cols, 'socid' => $object->fk_soc); if (! empty($cols)) $parameters['colspan'] = ' colspan="'.$cols.'"';
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); if (! empty($cols)) $parameters['cols'] = $cols;
if (! empty($object->fk_soc)) $parameters['socid'] = $object->fk_soc;
if (empty($reshook) && ! empty($extrafields->attribute_label)) $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label']))
{ {
foreach ($extrafields->attribute_label as $key => $label) foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
{ {
if ($action == 'edit_extras') if ($action == 'edit_extras')
{ {
@ -42,54 +48,63 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
$value = $object->array_options["options_" . $key]; $value = $object->array_options["options_" . $key];
} }
if ($extrafields->attribute_type[$key] == 'separate') if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate')
{ {
print $extrafields->showSeparator($key); print $extrafields->showSeparator($key);
} }
else else
{ {
if (!empty($extrafields->attribute_hidden[$key])) print '<tr class="hideobject"><td>'; if (! empty($extrafields->attributes[$object->table_element]['ishidden'][$key])) print '<tr class="hideobject"><td>';
else print '<tr><td>'; else print '<tr><td>';
print '<table width="100%" class="nobordernopadding">'; print '<table width="100%" class="nobordernopadding">';
print '<tr>'; print '<tr>';
print '<td'; print '<td';
//var_dump($action);exit; //var_dump($action);exit;
if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"'; if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' class="fieldrequired"';
print '>' . $langs->trans($label) . '</td>'; print '>' . $langs->trans($label) . '</td>';
//TODO Improve element and rights detection //TODO Improve element and rights detection
//var_dump($user->rights); //var_dump($user->rights);
$permok=false; $permok=false;
$keyforperm=$object->element; $keyforperm=$object->element;
if ($object->element == 'fichinter') $keyforperm='ficheinter'; if ($object->element == 'fichinter') $keyforperm='ficheinter';
if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write;
if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer;
if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer;
if ($object->element=='shipping') $permok=$user->rights->expedition->creer; if ($object->element=='shipping') $permok=$user->rights->expedition->creer;
if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer;
if ($object->element=='productlot') $permok=$user->rights->stock->creer; if ($object->element=='productlot') $permok=$user->rights->stock->creer;
if (($object->statut == 0 || $extrafields->attribute_alwayseditable[$key]) if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key]))
&& $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key)) && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key)
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>'; && empty($extrafields->attributes[$object->table_element]['computed'][$key]))
{
$fieldid='id';
if ($object->table_element == 'societe') $fieldid='socid';
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>';
}
print '</tr></table>'; print '</tr></table>';
$html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : '';
print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.'" colspan="'.$cols.'">'; print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.'" colspan="'.$cols.'">';
// Convert date into timestamp format // Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key], array('date','datetime'))) { if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) {
$value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $db->jdate($object->array_options['options_' . $key]); $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $db->jdate($object->array_options['options_' . $key]);
} }
//TODO Improve element and rights detection //TODO Improve element and rights detection
if ($action == 'edit_extras' && $permok && GETPOST('attribute') == $key) if ($action == 'edit_extras' && $permok && GETPOST('attribute') == $key)
{ {
$fieldid='id';
if ($object->table_element == 'societe') $fieldid='socid';
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">'; print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">';
print '<input type="hidden" name="action" value="update_extras">'; print '<input type="hidden" name="action" value="update_extras">';
print '<input type="hidden" name="attribute" value="' . $key . '">'; print '<input type="hidden" name="attribute" value="' . $key . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">'; print '<input type="hidden" name="'.$fieldid.'" value="' . $object->id . '">';
print $extrafields->showInputField($key, $value,'','','',0,$object->id); print $extrafields->showInputField($key, $value,'','','',0,$object->id);
@ -102,8 +117,41 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
print $extrafields->showOutputField($key, $value); print $extrafields->showOutputField($key, $value);
} }
print '</td></tr>' . "\n"; print '</td></tr>' . "\n";
print "\n";
// Add code to manage list depending on others
if (! empty($conf->use_javascript_ajax))
print '
<script type="text/javascript">
jQuery(document).ready(function() {
function showOptions(child_list, parent_list)
{
var val = $("select[name=\"options_"+parent_list+"\"]").val();
var parentVal = parent_list + ":" + val;
if(val > 0) {
$("select[name=\""+child_list+"\"] option[parent]").hide();
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").show();
} else {
$("select[name=\""+child_list+"\"] option").show();
}
}
function setListDependencies() {
jQuery("select option[parent]").parent().each(function() {
var child_list = $(this).attr("name");
var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":");
var parent_list = infos[0];
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list);
});
});
}
setListDependencies();
});
</script>'."\n";
} }
} }
} }
?> ?>
<!-- END PHP TEMPLATE admin_extrafields_view.tpl.php --> <!-- END PHP TEMPLATE extrafields_view.tpl.php -->

View File

@ -336,7 +336,7 @@ if ($action == 'create')
print '</tr>'; print '</tr>';
// Country // Country
print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td colspan="3" class="maxwidthonsmartphone">'; print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">';
print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id); print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td></tr>'; print '</td></tr>';
@ -346,7 +346,7 @@ if ($action == 'create')
// Public note // Public note
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>'; print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
print '<td valign="top" colspan="2">'; print '<td>';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
@ -356,7 +356,7 @@ if ($action == 'create')
if (empty($user->societe_id)) { if (empty($user->societe_id)) {
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>'; print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
print '<td valign="top" colspan="2">'; print '<td>';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
@ -371,7 +371,7 @@ if ($action == 'create')
} }
// Other attributes // Other attributes
$parameters=array('colspan' => 3); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
@ -442,7 +442,7 @@ if (! empty($id) && $action == 'edit')
} }
else else
{ {
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="2">'; print '<tr><td>'.$langs->trans("Amount").'</td><td>';
print price($object->amount,0,$langs,0,0,-1,$conf->currency); print price($object->amount,0,$langs,0,0,-1,$conf->currency);
print '</td></tr>'; print '</td></tr>';
} }
@ -467,7 +467,7 @@ if (! empty($id) && $action == 'edit')
print '</tr>'; print '</tr>';
// Country // Country
print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td colspan="3">'; print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>';
print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id'); print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td></tr>'; print '</td></tr>';
@ -496,7 +496,7 @@ if (! empty($id) && $action == 'edit')
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="2"'); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {

View File

@ -740,7 +740,7 @@ if ($action == 'create')
// Weight // Weight
print '<tr><td>'; print '<tr><td>';
print $langs->trans("Weight"); print $langs->trans("Weight");
print '</td><td><input name="weight" size="4" value="'.GETPOST('weight','int').'"> '; print '</td><td colspan="3"><input name="weight" size="4" value="'.GETPOST('weight','int').'"> ';
$text=$formproduct->select_measuring_units("weight_units","weight",GETPOST('weight_units','int')); $text=$formproduct->select_measuring_units("weight_units","weight",GETPOST('weight_units','int'));
$htmltext=$langs->trans("KeepEmptyForAutoCalculation"); $htmltext=$langs->trans("KeepEmptyForAutoCalculation");
print $form->textwithpicto($text, $htmltext); print $form->textwithpicto($text, $htmltext);

View File

@ -156,9 +156,6 @@ if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0;
if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0; if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0;
if (empty($dolibarr_mailing_limit_sendbycli)) $dolibarr_mailing_limit_sendbycli=0; if (empty($dolibarr_mailing_limit_sendbycli)) $dolibarr_mailing_limit_sendbycli=0;
if (empty($dolibarr_strict_mode)) $dolibarr_strict_mode=0; // For debug in php strict mode if (empty($dolibarr_strict_mode)) $dolibarr_strict_mode=0; // For debug in php strict mode
// TODO Multicompany Remove this. Useless.
if (empty($multicompany_transverse_mode)) $multicompany_transverse_mode=0;
if (empty($multicompany_force_entity)) $multicompany_force_entity=0; // To force entity in login page
// Security: CSRF protection // Security: CSRF protection
// This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST']) // This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST'])

View File

@ -243,12 +243,7 @@ if ($object->id > 0)
// Other attributes // Other attributes
$parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields);
}
// Module Adherent // Module Adherent
if (! empty($conf->adherent->enabled)) if (! empty($conf->adherent->enabled))

View File

@ -1995,7 +1995,6 @@ elseif (! empty($object->id))
} }
// Other attributes // Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';

View File

@ -366,7 +366,8 @@ if ($action == 'create' && !$error) {
$parameters = array ( $parameters = array (
'objectsrc' => $objectsrc, 'objectsrc' => $objectsrc,
'idsrc' => $listoforders, 'idsrc' => $listoforders,
'colspan' => ' colspan="3"' 'colspan' => ' colspan="2"',
'cols'=>2
); );
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

View File

@ -1674,7 +1674,7 @@ if ($action == 'create')
if ($socid > 0) if ($socid > 0)
{ {
// Discounts for third party // Discounts for third party
print '<tr><td>' . $langs->trans('Discounts') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('Discounts') . '</td><td>';
if ($soc->remise_percent) if ($soc->remise_percent)
print $langs->trans("CompanyHasRelativeDiscount", '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">' . $soc->remise_percent . '</a>'); print $langs->trans("CompanyHasRelativeDiscount", '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?socid=' . $soc->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid')) . '">' . $soc->remise_percent . '</a>');
else else
@ -1705,17 +1705,17 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Payment term // Payment term
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">'; print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
$form->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id, 'cond_reglement_id'); $form->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id, 'cond_reglement_id');
print '</td></tr>'; print '</td></tr>';
// Payment mode // Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
$form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id, 'mode_reglement_id', 'DBIT'); $form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id, 'mode_reglement_id', 'DBIT');
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account
print '<tr><td>'.$langs->trans('BankAccount').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('BankAccount').'</td><td>';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1); $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>'; print '</td></tr>';
@ -1724,7 +1724,7 @@ if ($action == 'create')
{ {
print '<tr>'; print '<tr>';
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>'; print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
print '<td colspan="2" class="maxwidthonsmartphone">'; print '<td class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '</td></tr>'; print '</td></tr>';
} }
@ -1735,7 +1735,7 @@ if ($action == 'create')
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
$langs->load('projects'); $langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('Project') . '</td><td>';
$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1); $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1);
print '</td></tr>'; print '</td></tr>';
} }
@ -1790,7 +1790,7 @@ if ($action == 'create')
$langs->load('orders'); $langs->load('orders');
$txt=$langs->trans("SupplierOrder"); $txt=$langs->trans("SupplierOrder");
} }
print '<tr><td>'.$txt.'</td><td colspan="2">'.$objectsrc->getNomUrl(1); print '<tr><td>'.$txt.'</td><td>'.$objectsrc->getNomUrl(1);
// We check if Origin document (id and type is known) has already at least one invoice attached to it // We check if Origin document (id and type is known) has already at least one invoice attached to it
$objectsrc->fetchObjectLinked($originid,$origin,'','invoice_supplier'); $objectsrc->fetchObjectLinked($originid,$origin,'','invoice_supplier');
$cntinvoice=count($objectsrc->linkedObjects['invoice_supplier']); $cntinvoice=count($objectsrc->linkedObjects['invoice_supplier']);
@ -1800,29 +1800,29 @@ if ($action == 'create')
echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['invoice_supplier'])->getNomUrl(1).')'; echo ' ('.$langs->trans('LatestRelatedBill').end($objectsrc->linkedObjects['invoice_supplier'])->getNomUrl(1).')';
} }
echo '</td></tr>'; echo '</td></tr>';
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>'; print '<tr><td>'.$langs->trans('TotalHT').'</td><td>'.price($objectsrc->total_ht).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>"; print '<tr><td>'.$langs->trans('TotalVAT').'</td><td>'.price($objectsrc->total_tva)."</td></tr>";
if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1 if ($mysoc->localtax1_assuj=="1" || $object->total_localtax1 != 0) //Localtax1
{ {
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>"; print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td><td>'.price($objectsrc->total_localtax1)."</td></tr>";
} }
if ($mysoc->localtax2_assuj=="1" || $object->total_localtax2 != 0) //Localtax2 if ($mysoc->localtax2_assuj=="1" || $object->total_localtax2 != 0) //Localtax2
{ {
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>"; print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td><td>'.price($objectsrc->total_localtax2)."</td></tr>";
} }
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>"; print '<tr><td>'.$langs->trans('TotalTTC').'</td><td>'.price($objectsrc->total_ttc)."</td></tr>";
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled))
{ {
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>'; print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td>' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>"; print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td>' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>"; print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td>' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
} }
} }
// Other options // Other options
$parameters=array('colspan' => ' colspan="6"'); $parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
// Bouton "Create Draft" // Bouton "Create Draft"

View File

@ -31,8 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$langs->load("products"); $langs->loadLangs(array("products","suppliers"));
$langs->load("suppliers");
if (!$user->rights->produit->lire && !$user->rights->service->lire) accessforbidden(); if (!$user->rights->produit->lire && !$user->rights->service->lire) accessforbidden();
@ -42,40 +41,66 @@ $snom = GETPOST('snom');
$type = GETPOST('type'); $type = GETPOST('type');
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$sortfield = GETPOST('sortfield'); // Load variable for pagination
$sortorder = GETPOST('sortorder'); $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$page = GETPOST('page'); $sortfield = GETPOST('sortfield','alpha');
if ($page < 0) { $sortorder = GETPOST('sortorder','alpha');
$page = 0 ; $page = GETPOST('page','int');
} if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="p.ref"; // Set here default search field
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield = 'p.ref'; $fourn_id = GETPOST('fourn_id', 'intcomma');
if (! $sortorder) $sortorder = 'DESC'; $catid = GETPOST('catid', 'intcomma');
if (GETPOST('button_removefilter')) // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
{ $hookmanager->initHooks(array('supplierpricelist'));
$sref = ''; $extrafields = new ExtraFields($db);
$sRefSupplier = '';
$snom = '';
}
$fourn_id = GETPOST('fourn_id', 'int');
if (isset($_REQUEST['catid']))
{
$catid = $_REQUEST['catid'];
}
/* /*
* Mode Liste * ACTIONS
* *
* Put here all code to do according to value of "action" parameter
*/ */
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// 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
{
$sref = '';
$sRefSupplier = '';
$snom = '';
$search_field1='';
$search_field2='';
$search_date_creation='';
$search_date_update='';
$toselect='';
$search_array_options=array();
}
}
/*
* View
*/
$form = new Form($db);
$productstatic = new Product($db); $productstatic = new Product($db);
$companystatic = new Societe($db); $companystatic = new Societe($db);
@ -87,6 +112,17 @@ if ($fourn_id)
$supplier->fetch($fourn_id); $supplier->fetch($fourn_id);
} }
$arrayofmassactions = array(
'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type, p.entity,"; $sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type, p.entity,";
$sql.= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,"; $sql.= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,";
$sql.= " s.rowid as socid, s.nom as name"; $sql.= " s.rowid as socid, s.nom as name";
@ -155,7 +191,7 @@ if ($resql)
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
if (isset($catid)) if (! empty($catid))
{ {
print "<div id='ways'>"; print "<div id='ways'>";
$c = new Categorie($db); $c = new Categorie($db);
@ -175,17 +211,6 @@ if ($resql)
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
// Lignes des titres
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefSupplierShort"),$_SERVER["PHP_SELF"], "ppf.ref_fourn",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Supplier"),$_SERVER["PHP_SELF"], "ppf.fk_soc",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"], "ppf.price",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"], "ppf.quantity",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("UnitPrice"),$_SERVER["PHP_SELF"], "ppf.unitprice",$param,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
// Lignes des champs de filtre // Lignes des champs de filtre
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -197,13 +222,28 @@ if ($resql)
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="snom" value="'.$snom.'">'; print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" colspan="4" align="right">'; print '<td></td>';
print '<input type="image" class="liste_titre" value="button_search" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td></td>';
print '&nbsp; '; print '<td></td>';
print '<input type="image" class="liste_titre" value="button_removefilter" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '<td></td>';
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Lignes des titres
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefSupplierShort"),$_SERVER["PHP_SELF"], "ppf.ref_fourn",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Supplier"),$_SERVER["PHP_SELF"], "ppf.fk_soc",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"], "ppf.price",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"], "ppf.quantity",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("UnitPrice"),$_SERVER["PHP_SELF"], "ppf.unitprice",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"]);
print "</tr>\n";
$oldid = ''; $oldid = '';
$var=True; $var=True;
while ($i < min($num,$limit)) while ($i < min($num,$limit))
@ -236,6 +276,8 @@ if ($resql)
print '<td align="right">'.(isset($objp->unitprice) ? price($objp->unitprice) : '').'</td>'; print '<td align="right">'.(isset($objp->unitprice) ? price($objp->unitprice) : '').'</td>';
print '<td align="right"></td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }

View File

@ -1209,7 +1209,7 @@ class Holiday extends CommonObject
$sql = "SELECT u.rowid"; $sql = "SELECT u.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{ {
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE (ug.fk_user = u.rowid"; $sql.= " WHERE (ug.fk_user = u.rowid";
@ -1305,7 +1305,7 @@ class Holiday extends CommonObject
$sql = "SELECT u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut"; $sql = "SELECT u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{ {
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE (ug.fk_user = u.rowid"; $sql.= " WHERE (ug.fk_user = u.rowid";

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* *
@ -165,7 +165,7 @@ if (empty($user->societe_id))
DOL_DOCUMENT_ROOT."/contact/class/contact.class.php", DOL_DOCUMENT_ROOT."/contact/class/contact.class.php",
DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
DOL_DOCUMENT_ROOT."/product/class/product.class.php", DOL_DOCUMENT_ROOT."/product/class/product.class.php",
DOL_DOCUMENT_ROOT."/product/class/service.class.php", DOL_DOCUMENT_ROOT."/product/class/product.class.php",
DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php", DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php",
DOL_DOCUMENT_ROOT."/commande/class/commande.class.php", DOL_DOCUMENT_ROOT."/commande/class/commande.class.php",
DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",

View File

@ -381,3 +381,17 @@ create table llx_loan_schedule
)ENGINE=innodb; )ENGINE=innodb;
ALTER TABLE llx_tva ADD COLUMN datec date AFTER tms; ALTER TABLE llx_tva ADD COLUMN datec date AFTER tms;
ALTER TABLE llx_user_rights ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
ALTER TABLE llx_user_rights DROP FOREIGN KEY fk_user_rights_fk_user_user;
ALTER TABLE llx_user_rights DROP INDEX uk_user_rights;
ALTER TABLE llx_user_rights DROP INDEX fk_user;
ALTER TABLE llx_user_rights ADD UNIQUE INDEX uk_user_rights (entity, fk_user, fk_id);
ALTER TABLE llx_user_rights ADD CONSTRAINT fk_user_rights_fk_user_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);
ALTER TABLE llx_usergroup_rights ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
ALTER TABLE llx_usergroup_rights DROP FOREIGN KEY fk_usergroup_rights_fk_usergroup;
ALTER TABLE llx_usergroup_rights DROP INDEX fk_usergroup;
ALTER TABLE llx_usergroup_rights ADD UNIQUE INDEX uk_usergroup_rights (entity, fk_usergroup, fk_id);
ALTER TABLE llx_usergroup_rights ADD CONSTRAINT fk_usergroup_rights_fk_usergroup FOREIGN KEY (fk_usergroup) REFERENCES llx_usergroup (rowid);

View File

@ -1,6 +1,7 @@
-- ============================================================================ -- ============================================================================
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
-- --
-- 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
@ -21,7 +22,6 @@
-- Delete orphans -- Delete orphans
-- V4 DELETE llx_user_rights FROM llx_user_rights LEFT JOIN llx_user ON llx_user_rights.fk_user = llx_user.rowid WHERE llx_user.rowid IS NULL; -- V4 DELETE llx_user_rights FROM llx_user_rights LEFT JOIN llx_user ON llx_user_rights.fk_user = llx_user.rowid WHERE llx_user.rowid IS NULL;
ALTER TABLE llx_user_rights ADD UNIQUE INDEX uk_user_rights (entity, fk_user, fk_id);
ALTER TABLE llx_user_rights ADD CONSTRAINT fk_user_rights_fk_user_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid); ALTER TABLE llx_user_rights ADD CONSTRAINT fk_user_rights_fk_user_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);
ALTER TABLE llx_user_rights ADD UNIQUE INDEX uk_user_rights (fk_user, fk_id);

View File

@ -1,5 +1,6 @@
-- ============================================================================ -- ============================================================================
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> -- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
-- Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
-- --
-- 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
@ -19,6 +20,7 @@
create table llx_user_rights create table llx_user_rights
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
fk_user integer NOT NULL, fk_user integer NOT NULL,
fk_id integer NOT NULL fk_id integer NOT NULL
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -1,5 +1,6 @@
-- ============================================================================ -- ============================================================================
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
-- --
-- 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
@ -20,5 +21,6 @@
-- Supprime orhpelins pour permettre montee de la cle -- Supprime orhpelins pour permettre montee de la cle
-- V4 DELETE llx_usergroup_rights FROM llx_usergroup_rights LEFT JOIN llx_usergroup ON llx_usergroup_rights.fk_usergroup = llx_usergroup.rowid WHERE llx_usergroup.rowid IS NULL; -- V4 DELETE llx_usergroup_rights FROM llx_usergroup_rights LEFT JOIN llx_usergroup ON llx_usergroup_rights.fk_usergroup = llx_usergroup.rowid WHERE llx_usergroup.rowid IS NULL;
ALTER TABLE llx_usergroup_rights ADD UNIQUE INDEX uk_usergroup_rights (entity, fk_usergroup, fk_id);
ALTER TABLE llx_usergroup_rights ADD CONSTRAINT fk_usergroup_rights_fk_usergroup FOREIGN KEY (fk_usergroup) REFERENCES llx_usergroup (rowid); ALTER TABLE llx_usergroup_rights ADD CONSTRAINT fk_usergroup_rights_fk_usergroup FOREIGN KEY (fk_usergroup) REFERENCES llx_usergroup (rowid);

View File

@ -1,5 +1,6 @@
-- ============================================================================ -- ============================================================================
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
-- --
-- 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
@ -19,9 +20,9 @@
create table llx_usergroup_rights create table llx_usergroup_rights
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
fk_usergroup integer NOT NULL, fk_usergroup integer NOT NULL,
fk_id integer NOT NULL, fk_id integer NOT NULL
UNIQUE(fk_usergroup,fk_id)
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -136,6 +136,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09
// Create the global $hookmanager object // Create the global $hookmanager object
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db); $hookmanager=new HookManager($db);
$hookmanager->initHooks(array('upgrade'));
if (!$db->connected) if (!$db->connected)
{ {
@ -492,12 +493,16 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09
} }
} }
else else
{
//if (! empty($conf->modules))
if (! empty($conf->modules_parts['hooks'])) // If there is at least one module with one hook, we show message to say nothing was done
{ {
print '<tr><td colspan="4">'; print '<tr><td colspan="4">';
print '<b>'.$langs->trans('UpgradeExternalModule').'</b>: '.$langs->trans("None"); print '<b>'.$langs->trans('UpgradeExternalModule').'</b>: '.$langs->trans("None");
print '</td></tr>'; print '</td></tr>';
} }
} }
}
print '</table>'; print '</table>';

View File

@ -390,7 +390,7 @@ ExtrafieldCheckBox=Checkboxes
ExtrafieldCheckBoxFromList=Checkboxes from table ExtrafieldCheckBoxFromList=Checkboxes from table
ExtrafieldLink=Link to an object ExtrafieldLink=Link to an object
ComputedFormula=Computed field ComputedFormula=Computed field
ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: <strong>$db, $conf, $langs, $mysoc, $user, $object</strong>.<br><strong>WARNING</strong>: Only some properties of $object may be available. If you need a properties not loaded, just fetch yourself the object into your formula like in the second example.<br>Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.<br><br>Example of formula:<br>$object->id < 5 ? round($object->id / 2, 2) : ($object->id + 2*$user->id) * (int) substr($mysoc->zip, 1, 2)<br><br>Example of formula to force load of object and its parent object:<br>(($reloadedobj = new Task($db)) && ($reloadedobj->fetch($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetch($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : 'Parent project not found'<br><br>Other example to reload object<br>(($reloadedobj = new Societe($db)) && ($reloadedobj->fetch($obj->id ? $obj->id : ($obj->rowid ? $obj->rowid : $object->id)) > 0)) ? round($reloadedobj->capital / 5) : '-1' ComputedFormulaDesc=You can enter here a formula using other properties of object or any PHP coding to get a dynamic computed value. You can use any PHP compatible formulas including the "?" condition operator, and following global object: <strong>$db, $conf, $langs, $mysoc, $user, $object</strong>.<br><strong>WARNING</strong>: Only some properties of $object may be available. If you need a properties not loaded, just fetch yourself the object into your formula like in the second example.<br>Using a computed field means you can't enter yourself any value from interface. Also, if there is a syntax error, the formula may return nothing.<br><br>Example of formula:<br>$object->id < 10 ? round($object->id / 2, 2) : ($object->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)<br><br>Example to reload object<br>(($reloadedobj = new Societe($db)) && ($reloadedobj->fetch($obj->id ? $obj->id : ($obj->rowid ? $obj->rowid : $object->id)) > 0)) ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5 : '-1'<br><br>Other example of formula to force load of object and its parent object:<br>(($reloadedobj = new Task($db)) && ($reloadedobj->fetch($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetch($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : 'Parent project not found'
ExtrafieldParamHelpselect=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...<br><br>In order to have the list depending on another complementary attribute list :<br>1,value1|options_<i>parent_list_code</i>:parent_key<br>2,value2|options_<i>parent_list_code</i>:parent_key <br><br>In order to have the list depending on another list :<br>1,value1|<i>parent_list_code</i>:parent_key<br>2,value2|<i>parent_list_code</i>:parent_key ExtrafieldParamHelpselect=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...<br><br>In order to have the list depending on another complementary attribute list :<br>1,value1|options_<i>parent_list_code</i>:parent_key<br>2,value2|options_<i>parent_list_code</i>:parent_key <br><br>In order to have the list depending on another list :<br>1,value1|<i>parent_list_code</i>:parent_key<br>2,value2|<i>parent_list_code</i>:parent_key
ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>... ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpradio=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>... ExtrafieldParamHelpradio=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...

View File

@ -726,7 +726,7 @@ ViewPrivateNote=View notes
XMoreLines=%s line(s) hidden XMoreLines=%s line(s) hidden
PublicUrl=Public URL PublicUrl=Public URL
AddBox=Add box AddBox=Add box
SelectElementAndClickRefresh=Select an element and click Refresh SelectElementAndClick=Select an element and click %s
PrintFile=Print File %s PrintFile=Print File %s
ShowTransaction=Show entry on bank account ShowTransaction=Show entry on bank account
GoIntoSetupToChangeLogo=Go into Home - Setup - Company to change logo or go into Home - Setup - Display to hide. GoIntoSetupToChangeLogo=Go into Home - Setup - Company to change logo or go into Home - Setup - Display to hide.

View File

@ -17,7 +17,7 @@ NbOfInvoiceToWithdrawWithInfo=Nb. of customer invoice with direct debit payment
InvoiceWaitingWithdraw=Invoice waiting for direct debit InvoiceWaitingWithdraw=Invoice waiting for direct debit
AmountToWithdraw=Amount to withdraw AmountToWithdraw=Amount to withdraw
WithdrawsRefused=Direct debit refused WithdrawsRefused=Direct debit refused
NoInvoiceToWithdraw=No customer invoice in payment mode "withdraw" is waiting. Go on 'Withdraw' tab on invoice card to make a request. NoInvoiceToWithdraw=No customer invoice with open 'Direct debit requests' is waiting. Go on tab '%s' on invoice card to make a request.
ResponsibleUser=Responsible user ResponsibleUser=Responsible user
WithdrawalsSetup=Direct debit payment setup WithdrawalsSetup=Direct debit payment setup
WithdrawStatistics=Direct debit payment statistics WithdrawStatistics=Direct debit payment statistics

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com> * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2006 Andre Cianfarani <andre.cianfarani@acdeveloppement.net> * Copyright (C) 2006 Andre Cianfarani <andre.cianfarani@acdeveloppement.net>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
@ -98,11 +98,6 @@ if (! empty($dolibarr_main_document_root_alt))
} }
} }
// Set properties specific to multicompany
// TODO Multicompany Remove this. Useless. Var should be read when required.
$conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode; // Force Multi-Company transverse mode
$conf->multicompany->force_entity = empty($multicompany_force_entity)?'':(int) $multicompany_force_entity; // Force entity in login page
// Chargement des includes principaux de librairies communes // Chargement des includes principaux de librairies communes
if (! defined('NOREQUIREUSER')) require_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php'; // Need 500ko memory if (! defined('NOREQUIREUSER')) require_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php'; // Need 500ko memory
if (! defined('NOREQUIRETRAN')) require_once DOL_DOCUMENT_ROOT .'/core/class/translate.class.php'; if (! defined('NOREQUIRETRAN')) require_once DOL_DOCUMENT_ROOT .'/core/class/translate.class.php';
@ -170,10 +165,6 @@ if (! defined('NOREQUIREDB'))
{ {
$conf->entity = $_COOKIE['DOLENTITY']; $conf->entity = $_COOKIE['DOLENTITY'];
} }
else if (! empty($conf->multicompany->force_entity) && is_numeric($conf->multicompany->force_entity)) // To force entity in login page
{
$conf->entity = $conf->multicompany->force_entity;
}
// Sanitize entity // Sanitize entity
if (! is_numeric($conf->entity)) $conf->entity=1; if (! is_numeric($conf->entity)) $conf->entity=1;

View File

@ -165,7 +165,6 @@ class MyModuleObject extends CommonObject
* *
* @param int $id Id object * @param int $id Id object
* @param string $ref Ref * @param string $ref Ref
*
* @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 fetch($id, $ref = null) public function fetch($id, $ref = null)
@ -200,19 +199,12 @@ class MyModuleObject extends CommonObject
//... //...
} }
// Retrieve all extrafields for invoice $this->db->free($resql);
// fetch optionals attributes and labels
/* $this->fetch_optionals();
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
*/
// $this->fetch_lines(); // $this->fetch_lines();
$this->db->free($resql);
if ($numrows) { if ($numrows) {
return 1; return 1;
} else { } else {
@ -221,7 +213,6 @@ class MyModuleObject extends CommonObject
} else { } else {
$this->errors[] = 'Error ' . $this->db->lasterror(); $this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
return - 1; return - 1;
} }
} }

View File

@ -169,8 +169,9 @@ class modMyModule extends DolibarrModules
); );
*/ */
// Boxes // Boxes
// Add here list of php file(s) stored in core/boxes that contains class to show a box. // Add here list of php file(s) stored in core/boxes that contains class to show a widget.
$this->boxes = array(); // List of boxes $this->boxes = array(); // List of boxes
// Example: // Example:
//$this->boxes=array( //$this->boxes=array(
@ -179,24 +180,38 @@ class modMyModule extends DolibarrModules
// 2=>array('file'=>'myboxc.php@mymodule','note'=>'') // 2=>array('file'=>'myboxc.php@mymodule','note'=>'')
//); //);
// Cronjobs // Cronjobs
$this->cronjobs = array(); // List of cron jobs entries to add $this->cronjobs = array(); // List of cron jobs entries to add
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'test'=>true), // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'test'=>true),
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'test'=>true) // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'test'=>true)
// ); // );
// Permissions // Permissions
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$r=0;
// Add here list of permission defined by an id, a label, a boolean and two constant strings. $r=0;
// Example: $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
// $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) $this->rights[$r][1] = 'Read objects of My Module'; // Permission label
// $this->rights[$r][1] = 'Permision label'; // Permission label $this->rights[$r][3] = 1; // Permission by default for new user (0/1)
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1) $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $r++; $r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/Update objects of My Module'; // Permission label
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'create'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Delete objects of My Module'; // Permission label
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mymodule->level1->level2)
// Main menu entries // Main menu entries
$this->menu = array(); // List of menus to add $this->menu = array(); // List of menus to add

View File

@ -396,7 +396,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Other attributes // Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';

View File

@ -35,7 +35,7 @@
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); //if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) //if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
// Change this following line to use the correct relative path (../, ../../, etc) // Change this following lines to use the correct relative path (../, ../../, etc)
$res=0; $res=0;
if (! $res && file_exists("../main.inc.php")) $res=@include '../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory if (! $res && file_exists("../main.inc.php")) $res=@include '../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory
if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory if (! $res && file_exists("../../main.inc.php")) $res=@include '../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory
@ -49,8 +49,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
dol_include_once('/mymodule/class/myobject.class.php'); dol_include_once('/mymodule/class/myobject.class.php');
// Load traductions files requiredby by page // Load traductions files requiredby by page
$langs->load("mymodule"); $langs->loadLangs(array("mymodule","other"));
$langs->load("other");
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$massaction=GETPOST('massaction','alpha'); $massaction=GETPOST('massaction','alpha');
@ -89,14 +88,14 @@ if ($user->societe_id > 0)
} }
// Initialize technical object to manage context to save list fields // Initialize technical object to manage context to save list fields
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'mymodulelist'; $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectlist';
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('mymodulelist')); $hookmanager->initHooks(array('myobjectlist'));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('mymodule'); $extralabels = $extrafields->fetch_name_optionals_label('myobject');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
@ -110,7 +109,7 @@ if (empty($user->socid)) $fieldstosearchall["t.note_private"]="NotePrivate";
$arrayfields=array( $arrayfields=array(
't.field1'=>array('label'=>"Field1", 'checked'=>1), 't.field1'=>array('label'=>"Field1", 'checked'=>1),
't.field2'=>array('label'=>"Field2", 'checked'=>1), 't.field2'=>array('label'=>"Field2", 'checked'=>1),
//'t.entity'=>array('label'=>"Entity", 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), //'t.entity'=>array('label'=>"Entity", 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))),
't.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500), 't.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500),
't.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), 't.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
//'t.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), //'t.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
@ -263,7 +262,7 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) &&
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->rowid; $id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/skeleton/card.php?id='.$id); header("Location: ".DOL_URL_ROOT.'/mymodule/myobject_card.php?id='.$id);
exit; exit;
} }
@ -289,7 +288,7 @@ $arrayofmassactions = array(
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); if ($user->rights->mymodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array(); if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
@ -330,38 +329,11 @@ if (! empty($moreforfilter))
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Fields title
print '<tr class="liste_titre">';
// LIST_OF_TD_TITLE_FIELDS
//if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
//if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>'."\n";
// Fields title search // Fields title search
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -416,11 +388,40 @@ if (! empty($arrayfields['t.tms']['checked']))
}*/ }*/
// Action column // Action column
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
// Fields title
print '<tr class="liste_titre">';
// LIST_OF_TD_TITLE_FIELDS
//if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
//if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>'."\n";
// Detect if we need a fetch on each output line // Detect if we need a fetch on each output line
$needToFetchEachLine=0; $needToFetchEachLine=0;

View File

@ -1045,7 +1045,7 @@ else
} }
// Other attributes // Other attributes
$parameters=array('colspan' => 3); $parameters=array('cols' => 3);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
@ -1364,7 +1364,7 @@ else
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="2"'); $parameters=array('colspan' => ' colspan="3"', 'cols'=>3);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
@ -1727,11 +1727,7 @@ else
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'"'); $parameters=array('colspan' => ' colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields);
}
// Categories // Categories
if($conf->categorie->enabled) { if($conf->categorie->enabled) {

View File

@ -191,6 +191,7 @@ if ($object->id)
dol_fiche_head($head, 'documents', $titre, -1, $picto); dol_fiche_head($head, 'documents', $titre, -1, $picto);
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

View File

@ -41,6 +41,11 @@ class Listview
$this->totalRow=0; $this->totalRow=0;
$this->TField=array(); $this->TField=array();
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$this->extrafields = new ExtraFields($this->db);
$this->extralabels = $this->extrafields->fetch_name_optionals_label('product');
$this->search_array_options=$this->extrafields->getOptionalsFromPost($this->extralabels,'','search_');
} }
/** /**
@ -808,6 +813,9 @@ class Listview
} }
else else
{ {
// Overrive search from extrafields
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
if (isset($this->extralabels[$field])) $TParam['search'][$field] = $this->extrafields->showInputField($field, $this->search_array_options['search_options_'.$field], '', '', 'search_');
$visible = 1; $visible = 1;
} }

View File

@ -611,7 +611,7 @@ else
} }
//var_dump($arraytitle,$arrayhide); //var_dump($arraytitle,$arrayhide);
$list=new Listview($db, 'products'); $list=new Listview($db, 'product');
$listHTML = $list->render($sql,array( $listHTML = $list->render($sql,array(
'list'=>array( 'list'=>array(
'title'=>$texte 'title'=>$texte

View File

@ -616,7 +616,7 @@ if ($id > 0 || $ref)
print '</td></tr>'; print '</td></tr>';
// Hook formObject // Hook formObject
$parameters=array('colspan' => 3); $parameters=array('cols'=>2);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
// Desired stock // Desired stock

View File

@ -102,7 +102,7 @@ $arrayfields=array(
't.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>1), 't.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>1),
't.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>1), 't.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>1),
//'t.import_key'=>array('label'=>$langs->trans("ImportKey"), 'checked'=>1), //'t.import_key'=>array('label'=>$langs->trans("ImportKey"), 'checked'=>1),
//'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))),
//'t.fk_user_creat'=>array('label'=>$langs->trans("UserCreationShort"), 'checked'=>0, 'position'=>500), //'t.fk_user_creat'=>array('label'=>$langs->trans("UserCreationShort"), 'checked'=>0, 'position'=>500),
//'t.fk_user_modif'=>array('label'=>$langs->trans("UserModificationShort"), 'checked'=>0, 'position'=>500), //'t.fk_user_modif'=>array('label'=>$langs->trans("UserModificationShort"), 'checked'=>0, 'position'=>500),
't.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), 't.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),

View File

@ -392,7 +392,9 @@ class Project extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
if ($this->db->num_rows($resql)) $num_rows = $this->db->num_rows($resql);
if ($num_rows)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
@ -423,12 +425,16 @@ class Project extends CommonObject
$this->db->free($resql); $this->db->free($resql);
// Retreive all extrafield for thirdparty
$this->fetch_optionals();
return 1; return 1;
} }
else
{ $this->db->free($resql);
return 0;
} if ($num_rows) return 1;
else return 0;
} }
else else
{ {

View File

@ -250,6 +250,9 @@ class Task extends CommonObject
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->rang = $obj->rang; $this->rang = $obj->rang;
// Retreive all extrafield for thirdparty
$this->fetch_optionals();
} }
$this->db->free($resql); $this->db->free($resql);
@ -579,9 +582,10 @@ class Task extends CommonObject
* @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string * @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string
* @param string $sep Separator between ref and label if option addlabel is set * @param string $sep Separator between ref and label if option addlabel is set
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$option='',$mode='task', $addlabel=0, $sep=' - ', $notooltip=0) function getNomUrl($withpicto=0,$option='',$mode='task', $addlabel=0, $sep=' - ', $notooltip=0, $save_lastsearch_value=-1)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
@ -599,6 +603,10 @@ class Task extends CommonObject
} }
$url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option=='withproject'?'&withproject=1':''); $url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option=='withproject'?'&withproject=1':'');
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
$linkclose = ''; $linkclose = '';
if (empty($notooltip)) if (empty($notooltip))

View File

@ -193,7 +193,7 @@ if ($id > 0 || ! empty($ref))
// Project card // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Title // Title

View File

@ -136,7 +136,7 @@ if ($object->id > 0)
// Project card // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Title // Title

View File

@ -115,7 +115,7 @@ if ($object->id > 0)
$param=($mode=='mine'?'&mode=mine':''); $param=($mode=='mine'?'&mode=mine':'');
// Project card // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Title // Title

View File

@ -227,7 +227,7 @@ if ($id > 0 || ! empty($ref))
// Project card // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Title // Title
@ -430,7 +430,7 @@ if ($id > 0 || ! empty($ref))
* Fiche tache en mode visu * Fiche tache en mode visu
*/ */
$param=($withproject?'&withproject=1':''); $param=($withproject?'&withproject=1':'');
$linkback=$withproject?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':''; $linkback=$withproject?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'&restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>':'';
dol_fiche_head($head, 'task_task', $langs->trans("Task"), -1, 'projecttask'); dol_fiche_head($head, 'task_task', $langs->trans("Task"), -1, 'projecttask');
@ -511,13 +511,10 @@ if ($id > 0 || ! empty($ref))
print nl2br($object->description); print nl2br($object->description);
print '</td></tr>'; print '</td></tr>';
// Other options // Other attributes
$parameters=array(); $cols = 3;
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $parameyers=array('socid'=>$socid);
if (empty($reshook) && ! empty($extrafields->attribute_label)) include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
{
print $object->showOptionals($extrafields);
}
print '</table>'; print '</table>';

View File

@ -311,7 +311,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
// Project card // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Title // Title

View File

@ -175,7 +175,7 @@ if (! $action)
print '</tr>'; print '</tr>';
// Other attributes // Other attributes
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); $parameters=array('objectsrc' => $objectsrc);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {

View File

@ -201,7 +201,7 @@ if ( $object->fetch($id) > 0 )
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); $parameters=array('objectsrc' => $objectsrc);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
@ -269,12 +269,7 @@ if ( $object->fetch($id) > 0 )
print '</td>'; print '</td>';
// Other attributes // Other attributes
$parameters=array(); include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields);
}
print '</tr>'; print '</tr>';

View File

@ -280,6 +280,21 @@ if (empty($reshook))
$res=$object->setValueFrom('localtax2_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); $res=$object->setValueFrom('localtax2_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY');
} }
if ($action == 'update_extras') {
$object->fetch($socid);
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) $error++;
if (! $error)
{
$result = $object->insertExtraFields();
if ($result < 0) $error++;
}
if ($error) $action = 'edit_extras';
}
// Add new or update third party // Add new or update third party
if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode')) if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode'))
&& ($action == 'add' || $action == 'update') && $user->rights->societe->creer) && ($action == 'add' || $action == 'update') && $user->rights->societe->creer)
@ -2310,12 +2325,7 @@ else
// Other attributes // Other attributes
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields);
}
// Parent company // Parent company
if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY))

View File

@ -1062,7 +1062,6 @@ class Societe extends CommonObject
else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
dol_syslog(get_class($this)."::fetch ".$sql);
if ($resql) if ($resql)
{ {
$num=$this->db->num_rows($resql); $num=$this->db->num_rows($resql);
@ -1196,11 +1195,7 @@ class Societe extends CommonObject
$result = 1; $result = 1;
// Retreive all extrafield for thirdparty // Retreive all extrafield for thirdparty
// fetch optionals attributes and labels $this->fetch_optionals();
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
} }
else else
{ {
@ -1695,7 +1690,7 @@ class Societe extends CommonObject
$sql = "SELECT DISTINCT u.rowid, u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo"; $sql = "SELECT DISTINCT u.rowid, u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{ {
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ((ug.fk_user = sc.fk_user"; $sql.= " WHERE ((ug.fk_user = sc.fk_user";

View File

@ -142,13 +142,13 @@ if (! empty($socid))
$sql = "SELECT DISTINCT u.rowid, u.login, u.fk_soc, u.lastname, u.firstname, u.statut, u.entity, u.photo"; $sql = "SELECT DISTINCT u.rowid, u.login, u.fk_soc, u.lastname, u.firstname, u.statut, u.entity, u.photo";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{ {
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
} }
$sql .= " WHERE sc.fk_soc =".$object->id; $sql .= " WHERE sc.fk_soc =".$object->id;
$sql .= " AND sc.fk_user = u.rowid"; $sql .= " AND sc.fk_user = u.rowid";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{ {
$sql.= " AND ((ug.fk_user = sc.fk_user"; $sql.= " AND ((ug.fk_user = sc.fk_user";
$sql.= " AND ug.entity = ".$conf->entity.")"; $sql.= " AND ug.entity = ".$conf->entity.")";
@ -174,10 +174,7 @@ if (! empty($socid))
$parameters=array('socid'=>$object->id); $parameters=array('socid'=>$object->id);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$obj,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$obj,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
null; // actions in normal case
}
$tmpuser->id = $obj->rowid; $tmpuser->id = $obj->rowid;
$tmpuser->firstname = $obj->firstname; $tmpuser->firstname = $obj->firstname;
@ -232,7 +229,7 @@ if (! empty($socid))
$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.login, u.email, u.statut, u.fk_soc, u.photo"; $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.login, u.email, u.statut, u.fk_soc, u.photo";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
{ {
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ((ug.fk_user = u.rowid"; $sql.= " WHERE ((ug.fk_user = u.rowid";

View File

@ -359,16 +359,7 @@ if ($sql_select)
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, '', 0, '', '', $limit); print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, '', 0, '', '', $limit);
print '<table class="liste" width="100%">'."\n"; print '<table class="liste" width="100%">'."\n";
// Titles with sort buttons
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('TotalHT'),$_SERVER['PHP_SELF'],'total_ht','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('UnitPrice'),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
// Filters // Filters
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
@ -393,6 +384,18 @@ if ($sql_select)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Titles with sort buttons
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('TotalHT'),$_SERVER['PHP_SELF'],'total_ht','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('UnitPrice'),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$i = 0; $i = 0;
while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit))
{ {
@ -609,7 +612,7 @@ else if (empty($type_element) || $type_element == -1)
print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
print '<tr '.$bc[0].'><td class="opacitymedium" colspan="5">'.$langs->trans("SelectElementAndClickRefresh").'</td></tr>'; print '<tr '.$bc[0].'><td class="opacitymedium" colspan="5">'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'</td></tr>';
print "</table>"; print "</table>";
} }

View File

@ -840,6 +840,11 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">'; print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
} }
else
{
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
echo $extrafields->showInputField($key, $search_array_options['search_options_'.$key], '', '', 'search_');
}
print '</td>'; print '</td>';
} }
} }

View File

@ -959,27 +959,13 @@ if (empty($reshook))
// Fill array 'array_options' with data from update form // Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
if ($ret < 0) if ($ret < 0) $error++;
$error ++; if (! $error)
{
if (! $error) {
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('supplier_proposaldao'));
$parameters = array('id' => $object->id);
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been
// modified by
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields(); $result = $object->insertExtraFields();
if ($result < 0) { if ($result < 0) $error++;
$error ++;
} }
} else if ($reshook < 0) if ($error) $action = 'edit_extras';
$error ++;
}
if ($error)
$action = 'edit_extras';
} }
} }
@ -1163,9 +1149,7 @@ if ($action == 'create')
// Other attributes // Other attributes
$parameters = array('colspan' => ' colspan="3"'); $parameters = array('colspan' => ' colspan="3"');
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
// by
// hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) { if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit');
} }

View File

@ -265,7 +265,7 @@ input.select2-input {
border-bottom: solid 1px rgba(0,0,0,.2) !important; /* required to avoid to lose bottom line when focus is lost on select2. */ border-bottom: solid 1px rgba(0,0,0,.2) !important; /* required to avoid to lose bottom line when focus is lost on select2. */
} }
.liste_titre input[name=monthvalid], .liste_titre input[name=search_smonth], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=month_lim] { .liste_titre input[name=monthvalid], .liste_titre input[name=search_smonth], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month], .liste_titre input[name=month_lim] {
margin-right: 4px; margin-right: 4px;
} }
input[type=submit] { input[type=submit] {
@ -691,7 +691,7 @@ div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive
overflow-x: auto; overflow-x: auto;
} }
div.fiche>form>div.div-table-responsive { div.fiche>form>div.div-table-responsive {
min-height: 390px; min-height: 392px;
} }
.flexcontainer { .flexcontainer {

Some files were not shown because too many files have changed in this diff Show More