Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into 8.0

This commit is contained in:
Laurent Destailleur 2018-07-24 19:23:51 +02:00
commit 7821e21e5b
8 changed files with 49 additions and 6 deletions

View File

@ -379,7 +379,7 @@ $tabrowid[9] = "code_iso";
$tabrowid[10]= "";
$tabrowid[11]= "rowid";
$tabrowid[12]= "";
$tabrowid[13]= "";
$tabrowid[13]= "id";
$tabrowid[14]= "";
$tabrowid[15]= "";
$tabrowid[16]= "code";

View File

@ -4730,7 +4730,7 @@ else if ($id > 0 || ! empty($ref))
}
// For situation invoice with excess received
if ($object->statut == Facture::STATUS_VALIDATED
if ($object->statut > Facture::STATUS_DRAFT
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
&& $user->rights->facture->creer
&& !$objectidnext
@ -4748,7 +4748,7 @@ else if ($id > 0 || ! empty($ref))
}
// remove situation from cycle
if ($object->statut == Facture::STATUS_VALIDATED
if ($object->statut > Facture::STATUS_DRAFT
&& $object->type == Facture::TYPE_SITUATION
&& $user->rights->facture->creer
&& !$objectidnext

View File

@ -984,6 +984,7 @@ class FactureRec extends CommonInvoice
$error=0;
$langs->load("bills");
$langs->load('main');
$nb_create=0;
@ -1060,6 +1061,8 @@ class FactureRec extends CommonInvoice
}
if (! $error && $facturerec->generate_pdf)
{
// We refresh the object in order to have all necessary data (like date_lim_reglement)
$facture->fetch($facture->id);
$result = $facture->generateDocument($facturerec->modelpdf, $langs);
if ($result <= 0)
{

View File

@ -838,7 +838,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code";
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC";

View File

@ -193,6 +193,21 @@ if ($action == 'presend')
);
complete_substitutions_array($substitutionarray, $outputlangs, $object, $parameters);
// Find the good contact adress
$custcontact = '';
$contactarr = array();
$contactarr = $object->liste_contact(- 1, 'external');
if (is_array($contactarr) && count($contactarr) > 0) {
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
$contactstatic = new Contact($db);
foreach ($contactarr as $contact) {
$contactstatic->fetch($contact['id']);
$substitutionarray['__CONTACT_NAME_'.$contact['code'].'__'] = $contactstatic->getFullName($langs, 1);
}
}
// Tableau des substitutions
$formmail->substit = $substitutionarray;

View File

@ -51,6 +51,9 @@ ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (filepath, filename, ent
DROP TABLE llx_c_accountancy_category;
DROP TABLE llx_c_accountingaccount;
-- drop old postgresql unique key
-- VPGSQL8.2 DROP INDEX llx_usergroup_rights_fk_usergroup_fk_id_key
update llx_propal set fk_statut = 1 where fk_statut = -1;
ALTER TABLE llx_inventory ADD COLUMN fk_user_creat integer;

View File

@ -1079,15 +1079,28 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha'))
if ($db->type == "mysql" || $db->type == "mysqli")
{
$listoftables = $db->DDLListTables($db->database_name);
$force_utf8_on_tables = GETPOST('force_utf8_on_tables','alpha');
$listoftables = $db->DDLListTables($db->database_name);
// Disable foreign key checking for avoid errors
if ($force_utf8_on_tables == 'confirmed')
{
$sql='SET FOREIGN_KEY_CHECKS=0';
print '<!-- '.$sql.' -->';
$resql = $db->query($sql);
}
foreach($listoftables as $table)
{
// do not convert llx_const if mysql encrypt/decrypt is used
if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table)) continue;
print '<tr><td colspan="2">';
print $table;
$sql='ALTER TABLE '.$table.' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci';
print '<!-- '.$sql.' -->';
if (GETPOST('force_utf8_on_tables','alpha') == 'confirmed')
if ($force_utf8_on_tables == 'confirmed')
{
$resql = $db->query($sql);
print ' - Done ('.($resql?'OK':'KO').')';
@ -1095,6 +1108,14 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha'))
else print ' - Disabled';
print '</td></tr>';
}
// Enable foreign key checking
if ($force_utf8_on_tables == 'confirmed')
{
$sql='SET FOREIGN_KEY_CHECKS=1';
print '<!-- '.$sql.' -->';
$resql = $db->query($sql);
}
}
else
{

View File

@ -142,6 +142,7 @@ Closed=Closed
Closed2=Closed
NotClosed=Not closed
Enabled=Enabled
Enable=Enable
Deprecated=Deprecated
Disable=Disable
Disabled=Disabled