diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index 2f440f9f873..755440a47fd 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -177,7 +177,7 @@ if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$la
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
-$elementList['all']=$langs->trans('VisibleEverywhere');
+$elementList['all'] =$langs->trans('VisibleEverywhere');
$elementList['none']=$langs->trans('VisibleNowhere');
@@ -295,7 +295,7 @@ if (empty($reshook))
if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]='';
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
- if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''
+ if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
else $sql.="'".$db->escape($_POST[$keycode])."'";
$i++;
}
@@ -485,7 +485,7 @@ if (! $user->admin)
}
if (empty($conf->global->MAIN_MULTILANGS))
{
- $sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL)";
+ $sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL OR lang = '')";
}
if ($search_label) $sql.=natural_search('label', $search_label);
if ($search_type_template != '' && $search_type_template != '-1') $sql.=natural_search('type_template', $search_type_template);
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 2535d8e7442..940ada5e04b 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -604,27 +604,30 @@ if (empty($reshook))
$ventilExportCompta = $object->getVentilExportCompta();
// On verifie si aucun paiement n'a ete effectue
- if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0)
+ if ($ventilExportCompta == 0)
{
- $result=$object->set_draft($user, $idwarehouse);
- if ($result<0) setEventMessages($object->error, $object->errors, 'errors');
-
-
- // Define output language
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+ if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == $object->total_ttc && empty($object->paye)))
{
- $outputlangs = $langs;
- $newlang = '';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
- if (! empty($newlang)) {
- $outputlangs = new Translate("", $conf);
- $outputlangs->setDefaultLang($newlang);
- }
- $model=$object->modelpdf;
- $ret = $object->fetch($id); // Reload to get new records
+ $result=$object->set_draft($user, $idwarehouse);
+ if ($result<0) setEventMessages($object->error, $object->errors, 'errors');
- $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
+
+ // Define output language
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+ {
+ $outputlangs = $langs;
+ $newlang = '';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
+ if (! empty($newlang)) {
+ $outputlangs = new Translate("", $conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+ $model=$object->modelpdf;
+ $ret = $object->fetch($id); // Reload to get new records
+
+ $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
+ }
}
}
}
@@ -1436,7 +1439,7 @@ if (empty($reshook))
$object->situation_counter = $object->situation_counter + 1;
$id = $object->createFromCurrent($user);
- if ($id <= 0)
+ if ($id <= 0)
{
$mesg = $object->error;
}
@@ -4115,28 +4118,35 @@ else if ($id > 0 || ! empty($ref))
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
- if ($object->statut == 1)
+ if ($object->statut == Facture::STATUS_VALIDATED)
{
// On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees
$ventilExportCompta = $object->getVentilExportCompta();
- if ($resteapayer == $object->total_ttc && empty($object->paye) && $ventilExportCompta == 0)
+ if ($ventilExportCompta == 0)
{
- if (! $objectidnext && $object->is_last_in_cycle())
+ if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == $object->total_ttc && empty($object->paye)))
{
- if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
- || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
+ if (! $objectidnext && $object->is_last_in_cycle())
{
- print '
';
+ if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
+ {
+ print '';
+ } else {
+ print '' . $langs->trans('Modify') . '
';
+ }
+ } else if (!$object->is_last_in_cycle()) {
+ print '' . $langs->trans('Modify') . '
';
} else {
- print '' . $langs->trans('Modify') . '
';
+ print '' . $langs->trans('Modify') . '
';
}
- } else if (!$object->is_last_in_cycle()) {
- print '' . $langs->trans('Modify') . '
';
- } else {
- print '' . $langs->trans('Modify') . '
';
}
}
+ else
+ {
+ print '' . $langs->trans('Modify') . '
';
+ }
}
$discount = new DiscountAbsolute($db);
@@ -4158,7 +4168,7 @@ else if ($id > 0 || ! empty($ref))
}
// Validate
- if ($object->statut == 0 && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (! empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
+ if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (! empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate)))
{
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index ba8e9f4d085..c252df5070e 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -5234,7 +5234,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
'__MYCOMPANY_PROFID5__' => $mysoc->idprof5,
'__MYCOMPANY_PROFID6__' => $mysoc->idprof6,
'__MYCOMPANY_CAPITAL__' => $mysoc->capital,
- '__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
+ '__MYCOMPANY_FULLADDRESS__' => $mysoc->getFullAddress(1, ', '),
+ '__MYCOMPANY_ADDRESS__' => $mysoc->address,
+ '__MYCOMPANY_ZIP__' => $mysoc->zip,
+ '__MYCOMPANY_TOWN__' => $mysoc->town,
+ '__MYCOMPANY_COUNTRY__' => $mysoc->country,
+ '__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
));
}
if (($onlykey || is_object($object)) && (empty($exclude) || ! in_array('object', $exclude)))
@@ -5390,8 +5395,14 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
'__USER_FIRSTNAME__' => (string) $user->firstname,
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
'__USER_SUPERVISOR_ID__' => (string) $user->fk_user,
- '__SIGNATURE__' => (string) (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '')
- ));
+ '__USER_SIGNATURE__' => (string) (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '')
+ )
+ );
+ // For backward compatibility
+ if ($onlykey != 2)
+ {
+ $substitutionarray['__SIGNATURE__'] = (string) (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '');
+ }
}
if (! empty($conf->multicompany->enabled))
{
diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql
index b3bb3292ba6..bfa183781c7 100644
--- a/htdocs/install/mysql/data/llx_c_email_templates.sql
+++ b/htdocs/install/mysql/data/llx_c_email_templates.sql
@@ -20,4 +20,7 @@
-- de l'install et tous les sigles '--' sont supprimés.
--
-INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,active,topic,content,content_lines) VALUES (0,null,'member',null,0,null,null,'(SendAnEMailToMember)',1,1,'__(CardContent)__','__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__',null);
+INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines) VALUES (0,'adherent','member','',0,null,null,'(SendAnEMailToMember)',1,1,1,'__(CardContent)__','__(Hello)__,
\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__
\n__(Sincerely)__
__USER_SIGNATURE__',null);
+INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines) VALUES (0,'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,1,0,'__(YourSEPAMandate)__','__(Hello)__,
\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__
\n__(Sincerely)__
\n__USER_SIGNATURE__',null);
+
+
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 0d2a6a7baed..b2df01afe51 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
@@ -70,8 +70,12 @@ ALTER TABLE llx_contrat MODIFY COLUMN ref_ext varchar(50);
UPDATE llx_c_email_templates SET position = 0 WHERE position IS NULL;
+UPDATE llx_c_email_templates SET lang = '' WHERE lang IS NULL;
-INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,active,topic,content,content_lines) VALUES (0,null,'member',null,0,null,null,'(SendAnEMailToMember)',1,1,'__(CardContent)__','__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__',null);
+ALTER TABLE llx_c_email_templates ADD COLUMN enabled varchar(255) DEFAULT '1';
+
+INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines) VALUES (0,'adherent','member','',0,null,null,'(SendAnEMailToMember)',1,1,1,'__(CardContent)__','__(Hello)__,
\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__
\n__(Sincerely)__
__USER_SIGNATURE__',null);
+INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines) VALUES (0,'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,1,0,'__(YourSEPAMandate)__','__(Hello)__,
\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__
\n__(Sincerely)__
\n__USER_SIGNATURE__',null);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VENTES', 'Income of products/services', 'Exemple: 7xxxxx', 0, 0, '', '10', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'DEPENSES', 'Expenses of products/services', 'Exemple: 6xxxxx', 0, 0, '', '20', 1, 1);
diff --git a/htdocs/install/mysql/tables/llx_c_email_templates.sql b/htdocs/install/mysql/tables/llx_c_email_templates.sql
index 9d82d37768a..69cbc186ebd 100644
--- a/htdocs/install/mysql/tables/llx_c_email_templates.sql
+++ b/htdocs/install/mysql/tables/llx_c_email_templates.sql
@@ -23,13 +23,14 @@ create table llx_c_email_templates
entity integer DEFAULT 1 NOT NULL, -- multi company id
module varchar(32), -- Nom du module en rapport avec le modele
type_template varchar(32), -- template for which type of email (send invoice by email, send order, ...)
- lang varchar(6),
+ lang varchar(6) DEFAULT '', -- We use a default to '' so the unique index that include this field will work
private smallint DEFAULT 0 NOT NULL, -- Template public or private
fk_user integer, -- Id user owner if template is private, or null
datec datetime,
tms timestamp,
label varchar(255), -- Label of predefined email
position smallint, -- Position
+ enabled varchar(255) DEFAULT '1', -- Condition to have this module visible
active tinyint DEFAULT 1 NOT NULL,
topic text, -- Predefined topic
content text, -- Predefined text
diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang
index caed4498f3b..d45c0c15c1c 100644
--- a/htdocs/langs/en_US/banks.lang
+++ b/htdocs/langs/en_US/banks.lang
@@ -157,4 +157,6 @@ NewVariousPayment=New miscellaneous payments
VariousPayment=Miscellaneous payments
VariousPayments=Miscellaneous payments
ShowVariousPayment=Show miscellaneous payments
-AddVariousPayment=Add miscellaneous payments
\ No newline at end of file
+AddVariousPayment=Add miscellaneous payments
+YourSEPAMandate=Your SEPA mandate
+FindYourSEPAMandate=This is your SEPA mandate to authorize our company to make direct debit order to your bank. Thanks to return it signed (scan of the signed document) or sent it by mail to
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 93616b6151c..bfcbb5a2010 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -262,6 +262,7 @@ DateBuild=Report build date
DatePayment=Date of payment
DateApprove=Approving date
DateApprove2=Approving date (second approval)
+RegistrationDate=Registration date
UserCreation=Creation user
UserModification=Modification user
UserCreationShort=Creat. user
@@ -770,6 +771,7 @@ Genderwoman=Woman
ViewList=List view
Mandatory=Mandatory
Hello=Hello
+GoodBye=GoodBye
Sincerely=Sincerely
DeleteLine=Delete line
ConfirmDeleteLine=Are you sure you want to delete this line?
diff --git a/htdocs/theme/eldy/img/stcomm0.png b/htdocs/theme/eldy/img/stcomm0.png
index b6c11d4569a..1220cf8113e 100644
Binary files a/htdocs/theme/eldy/img/stcomm0.png and b/htdocs/theme/eldy/img/stcomm0.png differ