diff --git a/ChangeLog b/ChangeLog index 00a99cef973..3c057697bac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,6 +64,7 @@ For users: - New: Can choose contact on event (action com) creation, and filtred by thirdparty. - New: Add hidden option MAIN_FORCE_DEFAULT_STATE_ID. - New: Add page to make mass stock movement. +- New: Add field oustanding limit into thirdparty properties. For translators: - Qual: Normalized sort order of all languages files with english reference files. @@ -315,7 +316,7 @@ For users: - New: Can list elements (invoices, orders or proposals) on a particular user contact). This allow to view a "basket" of its elements. - New: Show bank account on payment list of invoice card. -- New: Cloning project allow to clones task, notes, files, contacts. +- New: Cloning project allow to clones task, notes, projects files, tasks files, contacts. - New: Enhance default style. - New: Can edit and resiliate member status from list. - New: Can insert URL links into elements lines. Also reported into PDF. diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 1189b77ec57..8574e6eb5ad 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -128,6 +128,14 @@ if ($action == 'cstc') if ($result < 0) setEventMessage($object->error,'errors'); } +// Update communication level +if ($action == 'setOutstandingBill') +{ + $object->fetch($id); + $object->outstanding_limit=GETPOST('OutstandingBill'); + $result=$object->set_OutstandingBill($user); + if ($result < 0) setEventMessage($object->error,'errors'); +} /* @@ -369,6 +377,18 @@ if ($id > 0) print ''; print ''; + if ($object->client) + { + print ''; + print ''; + print $form->editfieldkey("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer); + print ''; + print $form->editfieldval("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer); + print ''; + print ''; + } + + // Multiprice level if (! empty($conf->global->PRODUIT_MULTIPRICES)) { @@ -898,4 +918,4 @@ dol_htmloutput_mesg('',$mesgs); // End of page llxFooter(); $db->close(); -?> \ No newline at end of file +?> diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index f6d082c763d..c56688b3e44 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1885,6 +1885,18 @@ else print ''; } + if ($soc->outstanding_limit) + { + // Outstanding Bill + print ''; + print $langs->trans('OutstandingBill'); + print ''; + print price($soc->get_OutstandingBill()).' / '; + print price($soc->outstanding_limit, 0, '', 1, -1, -1, $conf->currency); + print ''; + print ''; + } + // Other attributes $res=$object->fetch_optionals($object->id,$extralabels); $parameters=array('colspan' => ' colspan="3"'); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 3016f5ac191..737e31cca7f 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2195,6 +2195,19 @@ else print ''; } + + if ($soc->outstanding_limit) + { + // Outstanding Bill + print ''; + print $langs->trans('OutstandingBill'); + print ''; + print price($soc->get_OutstandingBill()).' / '; + print price($soc->outstanding_limit, 0, '', 1, -1, -1, $conf->currency); + print ''; + print ''; + } + // Other attributes $res=$object->fetch_optionals($object->id,$extralabels); $parameters=array('colspan' => ' colspan="3"'); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 31c69d93295..a2c9dc80594 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2318,6 +2318,18 @@ if ($action == 'create') print ''; } + if ($soc->outstanding_limit) + { + // Outstanding Bill + print ''; + print $langs->trans('OutstandingBill'); + print ''; + print price($soc->get_OutstandingBill()).' / '; + print price($soc->outstanding_limit).''; + print ''; + print ''; + } + // Other attributes $parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -3034,6 +3046,7 @@ else if ($id > 0 || ! empty($ref)) $nbrows=8; $nbcols=2; if (! empty($conf->projet->enabled)) $nbrows++; if (! empty($conf->banque->enabled)) $nbcols++; + if (! empty($soc->outstandingbill)) $nbrows++; if($mysoc->localtax1_assuj=="1") $nbrows++; if($mysoc->localtax2_assuj=="1") $nbrows++; if ($selleruserevenustamp) $nbrows++; @@ -3305,6 +3318,18 @@ else if ($id > 0 || ! empty($ref)) } print ''; + if ($soc->outstandingbill) + { + // Outstanding Bill + print ''; + print $langs->trans('OutstandingBill'); + print ''; + print price($soc->get_OutstandingBill()).' / '; + print price($soc->outstandingbill); + print ''; + print ''; + } + // Amount print ''.$langs->trans('AmountHT').''; print ''.price($object->total_ht,1,'',1,-1,-1,$conf->currency).''; @@ -3955,4 +3980,4 @@ dol_htmloutput_mesg('',$mesgs); llxFooter(); $db->close(); -?> \ No newline at end of file +?> diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 140fc3480ea..95b1ffc2e0f 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -103,6 +103,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3103__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/valo.php', 'EnhancedValue', 1, 'stocks', '$user->rights->stock->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); -- Product - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 98021186e34..5f62b06c868 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -565,7 +565,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu /* - * Menu TIERS + * Menu THIRDPARTIES */ if ($mainmenu == 'companies') { @@ -598,7 +598,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu //$newmenu->add("/contact/list.php?leftmenu=customers&type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire); } - // Clients + // Customers/Prospects if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { $langs->load("commercial"); @@ -608,7 +608,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu //$newmenu->add("/contact/list.php?leftmenu=customers&type=c", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire); } - // Fournisseurs + // Suppliers if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled)) { $langs->load("suppliers"); @@ -1008,6 +1008,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/valo.php", $langs->trans("EnhancedValue"), 1, $user->rights->stock->lire); if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); + if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); } // Expeditions diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index 398ca6e008f..aa96b46a859 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -16,6 +16,8 @@ * along with this program. If not, see . * * Javascript code to activate drag and drop on lines + * You can use this if you want to be abale to drag and drop rows of a table. + * You must add id="tablelines" ont table level tag and have count($object->lines) or count($taskarray) > 0 */ ?> @@ -26,6 +28,7 @@ $fk_element=$object->fk_element; $table_element_line=$object->table_element_line; $nboflines=(isset($object->lines)?count($object->lines):(isset($tasksarray)?count($tasksarray):0)); $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; +$tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); if (GETPOST('action') != 'editline' && $nboflines > 1) { ?> + @@ -37,32 +39,43 @@ if (empty($conf->global->MAIN_FEATURES_LEVEL)) This page is a sample of page using tables. To make test with
- css (edit page to change)
- jmobile (edit page to enable/disable)
-- dataTables.
+- dataTables
+- tablednd

-
Example 1 : Table using tags: div.tagtable+form+div or div.tagtable+div.tagtr+div.tagtd
+use_javascript_ajax) && $object->statut == 0) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; +?> -
-
-
snake
+
+ +
line1
-
snagfdgfd gd fgf ke
+
line2
dfsdf
-
+
-
snagfdgfd gd fgf ke
+
line3
dfsdf
-
+
+
+
+
line4
+
dfsdf
+
+
@@ -133,68 +146,89 @@ $('xxxth').replaceWith( - snagfdgfd gd fgf ke + line1 dfsdf xxx - snagfdgfd gd fgf ke + line2 dfsdf xxx - snagfdgfd gd fgf ke + line3 dfsdf xxx - snagfdgfd gd fgf ke + line4 dfsdf xxx - snagfdgfd gd fgf ke + line5 dfsdf xxx - snagfdgfd gd fgf ke + line6 dfsdf xxx - snagfdgfd gd fgf ke + line7 dfsdf xxx - snagfdgfd gd fgf ke + line8 dfsdf xxx - snagfdgfd gd fgf ke + line9 dfsdf xxx - snagfdgfd gd fgf ke + line10 dfsdf xxx - snagfdgfd gd fgf ke + line11 dfsdf xxx - snagfdgfd gd fgf ke + line12 dfsdf xxx + +

+ + + +
+Example 3 : Standard table
+use_javascript_ajax) && $object->statut == 0) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; +?> + + + + + +
title1title2
a1b1
a2b2
+
+ +
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 154a7e344f2..162550a162b 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -124,6 +124,7 @@ class Societe extends CommonObject var $statut_commercial; var $price_level; + var $outstanding_limit; var $datec; var $date_update; @@ -707,7 +708,7 @@ class Societe extends CommonObject $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; $sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj'; $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo'; - $sql .= ', s.import_key, s.canvas'; + $sql .= ', s.outstanding_limit, s.import_key, s.canvas'; $sql .= ', fj.libelle as forme_juridique'; $sql .= ', e.libelle as effectif'; $sql .= ', p.code as country_code, p.libelle as country'; @@ -836,6 +837,8 @@ class Societe extends CommonObject $this->default_lang = $obj->default_lang; $this->logo = $obj->logo; + $this->outstanding_limit = $obj->outstanding_limit; + // multiprix $this->price_level = $obj->price_level; @@ -2767,6 +2770,71 @@ class Societe extends CommonObject } } + /** + * Set outstanding value + * + * @param User $user User making change + * @return int <0 if KO, >0 if OK + */ + function set_outstanding($user) + { + if ($this->id) + { + $this->db->begin(); + + $now=dol_now(); + + $outstanding = price2num($this->outstanding_limit); + + // Positionne l'encours de facturaiton + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET "; + $sql.= " outstanding_limit=".$outstanding; + $sql.= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this)."::set_outstanding sql=".$sql); + $resql=$this->db->query($sql); + if (! $resql) + { + $this->db->rollback(); + $this->error=$this->db->error(); + return -1; + } + + $this->db->commit(); + return 1; + } + } + + /** + * return amount of bill not paid + * + * @return boolean Yes or no + */ + function get_OutstandingBill() + { + /* Accurate value of remain to pay is to sum remaintopay for each invoice + $paiement = $invoice->getSommePaiement(); + $creditnotes=$invoice->getSumCreditNotesUsed(); + $deposits=$invoice->getSumDepositsUsed(); + $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT'); + $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); + */ + $sql = "SELECT sum(total) as amount FROM ".MAIN_DB_PREFIX."facture as f"; + $sql .= " WHERE fk_soc = ". $this->id; + $sql .= " AND paye = 0"; + $sql .= " AND fk_statut <> 0"; + + dol_syslog("get_OutstandingBill sql=".$sql); + $resql=$this->db->query($sql); + if ($resql) + { + $obj=$this->db->fetch_object($resql); + return ($obj->amount); + } + else + return 0; + } + /** * Return label of status customer is prospect/customer * diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index beafd1c8d2f..4b5a40eee82 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -374,6 +374,7 @@ td.showDragHandle { } .tdlineupdown { white-space: nowrap; + min-width: 10px; } /* ============================================================================== */ diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 22d0a5292a2..6e70faf60dd 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -256,6 +256,7 @@ td.showDragHandle { } .tdlineupdown { white-space: nowrap; + min-width: 10px; } diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 8cbf8829ac8..d0f3185cee9 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -282,6 +282,7 @@ td.showDragHandle { } .tdlineupdown { white-space: nowrap; + min-width: 10px; } diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index a3311ac2566..a6631db8e6e 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -256,6 +256,7 @@ td.showDragHandle { } .tdlineupdown { white-space: nowrap; + min-width: 10px; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index aeaabc585c5..209ce753814 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -426,6 +426,7 @@ td.showDragHandle { } .tdlineupdown { white-space: nowrap; + min-width: 10px; }