diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 6202fcccebb..2e26e3709ed 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -398,7 +398,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n"; - $result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1, '', $moreinheader); + $result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader); if ($result < 0) { $errmsg = $object->error; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f0854eabde2..cdfa106e755 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1387,7 +1387,7 @@ if (empty($reshook)) if (empty($amount)) continue; $arraylist = array('amount' => 'FixAmount', 'variable' => 'VarAmount'); - $descline = $langs->trans('Deposit'); + $descline = '(DEPOSIT)'; //$descline.= ' - '.$langs->trans($arraylist[$typeamount]); if ($typeamount == 'amount') { $descline .= ' ('.price($valuedeposit, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).')'; diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 70396eb8a58..55a340d7682 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -40,6 +40,7 @@ $year = GETPOST("year", "int"); if (empty($year)) { $year_current = strftime("%Y", dol_now()); + if ($conf->global->SOCIETE_FISCAL_MONTH_START > date('m')) $year_current--; $year_start = $year_current; } else { $year_current = $year; diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 3520b5f1c3c..8c86631fc17 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -358,6 +358,7 @@ class Notify $sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action"; $sql.= " AND n.fk_soc = s.rowid"; + $sql.= " AND c.statut = 1"; if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage else $sql.= " AND a.code = '".$notifcode."'"; // New usage $sql .= " AND s.rowid = ".$object->socid; @@ -372,6 +373,7 @@ class Notify $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql.= " ".MAIN_DB_PREFIX."notify_def as n"; $sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action"; + $sql.= " AND c.statut = 1"; if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage else $sql.= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 734810eb5e4..90ea0e4fbf6 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -52,7 +52,7 @@ function societe_prepare_head(Societe $object) if (empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) { - if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) + if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->societe->contact->lire) { //$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); $nbContact = 0; // TODO diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index da7d15806f9..86f5043f1bf 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1282,6 +1282,9 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) $note = $prodser->multilangs[$outputlangs->defaultlang]["note"]; } } + elseif ($object->type == Facture::TYPE_DEPOSIT && $object->element == 'facture') { + $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + } // Description short of product line $libelleproduitservice = $label; @@ -1308,9 +1311,9 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $sourceref = !empty($discount->discount_type) ? $discount->ref_invoive_supplier_source : $discount->ref_facture_source; $libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $sourceref); // Add date of deposit - if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec, 'day', '', $outputlangs).')'; + if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) $libelleproduitservice.= ' ('.dol_print_date($discount->datec, 'day', '', $outputlangs).')'; } - if ($desc == '(EXCESS RECEIVED)' && $object->lines[$i]->fk_remise_except) + elseif ($desc == '(EXCESS RECEIVED)' && $object->lines[$i]->fk_remise_except) { $discount = new DiscountAbsolute($db); $discount->fetch($object->lines[$i]->fk_remise_except); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index e0b5924cc94..f08c99a4c82 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -265,11 +265,12 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = !empty($conf->tax->enabled) || !empty($conf->salaries->enabled) || !empty($conf->supplier_invoice->enabled) || - !empty($conf->loan->enabled) + !empty($conf->loan->enabled) || + !empty($conf->margins->enabled) ) ? 1 : 0, 'perms'=>(!empty($user->rights->facture->lire) || !empty($user->rights->don->contact->lire) || !empty($user->rights->tax->charges->lire) || !empty($user->rights->salaries->read) - || !empty($user->rights->fournisseur->facture->lire) || !empty($user->rights->loan->read)), + || !empty($user->rights->fournisseur->facture->lire) || !empty($user->rights->loan->read) || !empty($user->rights->margins->liretous)), 'module'=>'facture|supplier_invoice|don|tax|salaries|loan' ); $menu_arr[] = array( diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 25b691aaa70..65b7f5011cc 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -155,6 +155,8 @@ class pdf_rouget extends ModelePdfExpedition $this->posxtotalht=$this->page_largeur - $this->marge_droite - 20; } + if(!empty($conf->global->SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME)) $this->posxweightvol = $this->posxqtyordered; + $this->posxpicture=$this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images // To work with US executive format diff --git a/htdocs/loan/calcmens.php b/htdocs/loan/calcmens.php index 9a95ec9d438..e31353b3726 100644 --- a/htdocs/loan/calcmens.php +++ b/htdocs/loan/calcmens.php @@ -44,7 +44,7 @@ $object = new LoanSchedule($db); $int = ($capital * ($rate / 12)); $int = round($int, 2, PHP_ROUND_HALF_UP); $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP); -$output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1), 'mens'=>$mens); +$output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens); $echance++; $capital = $cap_rest; @@ -55,7 +55,7 @@ while ($echance <= $nbterm) { $int = round($int, 2, PHP_ROUND_HALF_UP); $cap_rest = round($capital - ($mens - $int), 2, PHP_ROUND_HALF_UP); - $output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1), 'mens'=>$mens); + $output[$echance] = array('cap_rest'=>$cap_rest, 'cap_rest_str'=>price($cap_rest, 0, '', 1, -1, -1, $conf->currency), 'interet'=>$int, 'interet_str'=>price($int, 0, '', 1, -1, -1, $conf->currency), 'mens'=>$mens); $capital = $cap_rest; $echance++; diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 29b70e50f2c..85b797804c9 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -561,7 +561,7 @@ if ($id > 0) } else { - print $object->rate.'%'; + print price($object->rate).'%'; } print ''; diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 165756e621f..f36a31caa61 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -356,6 +356,7 @@ class Loan extends CommonObject $sql.= " datestart='".$this->db->idate($this->datestart)."',"; $sql.= " dateend='".$this->db->idate($this->dateend)."',"; $sql.= " nbterm=".$this->nbterm.","; + $sql.= " rate=".$this->db->escape($this->rate).","; $sql.= " accountancy_account_capital = '".$this->db->escape($this->account_capital)."',"; $sql.= " accountancy_account_insurance = '".$this->db->escape($this->account_insurance)."',"; $sql.= " accountancy_account_interest = '".$this->db->escape($this->account_interest)."',"; diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index 7ba240a7c14..f8e4a092f95 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -44,6 +44,47 @@ llxHeader("", $title, $help_url); $head = loan_prepare_head($object); dol_fiche_head($head, 'FinancialCommitment', $langs->trans("Loan"), -1, 'bill'); +$linkback = '' . $langs->trans("BackToList") . ''; + +$morehtmlref='
'; +// Ref loan +$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); +$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); +// Project +if (! empty($conf->projet->enabled)) +{ + $langs->loadLangs(array("projects")); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->loan->write) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } +} +$morehtmlref.='
'; +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + if ($action == 'createecheancier') { $i = 1; while ($i < $object->nbterm + 1) { @@ -124,9 +165,9 @@ $(document).ready(function() { var interet_res_str='#interets'+index; var men_res='#mens'+index; $(idcap_res).val(element.cap_rest); - $(idcap_res_srt).text(element.cap_rest_str+' €'); + $(idcap_res_srt).text(element.cap_rest_str); $(interet_res).val(element.interet); - $(interet_res_str).text(element.interet_str+' €'); + $(interet_res_str).text(element.interet_str); $(men_res).val(element.mens); }); } @@ -162,7 +203,7 @@ print ''.$langs->trans("Insurance"); print ''.$langs->trans("InterestAmount").''; print ''.$langs->trans("Amount").''; print ''.$langs->trans("CapitalRemain"); -print ' ('.price2num($object->capital).')'; +print '
('.price($object->capital, 0, '', 1, -1, -1, $conf->currency).')'; print ''; print ''; if (count($echeance->lines) > 0) print ''.$langs->trans('DoPayment').''; @@ -185,8 +226,8 @@ if ($object->nbterm > 0 && count($echeance->lines) == 0) print ''; print ''.$i.''; print ''.dol_print_date(dol_time_plus_duree($object->datestart, $i - 1, 'm'), 'day').''; - print ''.price($insurance + (($i == 1) ? $regulInsurance : 0), 0, '', 1).' €'; - print ''.price($int, 0, '', 1).' €'; + print ''.price($insurance + (($i == 1) ? $regulInsurance : 0), 0, '', 1, -1, -1, $conf->currency).' €'; + print ''.price($int, 0, '', 1, -1, -1, $conf->currency).' €'; print ' €'; print ''.price($cap_rest).' €'; print ''."\n"; @@ -211,15 +252,15 @@ elseif (count($echeance->lines) > 0) print ''; print ''.$i.''; print ''.dol_print_date($line->datep, 'day').''; - print ''.price($insu, 0, '', 1).' €'; - print ''.price($int, 0, '', 1).' €'; + print ''.price($insu, 0, '', 1, -1, -1, $conf->currency).' €'; + print ''.price($int, 0, '', 1, -1, -1, $conf->currency).' €'; if ($line->datep > dol_now() && empty($line->fk_bank)) { print ' €'; } else { - print ''.price($mens).' €'; + print ''.price($mens, 0, '', 1, -1, -1, $conf->currency).''; } - print ''.price($cap_rest).' €'; + print ''.price($cap_rest, 0, '', 1, -1, -1, $conf->currency).''; print ''; if (!empty($line->fk_bank)) print $langs->trans('Paid'); elseif (!$printed) diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 66077dc8708..73614030e24 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -42,7 +42,7 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); if (! empty($user->socid)) $socid=$user->socid; $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); -$result=restrictedArea($user, 'margins'); +if(empty($user->rights->margins->liretous)) accessforbidden(); $mesg = ''; diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 0056c869fa1..7dae554fd91 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -38,6 +38,7 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); if (! empty($user->socid)) $socid=$user->socid; $result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); +if(empty($user->rights->margins->liretous)) accessforbidden(); $object = new Product($db); diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index d761d8a1f71..6e16e151593 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -88,6 +88,7 @@ if (!empty($canvas)) // Security check $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas); +if(empty($user->rights->societe->contact->lire)) accessforbidden(); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 00771f4fdba..edbd1257c68 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -46,6 +46,7 @@ $langs->loadLangs(array("companies", "other", "ticket")); // Get parameters $id = GETPOST('id', 'int'); +$socid = GETPOST('socid', 'int'); $track_id = GETPOST('track_id', 'alpha', 3); $ref = GETPOST('ref', 'alpha'); $projectid = GETPOST('projectid', 'int');