diff --git a/ChangeLog b/ChangeLog index 6ac794b974e..15c1dc404f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,26 @@ Following changes may create regression for some external modules, but were nece * Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still exists, but if an external module need action on it, it must provides itself its trigger file. +***** ChangeLog for 5.0.3 compared to 5.0.2 ***** +FIX: #6677 Expired contracts dashboard box does not show the name of the thirdparty +FIX: #6813 +FIX: 6863 +FIX: #6877 +FIX: #6881 +FIX: Better sanitizing of search all parameter. +FIX: Correction with author and validator user on orders +FIX: dialog window with md theme must not be hidden by left menu part. +FIX: doactions hook missing in invoice model page +FIX: Fullname when member is a moral entity with no name. +FIX: Link to files on bank account tab broken with multicompany FIX: Link to preview on thirdparty broken with multicompany +FIX: New vat code not correctly implemented if "1 price per customer". +FIX: Pagination of invoices +FIX: pagination on resources +FIX: REST API not possible to add agendaevents +FIX: situation invoice broken due to the all percent application form inside addline form +FIX: SQL injection on user/index.php parameter search_statut. +FIX: XSS + ***** ChangeLog for 5.0.2 compared to 5.0.1 ***** FIX: #6468 + Fix missing translation FIX: #6517 #6525 Autocompletion of thirdparty after n chars not implemented diff --git a/build/debian/README.howto b/build/debian/README.howto index c94309ec2ef..1632e954237 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -444,3 +444,4 @@ Note that package 3.5.7 contains not only fixed for bugs reported to debian. It so it is a better solution to validate this maintenance release than applying a patch of the only CVE-2015-3935. After discussion with ..., it appears that security holes are enough to request this unblock request." +Note: If there is a response to ask more information, don't forget to remove the tag during answer. diff --git a/build/debian/source/lintian-overrides b/build/debian/source/lintian-overrides index b4c0956e90f..c878035b482 100644 --- a/build/debian/source/lintian-overrides +++ b/build/debian/source/lintian-overrides @@ -4,7 +4,12 @@ dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jsgantt/* dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jstz/* # Those are false positives, the files are their own sources since # they are not minified -source-is-missing htdocs/includes/jsgantt/jsgantt.js * -source-is-missing htdocs/includes/jquery/plugins/colorpicker/jquery.colorpicker.js * -source-is-missing htdocs/includes/jquery/plugins/select2/select2.js * -source-is-missing htdocs/includes/jquery/plugins/select2/select2_locale_ar.js * +source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/a11yhelp/dialogs/lang/*.js +source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/specialchar/dialogs/lang/*.js +source-is-missing htdocs/includes/ckeditor/ckeditor/lang/*.js +source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/dialogs/*.js +source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/*/filter/*.js +source-is-missing htdocs/includes/ckeditor/ckeditor/plugins/templates/templates/default.js +source-is-missing htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.json +source-is-missing htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/*.js + diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index bd9587a4440..44ec3ade889 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -49,6 +49,8 @@ $type = 'action'; * Actions */ +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + if (preg_match('/set_(.*)/',$action,$reg)) { $code=$reg[1]; @@ -77,21 +79,6 @@ if (preg_match('/del_(.*)/',$action,$reg)) dol_print_error($db); } } -// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) -if ($action == 'setModuleOptions') -{ - - if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} if ($action == 'set') { dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity); @@ -233,7 +220,7 @@ else if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print load_fiche_titre($langs->trans("AgendaModelModule"),'',''); - + print '
| '.$langs->trans("Name").' | '."\n"; @@ -243,13 +230,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print ''.$langs->trans("ShortInfo").' | '; print ''.$langs->trans("Preview").' | '; print '|||||||||||||||||||||
| "; print (empty($module->name)?$name:$module->name); @@ -272,16 +259,16 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print " | \n"; require_once $dir.$file; $module = new $classname($db,$specimenthirdparty); - if (method_exists($module,'info')) + if (method_exists($module,'info')) print $module->info($langs); - else + else print $module->description; print " | \n"; - + // Active if (in_array($name, $def)) { - + print ''."\n"; if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") { @@ -301,7 +288,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print 'scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"),'switch_off').''; print " | "; } - + // Default print ''; if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name") @@ -313,7 +300,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print 'scandir.'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ' | '; - + // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip.=''; print ''.img_object($langs->trans("Preview"),'order').''; print ' | '; - + print "|||||||||||||||||||
| '.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").' | '."\n"; @@ -404,30 +391,30 @@ print '|||||||||||||||||||||||
| '.$langs->trans('AGENDA_NOTIFICATION').' | '."\n"; print ''."\n"; print ' | '."\n"; - + if (empty($conf->global->AGENDA_NOTIFICATION)) { print ''.img_picto($langs->trans('Disabled'),'switch_off').''; print ' | |||||||||||||||||||||
| '.$langs->trans('AGENDA_NOTIFICATION_SOUND').' | '."\n"; print ''."\n"; print ' | '."\n"; - + if (empty($conf->global->AGENDA_NOTIFICATION_SOUND)) { print ''.img_picto($langs->trans('Disabled'),'switch_off').''; } else { print ''.img_picto($langs->trans('Enabled'),'switch_on').''; } - + print ' | '; print $formbarcode->setBarcodeEncoder($obj->coder,$barcodelist,$obj->rowid,'form'.$i); print " | \n"; - + $i++; } } @@ -312,7 +288,7 @@ print ''; // Chemin du binaire genbarcode sous linux if (! isset($_SERVER['WINDIR'])) { - + print '||||||||||||||||||||
| '.$langs->trans("GenbarcodeLocation").' | '; print ''; @@ -328,7 +304,7 @@ if (! isset($_SERVER['WINDIR'])) // Module products if (! empty($conf->product->enabled)) { - + print ' | ||||||||||||||||||||||
| '.$langs->trans("SetDefaultBarcodeTypeProducts").' | '; print ''; @@ -339,7 +315,7 @@ if (! empty($conf->product->enabled)) // Module thirdparty if (! empty($conf->societe->enabled)) { - + print ' | ||||||||||||||||||||||
| '.$langs->trans("SetDefaultBarcodeTypeThirdParties").' | '; print ''; diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index bc55eb4b9f6..f88dfc6f5a6 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -77,7 +77,7 @@ if ($action == 'setmod') if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') { - $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string + $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT','none'); // No alpha here, we want exact string $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 6d92ad21999..f4104e2007f 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -54,6 +54,8 @@ $type = 'order'; * Actions */ +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + if ($action == 'updateMask') { $maskconstorder=GETPOST('maskconstorder','alpha'); @@ -118,35 +120,6 @@ else if ($action == 'specimen') } } -// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) -if ($action == 'setModuleOptions') -{ - $post_size=count($_POST); - - $db->begin(); - - for($i=0;$i < $post_size;$i++) - { - if (array_key_exists('param'.$i,$_POST)) - { - $param=GETPOST("param".$i,'alpha'); - $value=GETPOST("value".$i,'alpha'); - if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - } - } - if (! $error) - { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - $db->rollback(); - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - // Activate a model else if ($action == 'set') { @@ -207,7 +180,7 @@ else if ($action == 'set_COMMANDE_DRAFT_WATERMARK') else if ($action == 'set_ORDER_FREE_TEXT') { - $freetext = GETPOST("ORDER_FREE_TEXT"); // No alpha here, we want exact string + $freetext = GETPOST("ORDER_FREE_TEXT",'none'); // No alpha here, we want exact string $res = dolibarr_set_const($db, "ORDER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 47e53a05048..e2f865f61f6 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -50,6 +50,8 @@ if (empty($conf->global->CONTRACT_ADDON)) * Actions */ +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + if ($action == 'updateMask') { $maskconst = GETPOST('maskconstcontract','alpha'); @@ -113,35 +115,6 @@ else if ($action == 'specimen') // For contract } } -// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) -if ($action == 'setModuleOptions') -{ - $post_size=count($_POST); - - $db->begin(); - - for($i=0;$i < $post_size;$i++) - { - if (array_key_exists('param'.$i,$_POST)) - { - $param=GETPOST("param".$i,'alpha'); - $value=GETPOST("value".$i,'alpha'); - if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; - } - } - if (! $error) - { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - $db->rollback(); - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - // Activate a model else if ($action == 'set') { @@ -185,7 +158,7 @@ else if ($action == 'setmod') else if ($action == 'set_other') { - $freetext= GETPOST('CONTRACT_FREE_TEXT'); // No alpha here, we want exact string + $freetext= GETPOST('CONTRACT_FREE_TEXT','none'); // No alpha here, we want exact string $res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); $draft= GETPOST('CONTRACT_DRAFT_WATERMARK','alpha'); @@ -501,7 +474,7 @@ print ' | '.$langs->trans("Value").' | '; print "|||||||||||||||||||||
| ";
print (empty($module->name)?$name:$module->name);
diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php
index 82eeddd594c..8c52ee83dda 100644
--- a/htdocs/admin/supplier_proposal.php
+++ b/htdocs/admin/supplier_proposal.php
@@ -41,10 +41,15 @@ $label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$type='supplier_proposal';
+$error=0;
+
+
/*
* Actions
*/
-$error=0;
+
+include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+
if ($action == 'updateMask')
{
$maskconstsupplier_proposal=GETPOST('maskconstsupplier_proposal','alpha');
@@ -127,7 +132,7 @@ if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK')
if ($action == 'set_SUPPLIER_PROPOSAL_FREE_TEXT')
{
- $freetext = GETPOST('SUPPLIER_PROPOSAL_FREE_TEXT'); // No alpha here, we want exact string
+ $freetext = GETPOST('SUPPLIER_PROPOSAL_FREE_TEXT','none'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
@@ -159,35 +164,6 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL')
}
}
-// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
-if ($action == 'setModuleOptions')
-{
- $post_size=count($_POST);
-
- $db->begin();
-
- for($i=0;$i < $post_size;$i++)
- {
- if (array_key_exists('param'.$i,$_POST))
- {
- $param=GETPOST("param".$i,'alpha');
- $value=GETPOST("value".$i,'alpha');
- if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
- if (! $res > 0) $error++;
- }
- }
- if (! $error)
- {
- $db->commit();
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- $db->rollback();
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
-
// Activate a model
if ($action == 'set')
{
diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php
index 0c7574b7ec4..31efcb22474 100644
--- a/htdocs/admin/user.php
+++ b/htdocs/admin/user.php
@@ -47,37 +47,9 @@ $type='user';
* Action
*/
-// Activate a model
+include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
-// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
-if ($action == 'setModuleOptions')
-{
- $post_size=count($_POST);
-
- $db->begin();
-
- for($i=0;$i < $post_size;$i++)
- {
- if (array_key_exists('param'.$i,$_POST))
- {
- $param=GETPOST("param".$i,'alpha');
- $value=GETPOST("value".$i,'alpha');
- if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
- if (! $res > 0) $error++;
- }
- }
- if (! $error)
- {
- $db->commit();
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- $db->rollback();
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
-elseif ($action == 'set_default')
+if ($action == 'set_default')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
$res = true;
diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php
index 4642e6d3183..8d098ee6923 100644
--- a/htdocs/admin/usergroup.php
+++ b/htdocs/admin/usergroup.php
@@ -47,37 +47,9 @@ $type='group';
* Action
*/
-// Activate a model
+include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
-// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
-if ($action == 'setModuleOptions')
-{
- $post_size=count($_POST);
-
- $db->begin();
-
- for($i=0;$i < $post_size;$i++)
- {
- if (array_key_exists('param'.$i,$_POST))
- {
- $param=GETPOST("param".$i,'alpha');
- $value=GETPOST("value".$i,'alpha');
- if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
- if (! $res > 0) $error++;
- }
- }
- if (! $error)
- {
- $db->commit();
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- $db->rollback();
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
-elseif ($action == 'set_default')
+if ($action == 'set_default')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
$res = true;
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 02ee84dc2de..eb2eddb3197 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1208,7 +1208,7 @@ if ($id > 0)
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
$out.=''.$langs->trans("ViewCal").'';
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
- $out.=''.$langs->trans("ViewWeek").'';
+ $out.=''.$langs->trans("ViewWeek").'';
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
$out.=''.$langs->trans("ViewDay").'';
$linkback.=$out;
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index e46b5718d22..babeb241de0 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -54,7 +54,7 @@ class Facture extends CommonInvoice
public $fk_element = 'fk_facture';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto='bill';
-
+
/**
* {@inheritdoc}
*/
@@ -243,7 +243,7 @@ class Facture extends CommonInvoice
if (! $this->mode_reglement_id) $this->mode_reglement_id = 0;
$this->brouillon = 1;
if (empty($this->entity)) $this->entity = $conf->entity;
-
+
// Multicurrency (test on $this->multicurrency_tx because we sould take the default rate only if not using origin rate)
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
@@ -280,7 +280,7 @@ class Facture extends CommonInvoice
if ($this->fac_rec > 0)
{
$this->fk_fac_rec_source = $this->fac_rec;
-
+
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
$_facrec = new FactureRec($this->db);
$result=$_facrec->fetch($this->fac_rec);
@@ -288,7 +288,7 @@ class Facture extends CommonInvoice
$this->socid = $_facrec->socid; // Invoice created on same thirdparty than template
$this->entity = $_facrec->entity; // Invoice created in same entity than template
-
+
// Fields coming from GUI (priority on template). TODO Value of template should be used as default value on GUI so we can use here always value from GUI
$this->fk_project = GETPOST('projectid','int') > 0 ? GETPOST('projectid','int') : $_facrec->fk_project;
$this->note_public = GETPOST('note_public') ? GETPOST('note_public') : $_facrec->note_public;
@@ -301,7 +301,7 @@ class Facture extends CommonInvoice
// Set here to have this defined for substitution into notes, should be recalculated after adding lines to get same result
$this->total_ht = $_facrec->total_ht;
$this->total_ttc = $_facrec->total_ttc;
-
+
// Fields always coming from template
$this->remise_absolue = $_facrec->remise_absolue;
$this->remise_percent = $_facrec->remise_percent;
@@ -360,9 +360,10 @@ class Facture extends CommonInvoice
'__INVOICE_YEAR__' => dol_print_date($this->date, '%Y'),
'__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'),
);
-
+
+ $substitutionisok=true;
complete_substitutions_array($substitutionarray, $outputlangs);
-
+
$this->note_public=make_substitutions($this->note_public,$substitutionarray);
$this->note_private=make_substitutions($this->note_private,$substitutionarray);
}
@@ -472,7 +473,7 @@ class Facture extends CommonInvoice
}
}
}
-
+
if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object
{
$originforcontact = $this->origin;
@@ -483,7 +484,7 @@ class Facture extends CommonInvoice
$exp = new Expedition($this->db);
$exp->fetch($this->origin_id);
$exp->fetchObjectLinked();
- if (count($exp->linkedObjectsIds['commande']) > 0)
+ if (count($exp->linkedObjectsIds['commande']) > 0)
{
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
{
@@ -493,10 +494,10 @@ class Facture extends CommonInvoice
}
}
}
-
+
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
-
+
$resqlcontact = $this->db->query($sqlcontact);
if ($resqlcontact)
{
@@ -555,11 +556,11 @@ class Facture extends CommonInvoice
foreach ($this->lines as $i => $val)
{
$line = $this->lines[$i];
-
+
// Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array
//if (! is_object($line)) $line=json_decode(json_encode($line), FALSE); // convert recursively array into object.
if (! is_object($line)) $line = (object) $line;
-
+
if (($line->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
{
// Reset fk_parent_line for no child products and special product
@@ -1060,7 +1061,7 @@ 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='';
-
+
if ($user->rights->facture->lire) {
$label = '' . $langs->trans("ShowInvoice") . '';
if (! empty($this->ref))
@@ -1079,7 +1080,7 @@ class Facture extends CommonInvoice
if ($this->type == self::TYPE_SITUATION) $label=$langs->transnoentitiesnoconv("ShowInvoiceSituation").': '.$this->ref;
if ($moretitle) $label.=' - '.$moretitle;
}
-
+
$linkclose='';
if (empty($notooltip) && $user->rights->facture->lire)
{
@@ -1113,7 +1114,7 @@ class Facture extends CommonInvoice
$result.='';
}
}
-
+
return $result;
}
@@ -1321,7 +1322,7 @@ class Facture extends CommonInvoice
$line->qty = $objp->qty;
$line->subprice = $objp->subprice;
- $line->vat_src_code = $objp->vat_src_code;
+ $line->vat_src_code = $objp->vat_src_code;
$line->tva_tx = $objp->tva_tx;
$line->localtax1_tx = $objp->localtax1_tx;
$line->localtax2_tx = $objp->localtax2_tx;
@@ -1574,7 +1575,7 @@ class Facture extends CommonInvoice
$arraytmp=$formmargin->getMarginInfosArray($srcinvoice, false);
$facligne->pa_ht = $arraytmp['pa_total'];
}
-
+
$facligne->total_ht = -$remise->amount_ht;
$facligne->total_tva = -$remise->amount_tva;
$facligne->total_ttc = -$remise->amount_ttc;
@@ -1628,7 +1629,7 @@ class Facture extends CommonInvoice
function set_ref_client($ref_client, $notrigger=0)
{
global $user;
-
+
$error=0;
$this->db->begin();
@@ -2457,7 +2458,7 @@ class Facture extends CommonInvoice
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
-
+
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
@@ -2465,7 +2466,7 @@ class Facture extends CommonInvoice
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
-
+
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
@@ -2650,7 +2651,7 @@ class Facture extends CommonInvoice
* @param double $pu_ht_devise Unit price in currency
* @return int < 0 if KO, > 0 if OK
*/
- function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null, $pu_ht_devise = 0)
+ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=100, $fk_unit = null, $pu_ht_devise = 0)
{
global $conf,$user;
// Deprecation warning
@@ -2770,14 +2771,14 @@ class Facture extends CommonInvoice
$this->line->label = $label;
$this->line->desc = $desc;
$this->line->qty = ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
-
+
$this->line->vat_src_code = $vat_src_code;
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
-
+
$this->line->remise_percent = $remise_percent;
$this->line->subprice = ($this->type==2?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->date_start = $date_start;
@@ -2896,7 +2897,7 @@ class Facture extends CommonInvoice
function deleteline($rowid)
{
global $user;
-
+
dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG);
if (! $this->brouillon)
@@ -2922,13 +2923,13 @@ class Facture extends CommonInvoice
}
$line=new FactureLigne($this->db);
-
+
$line->context = $this->context;
// For triggers
$result = $line->fetch($rowid);
if (! ($result > 0)) dol_print_error($db, $line->error, $line->errors);
-
+
if ($line->delete($user) > 0)
{
$result=$this->update_price(1);
@@ -4292,7 +4293,7 @@ class FactureLigne extends CommonInvoiceLine
$this->fk_unit = $objp->fk_unit;
$this->fk_user_modif = $objp->fk_user_modif;
$this->fk_user_author = $objp->fk_user_author;
-
+
$this->situation_percent = $objp->situation_percent;
$this->fk_prev_id = $objp->fk_prev_id;
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 90ba6a22431..ab04278ea84 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -252,7 +252,7 @@ class BonPrelevement extends CommonObject
function getErrorString($error)
{
global $langs;
-
+
$errors = array();
$errors[1027] = $langs->trans("DateInvalid");
@@ -813,7 +813,7 @@ class BonPrelevement extends CommonObject
dol_syslog(__METHOD__."::Read invoices error ".$this->db->error(), LOG_ERR);
}
}
-
+
if (! $error)
{
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
@@ -834,7 +834,7 @@ class BonPrelevement extends CommonObject
{
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0,$soc->id);
-
+
if ($bac->verif() >= 1)
//if (true)
{
@@ -867,7 +867,7 @@ class BonPrelevement extends CommonObject
}
$ok=0;
-
+
// Withdraw invoices in factures_prev array
$out=count($factures_prev)." invoices will be withdrawn.";
//print $out."\n";
@@ -920,7 +920,7 @@ class BonPrelevement extends CommonObject
$dir=$conf->prelevement->dir_output.'/receipts';
if (! is_dir($dir)) dol_mkdir($dir);
-
+
$this->filename = $dir.'/'.$ref.'.xml';
// Create withdraw receipt in database
@@ -1028,7 +1028,7 @@ class BonPrelevement extends CommonObject
$this->emetteur_bic = $account->bic;
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
-
+
$this->raison_sociale = $account->proprio;
}
@@ -1272,16 +1272,6 @@ class BonPrelevement extends CommonObject
* section Debiteur (sepa Debiteurs bloc lines)
*/
- /*$tmp_invoices = array();
-
- $sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
- $resql=$this->db->query($sql);
- if ($resql) {
- while ($objfac = $this->db->fetch_object($resql)) {
- $tmp_invoices[] = $objfac->fac;
- }
- }*/
-
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
@@ -1365,35 +1355,6 @@ class BonPrelevement extends CommonObject
fputs($this->file, ' '.$CrLf);
fputs($this->file, ' '.$CrLf);
fputs($this->file, ''.$CrLf);
-
- /*$sql = "SELECT pl.amount";
- $sql.= " FROM";
- $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
- $sql.= " ".MAIN_DB_PREFIX."facture as f,";
- $sql.= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
- $sql.= " WHERE pl.fk_prelevement_bons = ".$this->id;
- $sql.= " AND pl.rowid = pf.fk_prelevement_lignes";
- $sql.= " AND pf.fk_facture = f.rowid";
-
- //Lines
- $i = 0;
- $resql=$this->db->query($sql);
- if ($resql)
- {
- $num = $this->db->num_rows($resql);
-
- while ($i < $num)
- {
- $obj = $this->db->fetch_object($resql);
- $this->total = $this->total + $obj->amount;
- $i++;
- }
- }
- else
- {
- $result = -2;
- }*/
-
}
// Build file for Other Countries with unknow format
@@ -1580,11 +1541,11 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR .=' '.$CrLf;
$XML_DEBITOR .=' '.$CrLf;
$XML_DEBITOR .=' '.$langs->trans('Ref').': '.$this->ref; @@ -1874,7 +1874,7 @@ class Contrat extends CommonObject $label .= ' '.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); } } - + $linkclose=''; if (empty($notooltip) && $user->rights->contrat->lire) { @@ -1890,7 +1890,7 @@ class Contrat extends CommonObject $linkstart = ''; $linkend=''; - + if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$linkstart.$this->ref.$linkend; @@ -2225,7 +2225,11 @@ class Contrat extends CommonObject $line->total_ht=90; $line->total_ttc=107.64; // 90 * 1.196 $line->total_tva=17.64; - if ($num_prods > 0) + $line->date_ouverture = dol_now() - 200000; + $line->date_ouverture_prevue = dol_now() - 500000; + $line->date_fin_validite = dol_now() + 500000; + $line->date_cloture = dol_now() - 100000; + if ($num_prods > 0) { $prodid = mt_rand(1, $num_prods); $line->fk_product=$prodids[$prodid]; @@ -2233,11 +2237,6 @@ class Contrat extends CommonObject $this->lines[$xnbp]=$line; $xnbp++; } - - $this->amount_ht = $xnbp*100; - $this->total_ht = $xnbp*100; - $this->total_tva = $xnbp*19.6; - $this->total_ttc = $xnbp*119.6; } /** @@ -2750,6 +2749,8 @@ class ContratLigne extends CommonObjectLine if (empty($this->total_ht)) $this->total_ht = 0; if (empty($this->total_tva)) $this->total_tva = 0; if (empty($this->total_ttc)) $this->total_ttc = 0; + if (empty($this->localtax1_tx)) $this->localtax1_tx = 0; + if (empty($this->localtax2_tx)) $this->localtax2_tx = 0; // Check parameters // Put here code to add control on parameters values diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 92d1011b923..fde828fd6d4 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -24,20 +24,22 @@ // $massaction must be defined // $objectclass and $$objectlabel must be defined -// $uploaddir (example $conf->projet->dir_output . "/";) +// $parameters, $object, $action must be defined for the hook. + +// $uploaddir may be defined (example to $conf->projet->dir_output."/";) // $toselect may be defined // Protection -if (empty($objectclass) || empty($uploaddir)) +if (empty($objectclass) || empty($uploaddir)) { dol_print_error(null, 'include of actions_massactions.inc.php is done but var $massaction or $objectclass or $uploaddir was not defined'); exit; } -// Mass actions. Controls on number of lines checked -$maxformassaction=1000; +// Mass actions. Controls on number of lines checked. +$maxformassaction=(empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS)?1000:$conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS); if (! empty($massaction) && count($toselect) < 1) { $error++; @@ -87,7 +89,7 @@ if (! $error && $massaction == 'confirm_presend') } } //var_dump($listofobjectthirdparties);exit; - + foreach ($listofobjectthirdparties as $thirdpartyid) { $result = $thirdparty->fetch($thirdpartyid); @@ -144,7 +146,7 @@ if (! $error && $massaction == 'confirm_presend') { //var_dump($object); //var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut); - + if ($objectclass == 'Facture' && $object->statut != Facture::STATUS_VALIDATED) { $nbignored++; @@ -157,7 +159,7 @@ if (! $error && $massaction == 'confirm_presend') $resaction.=' '.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$object->ref).' '; continue; } - + // Read document // TODO Use future field $object->fullpathdoc to know where is stored default file // TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc. @@ -202,7 +204,7 @@ if (! $error && $massaction == 'confirm_presend') dol_syslog('Failed to read file: '.$file, LOG_WARNING); continue; } - + //var_dump($listofqualifiedref); } @@ -252,9 +254,9 @@ if (! $error && $massaction == 'confirm_presend') $filepath = $attachedfiles['paths']; $filename = $attachedfiles['names']; $mimetype = $attachedfiles['mimes']; - + //var_dump($filepath); - + // Send mail require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1); @@ -280,7 +282,7 @@ if (! $error && $massaction == 'confirm_presend') if ($objectclass == 'Supplier_Proposal') $actiontypecode='AC_SUP_PRO'; if ($objectclass == 'CommandeFournisseur') $actiontypecode='AC_SUP_ORD'; if ($objectclass == 'FactureFournisseur') $actiontypecode='AC_SUP_INV';*/ - + $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; if ($message) { @@ -290,7 +292,7 @@ if (! $error && $massaction == 'confirm_presend') $actionmsg = dol_concatdesc($actionmsg, $message); } $actionmsg2=''; - + // Initialisation donnees $object->sendtoid = 0; $object->actionmsg = $actionmsg; // Long text @@ -335,7 +337,7 @@ if (! $error && $massaction == 'confirm_presend') $resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n "; $resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n "; $resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n "; - + if ($nbsent) { $action=''; // Do not show form post if there was at least one successfull sent @@ -359,7 +361,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - + $objecttmp=new $objectclass($db); $listofobjectid=array(); $listofobjectthirdparties=array(); @@ -425,21 +427,21 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se if (count($files)>0) { - + $now=dol_now(); $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; - + $input_files = ''; foreach($files as $f) { $input_files.=' '.escapeshellarg($f); } - + $cmd = 'pdftk '.$input_files.' cat output '.escapeshellarg($file); exec($cmd); - + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); - + $langs->load("exports"); setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); } @@ -447,7 +449,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se { setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); } - + } else { // Create empty PDF @@ -481,7 +483,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se // Defined name of merged file $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); $filename=preg_replace('/\s/','_',$filename); - + // Save merged file if ($filter=='paye:0') { @@ -565,6 +567,11 @@ if (! $error && $massaction == 'delete' && $permtodelete) //var_dump($listofobjectthirdparties);exit; } +$parameters['toselect']=$toselect; +$parameters['uploaddir']=$uploaddir; + +$reshook=$hookmanager->executeHooks('doMassActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php new file mode 100644 index 00000000000..03b33b19eb1 --- /dev/null +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -0,0 +1,86 @@ + + * + * 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 ';
$ret.='';
// Warning: if you set submit button to disabled, post using 'Enter' will no more work.
$ret.='';
@@ -1391,7 +1400,7 @@ class Form
* @deprecated
* @see select_dolusers()
*/
- function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0)
+ function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=null,$disabled=0,$include='',$enableonly='',$force_entity=0)
{
print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity);
}
@@ -1411,13 +1420,13 @@ class Form
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request
* @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
- * @param string $enableonlytext If option $enableonly is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
+ * @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
* @param string $morecss More css
* @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
* @return string HTML select string
* @see select_dolgroups
*/
- function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0)
+ function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0)
{
global $conf,$user,$langs;
@@ -1613,7 +1622,7 @@ class Form
* @return string HTML select string
* @see select_dolgroups
*/
- function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
+ function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
{
global $conf,$user,$langs;
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index bcff0981a70..88ebb816a31 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -358,7 +358,7 @@ class FormCompany
*
* @param string $selected Title preselected
* @param string $htmlname Name of HTML select combo field
- * @param string $morecss Add more css on SELECT element
+ * @param string $morecss Add more css on SELECT element
* @return string String with HTML select
*/
function select_civility($selected='',$htmlname='civility_id',$morecss='maxwidth100')
@@ -563,11 +563,11 @@ class FormCompany
$events=array();
// Add an entry 'method' to say 'yes, we must execute url with param action = method';
// Add an entry 'url' to say which url to execute
- // Add an entry htmlname to say which element we must change once url is called
- // Add entry params => array('cssid' => 'attr') to say to remov or add attribute attr if answer of url return 0 or >0 lines
+ // Add an entry htmlname to say which element we must change once url is called
+ // Add entry params => array('cssid' => 'attr') to say to remov or add attribute attr if answer of url return 0 or >0 lines
// To refresh contacts list on thirdparty list change
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
-
+
if (count($events)) // If there is some ajax events to run once selection is done, we add code here to run events
{
print '';
+
+
// Loan card
-
+
$linkback = '' . $langs->trans("BackToList") . '';
-
+
$morehtmlref=' ';
// Ref loan
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
@@ -458,7 +470,7 @@ if ($id > 0)
}
}
$morehtmlref.=' ';
-
+
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
@@ -652,7 +664,7 @@ if ($id > 0)
while ($i < $num)
{
$objp = $db->fetch_object($resql);
-
+
print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.' | ';
print ''.dol_print_date($db->jdate($objp->dp),'day')." | \n";
@@ -713,31 +725,33 @@ if ($id > 0)
if (empty($reshook))
{
print '';
-
+
// Edit
if ($user->rights->loan->write)
{
+ print ''.$langs->trans('CreateCalcSchedule').'';
+
print ''.$langs->trans("Modify").'';
}
-
+
// Emit payment
if ($object->paid == 0 && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write)
{
print ''.$langs->trans("DoPayment").'';
}
-
+
// Classify 'paid'
if ($object->paid == 0 && round($staytopay) <=0 && $user->rights->loan->write)
{
print ''.$langs->trans("ClassifyPaid").'';
}
-
+
// Delete
if ($user->rights->loan->delete)
{
print ''.$langs->trans("Delete").'';
}
-
+
print " ";
}
}
diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php
new file mode 100644
index 00000000000..fb6df8fcb6c
--- /dev/null
+++ b/htdocs/loan/class/loanschedule.class.php
@@ -0,0 +1,542 @@
+
+ *
+ * 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
| |||||||||||||||||||||
| '.$langs->trans("User").' | '; - print ''; - if ($mine) print $user->getLoginUrl(1); - print ' | '; - print '
| '.$langs->trans("User").' | '; - print ''; - if ($mine) print $user->getLoginUrl(1); - print ' | '; - print '