diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 902d8e52846..ca916981076 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4633,7 +4633,7 @@ else if ($id > 0 || ! empty($ref))
if ($objectidnext) {
print '
' . $langs->trans('DoPayment') . '
';
} else {
- //if ($resteapayer == 0) {
+ //if ($resteapayer == 0) { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
// print '' . $langs->trans('DoPayment') . '
';
//} else {
print '';
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index 58161aef6f5..f5382a91550 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -628,6 +628,7 @@ class CMailFile
if (! $res)
{
+ $langs->load("errors");
$this->error="Failed to send mail with php mail";
$linuxlike=1;
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index 9ce569edb35..9bab103d2e4 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -173,7 +173,7 @@ abstract class CommonInvoice extends CommonObject
}
/**
- * Return amount (with tax) of all credit notes and deposits invoices used by invoice
+ * Return amount (with tax) of all credit notes invoices + excess received used by invoice
*
* @param int $multicurrency Return multicurrency_amount instead of amount
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 6c8fcf2f07e..bbb9475b710 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -795,7 +795,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('','', $default_font_size - 4);
- // Loop on each deposits and credit notes included
+ // Loop on each discount available (deposits and credit notes and excess of payment included)
$sql = "SELECT re.rowid, re.amount_ht, re.multicurrency_amount_ht, re.amount_tva, re.multicurrency_amount_tva, re.amount_ttc, re.multicurrency_amount_ttc,";
$sql.= " re.description, re.fk_facture_source,";
$sql.= " f.type, f.datef";
@@ -814,6 +814,7 @@ class pdf_crabe extends ModelePDFFactures
if ($obj->type == 2) $text=$outputlangs->trans("CreditNote");
elseif ($obj->type == 3) $text=$outputlangs->trans("Deposit");
+ elseif ($obj->type == 0) $text=$outputlangs->trans("ExcessReceived");
else $text=$outputlangs->trans("UnknownType");
$invoice->fetch($obj->fk_facture_source);
@@ -1304,7 +1305,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetTextColor(0,0,0);
- $creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
+ $creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received
$depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
//print "x".$creditnoteamount."-".$depositsamount;exit;
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
@@ -1322,9 +1323,10 @@ class pdf_crabe extends ModelePDFFactures
// Credit note
if ($creditnoteamount)
{
+ $labeltouse = ($outputlangs->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangs->transnoentities("CreditNotesOrExcessReceived") : $outputlangs->transnoentities("CreditNotes");
$index++;
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
- $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0);
+ $pdf->MultiCell($col2x-$col1x, $tab2_hl, $labeltouse, 0, 'L', 0);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0);
}
diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php
index 9a71f35a41a..365d40cca96 100644
--- a/htdocs/hrm/index.php
+++ b/htdocs/hrm/index.php
@@ -39,34 +39,33 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
// Load translation files required by the page
$langs->loadLangs(array('users', 'holidays', 'trips'));
-$socid=GETPOST("socid");
+$socid=GETPOST("socid","int");
// Protection if external user
if ($user->societe_id > 0) accessforbidden();
+if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
+
+$holiday = new Holiday($db);
+$holidaystatic=new Holiday($db);
+
/*
* Actions
*/
-// None
-
+// Update sold
+if (! empty($conf->holiday->enabled) && ! empty($setupcompanynotcomplete))
+{
+ $result = $holiday->updateBalance();
+}
/*
* View
*/
-$holiday = new Holiday($db);
-$holidaystatic=new Holiday($db);
-
-// Update sold
-if (! empty($conf->holiday->enabled))
-{
- $result = $holiday->updateBalance();
-}
-
$childids = $user->getAllChildIds();
$childids[]=$user->id;
@@ -75,13 +74,13 @@ llxHeader('', $langs->trans('HRMArea'));
print load_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png');
-if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
if (! empty($setupcompanynotcomplete))
{
$langs->load("errors");
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
print '
';
+ llxFooter();
exit;
}
diff --git a/htdocs/index.php b/htdocs/index.php
index b7e8aed91d3..63b3a1fa689 100644
--- a/htdocs/index.php
+++ b/htdocs/index.php
@@ -524,7 +524,7 @@ foreach($valid_dashboardlines as $board)
}
}
//var_dump($totallate, $totaltodo);
-if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = round($totallate / $totaltodo * 100, 2);
+if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) && !empty($totaltodo)) $totallate = round($totallate / $totaltodo * 100, 2);
//var_dump($totallate);
$boxwork='';
$boxwork.='';
diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
index 5327269fbe5..6bc8594a826 100644
--- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
+++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql
@@ -298,6 +298,7 @@ ALTER TABLE llx_website_account ADD INDEX idx_website_account_login (login);
ALTER TABLE llx_website_account ADD INDEX idx_website_account_import_key (import_key);
ALTER TABLE llx_website_account ADD INDEX idx_website_account_status (status);
ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_soc (fk_soc);
+ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_website (fk_website);
ALTER TABLE llx_website_account ADD UNIQUE INDEX uk_website_account_login_website_soc(login, fk_website, fk_soc);
@@ -474,7 +475,7 @@ ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1;
ALTER TABLE llx_extrafields MODIFY COLUMN langs varchar(64);
-ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
+ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128) NOT NULL;
ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name);
ALTER TABLE llx_societe MODIFY COLUMN ref_ext varchar(255);
@@ -670,9 +671,9 @@ ALTER TABLE llx_blockedlog ADD COLUMN user_fullname varchar(255);
ALTER TABLE llx_blockedlog MODIFY COLUMN ref_object varchar(255);
-- SPEC : use database type 'double' to store monetary values
-ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8);
+ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8) NOT NULL;
ALTER TABLE llx_chargessociales MODIFY COLUMN amount double(24,8);
-ALTER TABLE llx_commande MODIFY COLUMN amount_ht double(24,8);
+ALTER TABLE llx_commande MODIFY COLUMN amount_ht double(24,8) default 0;
ALTER TABLE llx_commande_fournisseur MODIFY COLUMN amount_ht double(24,8);
ALTER TABLE llx_don MODIFY COLUMN amount double(24,8);
ALTER TABLE llx_expensereport_rules MODIFY COLUMN amount double(24,8);
diff --git a/htdocs/install/mysql/tables/llx_website_account.key.sql b/htdocs/install/mysql/tables/llx_website_account.key.sql
new file mode 100644
index 00000000000..2114d3c0f85
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_website_account.key.sql
@@ -0,0 +1,29 @@
+-- Copyright (C) 2016 Laurent Destailleur
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see http://www.gnu.org/licenses/.
+
+
+-- BEGIN MODULEBUILDER INDEXES
+ALTER TABLE llx_website_account ADD INDEX idx_website_account_rowid (rowid);
+ALTER TABLE llx_website_account ADD INDEX idx_website_account_login (login);
+ALTER TABLE llx_website_account ADD INDEX idx_website_account_import_key (import_key);
+ALTER TABLE llx_website_account ADD INDEX idx_website_account_status (status);
+ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_soc (fk_soc);
+ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_website (fk_website);
+-- END MODULEBUILDER INDEXES
+
+ALTER TABLE llx_website_account ADD UNIQUE INDEX uk_website_account_login_website_soc(login, fk_website, fk_soc);
+
+ALTER TABLE llx_website_account ADD CONSTRAINT llx_website_account_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid);
+
diff --git a/htdocs/install/mysql/tables/llx_website_account.sql b/htdocs/install/mysql/tables/llx_website_account.sql
new file mode 100644
index 00000000000..373ba53f484
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_website_account.sql
@@ -0,0 +1,36 @@
+-- Copyright (C) 2016 Laurent Destailleur
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see http://www.gnu.org/licenses/.
+
+
+CREATE TABLE llx_website_account(
+ -- BEGIN MODULEBUILDER FIELDS
+ rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
+ login varchar(64) NOT NULL,
+ pass_encoding varchar(24) NOT NULL,
+ pass_crypted varchar(128),
+ pass_temp varchar(128), -- temporary password when asked for forget password
+ fk_soc integer,
+ fk_website integer NOT NULL,
+ note_private text,
+ date_last_login datetime,
+ date_previous_login datetime,
+ date_creation datetime NOT NULL,
+ tms timestamp NOT NULL,
+ fk_user_creat integer NOT NULL,
+ fk_user_modif integer,
+ import_key varchar(14),
+ status integer
+ -- END MODULEBUILDER FIELDS
+) ENGINE=innodb;
\ No newline at end of file
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index d06b1512cc6..3b59e46219a 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -282,6 +282,7 @@ RelativeDiscount=Relative discount
GlobalDiscount=Global discount
CreditNote=Credit note
CreditNotes=Credit notes
+CreditNotesOrExcessReceived=Credit notes or excess received
Deposit=Down payment
Deposits=Down payments
DiscountFromCreditNote=Discount from credit note %s
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index 122796370a7..1b1748f90a1 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -78,7 +78,7 @@ MenuNewSocialContribution=New social/fiscal tax
NewSocialContribution=New social/fiscal tax
AddSocialContribution=Add social/fiscal tax
ContributionsToPay=Social/fiscal taxes to pay
-AccountancyTreasuryArea=Accountancy/Treasury area
+AccountancyTreasuryArea=Billing and payment area
NewPayment=New payment
Payments=Payments
PaymentCustomerInvoice=Customer invoice payment
diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang
index dd9f6e54412..9705e9ccc0b 100644
--- a/htdocs/langs/fr_FR/bills.lang
+++ b/htdocs/langs/fr_FR/bills.lang
@@ -282,6 +282,7 @@ RelativeDiscount=Remise relative
GlobalDiscount=Ligne de déduction
CreditNote=Avoir
CreditNotes=Avoirs
+CreditNotesOrExcessReceived=Avoirs ou trop perçus
Deposit=Acompte
Deposits=Acomptes
DiscountFromCreditNote=Remise issue de l'avoir %s
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index a8825da56fa..137e394fe08 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -270,7 +270,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
);
- }*/
+ */
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
}