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

This commit is contained in:
Regis Houssin 2018-01-12 10:35:22 +01:00
commit 93d5c818c5
25 changed files with 290 additions and 236 deletions

View File

@ -39,6 +39,7 @@ $mesg = '';
$action = GETPOST('action','aZ09'); $action = GETPOST('action','aZ09');
$backtopage = GETPOST('backtopage','alpha'); $backtopage = GETPOST('backtopage','alpha');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel','alpha'); $cancel = GETPOST('cancel','alpha');
@ -261,8 +262,10 @@ if ($action == 'create') {
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} else if ($id) { }
$result = $object->fetch($id); else if ($id > 0 || $ref) {
$result = $object->fetch($id, $ref, 1);
if ($result > 0) { if ($result > 0) {
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);
@ -329,17 +332,18 @@ if ($action == 'create') {
// View mode // View mode
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">' . $langs->trans("BackToList") . '</a>';
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), -1, 'billr');
dol_banner_tab($object, 'ref', $linkback, 1, 'account_number', 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Account number
print '<tr><td class="titlefield">' . $langs->trans("AccountNumber") . '</td>';
print '<td>' . $object->account_number . '</td>';
print '<td align="right" width="25%">' . $linkback . '</td></tr>';
// Label // Label
print '<tr><td>' . $langs->trans("Label") . '</td>'; print '<tr><td class="titlefield">' . $langs->trans("Label") . '</td>';
print '<td colspan="2">' . $object->label . '</td></tr>'; print '<td colspan="2">' . $object->label . '</td></tr>';
// Account parent // Account parent
@ -361,20 +365,10 @@ if ($action == 'create') {
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>'; print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
print '<td colspan="2">' . $object->pcg_subtype . '</td></tr>'; print '<td colspan="2">' . $object->pcg_subtype . '</td></tr>';
// Active
print '<tr><td>' . $langs->trans("Status") . '</td>';
print '<td colspan="2">';
print $object->getLibStatut(4);
/*if (empty($object->active)) {
print img_picto($langs->trans("Disabled"), 'switch_off');
} else {
print img_picto($langs->trans("Activated"), 'switch_on');
}*/
print '</td></tr>';
print '</table>'; print '</table>';
print '</div>';
dol_fiche_end(); dol_fiche_end();
/* /*
@ -397,7 +391,7 @@ if ($action == 'create') {
print '</div>'; print '</div>';
} }
} else { } else {
dol_print_error($db); dol_print_error($db, $object->error, $object->errors);
} }
} }

View File

@ -30,6 +30,21 @@
*/ */
class AccountingAccount extends CommonObject class AccountingAccount extends CommonObject
{ {
public $element='accounting_account';
public $table_element='accounting_account';
public $picto = 'billr';
/**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var int
*/
public $ismultientitymanaged = 1;
/**
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* @var integer
*/
public $restrictiononfksoc = 1;
var $db; var $db;
var $error; var $error;
var $errors; var $errors;
@ -48,13 +63,17 @@ class AccountingAccount extends CommonObject
var $active; // duplicate with status var $active; // duplicate with status
var $status; var $status;
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handle * @param DoliDB $db Database handle
*/ */
function __construct($db) { function __construct($db) {
global $conf;
$this->db = $db; $this->db = $db;
$this->next_prev_filter='fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; // Used to add a filter in Form::showrefnav method
} }
/** /**
@ -91,6 +110,7 @@ class AccountingAccount extends CommonObject
if ($obj) { if ($obj) {
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->rowid = $obj->rowid; $this->rowid = $obj->rowid;
$this->ref = $obj->account_number;
$this->datec = $obj->datec; $this->datec = $obj->datec;
$this->tms = $obj->tms; $this->tms = $obj->tms;
$this->fk_pcg_version = $obj->fk_pcg_version; $this->fk_pcg_version = $obj->fk_pcg_version;

View File

@ -250,14 +250,14 @@ if ($action == 'writebookkeeping') {
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; if ($alreadydispatched) $replacedinvoice = 2;
} }
// If not already into bookkeeping, we won't add it, if yes, we will also add the counterpart. // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
if ($replacedinvoice == 1) if ($replacedinvoice == 1)
{ {
continue; continue;
@ -560,14 +560,14 @@ if ($action == 'exportcsv') {
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; if ($alreadydispatched) $replacedinvoice = 2;
} }
// If not already into bookkeeping, we won't add it, if yes, we will also add the counterpart. // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
if ($replacedinvoice == 1) if ($replacedinvoice == 1)
{ {
continue; continue;
@ -760,14 +760,14 @@ if (empty($action) || $action == 'view') {
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == FactureFournisseur::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; if ($alreadydispatched) $replacedinvoice = 2;
} }
// If no, we won't add it, if yes, we will also add the counterpart. // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
if ($replacedinvoice == 1) if ($replacedinvoice == 1)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -252,14 +252,14 @@ if ($action == 'writebookkeeping') {
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; if ($alreadydispatched) $replacedinvoice = 2;
} }
// If not already into bookkeeping, we won't add it, if yes, we will also add the counterpart. // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
if ($replacedinvoice == 1) if ($replacedinvoice == 1)
{ {
continue; continue;
@ -515,14 +515,14 @@ if ($action == 'exportcsv') {
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; if ($alreadydispatched) $replacedinvoice = 2;
} }
// If not already into bookkeeping, we won't add it, if yes, we will also add the counterpart. // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
if ($replacedinvoice == 1) if ($replacedinvoice == 1)
{ {
continue; continue;
@ -692,14 +692,14 @@ if (empty($action) || $action == 'view') {
// Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched // Is it a replaced invoice ? 0=not a replaced invoice, 1=replaced invoice not yet dispatched, 2=replaced invoice dispatched
$replacedinvoice = 0; $replacedinvoice = 0;
if ($invoicestatic->close_code == 'replaced') if ($invoicestatic->close_code == Facture::CLOSECODE_REPLACED)
{ {
$replacedinvoice = 1; $replacedinvoice = 1;
$alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping. $alreadydispatched = $invoicestatic->getVentilExportCompta(); // Test if replaced invoice already into bookkeeping.
if ($alreadydispatched) $replacedinvoice = 2; if ($alreadydispatched) $replacedinvoice = 2;
} }
// If not already into bookkeeping, we won't add it, if yes, we will also add the counterpart. // If not already into bookkeeping, we won't add it, if yes, add the counterpart ???.
if ($replacedinvoice == 1) if ($replacedinvoice == 1)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -80,8 +80,8 @@ print img_picto('','puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'
if (! empty($setupcompanynotcomplete)) if (! empty($setupcompanynotcomplete))
{ {
$langs->load("errors"); $langs->load("errors");
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete")); $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit').'">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>'; print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit').'">'.$warnpicto.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
} }
print '<br>'; print '<br>';
print '<br>'; print '<br>';
@ -92,8 +92,8 @@ print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
{ {
$langs->load("errors"); $langs->load("errors");
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete")); $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>'; print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
} }
print '<br>'; print '<br>';
print '<br>'; print '<br>';

View File

@ -3167,7 +3167,7 @@ else if ($id > 0 || ! empty($ref))
$i ++; $i ++;
// Texte // Texte
$i = 0; $i = 0;
$close [$i] ['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonDiscountVat", $resteapayer, $langs->trans("Currency" . $conf->currency)), $close [$i] ['label'], 1); $close [$i] ['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonDiscount", $resteapayer, $langs->trans("Currency" . $conf->currency)), $close [$i] ['label'], 1);
$i ++; $i ++;
$close [$i] ['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer", $resteapayer, $langs->trans("Currency" . $conf->currency)), $close [$i] ['label'], 1); $close [$i] ['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer", $resteapayer, $langs->trans("Currency" . $conf->currency)), $close [$i] ['label'], 1);
$i ++; $i ++;

View File

@ -214,10 +214,10 @@ class Facture extends CommonInvoice
*/ */
const STATUS_ABANDONED = 3; const STATUS_ABANDONED = 3;
const CLOSECODE_DISCOUNTVAT = 'discount_vat'; const CLOSECODE_DISCOUNTVAT = 'discount_vat'; // Abandonned remain - escompte
const CLOSECODE_BADDEBT = 'badcustomer'; const CLOSECODE_BADDEBT = 'badcustomer'; // Abandonned - bad
const CLOSECODE_ABANDONED = 'abandon'; const CLOSECODE_ABANDONED = 'abandon'; // Abandonned - other
const CLOSECODE_REPLACED = 'replaced'; const CLOSECODE_REPLACED = 'replaced'; // Closed after doing a replacement invoice
/** /**
* Constructor * Constructor
@ -2053,11 +2053,11 @@ class Facture extends CommonInvoice
* of no payment even if merchandises were sent). * of no payment even if merchandises were sent).
* *
* @param User $user Object user making change * @param User $user Object user making change
* @param string $close_code Code de fermeture * @param string $close_code Code of closing invoice (CLOSECODE_REPLACED, CLOSECODE_...)
* @param string $close_note Comment * @param string $close_note Comment
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function set_canceled($user,$close_code='',$close_note='') function set_canceled($user, $close_code='', $close_note='')
{ {
dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG); dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG);
@ -2187,7 +2187,7 @@ class Facture extends CommonInvoice
return -12; return -12;
} }
$result=$facreplaced->set_canceled($user,'replaced',''); $result=$facreplaced->set_canceled($user, self::CLOSECODE_REPLACED, '');
if ($result < 0) if ($result < 0)
{ {
$this->error=$facreplaced->error; $this->error=$facreplaced->error;

View File

@ -1135,29 +1135,28 @@ class Paiement extends CommonObject
} }
/** /**
* Load the third party of object, from id into this->thirdparty * Load the third party of object, from id into this->thirdparty
* *
* @param int $force_thirdparty_id Force thirdparty id * @param int $force_thirdparty_id Force thirdparty id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_thirdparty($force_thirdparty_id=0) function fetch_thirdparty($force_thirdparty_id=0)
{ {
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
if (empty($force_thirdparty_id)) if (empty($force_thirdparty_id))
{ {
$billsarray = $this->getBillsArray(); // From payment, the fk_soc isn't available, we should load the first invoice to get him $billsarray = $this->getBillsArray(); // From payment, the fk_soc isn't available, we should load the first supplier invoice to get him
if (!empty($billsarray)) if (!empty($billsarray))
{ {
$supplier_invoice = new FactureFournisseur($this->db); $invoice = new Facture($this->db);
if ($supplier_invoice->fetch($billsarray[0]) > 0) if ($invoice->fetch($billsarray[0]) > 0)
{ {
$force_thirdparty_id = $supplier_invoice->fk_soc; $force_thirdparty_id = $invoice->fk_soc;
} }
} }
} }
return parent::fetch_thirdparty($force_thirdparty_id); return parent::fetch_thirdparty($force_thirdparty_id);
} }
} }

View File

@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("accountancy");
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
// Security check // Security check

View File

@ -76,17 +76,17 @@ class Contact extends CommonObject
public $email; public $email;
public $skype; public $skype;
public $photo; public $photo;
public $jabberid; public $jabberid;
public $phone_pro; public $phone_pro;
public $phone_perso; public $phone_perso;
public $phone_mobile; public $phone_mobile;
public $fax; public $fax;
public $priv; public $priv;
public $birthday; public $birthday;
public $default_lang; public $default_lang;
public $no_email; // 1=Don't send e-mail to this contact, 0=do public $no_email; // 1=Don't send e-mail to this contact, 0=do
public $ref_facturation; // Reference number of invoice for which it is contact public $ref_facturation; // Reference number of invoice for which it is contact
public $ref_contrat; // Nb de reference contrat pour lequel il est contact public $ref_contrat; // Nb de reference contrat pour lequel il est contact
@ -178,6 +178,8 @@ class Contact extends CommonObject
if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
$entity = (isset($this->entity) && is_numeric($this->entity)?$this->entity:$conf->entity); $entity = (isset($this->entity) && is_numeric($this->entity)?$this->entity:$conf->entity);
$entity = isset($this->entity)?$this->entity:$conf->entity;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (";
$sql.= " datec"; $sql.= " datec";
$sql.= ", fk_soc"; $sql.= ", fk_soc";

View File

@ -6234,7 +6234,6 @@ class Form
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters, $object); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters, $object); // Note that $action and $object may have been modified by hook
$object->next_prev_filter.=$hookmanager->resPrint; $object->next_prev_filter.=$hookmanager->resPrint;
} }
$previous_ref = $next_ref = ''; $previous_ref = $next_ref = '';
if ($shownav) if ($shownav)
{ {

View File

@ -3096,7 +3096,7 @@ function img_info($titlealt = 'default')
* Show warning logo * Show warning logo
* *
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"'). If 1 * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"'). If 1, add float: right. Can't be "class" attribute.
* @return string Return img tag * @return string Return img tag
*/ */
function img_warning($titlealt = 'default', $moreatt = '') function img_warning($titlealt = 'default', $moreatt = '')
@ -5479,7 +5479,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__MEMBER_PHONEPRO__']=$msgishtml?dol_htmlentitiesbr($object->phone_perso):$object->phone_perso; $substitutionarray['__MEMBER_PHONEPRO__']=$msgishtml?dol_htmlentitiesbr($object->phone_perso):$object->phone_perso;
$substitutionarray['__MEMBER_PHONEMOBILE__']=$msgishtml?dol_htmlentitiesbr($object->phone_mobile):$object->phone_mobile; $substitutionarray['__MEMBER_PHONEMOBILE__']=$msgishtml?dol_htmlentitiesbr($object->phone_mobile):$object->phone_mobile;
if (is_object($object->thirdparty) && $object->thirdparty->id > 0) if (is_object($object) && $object->element == 'societe')
{
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object)?$object->id:'');
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object)?$object->name:'');
}
elseif (is_object($object->thirdparty) && $object->thirdparty->id > 0)
{ {
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:''); $substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:''); $substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:'');

View File

@ -19,9 +19,9 @@
*/ */
/** /**
* \file htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php * \file htdocs/core/modules/supplier_invoice/doc/pdf_standard.modules.php
* \ingroup fournisseur * \ingroup fournisseur
* \brief Class file to generate the supplier invoices with the canelle model * \brief Class file to generate the supplier invoice payment file with the standard model
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_payment/modules_supplier_payment.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_payment/modules_supplier_payment.php';
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functionsnumtoword.lib.php';
/** /**
* Class to generate the supplier invoices with the canelle model * Class to generate the supplier invoices payment file with the standard model
*/ */
class pdf_standard extends ModelePDFSuppliersPayments class pdf_standard extends ModelePDFSuppliersPayments
{ {
@ -114,6 +114,10 @@ class pdf_standard extends ModelePDFSuppliersPayments
$this->localtax2=array(); $this->localtax2=array();
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
$this->atleastonediscount=0; $this->atleastonediscount=0;
// Recupere emetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
} }
@ -132,12 +136,6 @@ class pdf_standard extends ModelePDFSuppliersPayments
{ {
global $user,$langs,$conf,$mysoc,$hookmanager; global $user,$langs,$conf,$mysoc,$hookmanager;
// Get source company
if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
if (! is_object($object->thirdparty)) $object->thirdparty=$mysoc; // If fetch_thirdparty fails, object has no socid (specimen)
$this->emetteur=$object->thirdparty;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
@ -682,17 +680,17 @@ class pdf_standard extends ModelePDFSuppliersPayments
// Sender properties // Sender properties
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
// Show sender // Show payer
$posy=42; $posy=42;
$posx=$this->marge_gauche; $posx=$this->marge_gauche;
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
$hautcadre=40; $hautcadre=40;
/*
// Show sender frame // Show sender frame
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx,$posy-5); $pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); $pdf->MultiCell(66,5, $outputlangs->transnoentities("PayedBy").":", 0, 'L');
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetFillColor(230,230,230); $pdf->SetFillColor(230,230,230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
@ -709,28 +707,12 @@ class pdf_standard extends ModelePDFSuppliersPayments
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
*/ // Payed
$thirdparty = $object->thirdparty;
// If BILLING contact defined on invoice, we use it
$usecontact=false;
$arrayidcontact=$object->getIdContact('internal','BILLING');
if (count($arrayidcontact) > 0)
{
$usecontact=true;
$result=$object->fetch_contact($arrayidcontact[0]);
}
//Recipient name
// On peut utiliser le nom de la societe du contact
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$thirdparty = $object->contact;
} else {
$thirdparty = $object->thirdparty;
}
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$thirdparty,((!empty($object->contact))?$object->contact:null),$usecontact,'target',$object); $carac_client=pdf_build_address($outputlangs,$this->emetteur,$mysoc,((!empty($object->contact))?$object->contact:null),$usecontact,'target',$object);
// Show recipient // Show recipient
$widthrecbox=90; $widthrecbox=90;
@ -743,7 +725,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($posx+2,$posy-5); $pdf->SetXY($posx+2,$posy-5);
$pdf->MultiCell($widthrecbox, 5, "",0,'L'); $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("PayedTo").":",0,'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show recipient name // Show recipient name

View File

@ -739,14 +739,15 @@ class PaiementFourn extends Paiement
return $way; return $way;
} }
/** /**
* Load the third party of object, from id into this->thirdparty * Load the third party of object, from id into this->thirdparty
* *
* @param int $force_thirdparty_id Force thirdparty id * @param int $force_thirdparty_id Force thirdparty id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_thirdparty($force_thirdparty_id=0) function fetch_thirdparty($force_thirdparty_id=0)
{ {
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
if (empty($force_thirdparty_id)) if (empty($force_thirdparty_id))
@ -763,5 +764,6 @@ class PaiementFourn extends Paiement
} }
return parent::fetch_thirdparty($force_thirdparty_id); return parent::fetch_thirdparty($force_thirdparty_id);
} }
} }

View File

@ -2439,6 +2439,8 @@ else
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder paymenttable" width="100%">'; print '<table class="noborder paymenttable" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">' . ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '</td>'; print '<td class="liste_titre">' . ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . '</td>';
@ -2449,7 +2451,6 @@ else
print '<td width="18">&nbsp;</td>'; print '<td width="18">&nbsp;</td>';
print '</tr>'; print '</tr>';
$var=false;
if ($num > 0) if ($num > 0)
{ {
while ($i < $num) while ($i < $num)
@ -2658,6 +2659,7 @@ else
} }
print '</table>'; print '</table>';
print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
@ -2712,8 +2714,6 @@ else
{ {
if ($action != 'editline') if ($action != 'editline')
{ {
$var = true;
// Add free products/services // Add free products/services
$object->formAddObjectLine(1, $societe, $mysoc); $object->formAddObjectLine(1, $societe, $mysoc);

View File

@ -370,32 +370,36 @@ if ($result > 0)
} }
print '</div>'; print '</div>';
/*
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
// Documents generes // Documents generes
$ref=dol_sanitizeFileName($object->ref);
$filedir = $conf->fournisseur->payment->dir_output.'/'.dol_sanitizeFileName($object->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
$genallowed=$user->rights->fournisseur->facture->lire;
$delallowed=$user->rights->fournisseur->facture->creer;
$modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->SUPPLIER_PAYMENT_ADDON_PDF)?'':$conf->global->SUPPLIER_PAYMENT_ADDON_PDF));
print $formfile->showdocuments('supplier_payment',$ref,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang); include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_payment/modules_supplier_payment.php';
$somethingshown=$formfile->numoffiles; $modellist=ModelePDFSuppliersPayments::liste_modeles($db);
if (is_array($modellist))
{
$ref=dol_sanitizeFileName($object->ref);
$filedir = $conf->fournisseur->payment->dir_output.'/'.dol_sanitizeFileName($object->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
$genallowed=$user->rights->fournisseur->facture->lire;
$delallowed=$user->rights->fournisseur->facture->creer;
$modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->SUPPLIER_PAYMENT_ADDON_PDF)?'':$conf->global->SUPPLIER_PAYMENT_ADDON_PDF));
print $formfile->showdocuments('supplier_payment',$ref,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang);
$somethingshown=$formfile->numoffiles;
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';
//print '</td><td valign="top" width="50%">';
//print '<br>'; //print '<br>';
// List of actions on element // List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; /*include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db); $formactions=new FormActions($db);
$somethingshown = $formactions->showactions($object,'supplier_payment',$socid,1,'listaction'.($genallowed?'largetitle':'')); $somethingshown = $formactions->showactions($object,'supplier_payment',$socid,1,'listaction'.($genallowed?'largetitle':''));
*/
print '</div></div></div>'; print '</div></div></div>';
//print '</td></tr></table>';
*/
} }
else else
{ {

View File

@ -25,6 +25,10 @@
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY fk_pcg_version VARCHAR(20) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY fk_pcg_version VARCHAR(20) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_system MODIFY pcg_version VARCHAR(20) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_system MODIFY pcg_version VARCHAR(20) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci;
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) CHARACTER SET utf8; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) CHARACTER SET utf8;

View File

@ -1036,10 +1036,13 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha'))
print '<tr><td colspan="2">'; print '<tr><td colspan="2">';
print $table; print $table;
$sql='ALTER TABLE '.$table.' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci'; $sql='ALTER TABLE '.$table.' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci';
print $sql;
if (GETPOST('force_utf8_on_tables','alpha') == 'confirmed') if (GETPOST('force_utf8_on_tables','alpha') == 'confirmed')
{ {
$db->query($sql); $resql = $db->query($sql);
print ' - Done ('.$resql.')';
} }
else print ' - Disabled';
print '</td></tr>'; print '</td></tr>';
} }
} }

View File

@ -178,6 +178,7 @@ ConfirmCancelBillQuestion=Why do you want to classify this invoice 'abandoned'?
ConfirmClassifyPaidPartially=Are you sure you want to change invoice <b>%s</b> to status paid? ConfirmClassifyPaidPartially=Are you sure you want to change invoice <b>%s</b> to status paid?
ConfirmClassifyPaidPartiallyQuestion=This invoice has not been paid completely. What are reasons for you to close this invoice? ConfirmClassifyPaidPartiallyQuestion=This invoice has not been paid completely. What are reasons for you to close this invoice?
ConfirmClassifyPaidPartiallyReasonAvoir=Remaining unpaid <b>(%s %s)</b> is a discount granted because payment was made before term. I regularise the VAT with a credit note. ConfirmClassifyPaidPartiallyReasonAvoir=Remaining unpaid <b>(%s %s)</b> is a discount granted because payment was made before term. I regularise the VAT with a credit note.
ConfirmClassifyPaidPartiallyReasonDiscount=Remaining unpaid <b>(%s %s)</b> is a discount granted because payment was made before term.
ConfirmClassifyPaidPartiallyReasonDiscountNoVat=Remaining unpaid <b>(%s %s)</b> is a discount granted because payment was made before term. I accept to lose the VAT on this discount. ConfirmClassifyPaidPartiallyReasonDiscountNoVat=Remaining unpaid <b>(%s %s)</b> is a discount granted because payment was made before term. I accept to lose the VAT on this discount.
ConfirmClassifyPaidPartiallyReasonDiscountVat=Remaining unpaid <b>(%s %s)</b> is a discount granted because payment was made before term. I recover the VAT on this discount without a credit note. ConfirmClassifyPaidPartiallyReasonDiscountVat=Remaining unpaid <b>(%s %s)</b> is a discount granted because payment was made before term. I recover the VAT on this discount without a credit note.
ConfirmClassifyPaidPartiallyReasonBadCustomer=Bad customer ConfirmClassifyPaidPartiallyReasonBadCustomer=Bad customer

View File

@ -912,3 +912,5 @@ CommentPage=Comments space
CommentAdded=Comment added CommentAdded=Comment added
CommentDeleted=Comment deleted CommentDeleted=Comment deleted
Everybody=Everybody Everybody=Everybody
PayedBy=Payed by
PayedTo=Payed to

View File

@ -140,14 +140,17 @@ if (!empty($action) && empty($cancel)) {
$action = ''; $action = '';
} }
/* /*
* View * View
*/ */
$form = new Form($db);
llxHeader("","",$langs->trans("CardProduct".$product->type)); llxHeader("","",$langs->trans("CardProduct".$product->type));
print load_fiche_titre($langs->trans("DynamicPriceConfiguration")); $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
$form = new Form($db); print load_fiche_titre($langs->trans("DynamicPriceConfiguration"), $linkback, 'title_setup');
print $langs->trans("DynamicPriceDesc").'<br>'; print $langs->trans("DynamicPriceDesc").'<br>';
print '<br>'; print '<br>';

View File

@ -326,12 +326,14 @@ if ($id)
$onlyopenedproject=1; // or -1 $onlyopenedproject=1; // or -1
$morewherefilter=''; $morewherefilter='';
if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
if ($search_task_label) $morewherefilter.=natural_search(array("t.ref", "t.label"), $search_task_label); if ($search_project_ref) $morewherefilter.=natural_search("p.ref", $search_project_ref);
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty); if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
if ($search_task_label) $morewherefilter.=natural_search(array("t.ref", "t.label"), $search_task_label);
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later. $tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
if ($morewherefilter) // Get all task with no filter so we can show total of time spent for not visible tasks if ($morewherefilter) // Get all task without any filter, so we can show total of time spent for not visible tasks
{ {
$tasksarraywithoutfilter=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later. $tasksarraywithoutfilter=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
} }
@ -499,7 +501,12 @@ $isavailable[$daytoparse]=$isavailablefordayanduser; // in projectLinesPerWeek
if (count($tasksarray) > 0) if (count($tasksarray) > 0)
{ {
//var_dump($tasksarray); // contains only selected tasks
//var_dump($tasksarraywithoutfilter); // contains all tasks (if there is a filter, not defined if no filter)
//var_dump($tasksrole);
$j=0; $j=0;
$level=0;
$totalforvisibletasks = projectLinesPerDay($j, 0, $usertoprocess, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $daytoparse, $isavailable, 0); $totalforvisibletasks = projectLinesPerDay($j, 0, $usertoprocess, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restrictviewformytask, $daytoparse, $isavailable, 0);
//var_dump($totalforvisibletasks); //var_dump($totalforvisibletasks);
@ -518,7 +525,6 @@ if (count($tasksarray) > 0)
$totalforeachday=array(); $totalforeachday=array();
foreach($listofdistinctprojectid as $tmpprojectid) foreach($listofdistinctprojectid as $tmpprojectid)
{ {
$lineother='';
$projectstatic->id=$tmpprojectid; $projectstatic->id=$tmpprojectid;
$projectstatic->loadTimeSpent($daytoparse, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week $projectstatic->loadTimeSpent($daytoparse, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
for ($idw = 0; $idw < 7; $idw++) for ($idw = 0; $idw < 7; $idw++)
@ -527,15 +533,25 @@ if (count($tasksarray) > 0)
$totalforeachday[$tmpday]+=$projectstatic->weekWorkLoad[$tmpday]; $totalforeachday[$tmpday]+=$projectstatic->weekWorkLoad[$tmpday];
} }
} }
$lineother='';
//var_dump($totalforeachday); //var_dump($totalforeachday);
// Is there a diff between selected/filtered tasks and all tasks ?
$isdiff = 0;
if (count($totalforeachday))
{
$timeonothertasks=($totalforeachday[$daytoparse] - $totalforvisibletasks[$daytoparse]);
if ($timeonothertasks)
{
$isdiff=1;
}
}
$colspan = 8; $colspan = 8;
// There is a diff between total shown on screen and total spent by user, so we add a line with all other cumulated time of user // There is a diff between total shown on screen and total spent by user, so we add a line with all other cumulated time of user
if (count($totalforeachday)) if ($isdiff)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven othertaskwithtime">';
print '<td colspan="'.$colspan.'">'; print '<td colspan="'.$colspan.'">';
print $langs->trans("OtherFilteredTasks"); print $langs->trans("OtherFilteredTasks");
print '</td>'; print '</td>';

View File

@ -41,7 +41,6 @@ $mode=GETPOST("mode",'alpha');
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$taskid=GETPOST('taskid','int'); $taskid=GETPOST('taskid','int');
$mine=0; $mine=0;
if ($mode == 'mine') $mine=1; if ($mode == 'mine') $mine=1;
@ -328,12 +327,14 @@ if ($id)
$onlyopenedproject=1; // or -1 $onlyopenedproject=1; // or -1
$morewherefilter=''; $morewherefilter='';
if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
if ($search_task_label) $morewherefilter.=natural_search(array("t.ref", "t.label"), $search_task_label); if ($search_project_ref) $morewherefilter.=natural_search("p.ref", $search_project_ref);
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty); if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
if ($search_task_label) $morewherefilter.=natural_search(array("t.ref", "t.label"), $search_task_label);
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later. $tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
if ($morewherefilter) // Get all task with no filter so we can show total of time spent for not visible tasks if ($morewherefilter) // Get all task without any filter, so we can show total of time spent for not visible tasks
{ {
$tasksarraywithoutfilter=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later. $tasksarraywithoutfilter=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, '', $onlyopenedproject, '', ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all tasks of open project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
} }
@ -514,7 +515,8 @@ $restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED
if (count($tasksarray) > 0) if (count($tasksarray) > 0)
{ {
//var_dump($tasksarray); //var_dump($tasksarray); // contains only selected tasks
//var_dump($tasksarraywithoutfilter); // contains all tasks (if there is a filter, not defined if no filter)
//var_dump($tasksrole); //var_dump($tasksrole);
$j=0; $j=0;
@ -537,7 +539,6 @@ if (count($tasksarray) > 0)
$totalforeachday=array(); $totalforeachday=array();
foreach($listofdistinctprojectid as $tmpprojectid) foreach($listofdistinctprojectid as $tmpprojectid)
{ {
$lineother='';
$projectstatic->id=$tmpprojectid; $projectstatic->id=$tmpprojectid;
$projectstatic->loadTimeSpent($firstdaytoshow, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week $projectstatic->loadTimeSpent($firstdaytoshow, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
for ($idw = 0; $idw < 7; $idw++) for ($idw = 0; $idw < 7; $idw++)
@ -546,15 +547,32 @@ if (count($tasksarray) > 0)
$totalforeachday[$tmpday]+=$projectstatic->weekWorkLoad[$tmpday]; $totalforeachday[$tmpday]+=$projectstatic->weekWorkLoad[$tmpday];
} }
} }
$lineother='';
//var_dump($totalforeachday); //var_dump($totalforeachday);
//var_dump($totalforvisibletasks);
// Is there a diff between selected/filtered tasks and all tasks ?
$isdiff = 0;
if (count($totalforeachday))
{
for ($idw = 0; $idw < 7; $idw++)
{
$tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd');
$timeonothertasks=($totalforeachday[$tmpday] - $totalforvisibletasks[$tmpday]);
if ($timeonothertasks)
{
$isdiff=1;
break;
}
}
}
$colspan=7; $colspan=7;
// There is a diff between total shown on screen and total spent by user, so we add a line with all other cumulated time of user // There is a diff between total shown on screen and total spent by user, so we add a line with all other cumulated time of user
if (count($totalforeachday)) if ($isdiff)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven othertaskwithtime">';
print '<td colspan="'.$colspan.'">'; print '<td colspan="'.$colspan.'">';
print $langs->trans("OtherFilteredTasks"); print $langs->trans("OtherFilteredTasks");
print '</td>'; print '</td>';

View File

@ -1489,7 +1489,7 @@ div.tmenuleft
margin-top: 0px; margin-top: 0px;
<?php if (empty($conf->dol_optimize_smallscreen)) { ?> <?php if (empty($conf->dol_optimize_smallscreen)) { ?>
width: 5px; width: 5px;
background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menutab-r.png',1); ?>) 0 -6px no-repeat; /* background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menutab-r.png',1); ?>) 0 -6px no-repeat; */
<?php } ?> <?php } ?>
<?php if ($disableimages) { ?> <?php if ($disableimages) { ?>
height: 26px; height: 26px;
@ -3125,15 +3125,29 @@ div.ok {
color: #114466; color: #114466;
} }
/* Info admin */
div.info {
border-<?php print $left; ?>: solid 5px #87cfd2;
padding-top: 8px;
padding-left: 10px;
padding-right: 4px;
padding-bottom: 8px;
margin: 0.5em 0em 0.5em 0em;
background: #eff8fc;
}
/* Warning message */ /* Warning message */
div.warning { div.warning {
color: #302020; border-<?php print $left; ?>: solid 5px #f2cf87;
padding: 0.3em 0.3em 0.3em 0.3em; padding-top: 8px;
margin: 0.5em 0em 0.5em 0em; padding-left: 10px;
border: 2px solid #805000; padding-right: 4px;
-webkit-border-radius: 4px; padding-bottom: 8px;
border-radius: 4px; margin: 0.5em 0em 0.5em 0em;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); background: #fcf8e3;
}
div.warning a, div.info a, div.error a {
color: rgb(<?php echo $colortext; ?>);
} }
/* Error message */ /* Error message */
@ -3141,19 +3155,6 @@ div.error {
background: #EFCFCF; background: #EFCFCF;
} }
/* Info admin */
div.info {
color: #fff;
padding: 0.4em 0.4em 0.4em 0.4em;
margin: 0.5em 0em 0.5em 0em;
-webkit-border-radius: 4px;
border-radius: 4px;
background: #798080;
}
div.warning a, div.info a, div.error a {
color: rgb(<?php echo $colortext; ?>);
}
/* /*
* Liens Payes/Non payes * Liens Payes/Non payes
@ -3323,20 +3324,19 @@ div#card-errors {
/* ============================================================================== */ /* ============================================================================== */
table.valid { table.valid {
border-top: solid 1px #E6E6E6; /* border-top: solid 1px #E6E6E6; */
border-<?php print $left; ?>: solid 1px #E6E6E6; border-<?php print $left; ?>: solid 5px #f2cf87;
border-<?php print $right; ?>: solid 1px #444444; /* border-<?php print $right; ?>: solid 1px #444444;
border-bottom: solid 1px #555555; border-bottom: solid 1px #555555; */
padding-top: 0px; padding-top: 8px;
padding-left: 0px; padding-left: 10px;
padding-right: 0px; padding-right: 4px;
padding-bottom: 0px; padding-bottom: 4px;
margin: 0px 0px; margin: 0px 0px;
background: #D5BAA8; background: #fcf8e3;
} }
.validtitre { .validtitre {
background: #D5BAA8;
font-weight: bold; font-weight: bold;
} }
@ -4948,7 +4948,7 @@ div.tabsElem a.tab {
/* nboftopmenuentries = <?php echo $nbtopmenuentries ?>, fontsize=<?php echo $fontsize ?> */ /* nboftopmenuentries = <?php echo $nbtopmenuentries ?>, fontsize=<?php echo $fontsize ?> */
/* rule to reduce top menu - 1st reduction */ /* rule to reduce top menu - 1st reduction */
@media only screen and (max-width: <?php echo round($nbtopmenuentries * $fontsize * 6.9, 0) + 24; ?>px) /* reduction 1 */ @media only screen and (max-width: <?php echo round($nbtopmenuentries * $fontsize * 7, 0) + 24; ?>px) /* reduction 1 */
{ {
div.tmenucenter { div.tmenucenter {
width: <?php echo round($fontsize * 4); ?>px; /* size of viewport */ width: <?php echo round($fontsize * 4); ?>px; /* size of viewport */

View File

@ -3181,17 +3181,29 @@ div.ok {
color: #114466; color: #114466;
} }
/* Info admin */
div.info {
border-<?php print $left; ?>: solid 5px #87cfd2;
padding-top: 8px;
padding-left: 10px;
padding-right: 4px;
padding-bottom: 8px;
margin: 0.5em 0em 0.5em 0em;
background: #eff8fc;
}
/* Warning message */ /* Warning message */
div.warning { div.warning {
color: #302020; border-<?php print $left; ?>: solid 5px #f2cf87;
padding: 0.3em 0.3em 0.3em 0.3em; padding-top: 8px;
margin: 0.5em 0em 0.5em 0em; padding-left: 10px;
/* border: 1px solid #e0d0b0; */ padding-right: 4px;
border: 2px solid #805000 padding-bottom: 8px;
-webkit-border-radius: 3px; margin: 0.5em 0em 0.5em 0em;
border-radius: 3px; background: #fcf8e3;
/* background: #EFDF9A; */ }
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); div.warning a, div.info a, div.error a {
color: rgb(<?php echo $colortext; ?>);
} }
/* Error message */ /* Error message */
@ -3205,19 +3217,6 @@ div.error {
background: #EFCFCF; background: #EFCFCF;
} }
/* Info admin */
div.info {
color: #fff;
padding: 0.4em 0.4em 0.4em 0.4em;
margin: 0.5em 0em 0.5em 0em;
-webkit-border-radius: 4px;
border-radius: 4px;
background: #989;
}
div.warning a, div.info a, div.error a {
color: rgb(<?php echo $colortext; ?>);
}
/* /*
* Liens Payes/Non payes * Liens Payes/Non payes
@ -3378,20 +3377,19 @@ div#card-errors {
/* ============================================================================== */ /* ============================================================================== */
table.valid { table.valid {
border-top: solid 1px #E6E6E6; /* border-top: solid 1px #E6E6E6; */
border-<?php print $left; ?>: solid 1px #E6E6E6; border-<?php print $left; ?>: solid 5px #f2cf87;
border-<?php print $right; ?>: solid 1px #444444; /* border-<?php print $right; ?>: solid 1px #444444;
border-bottom: solid 1px #555555; border-bottom: solid 1px #555555; */
padding-top: 0px; padding-top: 8px;
padding-left: 0px; padding-left: 10px;
padding-right: 0px; padding-right: 4px;
padding-bottom: 0px; padding-bottom: 4px;
margin: 0px 0px; margin: 0px 0px;
background: #D5BAA8; background: #fcf8e3;
} }
.validtitre { .validtitre {
background: #D5BAA8;
font-weight: bold; font-weight: bold;
} }