Merge branch 'develop' into new_ask_price
This commit is contained in:
commit
34bc1dbc15
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,6 +9,7 @@ default.properties
|
||||
.buildpath
|
||||
.gitmodules
|
||||
dolibarr_install.log
|
||||
upgrade.log
|
||||
doxygen_warnings.log
|
||||
/.project
|
||||
.DS_Store
|
||||
|
||||
@ -13,10 +13,25 @@ Issues are tracked at [Doliforge](https://doliforge.org/projects/dolibarr)
|
||||
|
||||
Code
|
||||
----
|
||||
|
||||
### Basic workflow
|
||||
|
||||
1. Fork the [GitHub repository](https://github.com/Dolibarr/dolibarr).
|
||||
2. Clone your fork.
|
||||
3. Commit and push your changes.
|
||||
4. Make a pull request.
|
||||
3. Choose a branch(See the Branches section below).
|
||||
4. Commit and push your changes.
|
||||
5. Make a pull request.
|
||||
|
||||
### Branches
|
||||
|
||||
Unless you're fixing a bug, all pull request should be made against the *develop* branch.
|
||||
|
||||
If you're fixing a bug, it is preferred that you cook your fix and pull request it
|
||||
against the oldest version affected that's still supported.
|
||||
|
||||
We officially support versions N, N − 1 and N − 2 for N the latest version available.
|
||||
|
||||
Choose your base branch accordingly.
|
||||
|
||||
### General rules
|
||||
Please don't edit the ChangeLog file. A project manager will update it from your commit messages.
|
||||
@ -32,9 +47,9 @@ Long description (Can span accross multiple lines).
|
||||
|
||||
Where KEYWORD is one of:
|
||||
|
||||
- void: don't put a keyword if the commit is not introducing feature or closing a bug.
|
||||
- NEW: for new features (May be followed by the task number i.e: #123)
|
||||
- FIXED: for bug fixes (May be followed by the bug number i.e: #456)
|
||||
- "FIXED:" for bug fixes (May be followed by the bug number i.e: #456)
|
||||
- "NEW:" for new features (May be followed by the task number i.e: #123)
|
||||
- void, don't put a keyword if the commit is not introducing feature or closing a bug.
|
||||
|
||||
### Resources
|
||||
[Developer documentation](http://wiki.dolibarr.org/index.php/Developer_documentation)
|
||||
|
||||
@ -1,13 +1,11 @@
|
||||
--------------------------------------------------------------
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
***** ChangeLog for 3.8 compared to 3.7.* *****
|
||||
- New: Add Option to not change date on cloning project
|
||||
- New: Add check list from table for extrafield type
|
||||
|
||||
|
||||
***** ChangeLog for 3.8 compared to 3.7.* *****
|
||||
For users:
|
||||
- New: Add Option to not change date on cloning project
|
||||
- New: Add check list from table for extrafield type
|
||||
- New: Use new combobox.
|
||||
- New: Add hidden option MAXTABS_IN_CARD.
|
||||
- Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined'
|
||||
@ -16,6 +14,7 @@ For users:
|
||||
- Introduce option MAIN_HTML_TITLE to start to control format of html title content.
|
||||
- Add extrafields on bank account cards.
|
||||
- Added delay between mails in Newsletter module
|
||||
- [ task #1793 ] Create new permission to restrict commercial agent margin to logged user
|
||||
|
||||
For translators:
|
||||
- Update language files.
|
||||
|
||||
4
INSTALL
4
INSTALL
@ -1,6 +1,6 @@
|
||||
INSTALL
|
||||
-------
|
||||
|
||||
English: See README file.
|
||||
English: See README.md file.
|
||||
|
||||
French: Voir fichier README-FR.
|
||||
French: Voir fichier README-FR.md.
|
||||
|
||||
15
README-FR.md
15
README-FR.md
@ -1,21 +1,16 @@
|
||||
# DOLIBARR ERP & CRM
|
||||
|
||||
## INTRODUCTION
|
||||
|
||||
Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans).
|
||||
Il est simple d'utilisation et modulaire, vous permettant de n'activez que les fonctions dont vous avez besoin (contacts, fournisseurs, factures, commandes, stocks, agenda, ...).
|
||||
|
||||

|
||||
|
||||
--------------------------------
|
||||
Documentation démarrage rapide
|
||||
--------------------------------
|
||||
|
||||
1) Installer Dolibarr
|
||||
2) Mettre à jour Dolibarr depuis une ancienne version
|
||||
3) Ce qui est nouveau dans cette version
|
||||
4) Ce que peux faire Dolibarr
|
||||
5) Ce que ne peux pas faire Dolibarr (pas encore)
|
||||
|
||||
## LICENCE
|
||||
|
||||
Dolibarr est distribué sous les termes de la licence GNU General Public License v3+ ou supérieure.
|
||||
|
||||
|
||||
|
||||
## INSTALLER DOLIBARR
|
||||
|
||||
@ -58,9 +58,9 @@ You can use a Web server and a supported database (MySQL recommended) to install
|
||||
## UPGRADING
|
||||
|
||||
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
||||
- If you're upgrading from version x.y.z to x.y.w (only third number differs), there is no need to run any migration process
|
||||
- If you're upgrading from version x.y.z to x.y.w (only third number differs), there is no need to run any migration process.
|
||||
- If you're upgrading from a beta version or from any version x.y.z to any other where x or y number differs, you must call the Dolibarr "install/" page in your browser (this should be done automatically at first dolibarr access) and follow the upgrade process.
|
||||
-
|
||||
|
||||
*Note: migration process can safely be done multiple times.*
|
||||
|
||||
## NEWS
|
||||
|
||||
@ -299,3 +299,17 @@ http://packages.qa.debian.org
|
||||
|
||||
* Package will be into release when test will be moved as stable.
|
||||
|
||||
|
||||
##### Send an unblock request
|
||||
Use this to move from unstable to testing.
|
||||
reportbug -B debian
|
||||
Choose package "release.debian.org"
|
||||
Then "unblock"
|
||||
Then name of package "dolibarr"
|
||||
Fill message, for example:
|
||||
"Please unblock package dolibarr
|
||||
A security error CVE-2014-7137 was reported and is fixed into package 3.5.5.
|
||||
Note that package 3.5.5 was prepared before the CVE was reported and include other fixes, but they are all related to stability or security (other se$
|
||||
After discussion with ..., it appears that security holes are enough to request this unblock request."
|
||||
|
||||
|
||||
|
||||
@ -376,7 +376,7 @@ $cfg['DefaultConnectionCollation'] = 'utf8_unicode_ci';
|
||||
// libraries/select_lang.lib.php
|
||||
// $cfg['Lang'] = 'en-iso-8859-1';
|
||||
|
||||
// Regullar expression to limit listed languages, eg. '^(cs|en)' for Czech and
|
||||
// Regular expression to limit listed languages, eg. '^(cs|en)' for Czech and
|
||||
// English only
|
||||
$cfg['FilterLanguages'] = '';
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -42,9 +42,15 @@ if (!$user->admin)
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
// Other parameters ACCOUNTING_*
|
||||
// Other parameters ACCOUNTING_EXPORT_*
|
||||
$list = array (
|
||||
'ACCOUNTING_SEPARATORCSV'
|
||||
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
||||
'ACCOUNTING_EXPORT_DATE',
|
||||
'ACCOUNTING_EXPORT_PIECE',
|
||||
'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
|
||||
'ACCOUNTING_EXPORT_LABEL',
|
||||
'ACCOUNTING_EXPORT_AMOUNT',
|
||||
'ACCOUNTING_EXPORT_DEVISE'
|
||||
);
|
||||
|
||||
/*
|
||||
@ -57,7 +63,7 @@ if ($action == 'update') {
|
||||
|
||||
if (! empty($modelcsv)) {
|
||||
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
@ -108,57 +114,63 @@ print '</tr>';
|
||||
$var = ! $var;
|
||||
|
||||
print '<tr ' . $bc[$var] . '>';
|
||||
print "<td>" . $langs->trans("Selectmodelcsv") . "</td>";
|
||||
print "<td>";
|
||||
print '<select class="flat" name="modelcsv" id="modelcsv">';
|
||||
print '<option value="0"';
|
||||
if ($conf->global->ACCOUNTING_MODELCSV == 0) {
|
||||
print ' selected="selected"';
|
||||
print '<td width="50%">' . $langs->trans("Selectmodelcsv") . '</td>';
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
print $langs->trans("NotAvailableWhenAjaxDisabled");
|
||||
print "</td>";
|
||||
}
|
||||
print '>' . $langs->trans("Modelcsv_normal") . '</option>';
|
||||
print '<option value="1"';
|
||||
if ($conf->global->ACCOUNTING_MODELCSV == 1) {
|
||||
print ' selected="selected"';
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
$listmodelcsv=array(
|
||||
'1'=>$langs->trans("Modelcsv_normal"),
|
||||
'2'=>$langs->trans("Modelcsv_CEGID")
|
||||
);
|
||||
print $form->selectarray("modelcsv",$listmodelcsv,$conf->global->ACCOUNTING_EXPORT_MODELCSV,0);
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
print '>' . $langs->trans("Modelcsv_CEGID") . '</option>';
|
||||
print "</select>";
|
||||
print "</td></tr>";
|
||||
print "</table>";
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
/*
|
||||
* Params
|
||||
*
|
||||
* Parameters
|
||||
*/
|
||||
|
||||
$num = count($list);
|
||||
if ($num) {
|
||||
if ($num)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
||||
print "</tr>\n";
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1) print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
|
||||
|
||||
foreach ( $list as $key ) {
|
||||
$var = ! $var;
|
||||
|
||||
print '<tr ' . $bc[$var] . ' class="value">';
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td width="50%">' . $label . '</td>';
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
foreach ( $list as $key ) {
|
||||
$var = ! $var;
|
||||
print '<br><div style="text-align:center"><input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '" name="button"></div>';
|
||||
|
||||
print '<tr ' . $bc[$var] . ' class="value">';
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td>' . $label . '</td>';
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><div style="text-align:center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
@ -50,10 +50,10 @@ if ($year == 0) {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
llxHeader('', $langs->trans("CustomersVentilation"));
|
||||
llxHeader('', $langs->trans("Bookkeeping"));
|
||||
|
||||
$textprevyear = "<a href=\"balancebymonth.php?year=" . ($year_current - 1) . "\">" . img_previous() . "</a>";
|
||||
$textnextyear = " <a href=\"balancebymonth.php?year=" . ($year_current + 1) . "\">" . img_next() . "</a>";
|
||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
|
||||
print_fiche_titre($langs->trans("AccountBalanceByMonth") . ' ' . $textprevyear . ' ' . $langs->trans("Year") . ' ' . $year_start . ' ' . $textnextyear);
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ if ($action == 'delbookkeeping') {
|
||||
setEventMessage($object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} // export csv
|
||||
} // Export
|
||||
else if ($action == 'export_csv') {
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
@ -151,7 +151,7 @@ else {
|
||||
|
||||
print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey'));
|
||||
|
||||
print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" />';
|
||||
print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -160,7 +160,7 @@ else {
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="export_csv">';
|
||||
print '<input type="submit" class="button" style="float: right;" value="Export CSV" />';
|
||||
print '<input type="submit" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
print '</form>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -231,4 +231,4 @@ else {
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
@ -56,12 +56,11 @@ $offset = $conf->liste_limit * $page;
|
||||
|
||||
llxHeader('', $langs->trans("Bookkeeping"));
|
||||
|
||||
$textprevyear = "<a href=\"listbyyear.php?year=" . ($year_current - 1) . "\">" . img_previous() . "</a>";
|
||||
$textnextyear = " <a href=\"listbyyear.php?year=" . ($year_current + 1) . "\">" . img_next() . "</a>";
|
||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
|
||||
/*
|
||||
* Mode Liste
|
||||
*
|
||||
* Mode List
|
||||
*/
|
||||
|
||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens, bk.code_journal";
|
||||
|
||||
@ -53,7 +53,6 @@ class AccountingAccount extends CommonObject
|
||||
* @param DoliDB $db Database handle
|
||||
*/
|
||||
function __construct($db)
|
||||
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ class FormVentilation extends Form
|
||||
$label = $obj->account_number . ' - ' . $obj->label;
|
||||
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accountingaccount and not the account_number
|
||||
// Bacause same account_number can be share between different accounting_system and do have the same meaning
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if (($selectid != '') && $selectid == $obj->rowid) {
|
||||
// $out .= '<option value="' . $obj->account_number . '" selected="selected">' . $label . '</option>';
|
||||
$out .= '<option value="' . $obj->rowid . '" selected="selected">' . $label . '</option>';
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
@ -40,19 +40,18 @@ $id = GETPOST('id');
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch)
|
||||
{
|
||||
if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
|
||||
if (! GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql .= " SET fk_code_ventilation = " . $codeventil;
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
|
||||
dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) {
|
||||
@ -61,7 +60,7 @@ if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch)
|
||||
} else {
|
||||
header("Location: ./lines.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
llxHeader("", "", "FicheVentilation");
|
||||
@ -86,38 +85,38 @@ if (! empty($id)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON l.fk_code_ventilation = aa.rowid";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = l.fk_facture";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
|
||||
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
}
|
||||
|
||||
|
||||
dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
||||
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
if ($num_lines) {
|
||||
|
||||
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php">'.$langs->trans("Back").'</a>';
|
||||
print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'setup');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Ref facture
|
||||
print '<tr><td>' . $langs->trans("Invoice") . '</td>';
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->id = $objp->facid;
|
||||
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr><td width="20%">' . $langs->trans("Line") . '</td>';
|
||||
print '<td>' . nl2br($objp->description) . '</td></tr>';
|
||||
print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>';
|
||||
@ -126,13 +125,13 @@ if (! empty($id)) {
|
||||
print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1);
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print "Error";
|
||||
@ -145,4 +144,4 @@ if (! empty($id)) {
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page accueil clients ventilation comptable
|
||||
* \brief Home customer ventilation
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -75,6 +75,8 @@ if ($action == 'validatehistory') {
|
||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||
}
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
@ -93,7 +95,7 @@ if ($action == 'validatehistory') {
|
||||
llxHeader('', $langs->trans("CustomersVentilation"));
|
||||
|
||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
|
||||
print_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
|
||||
|
||||
@ -105,6 +107,7 @@ $sql .= " , " . MAIN_DB_PREFIX . "facture as f";
|
||||
$sql .= " WHERE fd.fk_code_ventilation = 0";
|
||||
$sql .= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1;";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$row = $db->fetch_row($result);
|
||||
@ -160,6 +163,7 @@ if (! empty($conf->multicompany->enabled)) {
|
||||
|
||||
$sql .= " GROUP BY fd.fk_code_ventilation";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
@ -194,7 +198,7 @@ print "</table>\n";
|
||||
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("MarchMin") . '</td>';
|
||||
@ -232,6 +236,7 @@ if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
@ -303,7 +308,8 @@ if (! empty($conf->margin->enabled)) {
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
}
|
||||
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
|
||||
@ -133,7 +133,7 @@ if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
|
||||
}
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog("/accountancy/customer/linges.php sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog("/accountancy/customer/lines.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
@ -220,5 +220,5 @@ if ($result) {
|
||||
|
||||
print "</table></form>";
|
||||
|
||||
$db->close();
|
||||
llxFooter();
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -52,9 +52,25 @@ $formventilation = new FormVentilation($db);
|
||||
|
||||
llxHeader('', $langs->trans("Ventilation"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(\'#select-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = true;
|
||||
});
|
||||
});
|
||||
$(\'#unselect-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
*/
|
||||
|
||||
if ($action == 'ventil') {
|
||||
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||
@ -113,8 +129,8 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_fac
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_sell = aa.account_number";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation = 0";
|
||||
$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL)";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
|
||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
}
|
||||
@ -147,7 +163,7 @@ if ($result) {
|
||||
print '<td align="right">' . $langs->trans("Amount") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("AccountAccounting") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("Ventilate") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$facture_static = new Facture($db);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
*
|
||||
@ -99,10 +99,10 @@ $idpays = $p[0];
|
||||
|
||||
$sql = "SELECT b.rowid , b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, soc.code_compta, ba.courant,";
|
||||
$sql .= " soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, ba.account_number, bu1.type as typeop";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank b";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account ba on b.fk_account=ba.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe soc on bu1.url_id=soc.rowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
||||
// To isolate the cash of the other accounts
|
||||
$sql .= " WHERE ba.courant <> 2";
|
||||
$sql .= " AND ba.rowid=".$id_accountancy_journal;
|
||||
@ -176,6 +176,7 @@ if ($result) {
|
||||
{
|
||||
$tabtype[$obj->rowid] = $links[$key]['type'];
|
||||
|
||||
|
||||
if ($links[$key]['type'] == 'payment')
|
||||
{
|
||||
$paymentstatic->id = $links[$key]['url_id'];
|
||||
@ -305,6 +306,7 @@ if ($result) {
|
||||
|
||||
/*
|
||||
* Actions
|
||||
* FIXME Action should be before any view
|
||||
*/
|
||||
|
||||
// Write bookkeeping
|
||||
@ -447,18 +449,21 @@ if ($action == 'writeBookKeeping')
|
||||
setEventMessage($langs->trans('Success'), 'mesgs');
|
||||
}
|
||||
}
|
||||
// export csv
|
||||
// Export
|
||||
if ($action == 'export_csv')
|
||||
{
|
||||
$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$bank_journal = $conf->global->ACCOUNTING_BANK_JOURNAL;
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment;filename=journal_banque.csv');
|
||||
|
||||
$companystatic = new Client($db);
|
||||
|
||||
if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
|
||||
{
|
||||
$sep = ";";
|
||||
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
@ -466,23 +471,23 @@ if ($action == 'export_csv')
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
|
||||
// Bank
|
||||
print $date . $sep;
|
||||
print $conf->global->ACCOUNTING_BANK_JOURNAL . $sep;
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $bank_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print $sep;
|
||||
print $val["ref"] . $sep;
|
||||
print "\n";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
// Third party
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $conf->global->ACCOUNTING_BANK_JOURNAL . $sep;
|
||||
print $bank_journal . $sep;
|
||||
if ($val["lib"] == '(SupplierInvoicePayment)') {
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
||||
} else {
|
||||
@ -492,12 +497,12 @@ if ($action == 'export_csv')
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print $sep;
|
||||
print $val["ref"] . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else // Modèle Export Classique
|
||||
} else // Model Classic Export
|
||||
{
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
@ -505,24 +510,22 @@ if ($action == 'export_csv')
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Bank") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
// Third party
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $companystatic->name . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
@ -549,7 +552,7 @@ else
|
||||
$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);
|
||||
report_header($namereport, $namelink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
|
||||
|
||||
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
|
||||
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
|
||||
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writeBookKeeping();" />';
|
||||
|
||||
@ -632,5 +635,4 @@ else
|
||||
// End of page
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
*
|
||||
@ -91,10 +91,10 @@ $idpays = $p[0];
|
||||
|
||||
$sql = "SELECT b.rowid , b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, soc.code_compta, ba.courant,";
|
||||
$sql .= " soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, ba.account_number, bu1.type as typeop";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank b";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account ba on b.fk_account=ba.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe soc on bu1.url_id=soc.rowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
||||
|
||||
// Code opération type caisse
|
||||
$sql .= " WHERE ba.courant = 2";
|
||||
@ -365,67 +365,69 @@ if ($action == 'writeBookKeeping')
|
||||
setEventMessage($langs->trans('Success'), 'mesgs');
|
||||
}
|
||||
}
|
||||
// export csv
|
||||
// Export
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$cash_journal = $conf->global->ACCOUNTING_CASH_JOURNAL;
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition:attachment;filename=journal_caisse.csv');
|
||||
|
||||
if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
|
||||
{
|
||||
$sep = ";";
|
||||
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
// Cash
|
||||
print $date . $sep;
|
||||
print $conf->global->ACCOUNTING_CASH_JOURNAL . $sep;
|
||||
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $cash_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print price($mt) . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print $val["ref"] . $sep;
|
||||
print "\n";
|
||||
}
|
||||
print utf8_decode($langs->trans("CashPayment")) . $sep;
|
||||
print $val["ref"] . $sep;
|
||||
print "\n";
|
||||
|
||||
// Third party
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $conf->global->ACCOUNTING_CASH_JOURNAL . $sep;
|
||||
if ($obj->label == '(SupplierInvoicePayment)') {
|
||||
print $cash_journal . $sep;
|
||||
if ($val["lib"] == '(SupplierInvoicePayment)') {
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
||||
} else {
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
|
||||
}
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print price($mt) . $sep;
|
||||
print $langs->trans("ThirdParty") . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print $val["ref"] . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else // Modèle Export Classique
|
||||
} else // Model Classic Export
|
||||
{
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
|
||||
// Cash
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Cash") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
|
||||
// Third party
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
@ -455,7 +457,7 @@ if ($action == 'export_csv') {
|
||||
$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);
|
||||
report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
|
||||
|
||||
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
|
||||
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
|
||||
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writeBookKeeping();" />';
|
||||
|
||||
|
||||
@ -185,8 +185,8 @@ if ($action == 'writebookkeeping') {
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$compte = new AccountingAccount($db);
|
||||
if ($compte->fetch(null, $k)) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
if ($accountingaccount->fetch(null, $k)) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -195,7 +195,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
|
||||
$bookkeeping->code_tiers = '';
|
||||
$bookkeeping->label_compte = dol_trunc($val["description"], 128);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
@ -213,7 +213,6 @@ if ($action == 'writebookkeeping') {
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -243,16 +242,19 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
$companystatic = new Fournisseur($db);
|
||||
|
||||
// export csv
|
||||
// Export
|
||||
if ($action == 'export_csv')
|
||||
{
|
||||
$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$purchase_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment;filename=journal_achats.csv');
|
||||
|
||||
if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
|
||||
{
|
||||
$sep = ";";
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
@ -264,7 +266,7 @@ if ($action == 'export_csv')
|
||||
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep;
|
||||
print $purchase_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
@ -276,11 +278,10 @@ if ($action == 'export_csv')
|
||||
}
|
||||
|
||||
// VAT
|
||||
// var_dump($tabtva);
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep;
|
||||
print $purchase_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
@ -290,20 +291,20 @@ if ($action == 'export_csv')
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
print $date . $sep;
|
||||
print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $purchase_journal . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print utf8_decode($companystatic->name) . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
} else // Modèle Export Classique
|
||||
} else // Model Classic Export
|
||||
{
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
@ -314,18 +315,19 @@ if ($action == 'export_csv')
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($val["description"], 32) . '"' . $sep;
|
||||
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
// VAT
|
||||
// var_dump($tabtva);
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
@ -339,9 +341,9 @@ if ($action == 'export_csv')
|
||||
}
|
||||
|
||||
// Third party
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
@ -369,7 +371,7 @@ if ($action == 'export_csv')
|
||||
$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);
|
||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
|
||||
|
||||
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
|
||||
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
|
||||
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
|
||||
@ -417,19 +419,21 @@ if ($action == 'export_csv')
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
|
||||
if ($mt) {
|
||||
print "<tr " . $bc[$var] . " >";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>" . length_accountg($k) . "</td>";
|
||||
print "<td>" . $invoicestatic->description . "</td>";
|
||||
print "<td>" . $accountingaccount->label . "</td>";
|
||||
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
// VAT
|
||||
// var_dump($tabtva);
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print "<tr " . $bc[$var] . " >";
|
||||
@ -444,13 +448,11 @@ if ($action == 'export_csv')
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
|
||||
// Third party
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
|
||||
print "<td>" . length_accounta($k);
|
||||
print "</td><td>" . $langs->trans("ThirdParty");
|
||||
print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
@ -60,6 +60,8 @@ if ($user->societe_id > 0)
|
||||
|
||||
$action = GETPOST('action');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -94,7 +96,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_produc
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
||||
$sql .= " WHERE fd.fk_code_ventilation > 0 ";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity = " . $conf->entity;
|
||||
@ -151,7 +153,7 @@ if ($result) {
|
||||
$tabfac[$obj->rowid]["date"] = $obj->df;
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
$tabfac[$obj->rowid]["description"] = $obj->description;
|
||||
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
||||
$tabfac[$obj->rowid]["fk_facturedet"] = $obj->fdid;
|
||||
if (! isset($tabttc[$obj->rowid][$compta_soc]))
|
||||
$tabttc[$obj->rowid][$compta_soc] = 0;
|
||||
@ -176,14 +178,18 @@ if ($result) {
|
||||
|
||||
/*
|
||||
* Action
|
||||
* FIXME Action must be set before any view part
|
||||
*/
|
||||
|
||||
// Bookkeeping Write
|
||||
if ($action == 'writebookkeeping') {
|
||||
if ($action == 'writebookkeeping')
|
||||
{
|
||||
$now = dol_now();
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
foreach ($tabfac as $key => $val)
|
||||
{
|
||||
foreach ($tabttc[$key] as $k => $mt)
|
||||
{
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -204,11 +210,11 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
foreach ($tabht[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$compte = new AccountingAccount($db);
|
||||
if ($compte->fetch(null, $k)) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
if ($accountingaccount->fetch(null, $k)) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -218,7 +224,7 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = $val["fk_facturedet"];
|
||||
$bookkeeping->code_tiers = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = dol_trunc($val["description"], 128);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
|
||||
@ -232,8 +238,10 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
// VAT
|
||||
// var_dump($tabtva);
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
foreach ($tabtva[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@ -256,17 +264,22 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
}
|
||||
// export csv
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
|
||||
|
||||
// Export
|
||||
if ($action == 'export_csv')
|
||||
{
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment;filename=journal_ventes.csv');
|
||||
|
||||
$companystatic = new Client($db);
|
||||
|
||||
if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
|
||||
{
|
||||
$sep = ";";
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
@ -274,23 +287,23 @@ if ($action == 'export_csv') {
|
||||
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
print $date . $sep;
|
||||
print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $sell_journal . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print utf8_decode($companystatic->name) . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep;
|
||||
print $sell_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
@ -300,11 +313,12 @@ if ($action == 'export_csv') {
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// TVA
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep;
|
||||
print $sell_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
@ -315,31 +329,38 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else // Modèle Export Classique
|
||||
}
|
||||
else // Model Classic Export
|
||||
{
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
foreach ($tabfac as $key => $val)
|
||||
{
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
foreach ($tabht[$key] as $k => $mt)
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($val["description"], 32) . '"' . $sep;
|
||||
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print "\n";
|
||||
@ -347,8 +368,8 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
|
||||
// VAT
|
||||
// var_dump($tabtva);
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
foreach ($tabtva[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
@ -380,7 +401,7 @@ if ($action == 'export_csv') {
|
||||
$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);
|
||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
|
||||
|
||||
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
|
||||
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
|
||||
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
|
||||
@ -420,7 +441,8 @@ if ($action == 'export_csv') {
|
||||
$invoicestatic = new Facture($db);
|
||||
$companystatic = new Client($db);
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
foreach ($tabfac as $key => $val)
|
||||
{
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
@ -428,12 +450,12 @@ if ($action == 'export_csv') {
|
||||
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
|
||||
// Third party
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
foreach ($tabttc[$key] as $k => $mt)
|
||||
{
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
@ -446,13 +468,17 @@ if ($action == 'export_csv') {
|
||||
print "</tr>";
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
foreach ($tabht[$key] as $k => $mt)
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
|
||||
if ($mt) {
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
print "<td>" . length_accountg($k) . "</td>";
|
||||
print "<td>" . $invoicestatic->description . "</td>";
|
||||
print "<td>" . $accountingaccount->label . "</td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
@ -460,8 +486,8 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
|
||||
// VAT
|
||||
// var_dump($tabtva);
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
foreach ($tabtva[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt) {
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print "<td>" . $date . "</td>";
|
||||
@ -482,4 +508,5 @@ if ($action == 'export_csv') {
|
||||
// End of page
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent s<jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/index.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page accueil ventilation
|
||||
* \brief Home supplier ventilation
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -93,9 +93,9 @@ if ($action == 'validatehistory') {
|
||||
llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||
|
||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
|
||||
print_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
|
||||
print_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
|
||||
|
||||
print '<b>' . $langs->trans("DescVentilSupplier") . '</b>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=validatehistory">' . $langs->trans("ValidateHistory") . '</a></div>';
|
||||
@ -105,7 +105,7 @@ $y = $year_current;
|
||||
$var = true;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>';
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -48,6 +46,7 @@ if ($user->societe_id > 0)
|
||||
if (! $user->rights->accounting->ventilation->dispatch)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
$formventilation = new FormVentilation($db);
|
||||
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
@ -107,7 +106,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product
|
||||
$sql .= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
|
||||
$sql .= " AND aa.rowid = l.fk_code_ventilation";
|
||||
if (strlen(trim($_GET["search_facture"]))) {
|
||||
$sql .= " AND f.facnumber like '%" . $_GET["search_facture"] . "%'";
|
||||
$sql .= " AND f.ref like '%" . $_GET["search_facture"] . "%'";
|
||||
}
|
||||
if (strlen(trim($_GET["search_ref"]))) {
|
||||
$sql .= " AND p.ref like '%" . $_GET["search_ref"] . "%'";
|
||||
@ -218,7 +217,8 @@ if ($result) {
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
|
||||
print "</table></form>";
|
||||
|
||||
$db->close();
|
||||
llxFooter();
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/list.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page de ventilation des lignes de facture
|
||||
* \brief Ventilation page from suppliers invoices
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -53,6 +53,22 @@ $formventilation = new FormVentilation($db);
|
||||
|
||||
llxHeader('', $langs->trans("Ventilation"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(\'#select-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = true;
|
||||
});
|
||||
});
|
||||
$(\'#unselect-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
@ -115,8 +131,8 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_buy = aa.account_number";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation = 0";
|
||||
$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL)";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
|
||||
$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')";
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
@ -150,7 +166,7 @@ if ($result) {
|
||||
print '<td align="right">' . $langs->trans("Amount") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("Compte") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("Ventilate") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$facturefourn_static = new FactureFournisseur($db);
|
||||
@ -161,6 +177,23 @@ if ($result) {
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
// product_type: 0 = service ? 1 = product
|
||||
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
|
||||
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
|
||||
$code_buy_notset = '';
|
||||
|
||||
if (empty($objp->code_buy)) {
|
||||
$code_buy_notset = 'color:red';
|
||||
if ($objp->type == 1) {
|
||||
$objp->code_buy = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT) ? $conf->global->COMPTA_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
} else {
|
||||
$objp->code_buy = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT) ? $conf->global->COMPTA_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
}
|
||||
}else {
|
||||
$code_buy_notset = 'color:blue';
|
||||
}
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Ref facture
|
||||
@ -191,7 +224,7 @@ if ($result) {
|
||||
print price($objp->price);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print '<td align="center" style="' . $code_buy_notset . '">';
|
||||
print $objp->code_buy;
|
||||
print '</td>';
|
||||
|
||||
@ -216,4 +249,4 @@ if ($result) {
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
@ -1563,7 +1563,10 @@ class Adherent extends CommonObject
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowMember").': '.$this->ref;
|
||||
$label = '<u>' . $langs->trans("ShowMember") . '</u>';
|
||||
$label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
if (! empty($this->firstname) || ! empty($this->lastname))
|
||||
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
|
||||
if ($option == 'card')
|
||||
|
||||
@ -230,7 +230,7 @@ $sql.= ", entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."const";
|
||||
$sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
|
||||
if (empty($user->entity) && $debug) {} // to force for superadmin
|
||||
elseif ($user->entity || empty($conf->multicompany->enabled)) $sql.= " AND visible = 1";
|
||||
else $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
|
||||
$sql.= " ORDER BY entity, name ASC";
|
||||
|
||||
dol_syslog("Const::listConstant", LOG_DEBUG);
|
||||
@ -280,7 +280,6 @@ if ($result)
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print '<input type="checkbox" class="flat checkboxfordelete" id="check_'.$i.'" name="const['.$i.'][check]" value="1">';
|
||||
print ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -63,6 +63,7 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_ACTIVATE_HTML5", $_POST["MAIN_ACTIVATE_HTML5"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_ACTIVATE_FILECACHE", $_POST["MAIN_ACTIVATE_FILECACHE"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"],'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity);
|
||||
@ -173,7 +174,7 @@ if ($action == 'edit') // Edit
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Activate Html5 - Developement - Only available on Eldy template
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5))
|
||||
{
|
||||
@ -185,6 +186,16 @@ if ($action == 'edit') // Edit
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Activate FileCache - Developement
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>';
|
||||
print $form->selectyesno('MAIN_ACTIVATE_FILECACHE',$conf->global->MAIN_ACTIVATE_FILECACHE,1);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Max size of lists
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
|
||||
@ -363,7 +374,7 @@ else // Show
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print "</tr>";
|
||||
|
||||
|
||||
// Activate Html5 - Developement - Only available on Eldy template
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5))
|
||||
{
|
||||
@ -373,6 +384,14 @@ else // Show
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
// Activate FileCache - Developement
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("EnableFileCache").'</td><td>' . yn($conf->global->MAIN_ACTIVATE_FILECACHE) . '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
|
||||
@ -65,7 +65,7 @@ error_reporting($err);
|
||||
if ($action == 'update' && empty($_POST["cancel"]))
|
||||
{
|
||||
$_SESSION["mainmenu"]="home"; // Le gestionnaire de menu a pu changer
|
||||
|
||||
|
||||
dolibarr_set_const($db, "MAIN_MENU_STANDARD", $_POST["MAIN_MENU_STANDARD"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MENU_SMARTPHONE", $_POST["MAIN_MENU_SMARTPHONE"],'chaine',0,'',$conf->entity);
|
||||
|
||||
@ -89,11 +89,11 @@ if ($action == 'update' && empty($_POST["cancel"]))
|
||||
$file='init_menu_'.$key.'.sql';
|
||||
$fullpath=dol_buildpath($dirmenu.$file);
|
||||
//print 'action='.$action.' Search menu into fullpath='.$fullpath.'<br>';exit;
|
||||
|
||||
|
||||
if (file_exists($fullpath))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
|
||||
$result=run_sql($fullpath,1,'',1,$key,'none');
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -152,6 +152,10 @@ $head[$h][2] = 'misc';
|
||||
$h++;
|
||||
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
dol_fiche_head($head, 'handler', $langs->trans("Menus"));
|
||||
|
||||
print $langs->trans("MenusDesc")."<br>\n";
|
||||
@ -160,10 +164,6 @@ print "<br>\n";
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
clearstatcache();
|
||||
|
||||
// Gestionnaires de menu
|
||||
@ -202,14 +202,6 @@ if ($action == 'edit')
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -264,7 +256,21 @@ else
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<div class="center">';
|
||||
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
|
||||
if ($action != 'edit')
|
||||
{
|
||||
|
||||
@ -480,10 +480,10 @@ function backup_tables($outputfile, $tables='*')
|
||||
if ($row[$j] == null and !is_string($row[$j])) {
|
||||
// IMPORTANT: if the field is NULL we set it NULL
|
||||
$row[$j] = 'NULL';
|
||||
} elseif(is_string($row[$j]) and $row[$j] == '') {
|
||||
} elseif(is_string($row[$j]) && $row[$j] == '') {
|
||||
// if it's an empty string, we set it as an empty string
|
||||
$row[$j] = "''";
|
||||
} elseif(is_numeric($row[$j]) and !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0)
|
||||
} elseif(is_numeric($row[$j]) && !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0)
|
||||
// if it's a number, we return it as-is
|
||||
// $row[$j] = $row[$j];
|
||||
} else { // else for all other cases we escape the value and put quotes around
|
||||
|
||||
@ -14,7 +14,6 @@ support/index.php
|
||||
support/online.php
|
||||
|
||||
support/default.css
|
||||
support/dolibarr_logo2.png
|
||||
support/headbg.jpg
|
||||
support/helpcenter.png
|
||||
support/internet.png
|
||||
|
||||
@ -289,7 +289,8 @@ if ($socid)
|
||||
if ($soc->country)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($soc->country_code);
|
||||
//$img=picto_from_langcode($soc->country_code);
|
||||
$img='';
|
||||
print ($img?$img.' ':'');
|
||||
print $soc->country;
|
||||
print '</td></tr>';
|
||||
|
||||
@ -36,7 +36,6 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
@ -541,6 +540,7 @@ $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formactions = new FormActions($db);
|
||||
|
||||
if ($action == 'create')
|
||||
@ -881,15 +881,15 @@ if ($id > 0)
|
||||
|
||||
// Date start
|
||||
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td colspan="3">';
|
||||
if (GETPOST("afaire") == 1) $form->select_date($object->datep,'ap',1,1,0,"action",1,1,0,0,'fulldaystart');
|
||||
else if (GETPOST("afaire") == 2) $form->select_date($object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
|
||||
else $form->select_date($object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
|
||||
if (GETPOST("afaire") == 1) $form->select_date($datep?$datep:$object->datep,'ap',1,1,0,"action",1,1,0,0,'fulldaystart');
|
||||
else if (GETPOST("afaire") == 2) $form->select_date($datep?$datep:$object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
|
||||
else $form->select_date($datep?$datep:$object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
|
||||
print '</td></tr>';
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
|
||||
if (GETPOST("afaire") == 1) $form->select_date($object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||
else if (GETPOST("afaire") == 2) $form->select_date($object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||
else $form->select_date($object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||
if (GETPOST("afaire") == 1) $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||
else if (GETPOST("afaire") == 2) $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||
else $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
@ -1290,7 +1290,7 @@ if ($id > 0)
|
||||
|
||||
if (empty($conf->global->AGENDA_DISABLE_BUILDDOC))
|
||||
{
|
||||
print '<div style="clear:both;"> </div><div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<div style="clear:both;"> <br><br></div><div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
|
||||
@ -897,9 +897,11 @@ class ActionComm extends CommonObject
|
||||
global $conf,$langs;
|
||||
|
||||
$result='';
|
||||
$label=$this->label;
|
||||
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
|
||||
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->label;
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'" class="classfortooltip">';
|
||||
if ($option=='birthday') $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.$linkclose;
|
||||
else $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.$linkclose;
|
||||
$lienfin='</a>';
|
||||
@ -912,7 +914,7 @@ class ActionComm extends CommonObject
|
||||
$libelleshort='';
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$libelle=(empty($this->libelle)?$label:$this->libelle.(($label && $label != $this->libelle)?' '.$label:''));
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle=($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label;
|
||||
$libelleshort=dol_trunc($libelle,$maxlength);
|
||||
|
||||
@ -339,7 +339,7 @@ dol_fiche_end();
|
||||
|
||||
$showextcals=$listofextcals;
|
||||
// Legend
|
||||
if ($conf->use_javascript_ajax)
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$s='';
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
@ -349,29 +349,27 @@ if ($conf->use_javascript_ajax)
|
||||
$s.='jQuery(".family_birthday").toggle();' . "\n";
|
||||
if ($action=="show_week" || $action=="show_month" || empty($action))
|
||||
{
|
||||
$s.='jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
|
||||
$s.='jQuery( "td.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {';
|
||||
$s.='var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
|
||||
}
|
||||
$s.='});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
|
||||
$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda").' </div>';
|
||||
if (is_array($showextcals) && count($showextcals) > 0)
|
||||
{
|
||||
$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked="true" disabled="disabled"> ' . $langs->trans("LocalAgenda").' </div>';
|
||||
if (is_array($showextcals) && count($showextcals) > 0)
|
||||
foreach ($showextcals as $val)
|
||||
{
|
||||
foreach ($showextcals as $val)
|
||||
{
|
||||
$htmlname = dol_string_nospecial($val['name']);
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.=' jQuery("#check_' . $htmlname . '").click(function() {';
|
||||
$s.=' /* alert("'.$htmlname.'"); */';
|
||||
$s.=' jQuery(".family_' . $htmlname . '").toggle();';
|
||||
$s.=' });' . "\n";
|
||||
$s.='});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
||||
}
|
||||
$htmlname = dol_string_nospecial($val['name']);
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.=' jQuery("#check_' . $htmlname . '").click(function() {';
|
||||
$s.=' /* alert("'.$htmlname.'"); */';
|
||||
$s.=' jQuery(".family_' . $htmlname . '").toggle();';
|
||||
$s.=' });' . "\n";
|
||||
$s.='});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
||||
}
|
||||
}
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>';
|
||||
@ -1092,11 +1090,12 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
global $theme_datacolor;
|
||||
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
|
||||
|
||||
print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n";
|
||||
print "\n".'<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">';
|
||||
|
||||
// Line with title of day
|
||||
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
print '<table class="nobordernopadding" width="100%">'."\n";
|
||||
|
||||
print '<tr><td align="left" class="nowrap">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?';
|
||||
print 'action=show_day&day='.str_pad($day, 2, "0", STR_PAD_LEFT).'&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
|
||||
@ -1116,7 +1115,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
print img_picto($langs->trans("NewAction"),'edit_add.png');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Line with td contains all div of each events
|
||||
print '<tr height="'.$minheight.'"><td valign="top" colspan="2" class="sortable" style="padding-bottom: 2px;">';
|
||||
@ -1171,11 +1170,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$numicals[dol_string_nospecial($event->icalname)]++;
|
||||
}
|
||||
$color=$event->icalcolor;
|
||||
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable');
|
||||
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unmovable');
|
||||
}
|
||||
else if ($event->type_code == 'BIRTHDAY')
|
||||
{
|
||||
$numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||
$numbirthday++; $colorindex=2; $cssclass='family_birthday unmovable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1213,32 +1212,35 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
|
||||
|
||||
// Defined style to disable drag and drop feature
|
||||
if ($event->date_end_in_calendar && date('Ymd',$event->date_start_in_calendar) != date('Ymd',$event->date_end_in_calendar))
|
||||
if ($event->type_code =='AC_OTH_AUTO')
|
||||
{
|
||||
$cssclass.= " unmovable";
|
||||
}
|
||||
else if ($event->date_end_in_calendar && date('Ymd',$event->date_start_in_calendar) != date('Ymd',$event->date_end_in_calendar))
|
||||
{
|
||||
$tmpyearend = date('Y',$event->date_end_in_calendar);
|
||||
$tmpmonthend = date('m',$event->date_end_in_calendar);
|
||||
$tmpdayend = date('d',$event->date_end_in_calendar);
|
||||
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
|
||||
{
|
||||
$cssclass.= " unsortable";
|
||||
$cssclass.= " unmovable";
|
||||
}
|
||||
}
|
||||
if ($event->type_code =='AC_OTH_AUTO')
|
||||
{
|
||||
$cssclass.= " unsortable";
|
||||
}
|
||||
else $cssclass.= " movable";
|
||||
|
||||
$h=''; $nowrapontd=1;
|
||||
if ($action == 'show_day') { $h='height: 100%; '; $nowrapontd=0; }
|
||||
if ($action == 'show_week') { $h='height: 100%; '; $nowrapontd=0; }
|
||||
|
||||
// Show rect of event
|
||||
print '<div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'"';
|
||||
print "\n";
|
||||
print '<!-- start event '.$i.' --><div id="event_'.$ymd.'_'.$i.'" class="event '.$cssclass.'"';
|
||||
//print ' style="height: 100px;';
|
||||
//print ' position: absolute; top: 40px; width: 50%;';
|
||||
//print '"';
|
||||
print '>';
|
||||
print '<ul class="cal_event" style="'.$h.'"><li class="cal_event" style="'.$h.'">';
|
||||
print '<ul class="cal_event" style="'.$h.'">'; // always 1 li per ul, 1 ul per event
|
||||
print '<li class="cal_event" style="'.$h.'">';
|
||||
print '<table class="cal_event'.(empty($event->transparency)?'':' cal_event_busy').'" style="'.$h;
|
||||
print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
|
||||
//if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
|
||||
@ -1369,8 +1371,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') print $event->getLibStatut(3,1);
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</li></ul>';
|
||||
print '</div>';
|
||||
print '</li>';
|
||||
print '</ul>';
|
||||
print '</div><!-- end event '.$i.' -->'."\n";
|
||||
$i++;
|
||||
}
|
||||
else
|
||||
@ -1413,8 +1416,8 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</table></div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -205,6 +205,8 @@ if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month' |
|
||||
$param.="&maxprint=".$maxprint;
|
||||
|
||||
$prev = dol_get_first_day_week($day, $month, $year);
|
||||
//print "day=".$day." month=".$month." year=".$year;
|
||||
//var_dump($prev); exit;
|
||||
$prev_year = $prev['prev_year'];
|
||||
$prev_month = $prev['prev_month'];
|
||||
$prev_day = $prev['prev_day'];
|
||||
@ -223,6 +225,7 @@ $next_day = $next['day'];
|
||||
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
|
||||
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
|
||||
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
|
||||
//print $firstday.'-'.$first_month.'-'.$first_year;
|
||||
//print dol_print_date($firstdaytoshow,'dayhour');
|
||||
//print dol_print_date($lastdaytoshow,'dayhour');
|
||||
|
||||
@ -534,12 +537,16 @@ echo '<input type="hidden" name="newdate" id="newdate">' ;
|
||||
echo '</form>';
|
||||
|
||||
|
||||
// Table :
|
||||
// Line header with list of days
|
||||
|
||||
//print "begin_d=".$begin_d." end_d=".$end_d;
|
||||
|
||||
|
||||
echo '<table width="100%" class="nocellnopadd cal_month">';
|
||||
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<td></td>';
|
||||
$i=0;
|
||||
$i=0; // 0 = sunday,
|
||||
while ($i < 7)
|
||||
{
|
||||
if (($i + 1) < $begin_d || ($i + 1) > $end_d)
|
||||
@ -679,7 +686,7 @@ foreach ($usernames as $username)
|
||||
|
||||
// Lopp on each day of week
|
||||
$i = 0;
|
||||
for ($iter_day = 0; $iter_day < 7; $iter_day++)
|
||||
for ($iter_day = 0; $iter_day < 8; $iter_day++)
|
||||
{
|
||||
if (($i + 1) < $begin_d || ($i + 1) > $end_d)
|
||||
{
|
||||
|
||||
@ -265,7 +265,8 @@ if ($id > 0)
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
if (! empty($object->country_code))
|
||||
{
|
||||
$img=picto_from_langcode($object->country_code);
|
||||
//$img=picto_from_langcode($object->country_code);
|
||||
$img='';
|
||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
||||
else print ($img?$img.' ':'').$object->country;
|
||||
}
|
||||
@ -500,8 +501,11 @@ if ($id > 0)
|
||||
{
|
||||
$propal_static = new Propal($db);
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, ";
|
||||
$sql.= " p.datep as dp, p.fin_validite as datelimite";
|
||||
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
|
||||
$sql.= ", p.tva as total_tva";
|
||||
$sql.= ", p.total as total_ttc";
|
||||
$sql.= ", p.ref, p.ref_client, p.remise";
|
||||
$sql.= ", p.datep as dp, p.fin_validite as datelimite";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
$sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
|
||||
$sql.= " AND s.rowid = ".$object->id;
|
||||
@ -532,8 +536,12 @@ if ($id > 0)
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">';
|
||||
$propal_static->id=$objp->propalid;
|
||||
$propal_static->ref=$objp->ref;
|
||||
$propal_static->id = $objp->propalid;
|
||||
$propal_static->ref = $objp->ref;
|
||||
$propal_static->ref_client = $objp->ref_client;
|
||||
$propal_static->total_ht = $objp->total_ht;
|
||||
$propal_static->total_tva = $objp->total_tva;
|
||||
$propal_static->total_ttc = $objp->total_ttc;
|
||||
print $propal_static->getNomUrl(1);
|
||||
if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) {
|
||||
print " ".img_warning();
|
||||
@ -560,9 +568,12 @@ if ($id > 0)
|
||||
{
|
||||
$commande_static=new Commande($db);
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid,";
|
||||
$sql.= " c.rowid as cid, c.total_ht, c.ref, c.fk_statut, c.facture,";
|
||||
$sql.= " c.date_commande as dc";
|
||||
$sql = "SELECT s.nom, s.rowid";
|
||||
$sql.= ", c.rowid as cid, c.total_ht";
|
||||
$sql.= ", c.tva as total_tva";
|
||||
$sql.= ", c.total_ttc";
|
||||
$sql.= ", c.ref, c.ref_client, c.fk_statut, c.facture";
|
||||
$sql.= ", c.date_commande as dc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql.= " AND s.rowid = ".$object->id;
|
||||
@ -609,8 +620,12 @@ if ($id > 0)
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">';
|
||||
$commande_static->id=$objp->cid;
|
||||
$commande_static->ref=$objp->ref;
|
||||
$commande_static->id = $objp->cid;
|
||||
$commande_static->ref = $objp->ref;
|
||||
$commande_static->ref_client=$objp->ref_client;
|
||||
$commande_static->total_ht = $objp->total_ht;
|
||||
$commande_static->total_tva = $objp->total_tva;
|
||||
$commande_static->total_ttc = $objp->total_ttc;
|
||||
print $commande_static->getNomUrl(1);
|
||||
print '</td><td align="right" width="80">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
|
||||
print '<td align="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
|
||||
@ -749,15 +764,18 @@ if ($id > 0)
|
||||
{
|
||||
$facturestatic = new Facture($db);
|
||||
|
||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,';
|
||||
$sql.= ' f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut,';
|
||||
$sql.= ' s.nom, s.rowid as socid,';
|
||||
$sql.= ' SUM(pf.amount) as am';
|
||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount';
|
||||
$sql.= ', f.total';
|
||||
$sql.= ', f.tva as total_tva';
|
||||
$sql.= ', f.total_ttc';
|
||||
$sql.= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut';
|
||||
$sql.= ', s.nom, s.rowid as socid';
|
||||
$sql.= ', SUM(pf.amount) as am';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
|
||||
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,';
|
||||
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.tva, f.total_ttc,';
|
||||
$sql.= ' f.datef, f.datec, f.paye, f.fk_statut,';
|
||||
$sql.= ' s.nom, s.rowid';
|
||||
$sql.= " ORDER BY f.datef DESC, f.datec DESC";
|
||||
@ -786,9 +804,12 @@ if ($id > 0)
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td class="nowrap">';
|
||||
$facturestatic->id=$objp->facid;
|
||||
$facturestatic->ref=$objp->facnumber;
|
||||
$facturestatic->type=$objp->type;
|
||||
$facturestatic->id = $objp->facid;
|
||||
$facturestatic->ref = $objp->facnumber;
|
||||
$facturestatic->type = $objp->type;
|
||||
$facturestatic->total_ht = $objp->total;
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
print $facturestatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if ($objp->df > 0)
|
||||
|
||||
@ -142,7 +142,7 @@ if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
|
||||
*/
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
||||
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -173,6 +173,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
$propalstatic->id=$obj->rowid;
|
||||
$propalstatic->ref=$obj->ref;
|
||||
$propalstatic->ref_client=$obj->ref_client;
|
||||
$propalstatic->total_ht = $obj->total_ht;
|
||||
$propalstatic->total_tva = $obj->total_tva;
|
||||
$propalstatic->total_ttc = $obj->total_ttc;
|
||||
print $propalstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
@ -210,7 +213,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
{
|
||||
$langs->load("orders");
|
||||
|
||||
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
||||
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -241,6 +244,9 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
$orderstatic->id=$obj->rowid;
|
||||
$orderstatic->ref=$obj->ref;
|
||||
$orderstatic->ref_client=$obj->ref_client;
|
||||
$orderstatic->total_ht = $obj->total_ht;
|
||||
$orderstatic->total_tva = $obj->total_tva;
|
||||
$orderstatic->total_ttc = $obj->total_ttc;
|
||||
print $orderstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
@ -469,7 +475,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
{
|
||||
$langs->load("propal");
|
||||
|
||||
$sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
|
||||
$sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -506,6 +512,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
$propalstatic->id=$obj->propalid;
|
||||
$propalstatic->ref=$obj->ref;
|
||||
$propalstatic->ref_client=$obj->ref_client;
|
||||
$propalstatic->total_ht = $obj->total_ht;
|
||||
$propalstatic->total_tva = $obj->total_tva;
|
||||
$propalstatic->total_ttc = $obj->total_ttc;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
|
||||
@ -1389,8 +1389,8 @@ if ($action == 'create')
|
||||
print "</td></tr>";
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $socid > 0) {
|
||||
|
||||
if (! empty($conf->projet->enabled) && $socid > 0)
|
||||
{
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
$projectid = 0;
|
||||
@ -1398,9 +1398,9 @@ if ($action == 'create')
|
||||
$projectid = ($originid ? $originid : 0);
|
||||
|
||||
print '<tr>';
|
||||
print '<td valign="top">' . $langs->trans("Project") . '</td><td colspan="2">';
|
||||
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';
|
||||
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid);
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
|
||||
if ($numprojet == 0) {
|
||||
$langs->load("projects");
|
||||
print ' <a href="../projet/card.php?socid=' . $soc->id . '&action=create">' . $langs->trans("AddProject") . '</a>';
|
||||
@ -1684,7 +1684,7 @@ if ($action == 'create')
|
||||
print '<tr><td>' . $langs->trans('Company') . '</td><td colspan="5">' . $soc->getNomUrl(1) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Ligne info remises tiers
|
||||
// Lin for thirdparty discounts
|
||||
print '<tr><td>' . $langs->trans('Discounts') . '</td><td colspan="5">';
|
||||
if ($soc->remise_percent)
|
||||
print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent);
|
||||
@ -1881,20 +1881,22 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
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 ($user->rights->propal->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'classify') {
|
||||
$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid');
|
||||
$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');
|
||||
$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0);
|
||||
}
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
@ -1903,7 +1905,7 @@ if ($action == 'create')
|
||||
print '<td colspan="3">';
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
print '<a href="../projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
print $proj->ref;
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
|
||||
@ -2606,9 +2606,17 @@ class Propal extends CommonObject
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowPropal").': '.$this->ref;
|
||||
$label = '<u>' . $langs->trans("ShowPropal") . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$label.= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if (! empty($this->ref_client))
|
||||
$label.= '<br>'.$langs->trans('RefCustomer').': '.$this->ref_client;
|
||||
$label.= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
|
||||
if (! empty($this->total_ht))
|
||||
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_tva))
|
||||
$label.= '<br><b>' . $langs->trans('TVA') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_ttc))
|
||||
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
if ($option == '') {
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
@ -2647,7 +2655,8 @@ class Propal extends CommonObject
|
||||
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
|
||||
$sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang, pt.fk_parent_line,';
|
||||
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,';
|
||||
$sql.= ' p.description as product_desc';
|
||||
$sql.= ' p.description as product_desc,';
|
||||
$sql.= ' p.entity';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid';
|
||||
$sql.= ' WHERE pt.fk_propal = '.$this->id;
|
||||
@ -2671,9 +2680,10 @@ class Propal extends CommonObject
|
||||
$this->lines[$i]->description = $obj->description;
|
||||
$this->lines[$i]->fk_product = $obj->fk_product;
|
||||
$this->lines[$i]->ref = $obj->ref;
|
||||
$this->lines[$i]->entity = $obj->entity; // Product entity
|
||||
$this->lines[$i]->product_label = $obj->product_label;
|
||||
$this->lines[$i]->product_desc = $obj->product_desc;
|
||||
$this->lines[$i]->fk_product_type = $obj->fk_product_type; // deprecated
|
||||
$this->lines[$i]->fk_product_type = $obj->fk_product_type; // deprecated
|
||||
$this->lines[$i]->product_type = $obj->product_type;
|
||||
$this->lines[$i]->qty = $obj->qty;
|
||||
$this->lines[$i]->subprice = $obj->subprice;
|
||||
|
||||
@ -51,8 +51,8 @@ foreach($linkedObjectBlock as $object)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> ><td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/propal.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowPropal"),"propal").' '.$object->ref; ?></a></td>
|
||||
<tr <?php echo $bc[$var]; ?> >
|
||||
<td><?php echo $object->getNomUrl(1); ?></td>
|
||||
<td><?php echo $object->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -932,6 +932,10 @@ if (empty($reshook))
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1421,11 +1425,12 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $socid > 0) {
|
||||
if (! empty($conf->projet->enabled) && $socid > 0)
|
||||
{
|
||||
$formproject = new FormProjets($db);
|
||||
|
||||
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid);
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
|
||||
if ($numprojet == 0) {
|
||||
print ' <a href="' . DOL_URL_ROOT . '/projet/card.php?socid=' . $soc->id . '&action=create">' . $langs->trans("AddProject") . '</a>';
|
||||
}
|
||||
@ -1974,9 +1979,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
print '</td><td colspan="3">';
|
||||
// print "$object->id, $object->socid, $object->fk_project";
|
||||
if ($action == 'classify') {
|
||||
$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid');
|
||||
$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');
|
||||
$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -2887,10 +2887,18 @@ class Commande extends CommonOrder
|
||||
|
||||
if ($short) return $url;
|
||||
|
||||
$picto='order';
|
||||
$label=$langs->trans("ShowOrder").': '.$this->ref;
|
||||
$picto = 'order';
|
||||
$label = '<u>' . $langs->trans("ShowOrder") . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
if (! empty($this->ref_client))
|
||||
$label.= '<br>'.$langs->trans('RefCustomer').': '.$this->ref_client;
|
||||
$label.= '<br><b>' . $langs->trans('RefCustomer') . ':</b> ' . $this->ref_client;
|
||||
if (! empty($this->total_ht))
|
||||
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_tva))
|
||||
$label.= '<br><b>' . $langs->trans('TVA') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_ttc))
|
||||
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
|
||||
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
@ -3099,7 +3107,8 @@ class Commande extends CommonOrder
|
||||
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.localtax1_tx, l.localtax2_tx,';
|
||||
$sql.= ' l.date_start, l.date_end,';
|
||||
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, ';
|
||||
$sql.= ' p.description as product_desc, p.stock as stock_reel';
|
||||
$sql.= ' p.description as product_desc, p.stock as stock_reel,';
|
||||
$sql.= ' p.entity';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
|
||||
$sql.= ' WHERE l.fk_commande = '.$this->id;
|
||||
@ -3121,6 +3130,7 @@ class Commande extends CommonOrder
|
||||
$this->lines[$i]->description = $obj->description;
|
||||
$this->lines[$i]->fk_product = $obj->fk_product;
|
||||
$this->lines[$i]->ref = $obj->ref;
|
||||
$this->lines[$i]->entity = $obj->entity; // Product entity
|
||||
$this->lines[$i]->product_label = $obj->product_label;
|
||||
$this->lines[$i]->product_desc = $obj->product_desc;
|
||||
$this->lines[$i]->fk_product_type = $obj->fk_product_type;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -109,7 +110,7 @@ $companystatic = new Societe($db);
|
||||
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
||||
llxHeader('',$langs->trans("Orders"),$help_url);
|
||||
|
||||
$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
|
||||
$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, s.code_client, c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
|
||||
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison, c.fk_statut, c.facture as facturee';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
|
||||
@ -323,6 +324,7 @@ if ($resql)
|
||||
$var=true;
|
||||
$total=0;
|
||||
$subtotal=0;
|
||||
$productstat_cache=array();
|
||||
|
||||
$generic_commande = new Commande($db);
|
||||
$generic_product = new Product($db);
|
||||
@ -334,6 +336,10 @@ if ($resql)
|
||||
|
||||
$generic_commande->id=$objp->rowid;
|
||||
$generic_commande->ref=$objp->ref;
|
||||
$generic_commande->ref_client = $objp->ref_client;
|
||||
$generic_commande->total_ht = $objp->total_ht;
|
||||
$generic_commande->total_tva = $objp->total_tva;
|
||||
$generic_commande->total_ttc = $objp->total_ttc;
|
||||
$generic_commande->lines=array();
|
||||
$generic_commande->getLinesArray();
|
||||
|
||||
@ -351,17 +357,32 @@ if ($resql)
|
||||
if ($generic_commande->lines[$lig]->product_type==0) {
|
||||
$nbprod++; // order contains real products
|
||||
$generic_product->id = $generic_commande->lines[$lig]->fk_product;
|
||||
$generic_product->load_stock();
|
||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
|
||||
$generic_product->load_stock(true);
|
||||
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
|
||||
} else {
|
||||
$generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
|
||||
}
|
||||
// stock order and stock order_supplier
|
||||
$stock_order=0;
|
||||
$stock_order_supplier=0;
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) {
|
||||
if (! empty($conf->commande->enabled)) {
|
||||
$generic_product->load_stats_commande(0,'1,2');
|
||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) {
|
||||
$generic_product->load_stats_commande(0,'1,2',true);
|
||||
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty'];
|
||||
} else {
|
||||
$generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'];
|
||||
}
|
||||
$stock_order=$generic_product->stats_commande['qty'];
|
||||
}
|
||||
if (! empty($conf->fournisseur->enabled)) {
|
||||
$generic_product->load_stats_commande_fournisseur(0,'3');
|
||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) {
|
||||
$generic_product->load_stats_commande_fournisseur(0,'3',true);
|
||||
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty'];
|
||||
} else {
|
||||
$generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'];
|
||||
}
|
||||
$stock_order_supplier=$generic_product->stats_commande_fournisseur['qty'];
|
||||
}
|
||||
}
|
||||
@ -421,6 +442,7 @@ if ($resql)
|
||||
|
||||
// Company
|
||||
$companystatic->id=$objp->socid;
|
||||
$companystatic->code_client = $objp->code_client;
|
||||
$companystatic->name=$objp->name;
|
||||
$companystatic->client=$objp->client;
|
||||
print '<td>';
|
||||
|
||||
@ -36,6 +36,7 @@ print_titre($langs->trans('RelatedOrders'));
|
||||
<table class="noborder allwidth">
|
||||
<tr class="liste_titre">
|
||||
<td><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td align="center"><?php echo $langs->trans("RefCustomer"); ?></td>
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
@ -47,8 +48,9 @@ foreach($linkedObjectBlock as $object)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> ><td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/commande/card.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowOrder"),"order").' '.$object->ref; ?></a></td>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $object->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $object->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->commande->lire) {
|
||||
@ -62,7 +64,7 @@ foreach($linkedObjectBlock as $object)
|
||||
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="2"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||
<td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->commande->lire) {
|
||||
echo price($total);
|
||||
|
||||
@ -935,7 +935,12 @@ class Account extends CommonObject
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$linkclose = '" title="'.dol_escape_htmltag($this->label, 1).'" class="classfortooltip">';
|
||||
$label = '<u>' . $langs->trans("ShowAccount") . '</u>';
|
||||
if (! empty($this->label))
|
||||
$label .= '<br><b>' . $langs->trans('Account') . ':</b> ' . $this->label;
|
||||
if (! empty($this->number))
|
||||
$label .= '<br><b>' . $langs->trans('AccountNumber') . ':</b> ' . $this->number;
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
|
||||
if (empty($mode))
|
||||
{
|
||||
@ -948,7 +953,7 @@ class Account extends CommonObject
|
||||
$lienfin='</a>';
|
||||
}
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowAccount").': '.$this->label, 'account', 'class="classfortooltip"').$lienfin.' ');
|
||||
if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' ');
|
||||
$result.=$lien.$this->label.$lienfin;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -146,9 +146,14 @@ if (empty($num))
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("AccountStatement").'</td></tr>';
|
||||
print '<td>'.$langs->trans("AccountStatement").'</td>';
|
||||
print '<td align="right">'.$langs->trans("InitialBankBalance").'</td>';
|
||||
print '<td align="right">'.$langs->trans("EndBankBalance").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$balancestart=array();
|
||||
$content=array();
|
||||
|
||||
//while ($i < min($numrows,$conf->liste_limit)) // retrait de la limite tant qu'il n'y a pas de pagination
|
||||
while ($i < min($numrows,$conf->liste_limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
@ -159,7 +164,37 @@ if (empty($num))
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td><a href="releve.php?num='.$objp->numr.'&account='.$acct->id.'">'.$objp->numr.'</a></td></tr>'."\n";
|
||||
print '<tr '.$bc[$var].'><td><a href="releve.php?num='.$objp->numr.'&account='.$acct->id.'">'.$objp->numr.'</a></td>';
|
||||
|
||||
// Calculate start amount
|
||||
$sql = "SELECT sum(b.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= " WHERE b.num_releve < '".$db->escape($objp->numr)."'";
|
||||
$sql.= " AND b.fk_account = ".$acct->id;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
$balancestart[$objp->numr] = $obj->amount;
|
||||
$db->free($resql);
|
||||
}
|
||||
print '<td align="right">'.price($balancestart[$objp->numr],'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
|
||||
// Calculate end amount
|
||||
$sql = "SELECT sum(b.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= " WHERE b.num_releve = '".$db->escape($objp->numr)."'";
|
||||
$sql.= " AND b.fk_account = ".$acct->id;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
$content[$objp->numr] = $obj->amount;
|
||||
$db->free($resql);
|
||||
}
|
||||
print '<td align="right">'.price(($balancestart[$objp->numr]+$content[$objp->numr]),'',$langs,1,-1,-1,$conf->currency).'</td>';
|
||||
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -179,6 +214,7 @@ else
|
||||
*/
|
||||
$ve=$_GET["ve"];
|
||||
|
||||
// Define number of receipt to show (current, previous or next one ?)
|
||||
$found=false;
|
||||
if ($_GET["rel"] == 'prev')
|
||||
{
|
||||
@ -391,10 +427,9 @@ else
|
||||
}
|
||||
}
|
||||
elseif ($links[$key]['type']=='company') {
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$links[$key]['url_id'].'">';
|
||||
print img_object($langs->trans('ShowCustomer'),'company').' ';
|
||||
print dol_trunc($links[$key]['label'],24);
|
||||
print '</a>';
|
||||
$societestatic->id = $links[$key]['url_id'];
|
||||
$societestatic->name = $links[$key]['label'];
|
||||
print $societestatic->getNomUrl(1, 'company', 24);
|
||||
$newline=0;
|
||||
}
|
||||
elseif ($links[$key]['type']=='member') {
|
||||
|
||||
@ -486,11 +486,11 @@ else if ($id)
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'classify')
|
||||
{
|
||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'projectid');
|
||||
$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');
|
||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project,'none', 0, 0);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -2258,7 +2258,7 @@ if ($action == 'create')
|
||||
|
||||
$langs->load('projects');
|
||||
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
|
||||
$formproject->select_projects($soc->id, $projectid, 'projectid');
|
||||
$formproject->select_projects($soc->id, $projectid, 'projectid', 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -2538,7 +2538,8 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Confirmation de la validation
|
||||
if ($action == 'valid') {
|
||||
if ($action == 'valid')
|
||||
{
|
||||
// on verifie si l'objet est en numerotation provisoire
|
||||
$objectref = substr($object->ref, 1, 4);
|
||||
if ($objectref == 'PROV') {
|
||||
@ -2569,7 +2570,8 @@ if ($action == 'create')
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
||||
}
|
||||
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) {
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
|
||||
@ -3352,9 +3354,9 @@ if ($action == 'create')
|
||||
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'classify') {
|
||||
$form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'projectid');
|
||||
$form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1);
|
||||
} else {
|
||||
$form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'none');
|
||||
$form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -858,7 +858,17 @@ class Facture extends CommonInvoice
|
||||
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
|
||||
if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice
|
||||
|
||||
$label=$langs->trans("ShowInvoice").': '.$this->ref;
|
||||
$label = '<u>' . $langs->trans("ShowInvoice") . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$label .= '<br><b>'.$langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
if (! empty($this->ref_client))
|
||||
$label .= '<br><b>' . $langs->trans('RefCustomer') . ':</b> ' . $this->ref_client;
|
||||
if (! empty($this->total_ht))
|
||||
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_tva))
|
||||
$label.= '<br><b>' . $langs->trans('TVA') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (! empty($this->total_ttc))
|
||||
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref;
|
||||
if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref;
|
||||
if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref;
|
||||
@ -1681,8 +1691,8 @@ class Facture extends CommonInvoice
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate)))
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->invoice_advance->validate)))
|
||||
{
|
||||
$this->error='Permission denied';
|
||||
dol_syslog(get_class($this)."::validate ".$this->error, LOG_ERR);
|
||||
@ -3329,7 +3339,8 @@ class Facture extends CommonInvoice
|
||||
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
|
||||
$sql.= ' l.date_start, l.date_end,';
|
||||
$sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,';
|
||||
$sql.= ' p.description as product_desc';
|
||||
$sql.= ' p.description as product_desc,';
|
||||
$sql.= ' p.entity';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
|
||||
$sql.= ' WHERE l.fk_facture = '.$this->id;
|
||||
@ -3352,6 +3363,7 @@ class Facture extends CommonInvoice
|
||||
$this->lines[$i]->description = $obj->description;
|
||||
$this->lines[$i]->fk_product = $obj->fk_product;
|
||||
$this->lines[$i]->ref = $obj->product_ref;
|
||||
$this->lines[$i]->entity = $obj->entity; // Product entity
|
||||
$this->lines[$i]->product_label = $obj->product_label;
|
||||
$this->lines[$i]->product_desc = $obj->product_desc;
|
||||
$this->lines[$i]->fk_product_type = $obj->fk_product_type;
|
||||
|
||||
@ -36,6 +36,7 @@ else print_titre($langs->trans("RelatedBill"));
|
||||
<table class="noborder allwidth">
|
||||
<tr class="liste_titre">
|
||||
<td><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td align="center"><?php echo $langs->trans("RefCustomer"); ?></td>
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
@ -47,8 +48,9 @@ foreach($linkedObjectBlock as $object)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> ><td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/compta/facture.php?facid='.$object->id ?>"><?php echo img_object($langs->trans("ShowBill"),"bill").' '.$object->ref; ?></a></td>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $object->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $object->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->facture->lire) {
|
||||
@ -61,7 +63,7 @@ foreach($linkedObjectBlock as $object)
|
||||
}
|
||||
?>
|
||||
<tr class="liste_total">
|
||||
<td align="left" colspan="2"><?php echo $langs->trans("TotalHT"); ?></td>
|
||||
<td align="left" colspan="3"><?php echo $langs->trans("TotalHT"); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->facture->lire) {
|
||||
echo price($total);
|
||||
|
||||
@ -144,8 +144,12 @@ if (! empty($conf->don->enabled) && $user->rights->don->lire)
|
||||
*/
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.type,";
|
||||
$sql.= " s.nom as name, s.rowid as socid";
|
||||
$sql = "SELECT f.facnumber";
|
||||
$sql.= ", f.rowid, f.total as total_ht, f.tva as total_tva, f.total_ttc";
|
||||
$sql.= ", f.type";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ",s.code_client";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -180,13 +184,18 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">';
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
$facturestatic->total_ttc=$obj->total_ttc;
|
||||
$facturestatic->type=$obj->type;
|
||||
print $facturestatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=1;
|
||||
$companystatic->client = 1;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print $companystatic->getNomUrl(1,'',16);
|
||||
print '</td>';
|
||||
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td>';
|
||||
@ -218,8 +227,10 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
*/
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.type,";
|
||||
$sql.= " s.nom as name, s.rowid as socid";
|
||||
$sql = "SELECT f.ref, f.rowid, f.total_ht, f.tva as total_tva, f.total_ttc, f.type";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_fournisseur";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.rowid = f.fk_soc AND f.fk_statut = 0";
|
||||
@ -249,14 +260,19 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">';
|
||||
$facturesupplierstatic->ref=$obj->ref;
|
||||
$facturesupplierstatic->id=$obj->rowid;
|
||||
$facturesupplierstatic->total_ht=$obj->total_ht;
|
||||
$facturesupplierstatic->total_tva=$obj->total_tva;
|
||||
$facturesupplierstatic->total_ttc=$obj->total_ttc;
|
||||
$facturesupplierstatic->type=$obj->type;
|
||||
print $facturesupplierstatic->getNomUrl(1,'',16);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=1;
|
||||
print $companystatic->getNomUrl(1,'',16);
|
||||
$companystatic->fournisseur = 1;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print $companystatic->getNomUrl(1,'supplier',16);
|
||||
print '</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
@ -292,10 +308,12 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$langs->load("boxes");
|
||||
$facstatic=new Facture($db);
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.total_ttc, f.paye, f.tms,";
|
||||
$sql.= " f.date_lim_reglement as datelimite,";
|
||||
$sql.= " s.nom as name, s.rowid as socid,";
|
||||
$sql.= " sum(pf.amount) as am";
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
|
||||
$sql.= ", f.date_lim_reglement as datelimite";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -335,6 +353,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '<td width="110" class="nobordernopadding nowrap">';
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
$facturestatic->total_ttc=$obj->total_ttc;
|
||||
$facturestatic->type=$obj->type;
|
||||
print $facturestatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
@ -353,9 +374,11 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$thirdpartystatic->id=$obj->socid;
|
||||
$thirdpartystatic->name=$obj->name;
|
||||
$thirdpartystatic->client=1;
|
||||
$thirdpartystatic->code_client = $obj->code_client;
|
||||
$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print $thirdpartystatic->getNomUrl(1,'customer',44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total).'</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($obj->tms),'day').'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).'</td>';
|
||||
@ -391,8 +414,10 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$langs->load("boxes");
|
||||
$facstatic=new FactureFournisseur($db);
|
||||
|
||||
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye";
|
||||
$sql.= ", s.nom as name, s.rowid as socid";
|
||||
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_fournisseur";
|
||||
$sql.= ", SUM(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
|
||||
@ -401,7 +426,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql.= " AND ff.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid";
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid";
|
||||
$sql.= " ORDER BY ff.tms DESC ";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -427,13 +452,18 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
$facstatic->ref=$obj->ref;
|
||||
$facstatic->id=$obj->rowid;
|
||||
$facstatic->id = $obj->rowid;
|
||||
$facstatic->total_ht = $obj->total_ht;
|
||||
$facstatic->total_tva = $obj->total_tva;
|
||||
$facstatic->total_ttc = $obj->total_ttc;
|
||||
print $facstatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$thirdpartystatic->id=$obj->socid;
|
||||
$thirdpartystatic->name=$obj->name;
|
||||
$thirdpartystatic->fournisseur=1;
|
||||
$thirdpartystatic->code_client = $obj->code_client;
|
||||
$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print $thirdpartystatic->getNomUrl(1,'supplier',44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
@ -612,9 +642,11 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
$commandestatic=new Commande($db);
|
||||
$langs->load("orders");
|
||||
|
||||
$sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc,";
|
||||
$sql.= " s.nom as name, s.rowid as socid,";
|
||||
$sql.= " c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.total_ttc";
|
||||
$sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva as total_tva, c.total_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
|
||||
@ -677,6 +709,8 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->name=$obj->name;
|
||||
$societestatic->client=1;
|
||||
$societestatic->code_client = $obj->code_client;
|
||||
$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print $societestatic->getNomUrl(1,'customer',44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
@ -715,10 +749,12 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$facstatic=new Facture($db);
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.total_ttc, f.paye, f.tms,";
|
||||
$sql.= " f.date_lim_reglement as datelimite,";
|
||||
$sql.= " s.nom as name, s.rowid as socid,";
|
||||
$sql.= " sum(pf.amount) as am";
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
|
||||
$sql.= ", f.date_lim_reglement as datelimite";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -758,6 +794,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '<td width="110" class="nobordernopadding nowrap">';
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->total_ht=$obj->total_ht;
|
||||
$facturestatic->total_tva=$obj->total_tva;
|
||||
$facturestatic->total_ttc=$obj->total_ttc;
|
||||
$facturestatic->type=$obj->type;
|
||||
print $facturestatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
@ -776,9 +815,11 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->name=$obj->name;
|
||||
$societestatic->client=1;
|
||||
$societestatic->code_client = $obj->code_client;
|
||||
$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print $societestatic->getNomUrl(1,'customer',44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total).'</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="right">'.price($obj->am).'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).'</td>';
|
||||
@ -820,9 +861,12 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
{
|
||||
$facstatic=new FactureFournisseur($db);
|
||||
|
||||
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,";
|
||||
$sql.= " s.nom as name, s.rowid as socid,";
|
||||
$sql.= " sum(pf.amount) as am";
|
||||
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", s.code_fournisseur";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -832,7 +876,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql.= " AND ff.fk_statut = 1";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,";
|
||||
$sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_ttc, ff.paye,";
|
||||
$sql.= " s.nom, s.rowid";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
@ -859,12 +903,17 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
$facstatic->ref=$obj->ref;
|
||||
$facstatic->id=$obj->rowid;
|
||||
$facstatic->id = $obj->rowid;
|
||||
$facstatic->total_ht = $obj->total_ht;
|
||||
$facstatic->total_tva = $obj->total_tva;
|
||||
$facstatic->total_ttc = $obj->total_ttc;
|
||||
print $facstatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->name=$obj->name;
|
||||
$societestatic->client=0;
|
||||
$societestatic->code_client = $obj->code_client;
|
||||
$societestatic->code_fournisseur = $obj->code_fournisseur;
|
||||
print '<td>'.$societestatic->getNomUrl(1, 'supplier', 44).'</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
|
||||
@ -488,7 +488,7 @@ class Paiement extends CommonObject
|
||||
$fac->thirdparty->name,
|
||||
'company'
|
||||
);
|
||||
if ($result <= 0) dol_print_error($this->db);
|
||||
if ($result <= 0) dol_syslog(get_class($this).'::addPaymentToBank '.$this->db->lasterror());
|
||||
$linkaddedforthirdparty[$fac->thirdparty->id]=$fac->thirdparty->id; // Mark as done for this thirdparty
|
||||
}
|
||||
}
|
||||
@ -506,7 +506,7 @@ class Paiement extends CommonObject
|
||||
$fac->thirdparty->name,
|
||||
'company'
|
||||
);
|
||||
if ($result <= 0) dol_print_error($this->db);
|
||||
if ($result <= 0) dol_syslog(get_class($this).'::addPaymentToBank '.$this->db->lasterror());
|
||||
$linkaddedforthirdparty[$fac->thirdparty->id]=$fac->thirdparty->id; // Mark as done for this thirdparty
|
||||
}
|
||||
}
|
||||
|
||||
@ -887,7 +887,8 @@ class Contact extends CommonObject
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label = $langs->trans("ShowContact").': '.$this->getFullName($langs);
|
||||
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
|
||||
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$lienfin='</a>';
|
||||
|
||||
159
htdocs/contrat/admin/contractdet_extrafields.php
Normal file
159
htdocs/contrat/admin/contractdet_extrafields.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/contrat/admin/contract_extrafields.php
|
||||
* \ingroup contrat
|
||||
* \brief Page to setup extra fields of contract
|
||||
*/
|
||||
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("admin");
|
||||
$langs->load("contracts");
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label=ExtraFields::$type2label;
|
||||
$type2label=array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='contratdet'; //Must be the $element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup');
|
||||
|
||||
print '<br>';
|
||||
$head=contract_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'attributeslines', $langs->trans("Contracts"), 0, 'contract');
|
||||
|
||||
$textobject = $langs->transnoentitiesnoconv('Contracts');
|
||||
|
||||
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
// Load attribute_label
|
||||
$extrafields->fetch_name_optionals_label($elementtype);
|
||||
|
||||
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="center">'.$langs->trans("Position").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("AttributeCode").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Size").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Unique").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Required").'</td>';
|
||||
print '<td width="80"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
foreach($extrafields->attribute_type as $key => $value)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
|
||||
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
|
||||
print "<td>".$key."</td>\n";
|
||||
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
|
||||
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
|
||||
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
|
||||
print " <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
|
||||
print "</tr>";
|
||||
// $i++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Creation d'un champ optionnel
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition d'un champ optionnel */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && ! empty($attrname))
|
||||
{
|
||||
print "<br>";
|
||||
print_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -84,6 +84,10 @@ if ($id > 0 || ! empty($ref)) {
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// fetch optionals attributes lines and labels
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
|
||||
$permissionnote=$user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php
|
||||
|
||||
|
||||
@ -408,6 +412,18 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||
// Unset extrafield
|
||||
if (is_array($extralabelsline)) {
|
||||
// Get extra fields
|
||||
foreach ($extralabelsline as $key => $value) {
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Clean parameters
|
||||
@ -520,7 +536,8 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
$pu_ttc,
|
||||
$info_bits,
|
||||
$fk_fournprice,
|
||||
$pa_ht
|
||||
$pa_ht,
|
||||
$array_option
|
||||
);
|
||||
}
|
||||
|
||||
@ -617,6 +634,12 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST(
|
||||
$objectline->fk_fournprice=$fk_fournprice;
|
||||
$objectline->pa_ht=$pa_ht;
|
||||
|
||||
// Extrafields
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element);
|
||||
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||
$objectline->array_options=$array_option;
|
||||
|
||||
// TODO verifier price_min si fk_product et multiprix
|
||||
|
||||
$result=$objectline->update($user);
|
||||
@ -1192,11 +1215,11 @@ else
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == "classify")
|
||||
{
|
||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id,$object->socid,$object->fk_project,"projectid");
|
||||
$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");
|
||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id,$object->socid,$object->fk_project,"none", 0, 0);
|
||||
}
|
||||
print "</td></tr>";
|
||||
}
|
||||
@ -1237,7 +1260,7 @@ else
|
||||
* Lines of contracts
|
||||
*/
|
||||
|
||||
if ($conf->product->enabled) {
|
||||
if ($conf->product->enabled || $conf->service->enabled) {
|
||||
$productstatic=new Product($db);
|
||||
}
|
||||
|
||||
@ -1306,7 +1329,7 @@ else
|
||||
$productstatic->ref=$objp->label;
|
||||
print $productstatic->getNomUrl(0,'',16);
|
||||
}
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM) and $objp->description)
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($objp->description))
|
||||
print '<br>'.dol_nl2br($objp->description);
|
||||
print '</td>';
|
||||
}
|
||||
@ -1391,6 +1414,16 @@ else
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
//Display lines extrafields
|
||||
if (is_array($extralabelslines) && count($extralabelslines)>0) {
|
||||
print '<tr '.$bc[$var].'>';
|
||||
$line = new ContratLigne($db);
|
||||
$line->fetch_optionals($objp->rowid,$extralabelslines);
|
||||
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan));
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
// Ligne en mode update
|
||||
else
|
||||
@ -1448,6 +1481,15 @@ else
|
||||
print '<br>'.$langs->trans("DateEndPlanned").' ';
|
||||
$form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update");
|
||||
print '</td>';
|
||||
|
||||
if (is_array($extralabelslines) && count($extralabelslines)>0) {
|
||||
print '<tr '.$bc[$var].'>';
|
||||
$line = new ContratLigne($db);
|
||||
$line->fetch_optionals($objp->rowid,$extralabelslines);
|
||||
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan));
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -1730,7 +1772,7 @@ else
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
|
||||
@ -907,7 +907,8 @@ class Contrat extends CommonObject
|
||||
$modCodeContract = new $module();
|
||||
}
|
||||
|
||||
if (!empty($modCodeContract->code_auto)) {
|
||||
//Commerce Efficace - Debut : Modification r<>f<EFBFBD>rence Contrat
|
||||
/*if (!empty($modCodeContract->code_auto)) {
|
||||
// Mise a jour ref
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
||||
if ($this->db->query($sql))
|
||||
@ -917,7 +918,8 @@ class Contrat extends CommonObject
|
||||
$this->ref="(PROV".$this->id.")";
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//Commerce Efficace - Fin : Modification r<>f<EFBFBD>rence Contrat
|
||||
|
||||
// Insert contacts commerciaux ('SALESREPSIGN','contrat')
|
||||
$result=$this->add_contact($this->commercial_signature_id,'SALESREPSIGN','internal');
|
||||
@ -1238,9 +1240,10 @@ class Contrat extends CommonObject
|
||||
* @param int $info_bits Bits de type de lignes
|
||||
* @param int $fk_fournprice Fourn price id
|
||||
* @param int $pa_ht Buying price HT
|
||||
* @param array $array_option extrafields array
|
||||
* @return int <0 si erreur, >0 si ok
|
||||
*/
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_option=0)
|
||||
{
|
||||
global $user, $langs, $conf, $mysoc;
|
||||
|
||||
@ -1348,17 +1351,33 @@ class Contrat extends CommonObject
|
||||
$result=$this->update_statut($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_CREATE',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_option) && count($array_option)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$contractline = new ContratLigne($this->db);
|
||||
$contractline->array_options=$array_option;
|
||||
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
|
||||
$result=$contractline->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error[]=$contractline->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_CREATE',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1399,9 +1418,10 @@ class Contrat extends CommonObject
|
||||
* @param int $info_bits Bits de type de lignes
|
||||
* @param int $fk_fournprice Fourn price id
|
||||
* @param int $pa_ht Buying price HT
|
||||
* @param array $array_option extrafields array
|
||||
* @return int < 0 si erreur, > 0 si ok
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_option=0)
|
||||
{
|
||||
global $user, $conf, $langs, $mysoc;
|
||||
|
||||
@ -1501,17 +1521,33 @@ class Contrat extends CommonObject
|
||||
$result=$this->update_statut($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_UPDATE',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_option) && count($array_option)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$contractline = new ContratLigne($this->db);
|
||||
$contractline->array_options=$array_option;
|
||||
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
|
||||
$result=$contractline->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error[]=$contractline->error;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_UPDATE',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1560,12 +1596,32 @@ class Contrat extends CommonObject
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
// Remove extrafields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$contractline = new ContratLigne($this->db);
|
||||
$contractline->id= $idline;
|
||||
$result=$contractline->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
$this->error="Error ".get_class($this)."::delete deleteExtraFields error -4 ".$contractline->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
dol_syslog(get_class($this)."::delete ERROR:".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2067,6 +2123,9 @@ class ContratLigne extends CommonObject
|
||||
var $statut; // 0 inactive, 4 active, 5 closed
|
||||
var $label;
|
||||
|
||||
public $element='contratdet';
|
||||
public $table_element='contratdet';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @deprecated Use $label instead
|
||||
@ -2445,10 +2504,21 @@ class ContratLigne extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
$error++;
|
||||
//return -1;
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
@ -2456,9 +2526,16 @@ class ContratLigne extends CommonObject
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
$this->errors[]=$this->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -42,8 +42,8 @@ foreach($linkedObjectBlock as $object)
|
||||
$object->fetch_lines();
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> ><td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/contrat/card.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowContract"),"contract").' '.$object->ref; ?></a></td>
|
||||
<tr <?php echo $bc[$var]; ?> >
|
||||
<td><?php echo $object->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date_contrat,'day'); ?></td>
|
||||
<td align="right"> </td>
|
||||
<td align="right"><?php echo $object->getLibStatut(6); ?></td>
|
||||
|
||||
@ -188,7 +188,7 @@ if (file_exists($fullpathselecteddir))
|
||||
$userstatic->lastname=isset($val['login_c'])?$val['login_c']:0;
|
||||
$htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
|
||||
$htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1).'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1, '', false, 1).'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.(isset($val['date_c'])?dol_print_date($val['date_c'],"dayhour"):$langs->trans("NeedRefresh")).'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>';
|
||||
$htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:$langs->trans("NeedRefresh")).'<br>';
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -55,15 +56,20 @@ class box_actions extends ModeleBoxes
|
||||
|
||||
$this->max=$max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
$actionstatic=new ActionComm($db);
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
$societestatic = new Societe($db);
|
||||
$actionstatic = new ActionComm($db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo",$max));
|
||||
|
||||
if ($user->rights->agenda->myactions->read) {
|
||||
$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage,";
|
||||
$sql.= " ta.code, ta.libelle as type_label,";
|
||||
$sql.= " s.nom as name, s.rowid as socid";
|
||||
$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage";
|
||||
$sql.= ", ta.code";
|
||||
$sql.= ", ta.libelle as type_label";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, ";
|
||||
$sql.= MAIN_DB_PREFIX."actioncomm AS a)";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
@ -81,70 +87,66 @@ class box_actions extends ModeleBoxes
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$now=dol_now();
|
||||
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
|
||||
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$line = 0;
|
||||
while ($line < $num) {
|
||||
$late = '';
|
||||
$objp = $db->fetch_object($result);
|
||||
$datelimite=$db->jdate($objp->dp);
|
||||
$datelimite = $db->jdate($objp->dp);
|
||||
$actionstatic->label = $objp->label;
|
||||
$actionstatic->type_label = $objp->type_label;
|
||||
$actionstatic->code = $objp->code;
|
||||
$societestatic->id = $objp->socid;
|
||||
$societestatic->name = $objp->name;
|
||||
$societestatic->code_client = $objp->code_client;
|
||||
|
||||
if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning)) $late=img_warning($langs->trans("Late"));
|
||||
if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning))
|
||||
$late=img_warning($langs->trans("Late"));
|
||||
|
||||
//($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label)
|
||||
$label=empty($objp->label)?$objp->type_label:$objp->label;
|
||||
$label = empty($objp->label)?$objp->type_label:$objp->label;
|
||||
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => ("action"),
|
||||
'tooltip' => $langs->trans('Action'.$objp->code).': '.$label,
|
||||
'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$tooltip = $langs->trans('Action'.$objp->code).': '.$label;
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => dol_trunc($label,32),
|
||||
'text' => $actionstatic->getNomUrl(1),
|
||||
'text2'=> $late,
|
||||
'tooltip' => $langs->trans('Action'.$objp->code).': '.$label,
|
||||
'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id,
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => ($objp->socid?'company':''),
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:''),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => dol_trunc($objp->name,24),
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid,
|
||||
'text' => $societestatic->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left" class="nowrap"',
|
||||
'text' => dol_print_date($datelimite, "dayhour"),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][5] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => ($objp->percentage>= 0?$objp->percentage.'%':''),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][6] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $actionstatic->LibStatut($objp->percentage,3),
|
||||
);
|
||||
|
||||
$i++;
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoActionsToDo"));
|
||||
if ($num==0)
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoActionsToDo"),
|
||||
);
|
||||
|
||||
$db->free($result);
|
||||
$db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
@ -171,8 +173,7 @@ class box_actions extends ModeleBoxes
|
||||
{
|
||||
global $langs, $conf;
|
||||
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||
if ($conf->global->SHOW_DIALOG_HOMEPAGE)
|
||||
{
|
||||
if ($conf->global->SHOW_DIALOG_HOMEPAGE) {
|
||||
$actioncejour=false;
|
||||
$contents=$this->info_box_contents;
|
||||
$nblines=count($contents);
|
||||
@ -183,23 +184,23 @@ class box_actions extends ModeleBoxes
|
||||
{
|
||||
print '<div id="dialog" title="'.$nblines." ".$langs->trans("ActionsToDo").'">';
|
||||
print '<table width=100%>';
|
||||
for ($i=0, $n=$nblines; $i < $n; $i++)
|
||||
for ($line=0, $n=$nblines; $line < $n; $line++)
|
||||
{
|
||||
if (isset($contents[$i]))
|
||||
if (isset($contents[$line]))
|
||||
{
|
||||
// on affiche que les évènement du jours ou passé
|
||||
// qui ne sont pas à 100%
|
||||
$actioncejour=true;
|
||||
$var=!$var;
|
||||
// TR
|
||||
$logo=$contents[$i][0]['logo'];
|
||||
$label=$contents[$i][1]['text'];
|
||||
$urlevent=$contents[$i][1]['url'];
|
||||
$logosoc=$contents[$i][2]['logo'];
|
||||
$nomsoc=$contents[$i][3]['text'];
|
||||
$urlsoc=$contents[$i][3]['url'];
|
||||
$dateligne=$contents[$i][4]['text'];
|
||||
$percentage=$contents[$i][5]['text'];
|
||||
$logo=$contents[$line][0]['logo'];
|
||||
$label=$contents[$line][1]['text'];
|
||||
$urlevent=$contents[$line][1]['url'];
|
||||
$logosoc=$contents[$line][2]['logo'];
|
||||
$nomsoc=$contents[$line][3]['text'];
|
||||
$urlsoc=$contents[$line][3]['url'];
|
||||
$dateligne=$contents[$line][4]['text'];
|
||||
$percentage=$contents[$line][5]['text'];
|
||||
print '<tr '.$bcx[$var].'>';
|
||||
print '<td align=center>';
|
||||
print img_object("",$logo);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2014-2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -73,7 +73,7 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
$totalMnt = 0;
|
||||
$totalnb = 0;
|
||||
$i = 0;
|
||||
$line = 0;
|
||||
$cachetime = 3600;
|
||||
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache';
|
||||
$now = dol_now();
|
||||
@ -94,8 +94,10 @@ class box_activity extends ModeleBoxes
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
$cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice'.$fileid;
|
||||
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
|
||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||
$filename = '/boxactivity-invoice'.$fileid;
|
||||
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$data = array();
|
||||
if ($refresh) {
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
@ -118,38 +120,40 @@ class box_activity extends ModeleBoxes
|
||||
$data[$j]=$db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
file_put_contents($cachefile,serialize($data),LOCK_EX);
|
||||
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$db->free($result);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} else {
|
||||
$data = unserialize(file_get_contents($cachefile));
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
if (! empty($data)) {
|
||||
$j=0;
|
||||
while ($i < count($data)) {
|
||||
while ($line < count($data)) {
|
||||
$billurl="viewstatut=2&paye=1&year=".$data[$j]->annee;
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
'logo' => 'bill',
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'align="right"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0),
|
||||
'text' => $data[$j]->nb,
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency)
|
||||
);
|
||||
@ -159,22 +163,24 @@ class box_activity extends ModeleBoxes
|
||||
$totalnb += $data[$j]->nb;
|
||||
$totalMnt += $data[$j]->Mnttot;
|
||||
}
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
|
||||
);
|
||||
$i++;
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
if (count($data)==0)
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||
);
|
||||
}
|
||||
|
||||
$cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice2'.$fileid;
|
||||
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
|
||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||
$filename = '/boxactivity-invoice2'.$fileid;
|
||||
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
|
||||
if ($refresh) {
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
@ -187,58 +193,60 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result) + $i;
|
||||
$num = $db->num_rows($result) + $line;
|
||||
$j=0;
|
||||
while ($j < $num) {
|
||||
$data[$j]=$db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
file_put_contents($cachefile,serialize($data),LOCK_EX);
|
||||
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$db->free($result);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} else {
|
||||
$data = unserialize(file_get_contents($cachefile));
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
if (! empty($data)) {
|
||||
$j=0;
|
||||
|
||||
while ($i < count($data)) {
|
||||
while ($line < count($data)) {
|
||||
$billurl="viewstatut=".$data[$j]->fk_statut."&paye=0";
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
'logo' => 'bill',
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => $data[$j]->nb,
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0),
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
);
|
||||
$totalnb += $data[$j]->nb;
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||
);
|
||||
$totalMnt += $objp->Mnttot;
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
|
||||
);
|
||||
$i++;
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
if ($num==0)
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||
);
|
||||
@ -255,9 +263,11 @@ class box_activity extends ModeleBoxes
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$commandestatic=new Commande($db);
|
||||
|
||||
$cachefile = DOL_DATA_ROOT.'/commande/temp/boxactivity-order'.$fileid;
|
||||
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
|
||||
$cachedir = DOL_DATA_ROOT.'/commande/temp';
|
||||
$filename = '/boxactivity-order'.$fileid;
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$data = array();
|
||||
|
||||
if ($refresh) {
|
||||
|
||||
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
|
||||
@ -276,36 +286,38 @@ class box_activity extends ModeleBoxes
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result) + $i;
|
||||
$num = $db->num_rows($result) + $line;
|
||||
$j=0;
|
||||
while ($j < $num) {
|
||||
$data[$j]=$db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
file_put_contents($cachefile,serialize($data),LOCK_EX);
|
||||
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$db->free($result);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} else {
|
||||
$data = unserialize(file_get_contents($cachefile));
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
if (! empty($data)) {
|
||||
$j=0;
|
||||
while ($i < count($data)) {
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
while ($line < count($data)) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut,
|
||||
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
|
||||
'logo' => 'object_order',
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' =>$langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => $data[$j]->nb,
|
||||
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0),
|
||||
@ -313,17 +325,17 @@ class box_activity extends ModeleBoxes
|
||||
);
|
||||
$totalnb += $data[$j]->nb;
|
||||
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||
);
|
||||
$totalMnt += $data[$j]->Mnttot;
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3),
|
||||
);
|
||||
|
||||
$i++;
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
@ -334,8 +346,9 @@ class box_activity extends ModeleBoxes
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$propalstatic=new Propal($db);
|
||||
|
||||
$cachefile = DOL_DATA_ROOT.'/propale/temp/boxactivity-propal'.$fileid;
|
||||
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
|
||||
$cachedir = DOL_DATA_ROOT.'/propale/temp';
|
||||
$filename = '/boxactivity-propal'.$fileid;
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$data = array();
|
||||
if ($refresh) {
|
||||
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
|
||||
@ -354,24 +367,26 @@ class box_activity extends ModeleBoxes
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result) + $i;
|
||||
$num = $db->num_rows($result) + $line;
|
||||
$j=0;
|
||||
while ($j < $num) {
|
||||
$data[$j]=$db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
file_put_contents($cachefile,serialize($data),LOCK_EX);
|
||||
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$db->free($result);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} else {
|
||||
$data = unserialize(file_get_contents($cachefile));
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
if (! empty($data)) {
|
||||
$j=0;
|
||||
while ($i < count($data)) {
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
while ($line < count($data)) {
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut,
|
||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||
@ -379,12 +394,12 @@ class box_activity extends ModeleBoxes
|
||||
);
|
||||
|
||||
$objp = $db->fetch_object($result);
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => $data[$j]->nb,
|
||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0),
|
||||
@ -392,40 +407,40 @@ class box_activity extends ModeleBoxes
|
||||
);
|
||||
$totalnb += $data[$j]->nb;
|
||||
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||
);
|
||||
$totalMnt += $data[$j]->Mnttot;
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
|
||||
);
|
||||
|
||||
$i++;
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the sum in the bottom of the boxes
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => 'align="left" ',
|
||||
'text' => $langs->trans("Total")." ".$textHead,
|
||||
);
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'align="right" ',
|
||||
'text' => $totalnb,
|
||||
);
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'align="right" ',
|
||||
'text' => price($totalMnt,1,$langs,0,0,-1,$conf->currency)
|
||||
);
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" ',
|
||||
'text' => "",
|
||||
);
|
||||
$this->info_box_contents[$i][5] = array(
|
||||
$this->info_box_contents[$line][5] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => "",
|
||||
);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -80,19 +81,19 @@ class box_bookmarks extends ModeleBoxes
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
$line = 0;
|
||||
|
||||
while ($i < $num) {
|
||||
while ($line < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => $objp->url,
|
||||
'tooltip' => $objp->title,
|
||||
'target' => $objp->target?'newtab':'',
|
||||
);
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->title,
|
||||
'url' => $objp->url,
|
||||
@ -100,13 +101,13 @@ class box_bookmarks extends ModeleBoxes
|
||||
'target' => $objp->target?'newtab':'',
|
||||
);
|
||||
|
||||
$i++;
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num==0) {
|
||||
$mytxt=$langs->trans("NoRecordedBookmarks");
|
||||
if ($user->rights->bookmark->creer) $mytxt.=' '.$langs->trans("ClickToAdd");
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="center" colspan="2"',
|
||||
'tooltip' => $mytxt,
|
||||
'url'=> DOL_URL_ROOT.'/bookmarks/list.php', 'text'=>$mytxt,
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -79,7 +80,13 @@ class box_clients extends ModeleBoxes
|
||||
|
||||
if ($user->rights->societe->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status";
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", s.client";
|
||||
$sql.= ", s.code_fournisseur";
|
||||
$sql.= ", s.fournisseur";
|
||||
$sql.= ", s.logo";
|
||||
$sql.= ", s.datec, s.tms, s.status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.client IN (1, 3)";
|
||||
@ -97,40 +104,40 @@ class box_clients extends ModeleBoxes
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url= DOL_URL_ROOT."/comm/card.php?socid=";
|
||||
else $url= DOL_URL_ROOT."/societe/soc.php?socid=";
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
$line = 0;
|
||||
while ($line < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$datec=$db->jdate($objp->datec);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->logo = $objp->logo;
|
||||
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => $url.$objp->socid
|
||||
);
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => $url.$objp->socid
|
||||
'text' => $thirdpartystatic->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day")
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $thirdpartystatic->LibStatut($objp->status,3)
|
||||
);
|
||||
|
||||
$i++;
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
|
||||
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -53,20 +54,33 @@ class box_commandes extends ModeleBoxes
|
||||
{
|
||||
global $user, $langs, $db, $conf;
|
||||
|
||||
$this->max=$max;
|
||||
$this->max = $max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$commandestatic=new Commande($db);
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
$commandestatic = new Commande($db);
|
||||
$societestatic = new Societe($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."CustomerOrders",$max));
|
||||
|
||||
if ($user->rights->commande->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid,";
|
||||
$sql.= " c.ref, c.tms, c.rowid, c.date_commande,";
|
||||
$sql.= " c.fk_statut, c.fk_user_valid, c.facture, c.total_ht";
|
||||
$sql = "SELECT s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", s.logo";
|
||||
$sql.= ", c.ref, c.tms";
|
||||
$sql.= ", c.rowid";
|
||||
$sql.= ", c.date_commande";
|
||||
$sql.= ", c.ref_client";
|
||||
$sql.= ", c.fk_statut";
|
||||
$sql.= ", c.fk_user_valid";
|
||||
$sql.= ", c.facture";
|
||||
$sql.= ", c.total_ht";
|
||||
$sql.= ", c.tva as total_tva";
|
||||
$sql.= ", c.total_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -83,68 +97,63 @@ class box_commandes extends ModeleBoxes
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
$line = 0;
|
||||
|
||||
while ($i < $num) {
|
||||
while ($line < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$date=$db->jdate($objp->date_commande);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
$commandestatic->id = $objp->rowid;
|
||||
$commandestatic->ref = $objp->ref;
|
||||
$commandestatic->ref_client = $objp->ref_client;
|
||||
$commandestatic->total_ht = $objp->total_ht;
|
||||
$commandestatic->total_tva = $objp->total_tva;
|
||||
$commandestatic->total_ttc = $objp->total_ttc;
|
||||
$societestatic->id = $objp->socid;
|
||||
$societestatic->name = $objp->name;
|
||||
$societestatic->code_client = $objp->code_client;
|
||||
$societestatic->logo = $objp->logo;
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $langs->trans('Order').': '.$objp->ref,
|
||||
'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->ref,
|
||||
'tooltip' => $langs->trans('Order').': '.$objp->ref,
|
||||
'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid,
|
||||
);
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||
'text' => $commandestatic->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||
'text' => $societestatic->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => price($objp->total_ht),
|
||||
);
|
||||
|
||||
if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) {
|
||||
if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid);
|
||||
$this->info_box_contents[$i][] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''),
|
||||
'url' => (($objp->fk_user_valid > 0)?DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_valid:''),
|
||||
'asis' => 1,
|
||||
);
|
||||
}
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($date,'day'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $commandestatic->LibStatut($objp->fk_statut,$objp->facture,3),
|
||||
);
|
||||
|
||||
$i++;
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedOrders"));
|
||||
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedOrders"));
|
||||
|
||||
$db->free($result);
|
||||
} else {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -94,66 +95,56 @@ class box_comptes extends ModeleBoxes
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
$line = 0;
|
||||
$solde_total = array();
|
||||
|
||||
$account_static = new Account($db);
|
||||
while ($i < $num) {
|
||||
while ($line < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$account_static->id = $objp->rowid;
|
||||
$account_static->label = $objp->label;
|
||||
$account_static->number = $objp->number;
|
||||
$solde=$account_static->solde(0);
|
||||
|
||||
$solde_total[$objp->currency_code] += $solde;
|
||||
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $langs->trans('Account').': '.$objp->label,
|
||||
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->label,
|
||||
'tooltip' => $langs->trans('Account').': '.$objp->label,
|
||||
'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid,
|
||||
'text' => $account_static->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->number,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => price($solde, 0, $langs, 0, 0, -1, $objp->currency_code)
|
||||
'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code)
|
||||
);
|
||||
|
||||
$i++;
|
||||
$line++;
|
||||
}
|
||||
|
||||
// Total
|
||||
foreach ($solde_total as $key=>$solde) {
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'tr' => 'class="liste_total"',
|
||||
'td' => 'align="right" class="liste_total"',
|
||||
'text' => ' ',
|
||||
);
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
'td' => 'align="left" class="liste_total"',
|
||||
'text' => $langs->trans('Total').' '.$key,
|
||||
);
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" class="liste_total"',
|
||||
'text' => ' '
|
||||
);
|
||||
$totalamount=price($solde,0,$langs,0,0,-1,$key);
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" class="liste_total"',
|
||||
'text' => $totalamount
|
||||
'text' => price($solde, 0, $langs, 0, -1, -1, $key)
|
||||
);
|
||||
$i++;
|
||||
$line++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -61,14 +62,15 @@ class box_contacts extends ModeleBoxes
|
||||
|
||||
if ($user->rights->societe->lire)
|
||||
{
|
||||
$sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc,";
|
||||
$sql.= " s.nom as socname";
|
||||
$sql = "SELECT sp.rowid, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc";
|
||||
$sql.= ", s.nom as socname";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND sp.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($user->societe_id) $sql.= " AND sp.fk_soc = $user->societe_id";
|
||||
if ($user->societe_id) $sql.= " AND sp.fk_soc = ".$user->societe_id;
|
||||
$sql.= " ORDER BY sp.tms DESC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@ -79,8 +81,8 @@ class box_contacts extends ModeleBoxes
|
||||
$contactstatic=new Contact($db);
|
||||
$societestatic=new Societe($db);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$line = 0;
|
||||
while ($line < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$datec=$db->jdate($objp->datec);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
@ -89,47 +91,32 @@ class box_contacts extends ModeleBoxes
|
||||
$contactstatic->firstname=$objp->firstname;
|
||||
$contactstatic->civility_id=$objp->civility_id;
|
||||
|
||||
$societestatic->id=$objp->fk_soc;
|
||||
$societestatic->name=$objp->socname;
|
||||
$societestatic->id = $objp->fk_soc;
|
||||
$societestatic->code_client = $objp->code_client;
|
||||
$societestatic->name = $objp->socname;
|
||||
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $langs->trans('Contact').': '.$contactstatic->getFullName($langs,0),
|
||||
'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $contactstatic->getFullName($langs,0),
|
||||
'tooltip' => $langs->trans('Contact').': '.$contactstatic->getFullName($langs,0),
|
||||
'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid,
|
||||
'text' => $contactstatic->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => ($objp->fk_soc > 0?'company':''),
|
||||
'tooltip' => $societestatic->name,
|
||||
'url' => ($objp->fk_soc > 0?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc:''),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $societestatic->name,
|
||||
'tooltip' => $societestatic->name,
|
||||
'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc,
|
||||
'text' => $societestatic->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day"),
|
||||
);
|
||||
|
||||
$i++;
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num==0)
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoRecordedContacts"),
|
||||
);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -77,9 +78,9 @@ class box_contracts extends ModeleBoxes
|
||||
$num = $db->num_rows($resql);
|
||||
$now=dol_now();
|
||||
|
||||
$i = 0;
|
||||
$line = 0;
|
||||
|
||||
while ($i < $num) {
|
||||
while ($line < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$datec=$db->jdate($objp->datec);
|
||||
$dateterm=$db->jdate($objp->fin_validite);
|
||||
@ -93,14 +94,14 @@ class box_contracts extends ModeleBoxes
|
||||
// fin_validite is no more on contract but on services
|
||||
// if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }
|
||||
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid),
|
||||
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
|
||||
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid),
|
||||
@ -108,36 +109,36 @@ class box_contracts extends ModeleBoxes
|
||||
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => dol_trunc($objp->name,40),
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($datec,'day'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][5] = array(
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" class="nowrap"',
|
||||
'text' => $contractstatic->getLibStatut(6),
|
||||
'asis'=>1,
|
||||
);
|
||||
|
||||
$i++;
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num==0)
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoRecordedContracts"),
|
||||
);
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -108,10 +109,11 @@ class box_external_rss extends ModeleBoxes
|
||||
|
||||
// INFO on items
|
||||
$items=$rssparser->getItems();
|
||||
//print '<pre>'.print_r($items,true).'</pre>';
|
||||
$nbitems=count($items);
|
||||
for($i = 0; $i < $max && $i < $nbitems; $i++)
|
||||
for($line = 0; $line < $max && $line < $nbitems; $line++)
|
||||
{
|
||||
$item = $items[$i];
|
||||
$item = $items[$line];
|
||||
|
||||
// Feed common fields
|
||||
$href = $item['link'];
|
||||
@ -138,28 +140,38 @@ class box_external_rss extends ModeleBoxes
|
||||
if (! $isutf8 && $conf->file->character_set_client == 'UTF-8') $title=utf8_encode($title);
|
||||
elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') $title=utf8_decode($title);
|
||||
|
||||
$title=preg_replace("/([[:alnum:]])\?([[:alnum:]])/","\\1'\\2",$title); // Gere probleme des apostrophes mal codee/decodee par utf8
|
||||
$title=preg_replace("/([[:alnum:]])\?([[:alnum:]])/","\\1'\\2",$title); // Gere probleme des apostrophes mal codee/decodee par utf8
|
||||
$title=preg_replace("/^\s+/","",$title); // Supprime espaces de debut
|
||||
$this->info_box_contents["$href"]="$title";
|
||||
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
$tooltip = $title;
|
||||
$description = ! empty($item['description'])?$item['description']:'';
|
||||
$isutf8 = utf8_check($description);
|
||||
if (! $isutf8 && $conf->file->character_set_client == 'UTF-8') $description=utf8_encode($description);
|
||||
elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') $description=utf8_decode($description);
|
||||
$description=preg_replace("/([[:alnum:]])\?([[:alnum:]])/","\\1'\\2",$description);
|
||||
$description=preg_replace("/^\s+/","",$description);
|
||||
$description=str_replace("\r\n","",$description);
|
||||
$tooltip.= '<br>'.$description;
|
||||
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => $href,
|
||||
'tooltip' => $title,
|
||||
'tooltip' => $tooltip,
|
||||
'target' => 'newrss',
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $title,
|
||||
'url' => $href,
|
||||
'tooltip' => $title,
|
||||
'tooltip' => $tooltip,
|
||||
'maxlength' => 64,
|
||||
'target' => 'newrss',
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'align="right" nowrap="1"',
|
||||
'text' => $date,
|
||||
);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -53,8 +54,11 @@ class box_factures extends ModeleBoxes
|
||||
|
||||
$this->max=$max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$facturestatic=new Facture($db);
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
$facturestatic=new Facture($db);
|
||||
$societestatic = new Societe($db);
|
||||
|
||||
$text = $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."CustomerBills",$max);
|
||||
$this->info_box_head = array(
|
||||
@ -62,11 +66,16 @@ class box_factures extends ModeleBoxes
|
||||
'limit'=> dol_strlen($text)
|
||||
);
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
$sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.total as total_ht, f.datef as df";
|
||||
if ($user->rights->facture->lire) {
|
||||
$sql = "SELECT f.rowid as facid";
|
||||
$sql.= ", f.facnumber, f.type, f.total as total_ht";
|
||||
$sql.= ", f.tva as total_tva";
|
||||
$sql.= ", f.total_ttc";
|
||||
$sql.= ", f.datef as df";
|
||||
$sql.= ", f.paye, f.fk_statut, f.datec, f.tms";
|
||||
$sql.= ", s.nom as name, s.rowid as socid";
|
||||
$sql.= ", s.nom as name";
|
||||
$sql.= ", s.rowid as socid";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", f.date_lim_reglement as datelimite";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -88,60 +97,48 @@ class box_factures extends ModeleBoxes
|
||||
$i = 0;
|
||||
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$datelimite=$db->jdate($objp->datelimite);
|
||||
$date=$db->jdate($objp->df);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$datelimite = $db->jdate($objp->datelimite);
|
||||
$date = $db->jdate($objp->df);
|
||||
$datem = $db->jdate($objp->tms);
|
||||
$facturestatic->id = $objp->facid;
|
||||
$facturestatic->ref = $objp->facnumber;
|
||||
$facturestatic->type = $objp->type;
|
||||
$facturestatic->total_ht = $objp->total_ht;
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$societestatic->id = $objp->socid;
|
||||
$societestatic->name = $objp->name;
|
||||
$societestatic->code_client = $objp->code_client;
|
||||
|
||||
$picto='bill';
|
||||
if ($objp->type == 1) $picto.='r';
|
||||
if ($objp->type == 2) $picto.='a';
|
||||
$late = '';
|
||||
if ($objp->paye == 0 && ($objp->fk_statut != 2 && $objp->fk_statut != 3) && $datelimite < ($now - $conf->facture->client->warning_delay)) { $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));}
|
||||
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $picto,
|
||||
'tooltip' => $langs->trans('CustomerInvoice').': '.$objp->facnumber,
|
||||
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->facnumber,
|
||||
'text' => $facturestatic->getNomUrl(1),
|
||||
'text2'=> $late,
|
||||
'tooltip' => $langs->trans('CustomerInvoice').': '.$objp->facnumber,
|
||||
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid,
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'maxlength'=>40,
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||
'text' => $societestatic->getNomUrl(1, '', 40),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => price($objp->total_ht),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][5] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($date,'day'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][6] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3),
|
||||
);
|
||||
@ -173,11 +170,11 @@ class box_factures extends ModeleBoxes
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to show box
|
||||
* Method to show box
|
||||
*
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @return void
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @return void
|
||||
*/
|
||||
function showBox($head = null, $contents = null)
|
||||
{
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -55,7 +56,10 @@ class box_factures_fourn extends ModeleBoxes
|
||||
$this->max=$max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$facturestatic=new FactureFournisseur($db);
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
$facturestatic = new FactureFournisseur($db);
|
||||
$societestatic = new Societe($db);
|
||||
|
||||
$this->info_box_head = array(
|
||||
'text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."SupplierBills",$max)
|
||||
@ -64,7 +68,12 @@ class box_factures_fourn extends ModeleBoxes
|
||||
if ($user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid,";
|
||||
$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.total_ht,";
|
||||
$sql.= " s.code_fournisseur,";
|
||||
$sql.= " s.logo,";
|
||||
$sql.= " f.rowid as facid, f.ref, f.ref_supplier,";
|
||||
$sql.= " f.total_ht,";
|
||||
$sql.= " f.total_tva,";
|
||||
$sql.= " f.total_ttc,";
|
||||
$sql.= " f.paye, f.fk_statut,";
|
||||
$sql.= ' f.datef as df,';
|
||||
$sql.= ' f.datec as datec,';
|
||||
@ -94,47 +103,41 @@ class box_factures_fourn extends ModeleBoxes
|
||||
$datelimite=$db->jdate($objp->datelimite);
|
||||
$date=$db->jdate($objp->df);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
$facturestatic->id = $objp->facid;
|
||||
$facturestatic->ref = $objp->ref;
|
||||
$facturestatic->total_ht = $objp->total_ht;
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$societestatic->id = $objp->socid;
|
||||
$societestatic->name = $objp->name;
|
||||
$societestatic->fournisseur = 1;
|
||||
$societestatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$societestatic->logo = $objp->logo;
|
||||
|
||||
$late = '';
|
||||
if ($objp->paye == 0 && $datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day')));
|
||||
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'<br>'.$langs->trans('RefSupplier').': '.$objp->ref_supplier,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => ($objp->ref?$objp->ref:$objp->facid),
|
||||
'text' => $facturestatic->getNomUrl(1),
|
||||
'text2'=> $late,
|
||||
'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'<br>'.$langs->trans('RefSupplier').': '.$objp->ref_supplier,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->ref_supplier,
|
||||
'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'<br>'.$langs->trans('RefSupplier').': '.$objp->ref_supplier,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'tooltip' => $langs->trans('Supplier').': '.$objp->name,
|
||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'tooltip' => $langs->trans('Supplier').': '.$objp->name,
|
||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
|
||||
'text' => $societestatic->getNomUrl(1, 'supplier'),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][5] = array(
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($date,'day'),
|
||||
);
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -17,9 +18,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/boxes/box_factures_fourn_imp.php
|
||||
* \file htdocs/core/boxes/box_factures_fourn_imp.php
|
||||
* \ingroup fournisseur
|
||||
* \brief Fichier de gestion d'une box des factures fournisseurs impayees
|
||||
* \brief Fichier de gestion d'une box des factures fournisseurs impayees
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
|
||||
@ -29,9 +30,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
*/
|
||||
class box_factures_fourn_imp extends ModeleBoxes
|
||||
{
|
||||
var $boxcode="oldestunpaidsupplierbills";
|
||||
var $boximg="object_bill";
|
||||
var $boxlabel="BoxOldestUnpaidSupplierBills";
|
||||
var $boxcode = "oldestunpaidsupplierbills";
|
||||
var $boximg = "object_bill";
|
||||
var $boxlabel = "BoxOldestUnpaidSupplierBills";
|
||||
var $depends = array("facture","fournisseur");
|
||||
|
||||
var $db;
|
||||
@ -93,55 +94,82 @@ class box_factures_fourn_imp extends ModeleBoxes
|
||||
$late='';
|
||||
if ($datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid);
|
||||
$tooltip = $langs->trans('SupplierInvoice') . ': ' . ($objp->ref?$objp->ref:$objp->facid) . '<br>' . $langs->trans('RefSupplier') . ': ' . $objp->ref_supplier;
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => ($objp->ref?$objp->ref:$objp->facid),
|
||||
'text2'=> $late,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid);
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => ($objp->ref?$objp->ref:$objp->facid),
|
||||
'text2'=> $late,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="left"',
|
||||
'text' => $objp->ref_supplier,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid);
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->ref_supplier,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
|
||||
$tooltip = $langs->trans('Supplier') . ': '. $objp->name;
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'tooltip' => $tooltip,
|
||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][5] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($datelimite,'day'));
|
||||
$this->info_box_contents[$i][5] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($datelimite,'day'),
|
||||
);
|
||||
|
||||
$fac = new FactureFournisseur($db);
|
||||
$fac->fetch($objp->facid);
|
||||
$alreadypaid=$fac->getSommePaiement();
|
||||
$this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type));
|
||||
$this->info_box_contents[$i][6] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type),
|
||||
);
|
||||
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpaidSupplierBills"));
|
||||
if ($num==0)
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoUnpaidSupplierBills"),
|
||||
);
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
}
|
||||
$db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to show box
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -57,15 +58,24 @@ class box_factures_imp extends ModeleBoxes
|
||||
$this->max=$max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$facturestatic=new Facture($db);
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
$facturestatic = new Facture($db);
|
||||
$societestatic = new Societe($db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills",$max));
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid,";
|
||||
$sql.= " s.code_client,";
|
||||
$sql.= " s.logo,";
|
||||
$sql.= " f.facnumber, f.date_lim_reglement as datelimite,";
|
||||
$sql.= " f.type,";
|
||||
$sql.= " f.amount, f.datef as df,";
|
||||
$sql.= " f.total as total_ht,";
|
||||
$sql.= " f.tva as total_tva,";
|
||||
$sql.= " f.total_ttc,";
|
||||
$sql.= " f.paye, f.fk_statut, f.rowid as facid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -92,34 +102,43 @@ class box_factures_imp extends ModeleBoxes
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$datelimite=$db->jdate($objp->datelimite);
|
||||
$facturestatic->id = $objp->facid;
|
||||
$facturestatic->ref = $objp->facnumber;
|
||||
$facturestatic->type = $objp->type;
|
||||
$facturestatic->total_ht = $objp->total_ht;
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$societestatic->id = $objp->socid;
|
||||
$societestatic->name = $objp->name;
|
||||
$societestatic->client = 1;
|
||||
$societestatic->code_client = $objp->code_client;
|
||||
$societestatic->logo = $objp->logo;
|
||||
|
||||
$late='';
|
||||
if ($datelimite < ($now - $conf->facture->client->warning_delay)) $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $facturestatic->getNomUrl(1),
|
||||
'text2'=> $late,
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $objp->facnumber,
|
||||
'text2'=> $late,
|
||||
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $societestatic->getNomUrl(1, '', 44),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($datelimite,'day'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'maxlength'=>44,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($datelimite,'day'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
|
||||
$this->info_box_contents[$i][] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3),
|
||||
);
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -130,14 +149,18 @@ class box_factures_imp extends ModeleBoxes
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,20 +1,21 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/boxes/box_ficheinter.php
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2006 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -84,36 +85,52 @@ class box_fournisseurs extends ModeleBoxes
|
||||
$datec=$db->jdate($objp->datec);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
|
||||
$tooltip = $langs->trans('Supplier') . ': ' . $objp->name;
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid);
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day"));
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day"),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"',
|
||||
'text' => $thirdpartystatic->LibStatut($objp->status,3));
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $thirdpartystatic->LibStatut($objp->status,3),
|
||||
);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedSuppliers"));
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoRecordedSuppliers"),
|
||||
);
|
||||
|
||||
$db->free($result);
|
||||
$db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -95,8 +96,8 @@ class box_members extends ModeleBoxes
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
$line = 0;
|
||||
while ($line < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$datec=$db->jdate($objp->datec);
|
||||
@ -104,6 +105,7 @@ class box_members extends ModeleBoxes
|
||||
|
||||
$memberstatic->lastname=$objp->lastname;
|
||||
$memberstatic->firstname=$objp->firstname;
|
||||
$memberstatic->ref = $objp->rowid;
|
||||
|
||||
if (! empty($objp->fk_soc)) {
|
||||
$memberstatic->socid = $objp->fk_soc;
|
||||
@ -113,39 +115,53 @@ class box_members extends ModeleBoxes
|
||||
$memberstatic->name=$objp->company;
|
||||
}
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $memberstatic->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $memberstatic->getFullName($langs),
|
||||
'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $memberstatic->getFullName($langs),
|
||||
'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day"));
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day"),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"',
|
||||
'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3));
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3),
|
||||
);
|
||||
|
||||
$i++;
|
||||
}
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers"));
|
||||
if ($num==0)
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoRecordedCustomers"),
|
||||
);
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array('align' => 'left',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
}
|
||||
$db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'align' => 'left',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to show box
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -63,7 +64,7 @@ class box_produits extends ModeleBoxes
|
||||
|
||||
if ($user->rights->produit->lire || $user->rights->service->lire)
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy";
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
|
||||
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
||||
@ -75,8 +76,8 @@ class box_produits extends ModeleBoxes
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
$line = 0;
|
||||
while ($line < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
@ -98,58 +99,92 @@ class box_produits extends ModeleBoxes
|
||||
$objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
$productstatic->id = $objp->rowid;
|
||||
$productstatic->ref = $objp->ref;
|
||||
$productstatic->type = $objp->fk_product_type;
|
||||
$productstatic->label = $objp->label;
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => ($objp->fk_product_type==1?'object_service':'object_product'),
|
||||
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $productstatic->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $objp->label,
|
||||
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->label,
|
||||
);
|
||||
|
||||
if ($objp->price_base_type == 'HT')
|
||||
{
|
||||
$price=price($objp->price);
|
||||
$price_base_type=$langs->trans("HT");
|
||||
}
|
||||
else
|
||||
{
|
||||
$price=price($objp->price_ttc);
|
||||
$price_base_type=$langs->trans("TTC");
|
||||
}
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
||||
'text' => $price);
|
||||
if (empty($objp->fk_price_expression)) {
|
||||
$price_base_type=$langs->trans($objp->price_base_type);
|
||||
$price=($objp->price_base_type == 'HT')?price($objp->price):$price=price($objp->price_ttc);
|
||||
}
|
||||
else //Parse the dinamic price
|
||||
{
|
||||
$productstatic->fetch($objp->rowid, '', '', 1);
|
||||
$priceparser = new PriceParser($this->db);
|
||||
$price_result = $priceparser->parseProduct($productstatic);
|
||||
if ($price_result >= 0) {
|
||||
if ($objp->price_base_type == 'HT')
|
||||
{
|
||||
$price_base_type=$langs->trans("HT");
|
||||
}
|
||||
else
|
||||
{
|
||||
$price_result = $price_result * (1 + ($productstatic->tva_tx / 100));
|
||||
$price_base_type=$langs->trans("TTC");
|
||||
}
|
||||
$price=price($price_result);
|
||||
}
|
||||
}
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => $price,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="left" class="nowrap"',
|
||||
'text' => $price_base_type);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left" class="nowrap"',
|
||||
'text' => $price_base_type,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($datem,'day'));
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($datem,'day'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
|
||||
'text' => $productstatic->LibStatut($objp->tosell,3,0));
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $productstatic->LibStatut($objp->tosell,3,0),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"',
|
||||
'text' => $productstatic->LibStatut($objp->tobuy,3,1));
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $productstatic->LibStatut($objp->tobuy,3,1),
|
||||
);
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProducts"));
|
||||
$line++;
|
||||
}
|
||||
if ($num==0)
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoRecordedProducts"),
|
||||
);
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
}
|
||||
}
|
||||
$db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to show box
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2012 Maxime Kohlhaas <mko@atm-consulting.fr>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -64,7 +65,7 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
|
||||
if ($user->rights->produit->lire || $user->rights->service->lire)
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,";
|
||||
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,";
|
||||
$sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product";
|
||||
@ -82,9 +83,8 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
{
|
||||
$langs->load("stocks");
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$line = 0;
|
||||
while ($line < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
|
||||
@ -105,57 +105,90 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
$objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
$productstatic->id = $objp->rowid;
|
||||
$productstatic->ref = $objp->ref;
|
||||
$productstatic->type = $objp->fk_product_type;
|
||||
$productstatic->label = $objp->label;
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => ($objp->fk_product_type==1?'object_service':'object_product'),
|
||||
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $productstatic->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $objp->label,
|
||||
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->label,
|
||||
);
|
||||
|
||||
if ($objp->price_base_type == 'HT')
|
||||
{
|
||||
$price=price($objp->price);
|
||||
$price_base_type=$langs->trans("HT");
|
||||
}
|
||||
else
|
||||
{
|
||||
$price=price($objp->price_ttc);
|
||||
$price_base_type=$langs->trans("TTC");
|
||||
}
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
||||
'text' => $price);
|
||||
if (empty($objp->fk_price_expression))
|
||||
{
|
||||
$price_base_type=$langs->trans($objp->price_base_type);
|
||||
$price=($objp->price_base_type == 'HT')?price($objp->price):$price=price($objp->price_ttc);
|
||||
}
|
||||
else //Parse the dinamic price
|
||||
{
|
||||
$productstatic->fetch($objp->rowid, '', '', 1);
|
||||
$priceparser = new PriceParser($this->db);
|
||||
$price_result = $priceparser->parseProduct($productstatic);
|
||||
if ($price_result >= 0) {
|
||||
if ($objp->price_base_type == 'HT')
|
||||
{
|
||||
$price_base_type=$langs->trans("HT");
|
||||
}
|
||||
else
|
||||
{
|
||||
$price_result = $price_result * (1 + ($productstatic->tva_tx / 100));
|
||||
$price_base_type=$langs->trans("TTC");
|
||||
}
|
||||
$price=price($price_result);
|
||||
}
|
||||
}
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="left" class="nowrap"',
|
||||
'text' => $price_base_type);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => $price,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="center"',
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left" class="nowrap"',
|
||||
'text' => $price_base_type,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array('td' => 'align="center"',
|
||||
'text' => $objp->total_stock . ' / '.$objp->seuil_stock_alerte,
|
||||
'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit")));
|
||||
|
||||
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
|
||||
$this->info_box_contents[$line][] = array('td' => 'align="right" width="18"',
|
||||
'text' => $productstatic->LibStatut($objp->tosell,3,0));
|
||||
|
||||
$this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"',
|
||||
$this->info_box_contents[$line][] = array('td' => 'align="right" width="18"',
|
||||
'text' => $productstatic->LibStatut($objp->tobuy,3,1));
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoTooLowStockProducts"));
|
||||
$line++;
|
||||
}
|
||||
if ($num==0)
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoTooLowStockProducts"),
|
||||
);
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -90,21 +92,24 @@ class box_project extends ModeleBoxes
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$tooltip = $langs->trans('Project') . ': ' . $objp->ref;
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => 'object_project',
|
||||
'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid
|
||||
'tooltip' => $tooltip,
|
||||
'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->ref,
|
||||
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid
|
||||
'tooltip' => $tooltip,
|
||||
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->title
|
||||
'text' => $objp->title,
|
||||
);
|
||||
|
||||
$sql ="SELECT count(*) as nb, sum(progress) as totprogress";
|
||||
@ -114,9 +119,15 @@ class box_project extends ModeleBoxes
|
||||
$resultTask = $db->query($sql);
|
||||
if ($resultTask) {
|
||||
$objTask = $db->fetch_object($resultTask);
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks"));
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks"),
|
||||
);
|
||||
if ($objTask->nb > 0 )
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%");
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%",
|
||||
);
|
||||
else
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A ");
|
||||
$totalnbTask += $objTask->nb;
|
||||
@ -132,11 +143,28 @@ class box_project extends ModeleBoxes
|
||||
|
||||
|
||||
// Add the sum à the bottom of the boxes
|
||||
$this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead);
|
||||
$this->info_box_contents[$i][1] = array('td' => '', 'text' => "");
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects"));
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks"));
|
||||
$this->info_box_contents[$i][4] = array('td' => '', 'text' => "");
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'tr' => 'class="liste_total"',
|
||||
'td' => 'align="left" ',
|
||||
'text' => " ",
|
||||
);
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
'td' => '',
|
||||
'text' => $langs->trans("Total")." ".$textHead,
|
||||
'text' => " ",
|
||||
);
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
'td' => 'align="right" ',
|
||||
'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects"),
|
||||
);
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
'td' => 'align="right" ',
|
||||
'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks"),
|
||||
);
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
'td' => '',
|
||||
'text' => " ",
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -56,14 +57,16 @@ class box_propales extends ModeleBoxes
|
||||
$this->max=$max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
$propalstatic=new Propal($db);
|
||||
$societestatic = new Societe($db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals",$max));
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals",$max));
|
||||
|
||||
if ($user->rights->propale->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid,";
|
||||
$sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tms";
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo,";
|
||||
$sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -81,68 +84,81 @@ class box_propales extends ModeleBoxes
|
||||
$num = $db->num_rows($result);
|
||||
$now=dol_now();
|
||||
|
||||
$i = 0;
|
||||
$line = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($line < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$date=$db->jdate($objp->dp);
|
||||
$datec=$db->jdate($objp->datec);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
$dateterm=$db->jdate($objp->fin_validite);
|
||||
$dateclose=$db->jdate($objp->date_cloture);
|
||||
$propalstatic->id = $objp->rowid;
|
||||
$propalstatic->ref = $objp->ref;
|
||||
$propalstatic->total_ht = $objp->total_ht;
|
||||
$propalstatic->total_tva = $objp->total_tva;
|
||||
$propalstatic->total_ttc = $objp->total_ttc;
|
||||
$societestatic->id = $objp->socid;
|
||||
$societestatic->name = $objp->name;
|
||||
$societestatic->code_client = $objp->code_client;
|
||||
$societestatic->logo = $objp->logo;
|
||||
|
||||
$late = '';
|
||||
if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) {
|
||||
$late = img_warning($langs->trans("Late"));
|
||||
}
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $propalstatic->getNomUrl(1),
|
||||
'text2'=> $late,
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $objp->ref,
|
||||
'text2'=> $late,
|
||||
'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $societestatic->getNomUrl(1,'',40),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => price($objp->total_ht),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
|
||||
'text' => dol_trunc($objp->name,40),
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($date,'day'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
|
||||
'text' => price($objp->total_ht),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $propalstatic->LibStatut($objp->fk_statut,3),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][5] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($date,'day'));
|
||||
$line++;
|
||||
}
|
||||
|
||||
$this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"',
|
||||
'text' => $propalstatic->LibStatut($objp->fk_statut,3));
|
||||
if ($num==0)
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoRecordedProposals"),
|
||||
);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProposals"));
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
}
|
||||
$db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -104,41 +105,58 @@ class box_prospect extends ModeleBoxes
|
||||
$datec=$db->jdate($objp->datec);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'tooltip' => $objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day"));
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($datem, "day"),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"',
|
||||
'text' => str_replace('img ','img height="14" ',$prospectstatic->LibProspStatut($objp->fk_stcomm,3)));
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => str_replace('img ','img height="14" ',$prospectstatic->LibProspStatut($objp->fk_stcomm,3)),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
|
||||
'text' => $thirdpartystatic->LibStatut($objp->status,3));
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $thirdpartystatic->LibStatut($objp->status,3),
|
||||
);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProspects"));
|
||||
if ($num==0)
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoRecordedProspects"),
|
||||
);
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$db->free($resql);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
dol_syslog("box_prospect::loadBox not allowed de read this box content",LOG_ERR);
|
||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
/* Copyright (C) 2004-2006 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -82,8 +83,7 @@ class box_supplier_orders extends ModeleBoxes
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$date=$db->jdate($objp->date_commande);
|
||||
$datem=$db->jdate($objp->tms);
|
||||
@ -91,48 +91,70 @@ class box_supplier_orders extends ModeleBoxes
|
||||
$urlo = DOL_URL_ROOT."/fourn/commande/card.php?id=".$objp->rowid;
|
||||
$urls = DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid;
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => $urlo);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $objp->ref,
|
||||
'url' => $urlo);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'url' => $urls);
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'url' => $urls);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($date,'day'),
|
||||
$tooltip = $langs->trans('SupplierOrder') . ': ' . $objp->ref;
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => $urlo,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
|
||||
'text' => $supplierorderstatic->LibStatut($objp->fk_statut,3));
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->ref,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => $urlo,
|
||||
);
|
||||
|
||||
$tooltip = $langs->trans('Supplier') . ': ' . $objp->name;
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'tooltip' => $tooltip,
|
||||
'url' => $urls,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][3] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'tooltip' => $tooltip,
|
||||
'url' => $urls,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][4] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => dol_print_date($date,'day'),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][5] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $supplierorderstatic->LibStatut($objp->fk_statut,3),
|
||||
);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($num == 0)
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoSupplierOrder"));
|
||||
$this->info_box_contents[$i][0] = array(
|
||||
'td' => 'align="center"',
|
||||
'text' => $langs->trans("NoSupplierOrder"),
|
||||
);
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql));
|
||||
$db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'maxlength'=>500,
|
||||
'text' => ($db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -99,13 +100,13 @@ class box_task extends ModeleBoxes
|
||||
$objp = $db->fetch_object($result);
|
||||
$this->info_box_contents[$i][1] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0)
|
||||
'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array(
|
||||
'td' => 'align="right"',
|
||||
'text' => $objp->nb." ".$langs->trans("Tasks"),
|
||||
'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut
|
||||
'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut,
|
||||
);
|
||||
$totalnb += $objp->nb;
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5));
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -178,153 +179,173 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
*/
|
||||
function showBox($head, $contents)
|
||||
{
|
||||
global $langs,$conf;
|
||||
global $langs, $user, $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
|
||||
|
||||
$MAXLENGTHBOX=60; // Mettre 0 pour pas de limite
|
||||
$bcx=array();
|
||||
$bcx = array();
|
||||
$bcx[0] = 'class="box_pair"';
|
||||
$bcx[1] = 'class="box_impair"';
|
||||
$var = false;
|
||||
|
||||
dol_syslog(get_class($this).'::showBox');
|
||||
$cachetime = 900; // 900 : 15mn
|
||||
$cachedir = DOL_DATA_ROOT.'/boxes/temp';
|
||||
$fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache';
|
||||
$filename = '/box-'.$fileid;
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$out = '';
|
||||
|
||||
// Define nbcol and nblines of the box to show
|
||||
$nbcol=0;
|
||||
if (isset($contents[0])) $nbcol=count($contents[0]);
|
||||
$nblines=count($contents);
|
||||
if ($refresh) {
|
||||
dol_syslog(get_class($this).'::showBox');
|
||||
|
||||
print "\n\n<!-- Box start -->\n";
|
||||
print '<div class="box" id="boxto_'.$this->box_id.'">'."\n";
|
||||
// Define nbcol and nblines of the box to show
|
||||
$nbcol=0;
|
||||
if (isset($contents[0])) $nbcol=count($contents[0]);
|
||||
$nblines=count($contents);
|
||||
|
||||
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines)
|
||||
{
|
||||
print '<table summary="boxtable'.$this->box_id.'" width="100%" class="noborder boxtable">'."\n";
|
||||
}
|
||||
$out.= "\n<!-- Box ".get_class($this)." start -->\n";
|
||||
$out.= '<div class="box" id="boxto_'.$this->box_id.'">'."\n";
|
||||
|
||||
// Show box title
|
||||
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']))
|
||||
{
|
||||
//print '<div id="boxto_'.$this->box_id.'_title">'."\n";
|
||||
//print '<table summary="boxtabletitle'.$this->box_id.'" width="100%" class="noborder">'."\n";
|
||||
print '<tr class="box_titre">';
|
||||
print '<td';
|
||||
if ($nbcol > 0) { print ' colspan="'.$nbcol.'"'; }
|
||||
print '>';
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print '<table summary="" class="nobordernopadding" width="100%"><tr><td>';
|
||||
}
|
||||
if (! empty($head['text']))
|
||||
{
|
||||
$s=dol_trunc($head['text'],isset($head['limit'])?$head['limit']:$MAXLENGTHBOX);
|
||||
print $s;
|
||||
}
|
||||
print ' ';
|
||||
if (! empty($head['sublink'])) print '<a href="'.$head['sublink'].'"'.(empty($head['target'])?' target="_blank"':'').'>';
|
||||
if (! empty($head['subpicto'])) print img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"');
|
||||
if (! empty($head['sublink'])) '</a>';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print '</td><td class="nocellnopadd boxclose nowrap">';
|
||||
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
|
||||
print img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"');
|
||||
print img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"');
|
||||
$label=$head['text'];
|
||||
if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')';
|
||||
print '<input type="hidden" id="boxlabelentry'.$this->box_id.'" value="'.dol_escape_htmltag($label).'">';
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
//print "</table>\n";
|
||||
//print "</div>\n";
|
||||
}
|
||||
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines)
|
||||
{
|
||||
$out.= '<table summary="boxtable'.$this->box_id.'" width="100%" class="noborder boxtable">'."\n";
|
||||
}
|
||||
|
||||
// Show box lines
|
||||
if ($nblines)
|
||||
{
|
||||
//print '<table summary="boxtablelines'.$this->box_id.'" width="100%" class="noborder">'."\n";
|
||||
// Loop on each record
|
||||
for ($i=0, $n=$nblines; $i < $n; $i++)
|
||||
{
|
||||
if (isset($contents[$i]))
|
||||
{
|
||||
$var=!$var;
|
||||
// Show box title
|
||||
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']))
|
||||
{
|
||||
//$out.= '<div id="boxto_'.$this->box_id.'_title">'."\n";
|
||||
//$out.= '<table summary="boxtabletitle'.$this->box_id.'" width="100%" class="noborder">'."\n";
|
||||
$out.= '<tr class="box_titre">';
|
||||
$out.= '<td';
|
||||
if ($nbcol > 0) { $out.= ' colspan="'.$nbcol.'"'; }
|
||||
$out.= '>';
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
$out.= '<table summary="" class="nobordernopadding" width="100%"><tr><td>';
|
||||
}
|
||||
if (! empty($head['text']))
|
||||
{
|
||||
$s=dol_trunc($head['text'],isset($head['limit'])?$head['limit']:$MAXLENGTHBOX);
|
||||
$out.= $s;
|
||||
}
|
||||
$out.= ' ';
|
||||
if (! empty($head['sublink'])) $out.= '<a href="'.$head['sublink'].'"'.(empty($head['target'])?' target="_blank"':'').'>';
|
||||
if (! empty($head['subpicto'])) $out.= img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"');
|
||||
if (! empty($head['sublink'])) '</a>';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$out.= '</td><td class="nocellnopadd boxclose nowrap">';
|
||||
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
|
||||
$out.= img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"');
|
||||
$out.= img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"');
|
||||
$label=$head['text'];
|
||||
if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')';
|
||||
$out.= '<input type="hidden" id="boxlabelentry'.$this->box_id.'" value="'.dol_escape_htmltag($label).'">';
|
||||
$out.= '</td></tr></table>';
|
||||
}
|
||||
$out.= '</td>';
|
||||
$out.= "</tr>\n";
|
||||
//$out.= "</table>\n";
|
||||
//$out.= "</div>\n";
|
||||
}
|
||||
|
||||
// TR
|
||||
if (isset($contents[$i][0]['tr'])) print '<tr valign="top" '.$contents[$i][0]['tr'].'>';
|
||||
else print '<tr valign="top" '.$bcx[$var].'>';
|
||||
// Show box lines
|
||||
if ($nblines)
|
||||
{
|
||||
//$out.= '<table summary="boxtablelines'.$this->box_id.'" width="100%" class="noborder">'."\n";
|
||||
// Loop on each record
|
||||
for ($i=0, $n=$nblines; $i < $n; $i++)
|
||||
{
|
||||
if (isset($contents[$i]))
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
// Loop on each TD
|
||||
$nbcolthisline=count($contents[$i]);
|
||||
for ($j=0; $j < $nbcolthisline; $j++) {
|
||||
// Define tdparam
|
||||
$tdparam='';
|
||||
if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td'];
|
||||
// TR
|
||||
if (isset($contents[$i][0]['tr'])) $out.= '<tr valign="top" '.$contents[$i][0]['tr'].'>';
|
||||
else $out.= '<tr valign="top" '.$bcx[$var].'>';
|
||||
|
||||
if (empty($contents[$i][$j]['text'])) $contents[$i][$j]['text']="";
|
||||
$text=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:'';
|
||||
$textwithnotags=preg_replace('/<([^>]+)>/i','',$text);
|
||||
$text2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:'';
|
||||
$text2withnotags=preg_replace('/<([^>]+)>/i','',$text2);
|
||||
$textnoformat=isset($contents[$i][$j]['textnoformat'])?$contents[$i][$j]['textnoformat']:'';
|
||||
//print "xxx $textwithnotags y";
|
||||
if (empty($contents[$i][$j]['tooltip'])) $contents[$i][$j]['tooltip']="";
|
||||
$tooltip=isset($contents[$i][$j]['tooltip'])?$contents[$i][$j]['tooltip']:'';
|
||||
// Loop on each TD
|
||||
$nbcolthisline=count($contents[$i]);
|
||||
for ($j=0; $j < $nbcolthisline; $j++) {
|
||||
// Define tdparam
|
||||
$tdparam='';
|
||||
if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td'];
|
||||
|
||||
print '<td'.$tdparam.'>'."\n";
|
||||
if (empty($contents[$i][$j]['text'])) $contents[$i][$j]['text']="";
|
||||
$text=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:'';
|
||||
$textwithnotags=preg_replace('/<([^>]+)>/i','',$text);
|
||||
$text2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:'';
|
||||
$text2withnotags=preg_replace('/<([^>]+)>/i','',$text2);
|
||||
$textnoformat=isset($contents[$i][$j]['textnoformat'])?$contents[$i][$j]['textnoformat']:'';
|
||||
//$out.= "xxx $textwithnotags y";
|
||||
if (empty($contents[$i][$j]['tooltip'])) $contents[$i][$j]['tooltip']="";
|
||||
$tooltip=isset($contents[$i][$j]['tooltip'])?$contents[$i][$j]['tooltip']:'';
|
||||
|
||||
// Url
|
||||
if (! empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo']))
|
||||
{
|
||||
print '<a href="'.$contents[$i][$j]['url'].'" title="'.dol_escape_htmltag($langs->trans("Show").' '.$tooltip, 1).'" class="classfortooltip"';
|
||||
//print ' alt="'.$textwithnotags.'"'; // Pas de alt sur un "<a href>"
|
||||
print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
|
||||
print '>';
|
||||
}
|
||||
$out.= '<td'.$tdparam.'>'."\n";
|
||||
|
||||
// Logo
|
||||
if (! empty($contents[$i][$j]['logo']))
|
||||
{
|
||||
$logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']);
|
||||
print '<a href="'.$contents[$i][$j]['url'].'">';
|
||||
print img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"');
|
||||
}
|
||||
// Url
|
||||
if (! empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo']))
|
||||
{
|
||||
$out.= '<a href="'.$contents[$i][$j]['url'].'" title="'.dol_escape_htmltag($langs->trans("Show").' '.$tooltip, 1).'" class="classfortooltip"';
|
||||
//$out.= ' alt="'.$textwithnotags.'"'; // Pas de alt sur un "<a href>"
|
||||
$out.= isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':'';
|
||||
$out.= '>';
|
||||
}
|
||||
|
||||
$maxlength=$MAXLENGTHBOX;
|
||||
if (! empty($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength'];
|
||||
// Logo
|
||||
if (! empty($contents[$i][$j]['logo']))
|
||||
{
|
||||
$logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']);
|
||||
$out.= '<a href="'.$contents[$i][$j]['url'].'">';
|
||||
$out.= img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"');
|
||||
}
|
||||
|
||||
if ($maxlength) $textwithnotags=dol_trunc($textwithnotags,$maxlength);
|
||||
if (preg_match('/^<img/i',$text) || ! empty($contents[$i][$j]['asis'])) print $text; // show text with no html cleaning
|
||||
else print $textwithnotags; // show text with html cleaning
|
||||
$maxlength=$MAXLENGTHBOX;
|
||||
if (! empty($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength'];
|
||||
|
||||
// End Url
|
||||
if (! empty($contents[$i][$j]['url'])) print '</a>';
|
||||
if ($maxlength) $textwithnotags=dol_trunc($textwithnotags,$maxlength);
|
||||
if (preg_match('/^<img/i',$text) || ! empty($contents[$i][$j]['asis'])) $out.= $text; // show text with no html cleaning
|
||||
else $out.= $textwithnotags; // show text with html cleaning
|
||||
|
||||
if (preg_match('/^<img/i',$text2) || ! empty($contents[$i][$j]['asis2'])) print $text2; // show text with no html cleaning
|
||||
else print $text2withnotags; // show text with html cleaning
|
||||
// End Url
|
||||
if (! empty($contents[$i][$j]['url'])) $out.= '</a>';
|
||||
|
||||
if (! empty($textnoformat)) print "\n".$textnoformat."\n";
|
||||
if (preg_match('/^<img/i',$text2) || ! empty($contents[$i][$j]['asis2'])) $out.= $text2; // show text with no html cleaning
|
||||
else $out.= $text2withnotags; // show text with html cleaning
|
||||
|
||||
print "</td>\n";
|
||||
}
|
||||
if (! empty($textnoformat)) $out.= "\n".$textnoformat."\n";
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$out.= "</td>\n";
|
||||
}
|
||||
|
||||
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines)
|
||||
{
|
||||
print "</table>\n";
|
||||
}
|
||||
$out.= "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If invisible box with no contents
|
||||
if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) print "<br>\n";
|
||||
if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines)
|
||||
{
|
||||
$out.= "</table>\n";
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
print "<!-- Box end -->\n\n";
|
||||
}
|
||||
// If invisible box with no contents
|
||||
if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) $out.= "<br>\n";
|
||||
|
||||
$out.= "</div>\n";
|
||||
$out.= "<!-- Box ".get_class($this)." end -->\n\n";
|
||||
if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $out);
|
||||
}
|
||||
} else {
|
||||
dol_syslog(get_class($this).'::showBoxCached');
|
||||
$out = dol_readcachefile($cachedir, $filename);
|
||||
print "<!-- Box ".get_class($this)." from cache -->";
|
||||
|
||||
}
|
||||
print $out;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -737,7 +737,8 @@ abstract class CommonObject
|
||||
|
||||
$project = new Project($this->db);
|
||||
$result = $project->fetch($this->fk_project);
|
||||
$this->projet = $project;
|
||||
$this->projet = $project; // deprecated
|
||||
$this->project = $project;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -2702,6 +2703,8 @@ abstract class CommonObject
|
||||
$product_static->type=$line->fk_product_type;
|
||||
$product_static->id=$line->fk_product;
|
||||
$product_static->ref=$line->ref;
|
||||
if (! empty($line->entity))
|
||||
$product_static->entity=$line->entity;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
|
||||
// Define output language and label
|
||||
|
||||
67
htdocs/core/class/html.form.class.php
Executable file → Normal file
67
htdocs/core/class/html.form.class.php
Executable file → Normal file
@ -832,8 +832,9 @@ class Form
|
||||
if ($conf->use_javascript_ajax && ! $forcecombo)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||
$nodatarole=' data-role="none"';
|
||||
$comboenhancement =ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||
$out.= $comboenhancement;
|
||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
}
|
||||
|
||||
// Construct $out and $outarray
|
||||
@ -1037,8 +1038,9 @@ class Form
|
||||
if ($conf->use_javascript_ajax && ! $forcecombo && ! $options_only)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out.= ajax_combobox($htmlname, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
|
||||
$nodatarole=' data-role="none"';
|
||||
$comboenhancement = ajax_combobox($htmlname, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
|
||||
$out.= $comboenhancement;
|
||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
}
|
||||
|
||||
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
|
||||
@ -1226,12 +1228,14 @@ class Form
|
||||
if ($num)
|
||||
{
|
||||
// Enhance with select2
|
||||
$nodatarole='';
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out.= ajax_combobox($htmlname);
|
||||
$nodatarole=' data-role="none"';
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlname);
|
||||
$out.=$comboenhancement;
|
||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
}
|
||||
|
||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').$nodatarole.'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.((empty($selected) || $selected==-1)?' selected="selected"':'').'> </option>'."\n";
|
||||
@ -1465,7 +1469,7 @@ class Form
|
||||
$outarray=array();
|
||||
|
||||
$sql = "SELECT ";
|
||||
$sql.= " p.rowid, p.label, p.ref, p.description, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock";
|
||||
$sql.= " p.rowid, p.label, p.ref, p.description, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock, p.fk_price_expression";
|
||||
|
||||
//Price by customer
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
|
||||
@ -1544,6 +1548,8 @@ class Form
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php';
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
@ -1593,6 +1599,19 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($objp->fk_price_expression)) {
|
||||
$price_product = new Product($this->db);
|
||||
$price_product->fetch($objp->rowid, '', '', 1);
|
||||
$priceparser = new PriceParser($this->db);
|
||||
$price_result = $priceparser->parseProduct($price_product);
|
||||
if ($price_result >= 0) {
|
||||
$objp->price = $price_result;
|
||||
$objp->unitprice = $price_result;
|
||||
//Calculate the VAT
|
||||
$objp->price_ttc = price2num($objp->price) * (1 + ($objp->tva_tx / 100));
|
||||
$objp->price_ttc = price2num($objp->price_ttc,'MU');
|
||||
}
|
||||
}
|
||||
$this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected);
|
||||
// Add new entry
|
||||
// "key" value of json key array is used by jQuery automatically as selected value
|
||||
@ -1874,7 +1893,7 @@ class Form
|
||||
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,";
|
||||
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
|
||||
$sql.= " pfp.fk_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
|
||||
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
|
||||
@ -1956,9 +1975,9 @@ class Form
|
||||
{
|
||||
$outqty=$objp->quantity;
|
||||
$outdiscount=$objp->remise_percent;
|
||||
if (!empty($objp->fk_price_expression)) {
|
||||
if (!empty($objp->fk_supplier_price_expression)) {
|
||||
$priceparser = new PriceParser($this->db);
|
||||
$price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_price_expression, $objp->quantity, $objp->tva_tx);
|
||||
$price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_supplier_price_expression, $objp->quantity, $objp->tva_tx);
|
||||
if ($price_result >= 0) {
|
||||
$objp->fprice = $price_result;
|
||||
if ($objp->quantity >= 1)
|
||||
@ -2055,7 +2074,7 @@ class Form
|
||||
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,";
|
||||
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,";
|
||||
$sql.= " pfp.fk_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
|
||||
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
|
||||
@ -2095,9 +2114,9 @@ class Form
|
||||
}
|
||||
$opt.= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
|
||||
|
||||
if (!empty($objp->fk_price_expression)) {
|
||||
if (!empty($objp->fk_supplier_price_expression)) {
|
||||
$priceparser = new PriceParser($this->db);
|
||||
$price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_price_expression, $objp->quantity, $objp->tva_tx);
|
||||
$price_result = $priceparser->parseProductSupplier($objp->fk_product, $objp->fk_supplier_price_expression, $objp->quantity, $objp->tva_tx);
|
||||
if ($price_result >= 0) {
|
||||
$objp->fprice = $price_result;
|
||||
if ($objp->quantity >= 1)
|
||||
@ -3145,10 +3164,12 @@ class Form
|
||||
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||
* @param int $selected Id pre-selected project
|
||||
* @param string $htmlname Name of select field
|
||||
* @param int $discard_closed Hide all closed projects
|
||||
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
||||
* @param int $maxlength Max length
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @return void
|
||||
*/
|
||||
function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0)
|
||||
function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -3160,12 +3181,13 @@ class Form
|
||||
$langs->load("project");
|
||||
if ($htmlname != "none")
|
||||
{
|
||||
print "\n";
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="classin">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$formproject->select_projects($socid,$selected,$htmlname,20,0,1,$discard_closed);
|
||||
$formproject->select_projects($socid,$selected,$htmlname,$maxlength,0,1,$discard_closed, $forcefocus);
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
@ -4269,7 +4291,7 @@ class Form
|
||||
|
||||
// Try also magic suggest
|
||||
|
||||
// Add data-role="none" to diable jmobile decoration
|
||||
// Add data-role="none" to disable jmobile decoration
|
||||
$out = '<select data-role="none" id="'.$htmlname.'" class="multiselect" multiple="multiple" name="'.$htmlname.'[]"'.$option.($width?' style="width: '.$width.'px"':'').'>'."\n";
|
||||
if (is_array($array) && ! empty($array))
|
||||
{
|
||||
@ -4484,7 +4506,7 @@ class Form
|
||||
* @param int $width Width of photo
|
||||
* @return string HTML code to output photo
|
||||
*/
|
||||
function showphoto($modulepart,$object,$width=100)
|
||||
static function showphoto($modulepart,$object,$width=100)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -4609,8 +4631,9 @@ class Form
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out.= ajax_combobox($htmlname);
|
||||
$nodatarole=' data-role="none"';
|
||||
$comboenhancement = ajax_combobox($htmlname);
|
||||
$out.= $comboenhancement;
|
||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
}
|
||||
|
||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled="disabled"':'').$nodatarole.'>';
|
||||
|
||||
@ -324,8 +324,9 @@ class FormOther
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$moreforfilter.= ajax_combobox('select_categ_'.$htmlname);
|
||||
$nodatarole=' data-role="none"';
|
||||
$comboenhancement = ajax_combobox('select_categ_'.$htmlname);
|
||||
$moreforfilter.=$comboenhancement;
|
||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
}
|
||||
|
||||
// Print a select with each of them
|
||||
@ -373,8 +374,9 @@ class FormOther
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out.= ajax_combobox($htmlname);
|
||||
$nodatarole=' data-role="none"';
|
||||
$comboenhancement = ajax_combobox($htmlname);
|
||||
$out.=$comboenhancement;
|
||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
}
|
||||
// Select each sales and print them in a select input
|
||||
$out.='<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
|
||||
|
||||
@ -43,7 +43,7 @@ class FormProjets
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a combo list with projects qualified for a third party
|
||||
* Output a combo list with projects qualified for a third party
|
||||
*
|
||||
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||
* @param int $selected Id project preselected
|
||||
@ -51,10 +51,11 @@ class FormProjets
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $option_only Return only html options lines without the select tag
|
||||
* @param int $show_empty Add an empty line
|
||||
* @param int $discard_closed Discard closed projects
|
||||
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @return int Nber of project if OK, <0 if KO
|
||||
*/
|
||||
function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0)
|
||||
function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0)
|
||||
{
|
||||
global $user,$conf,$langs;
|
||||
|
||||
@ -85,8 +86,18 @@ class FormProjets
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Use select2 selector
|
||||
$nodatarole='';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||
$out.=$comboenhancement;
|
||||
$nodatarole=($comboenhancement?' data-role="none"':'');
|
||||
}
|
||||
|
||||
if (empty($option_only)) {
|
||||
$out.= '<select class="flat" name="'.$htmlname.'">';
|
||||
$out.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
|
||||
}
|
||||
if (!empty($show_empty)) {
|
||||
$out.= '<option value="0"> </option>';
|
||||
@ -105,7 +116,7 @@ class FormProjets
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($discard_closed && $obj->fk_statut == 2)
|
||||
if ($discard_closed == 1 && $obj->fk_statut == 2)
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
@ -114,30 +125,31 @@ class FormProjets
|
||||
$labeltoshow=dol_trunc($obj->ref,18);
|
||||
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
|
||||
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
|
||||
|
||||
$disabled=0;
|
||||
if ($obj->fk_statut == 0)
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("Draft");
|
||||
}
|
||||
else if ($obj->fk_statut == 2)
|
||||
{
|
||||
if ($discard_close == 2) $disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("Closed");
|
||||
}
|
||||
else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
|
||||
}
|
||||
|
||||
if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0)
|
||||
{
|
||||
$out.= '<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.' '.dol_trunc($obj->title,$maxlength).'</option>';
|
||||
$out.= '<option value="'.$obj->rowid.'" selected="selected">'.$labeltoshow.'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$disabled=0;
|
||||
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
|
||||
if ($obj->fk_statut == 0)
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("Draft");
|
||||
}
|
||||
else if ($obj->fk_statut == 2)
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("Closed");
|
||||
}
|
||||
else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
|
||||
}
|
||||
|
||||
if ($hideunselectables && $disabled)
|
||||
{
|
||||
$resultat='';
|
||||
@ -161,6 +173,7 @@ class FormProjets
|
||||
if (empty($option_only)) {
|
||||
$out.= '</select>';
|
||||
}
|
||||
|
||||
print $out;
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -176,7 +176,10 @@ class Ldap
|
||||
|
||||
if (is_resource($this->connection))
|
||||
{
|
||||
// Execute the ldap_set_option here (after connect and before bind)
|
||||
$this->setVersion();
|
||||
ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true.
|
||||
|
||||
|
||||
if ($this->serverType == "activedirectory")
|
||||
{
|
||||
|
||||
@ -550,7 +550,7 @@ class RssParser
|
||||
//
|
||||
elseif ($this->_format == 'atom' and $el == 'link' )
|
||||
{
|
||||
if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
|
||||
if ( isset($attrs['rel']) && $attrs['rel'] == 'alternate' )
|
||||
{
|
||||
$link_el = 'link';
|
||||
}
|
||||
|
||||
@ -26,17 +26,18 @@
|
||||
* \brief File to manage popup date selector
|
||||
*/
|
||||
|
||||
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // disabled
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN',1); // disabled
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
|
||||
require_once '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php
|
||||
$langs->load("main");
|
||||
@ -186,37 +187,45 @@ function displayBox($selectedDate,$month,$year)
|
||||
</tr>
|
||||
<tr class="dpDayNames">
|
||||
<?php
|
||||
$first_day_of_week = isset($conf->global->MAIN_START_WEEK) ? (int) $conf->global->MAIN_START_WEEK : 0;
|
||||
$startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1;
|
||||
$day_names = array('ShortSunday', 'ShortMonday', 'ShortTuesday', 'ShortWednesday', 'ShortThursday', 'ShortFriday', 'ShortSaturday');
|
||||
for( $i=0; $i < 7; $i++ )
|
||||
{
|
||||
echo '<td width="', (int) (($i+1)*100/7) - (int) ($i*100/7), '%">', $langs->trans($day_names[($i + $first_day_of_week) % 7]), '</td>', "\n";
|
||||
echo '<td width="', (int) (($i+1)*100/7) - (int) ($i*100/7), '%">', $langs->trans($day_names[($i + $startday) % 7]), '</td>', "\n";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
//print "x ".$thedate." y";
|
||||
//print "x ".$thedate." y"; // $thedate = first day of month
|
||||
$firstdate=dol_getdate($thedate);
|
||||
$mydate=$firstdate;
|
||||
//var_dump($firstdateofweek);
|
||||
$mydate=dol_get_first_day_week(1, $month, $year, true); // mydate = cursor date
|
||||
|
||||
// Loop on each day of month
|
||||
$stoploop=0; $day=1; $cols=0;
|
||||
while (! $stoploop)
|
||||
{
|
||||
//print_r($mydate);
|
||||
if($firstdate==$mydate) // At first run
|
||||
if ($mydate < $firstdate) // At first run
|
||||
{
|
||||
echo "<TR class=\"dpWeek\">";
|
||||
//echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday;
|
||||
$cols=0;
|
||||
for($i=0;$i< ($mydate["wday"]+7-$first_day_of_week)%7;$i++)
|
||||
for ($i = 0; $i < 7; $i++)
|
||||
{
|
||||
$w = ($i + $startday) % 7;
|
||||
if ($w == $firstdate["wday"])
|
||||
{
|
||||
$mydate = $firstdate;
|
||||
break;
|
||||
}
|
||||
echo "<TD> </TD>";
|
||||
$cols++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($mydate["wday"]==$first_day_of_week)
|
||||
if ($mydate["wday"] == $startday)
|
||||
{
|
||||
echo "<TR class=\"dpWeek\">";
|
||||
$cols=0;
|
||||
@ -240,7 +249,7 @@ function displayBox($selectedDate,$month,$year)
|
||||
echo ">".sprintf("%02s",$mydate["mday"])."</TD>";
|
||||
$cols++;
|
||||
|
||||
if ($mydate != $firstdate && $mydate["wday"]==(($first_day_of_week + 6)%7)) echo "</TR>\n";
|
||||
if (($mydate["wday"] + 1) % 7 == $startday) echo "</TR>\n";
|
||||
|
||||
//$thedate=strtotime("tomorrow",$thedate);
|
||||
$day++;
|
||||
@ -279,5 +288,4 @@ function displayBox($selectedDate,$month,$year)
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}//end function
|
||||
|
||||
}//end function
|
||||
@ -188,7 +188,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
||||
|
||||
if ( isset( $_FILES['NewFile'] ) && !is_null($_FILES['NewFile']['tmp_name'])
|
||||
// This is for the QuickUpload tab box
|
||||
or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name'])))
|
||||
or (isset($_FILES['upload']) && !is_null($_FILES['upload']['tmp_name'])))
|
||||
{
|
||||
global $Config ;
|
||||
|
||||
|
||||
@ -50,6 +50,8 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
global $conf, $user, $langs, $db, $hookmanager;
|
||||
global $begin_h, $end_h, $begin_d, $end_d;
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
// Filters
|
||||
print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
@ -114,7 +116,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<td class="nowrap">';
|
||||
print $langs->trans("Project").' ';
|
||||
print '</td><td class="nowrap maxwidthonsmartphone">';
|
||||
$formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 64);
|
||||
$formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -314,25 +314,28 @@ function ajax_dialog($title,$message,$w=350,$h=150)
|
||||
* @param string $htmlname Name of html select field
|
||||
* @param array $events More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete
|
||||
* @param int $forcefocus Force focus on field
|
||||
* @return string Return html string to convert a select field into a combo
|
||||
*/
|
||||
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0)
|
||||
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
//if (! empty($conf->browser->phone)) return ''; // combobox disabled for smartphones (does not works)
|
||||
//if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile
|
||||
if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile but it breaks the autosize feature of jmobile.
|
||||
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
|
||||
if (empty($conf->use_javascript_ajax)) return '';
|
||||
|
||||
if (empty($conf->use_javascript_ajax)) return '';
|
||||
|
||||
if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0;
|
||||
|
||||
|
||||
$msg = '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(\'#'.$htmlname.'\').select2({
|
||||
width: \'resolve\',
|
||||
minimumInputLength: '.$minLengthToAutocomplete.',
|
||||
});';
|
||||
})';
|
||||
if ($forcefocus) $msg.= '.select2(\'focus\')';
|
||||
$msg.= ';';
|
||||
|
||||
if (count($event))
|
||||
{
|
||||
@ -345,7 +348,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function runJsCodeForEvent'.$htmlname.'(obj) {
|
||||
var id = $("#'.$htmlname.'").val();
|
||||
var method = obj.method;
|
||||
@ -383,7 +386,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0)
|
||||
);
|
||||
}';
|
||||
}
|
||||
|
||||
|
||||
$msg.= '});'."\n";
|
||||
$msg.= "</script>\n";
|
||||
|
||||
|
||||
@ -2,11 +2,12 @@
|
||||
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
@ -988,9 +989,11 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
}
|
||||
|
||||
$out.='<td width="80" class="nowrap">';
|
||||
$userstatic->id=$obj->fk_user_author;
|
||||
$userstatic->login=$obj->login;
|
||||
$out.=$userstatic->getLoginUrl(1);
|
||||
//$userstatic->id=$obj->fk_user_author;
|
||||
//$userstatic->login=$obj->login;
|
||||
//$out.=$userstatic->getLoginUrl(1);
|
||||
$userstatic->fetch($obj->fk_user_author);
|
||||
$out.=$userstatic->getNomUrl(1);
|
||||
$out.='</td>';
|
||||
|
||||
// Statut
|
||||
@ -1235,22 +1238,36 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
{
|
||||
if ($histo[$key]['elementtype'] == 'propal' && ! empty($conf->propal->enabled))
|
||||
{
|
||||
$propalstatic->ref=$langs->trans("ProposalShort");
|
||||
$propalstatic->id=$histo[$key]['fk_element'];
|
||||
$out.=$propalstatic->getNomUrl(1);
|
||||
}
|
||||
//$propalstatic->ref=$langs->trans("ProposalShort");
|
||||
//$propalstatic->id=$histo[$key]['fk_element'];
|
||||
if ($propalstatic->fetch($histo[$key]['fk_element'])>0) {
|
||||
$propalstatic->type=$histo[$key]['ftype'];
|
||||
$out.=$propalstatic->getNomUrl(1);
|
||||
} else {
|
||||
$out.= $langs->trans("ProposalDeleted");
|
||||
}
|
||||
}
|
||||
elseif (($histo[$key]['elementtype'] == 'order' || $histo[$key]['elementtype'] == 'commande') && ! empty($conf->commande->enabled))
|
||||
{
|
||||
$orderstatic->ref=$langs->trans("Order");
|
||||
$orderstatic->id=$histo[$key]['fk_element'];
|
||||
$out.=$orderstatic->getNomUrl(1);
|
||||
}
|
||||
//$orderstatic->ref=$langs->trans("Order");
|
||||
//$orderstatic->id=$histo[$key]['fk_element'];
|
||||
if ($orderstatic->fetch($histo[$key]['fk_element'])>0) {
|
||||
$orderstatic->type=$histo[$key]['ftype'];
|
||||
$out.=$orderstatic->getNomUrl(1);
|
||||
} else {
|
||||
$out.= $langs->trans("OrderDeleted");
|
||||
}
|
||||
}
|
||||
elseif (($histo[$key]['elementtype'] == 'invoice' || $histo[$key]['elementtype'] == 'facture') && ! empty($conf->facture->enabled))
|
||||
{
|
||||
$facturestatic->ref=$langs->trans("Invoice");
|
||||
$facturestatic->id=$histo[$key]['fk_element'];
|
||||
$facturestatic->type=$histo[$key]['ftype'];
|
||||
$out.=$facturestatic->getNomUrl(1,'compta');
|
||||
//$facturestatic->ref=$langs->trans("Invoice");
|
||||
//$facturestatic->id=$histo[$key]['fk_element'];
|
||||
if ($facturestatic->fetch($histo[$key]['fk_element'])>0) {
|
||||
$facturestatic->type=$histo[$key]['ftype'];
|
||||
$out.=$facturestatic->getNomUrl(1,'compta');
|
||||
} else {
|
||||
$out.= $langs->trans("InvoiceDeleted");
|
||||
}
|
||||
}
|
||||
else $out.=' ';
|
||||
}
|
||||
@ -1272,9 +1289,11 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
|
||||
// Auteur
|
||||
$out.='<td class="nowrap" width="80">';
|
||||
$userstatic->id=$histo[$key]['userid'];
|
||||
$userstatic->login=$histo[$key]['login'];
|
||||
$out.=$userstatic->getLoginUrl(1);
|
||||
//$userstatic->id=$histo[$key]['userid'];
|
||||
//$userstatic->login=$histo[$key]['login'];
|
||||
//$out.=$userstatic->getLoginUrl(1);
|
||||
$userstatic->fetch($histo[$key]['userid']);
|
||||
$out.=$userstatic->getNomUrl(1);
|
||||
$out.='</td>';
|
||||
|
||||
// Statut
|
||||
|
||||
@ -112,6 +112,11 @@ function contract_admin_prepare_head()
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/admin/contractdet_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||
$head[$h][2] = 'attributeslines';
|
||||
$h++;
|
||||
|
||||
|
||||
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'contract_admin','remove');
|
||||
|
||||
@ -479,34 +479,36 @@ function dol_get_last_day($year,$month=12,$gm=false)
|
||||
return $datelim;
|
||||
}
|
||||
|
||||
/** Return first day of week for a date
|
||||
/** Return first day of week for a date. First day of week may be monday if option MAIN_START_WEEK is 1.
|
||||
*
|
||||
* @param int $day Day
|
||||
* @param int $month Month
|
||||
* @param int $year Year
|
||||
* @param int $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date.
|
||||
* @return array year,month,week,first_day,prev_year,prev_month,prev_day
|
||||
* @return array year,month,week,first_day,first_month,first_year,prev_day,prev_month,prev_year
|
||||
*/
|
||||
function dol_get_first_day_week($day,$month,$year,$gm=false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
//$day=2; $month=2; $year=2015;
|
||||
$date = dol_mktime(0,0,0,$month,$day,$year,$gm);
|
||||
|
||||
//Checking conf of start week
|
||||
$start_week = (isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1);
|
||||
|
||||
$tmparray = dol_getdate($date,true);
|
||||
$tmparray = dol_getdate($date,true); // detail of current day
|
||||
|
||||
//Calculate days to count
|
||||
//Calculate days = offset from current day
|
||||
$days = $start_week - $tmparray['wday'];
|
||||
if ($days>=1) $days=7-$days;
|
||||
$days = abs($days);
|
||||
$seconds = $days*24*60*60;
|
||||
//print 'start_week='.$start_week.' tmparray[wday]='.$tmparray['wday'].' day offset='.$days.' seconds offset='.$seconds.'<br>';
|
||||
|
||||
//Get first day of week
|
||||
$tmpday = date($tmparray[0])-$seconds;
|
||||
$tmpday = date("d",$tmpday);
|
||||
$tmpdaytms = date($tmparray[0])-$seconds; // $tmparray[0] is day of parameters
|
||||
$tmpday = date("d",$tmpdaytms);
|
||||
|
||||
//Check first day of week is in same month than current day or not
|
||||
if ($tmpday>$day)
|
||||
|
||||
@ -1876,3 +1876,49 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store object in file
|
||||
*
|
||||
* @param string $directory Directory of cache
|
||||
* @param string $filename Name of filecache
|
||||
* @param mixed $object Object to store in cachefile
|
||||
* @return void
|
||||
*/
|
||||
function dol_filecache($directory, $filename, $object)
|
||||
{
|
||||
if (! dol_is_dir($directory)) dol_mkdir($directory);
|
||||
$cachefile = $directory . $filename;
|
||||
file_put_contents($cachefile, serialize($object), LOCK_EX);
|
||||
@chmod($cachefile, 0644);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if Refresh needed
|
||||
*
|
||||
* @param string $directory Directory of cache
|
||||
* @param string $filename Name of filecache
|
||||
* @param int $cachetime Cachetime delay
|
||||
* @return boolean 0 no refresh 1 if refresh needed
|
||||
*/
|
||||
function dol_cache_refresh($directory, $filename, $cachetime)
|
||||
{
|
||||
$now = dol_now();
|
||||
$cachefile = $directory . $filename;
|
||||
$refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile);
|
||||
return $refresh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read object from cachefile
|
||||
*
|
||||
* @param string $directory Directory of cache
|
||||
* @param string $filename Name of filecache
|
||||
* @return mixed Unserialise from file
|
||||
*/
|
||||
function dol_readcachefile($directory, $filename)
|
||||
{
|
||||
$cachefile = $directory . $filename;
|
||||
$object = unserialize(file_get_contents($cachefile));
|
||||
return $object;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user