diff --git a/ChangeLog b/ChangeLog
index 07cd70d64fa..4d9f8b012cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,7 +15,7 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Method GetUrlTrackingStatus were renamed into getUrlTrackingStatus for consistency with naming rules.
* API getListOfCivility has been renamed into getListOfCivilities for consistency with naming rules.
-
+* Deprecated function img_phone as been removed. You can use img_picto(..., 'call|call_out') instead.;
***** ChangeLog for 9.0.1 compared to 9.0.0 *****
diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php
index 5964d0d3e62..364897615de 100755
--- a/dev/initdata/purge-data.php
+++ b/dev/initdata/purge-data.php
@@ -53,97 +53,104 @@ $error=0;
// List of sql to execute
$sqls=array(
'user'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX."user_rights WHERE fk_user IN (SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin')",
- 'DELETE FROM '.MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin'",
+ "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user IN (SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin') AND fk_user IN (select rowid FROM ".MAIN_DB_PREFIX."user where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin' AND datec < '__DATE__'",
),
'bank'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'bank_account',
- 'DELETE FROM '.MAIN_DB_PREFIX.'bank_class',
- 'DELETE FROM '.MAIN_DB_PREFIX.'bank_url',
- 'DELETE FROM '.MAIN_DB_PREFIX.'bank',
+ "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__'",
+ ),
+ 'bankaccount'=>array(
+ "DELETE FROM ".MAIN_DB_PREFIX."bank_account WHERE datec < '__DATE__'",
),
'contract'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'contratdet',
- 'DELETE FROM '.MAIN_DB_PREFIX.'contrat',
+ "DELETE FROM ".MAIN_DB_PREFIX."contratdet_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."contratdet WHERE fk_contrat IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where date < '__DATE__'))",
+ "DELETE FROM ".MAIN_DB_PREFIX."contratdet WHERE fk_contrat IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."contrat_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where date < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."contrat WHERE datec < '__DATE__'",
),
'invoice'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'paiement_facture',
- 'DELETE FROM '.MAIN_DB_PREFIX.'facture_rec',
- 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet',
- 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE fk_facture_source IS NOT NULL',
- 'DELETE FROM '.MAIN_DB_PREFIX.'facture',
+ "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture_source IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture_line IN (select rowid FROM ".MAIN_DB_PREFIX."facturedet as fd WHERE fd.fk_facture IN (select rowid from ".MAIN_DB_PREFIX."facture where datec < '__DATE__'))",
+ "DELETE FROM ".MAIN_DB_PREFIX."paiement_facture where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."facture_rec where datec < '__DATE__'",
+ "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
+ "UPDATE ".MAIN_DB_PREFIX."facture SET fk_facture_source = NULL WHERE fk_facture_source IN (select f2.rowid FROM (select * from ".MAIN_DB_PREFIX."facture) as f2 where f2.datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__'",
),
'proposal'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'propaldet',
- 'DELETE FROM '.MAIN_DB_PREFIX.'propal',
+ "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal IN (select rowid FROM ".MAIN_DB_PREFIX."propal where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE datec < '__DATE__'",
),
- 'supplier_proposal'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet',
- 'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal',
+ "supplier_proposal"=>array(
+ "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposaldet WHERE fk_supplier_proposal IN (select rowid FROM ".MAIN_DB_PREFIX."propal where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposal where datec < '__DATE__'",
),
'supplier_order'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet',
- 'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseur',
+ "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande IN (select rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__'",
),
'supplier_invoice'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det',
- 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn',
+ "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det WHERE fk_facture_fourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__'",
),
'delivery'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet',
- 'DELETE FROM '.MAIN_DB_PREFIX.'livraison',
+ "DELETE FROM ".MAIN_DB_PREFIX."livraisondet WHERE fk_livraison IN (select rowid FROM ".MAIN_DB_PREFIX."livraison where date_creation < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."livraison where date_creation < '__DATE__'",
),
'shipment'=>array(
'@delivery',
- 'DELETE FROM '.MAIN_DB_PREFIX.'expeditiondet_batch',
- 'DELETE FROM '.MAIN_DB_PREFIX.'expeditiondet_extrafields',
- 'DELETE FROM '.MAIN_DB_PREFIX.'expeditiondet',
- 'DELETE FROM '.MAIN_DB_PREFIX.'expedition_extrafields',
- 'DELETE FROM '.MAIN_DB_PREFIX.'expedition',
+ "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_batch WHERE fk_expeditiondet IN (select rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'))",
+ "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'))",
+ "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."expedition_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'",
),
'order'=>array(
'@shipment',
- 'DELETE FROM '.MAIN_DB_PREFIX.'commandedet',
- 'DELETE FROM '.MAIN_DB_PREFIX.'commande',
+ "DELETE FROM ".MAIN_DB_PREFIX."commandedet WHERE fk_commande IN (select rowid FROM ".MAIN_DB_PREFIX."commande where date_creation < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."commande where date_creation < '__DATE__'",
),
'intervention'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'fichinterdet',
- 'DELETE FROM '.MAIN_DB_PREFIX.'fichinter',
+ "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE fk_fichinter IN (select rowid FROM ".MAIN_DB_PREFIX."fichinter where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."fichinter where datec < '__DATE__'",
),
'product'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_product',
- 'DELETE FROM '.MAIN_DB_PREFIX.'product_lang',
- 'DELETE FROM '.MAIN_DB_PREFIX.'product_price',
- 'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price',
- 'DELETE FROM '.MAIN_DB_PREFIX.'product_batch',
- 'DELETE FROM '.MAIN_DB_PREFIX.'product_stock',
- 'DELETE FROM '.MAIN_DB_PREFIX.'product_lot',
- 'DELETE FROM '.MAIN_DB_PREFIX.'product',
+ "DELETE FROM ".MAIN_DB_PREFIX."categorie_product WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."product_lang WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty WHERE fk_product_price IN (select rowid FROM ".MAIN_DB_PREFIX."product_price where fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'))",
+ "DELETE FROM ".MAIN_DB_PREFIX."product_price WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."product_batch WHERE fk_product_stock IN (select rowid FROM ".MAIN_DB_PREFIX."product_stock where fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'))",
+ "DELETE FROM ".MAIN_DB_PREFIX."product_stock WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."product_lot WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'",
),
'project'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'projet_task_time',
- 'DELETE FROM '.MAIN_DB_PREFIX.'projet_task',
- 'DELETE FROM '.MAIN_DB_PREFIX.'projet',
+ // TODO set fk_project to null on object that refer to project
+ "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_task IN (select rowid FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'))",
+ "DELETE FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'",
),
'contact'=>array(
- 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_contact',
- 'DELETE FROM '.MAIN_DB_PREFIX.'socpeople',
+ "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople IN (select rowid FROM ".MAIN_DB_PREFIX."socpeople where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."socpeople where datec < '__DATE__'",
),
'thirdparty'=>array(
'@contact',
- 'DELETE FROM '.MAIN_DB_PREFIX.'cabinetmed_cons',
- 'UPDATE '.MAIN_DB_PREFIX.'adherent SET fk_soc = NULL',
- 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur',
- 'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe',
- 'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except',
- 'DELETE FROM '.MAIN_DB_PREFIX.'societe_rib',
- 'DELETE FROM '.MAIN_DB_PREFIX.'societe',
+ "DELETE FROM ".MAIN_DB_PREFIX."cabinetmed_cons WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
+ "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = NULL WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."categorie_fournisseur WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."societe_rib WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
+ "DELETE FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__'",
)
);
-
-
/*
* Main
*/
@@ -154,27 +161,37 @@ dol_syslog($script_file." launched with arg ".implode(',', $argv));
$mode = $argv[1];
$option = $argv[2];
+$date = $argv[3];
if (empty($mode) || ! in_array($mode, array('test','confirm'))) {
- print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
+ print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option can be ".implode(',', array_keys($sqls))."\n";
exit(-1);
}
if (empty($option) || ! in_array($option, array_merge(array('all'), array_keys($sqls))) ) {
- print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
+ print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option can be ".implode(',', array_keys($sqls))."\n";
exit(-1);
}
+if (empty($date) || (! preg_match('/\d\d\d\d\-\d\d\-\d\d$/', $date) && $date != 'all')) {
+ print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
+ print "\n";
+ print "date can be 'all' or 'YYYY-MM-DD' to delete record before YYYY-MM-DD\n";
+ exit(-1);
+}
+
+if ($date == 'all') $date = '2199-01-01';
+
// Replace database handler
-if (! empty($argv[3]))
+if (! empty($argv[4]))
{
$db->close();
unset($db);
- $db=getDoliDBInstance($argv[3], $argv[4], $argv[5], $argv[6], $argv[7], $argv[8]);
+ $db=getDoliDBInstance($argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9]);
$user=new User($db);
}
@@ -189,6 +206,7 @@ if (! $ret > 0)
print "Purge all data for this database:\n";
+print "Before = ".$date."\n";
print "Server = ".$db->database_host."\n";
print "Database name = ".$db->database_name."\n";
print "Database port = ".$db->database_port."\n";
@@ -206,9 +224,10 @@ if (! $confirmed)
* Process sql requests of a family
*
* @param string $family Name of family key of array $sqls
+ * @param string $date Date value
* @return int -1 if KO, 1 if OK
*/
-function processfamily($family)
+function processfamily($family, $date)
{
global $db, $sqls;
@@ -218,11 +237,14 @@ function processfamily($family)
if (preg_match('/^@/', $sql))
{
$newfamily=preg_replace('/@/', '', $sql);
- processfamily($newfamily);
+ processfamily($newfamily, $date);
continue;
}
+ $sql = preg_replace('/__DATE__/', $date, $sql);
+
print "Run sql: ".$sql."\n";
+
$resql=$db->query($sql);
if (! $resql)
{
@@ -255,7 +277,7 @@ foreach($sqls as $family => $familysql)
if ($family != $oldfamily) print "Process action for family ".$family."\n";
$oldfamily = $family;
- $result=processfamily($family);
+ $result=processfamily($family, $date);
if ($result < 0)
{
$error++;
@@ -265,7 +287,7 @@ foreach($sqls as $family => $familysql)
if ($error || $mode != 'confirm')
{
- print "Rollback any changes.\n";
+ print "\nRollback any changes.\n";
$db->rollback();
}
else
diff --git a/dev/resources/dbmodel/README b/dev/resources/dbmodel/README
new file mode 100644
index 00000000000..74233624a6d
--- /dev/null
+++ b/dev/resources/dbmodel/README
@@ -0,0 +1,2 @@
+This directory contains the file with the graphical database structure.
+It can be read with MySQL Workbench software.
\ No newline at end of file
diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml
index b6f62aede64..d8fff2265e9 100644
--- a/dev/setup/codesniffer/ruleset.xml
+++ b/dev/setup/codesniffer/ruleset.xml
@@ -428,4 +428,5 @@
+
diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php
index 78d2821bf90..af2a8841643 100644
--- a/htdocs/adherents/admin/adherent.php
+++ b/htdocs/adherents/admin/adherent.php
@@ -183,6 +183,10 @@ if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! emp
if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice");
print '
';
print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' ';
print '';
-print ' ';
// End of page
llxFooter();
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 77f3c7200f4..d4b77342c84 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -572,6 +572,22 @@ class Adherent extends CommonObject
$sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
$sql.= " WHERE rowid = ".$this->id;
+ // If we change the type of membership, we set also label of new type
+ if (! empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid)
+ {
+ $sql2 = "SELECT libelle as label";
+ $sql2.= " FROM ".MAIN_DB_PREFIX."adherent_type";
+ $sql2.= " WHERE rowid = ".$this->typeid;
+ $resql2 = $this->db->query($sql2);
+ if ($resql2)
+ {
+ while ($obj=$this->db->fetch_object($resql2))
+ {
+ $this->type=$obj->label;
+ }
+ }
+ }
+
dol_syslog(get_class($this)."::update update member", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php
index 164606431ff..6ba88e7771b 100644
--- a/htdocs/adherents/stats/byproperties.php
+++ b/htdocs/adherents/stats/byproperties.php
@@ -58,15 +58,16 @@ llxHeader('', $langs->trans("MembersStatisticsByProperties"), '', '', 0, 0, arra
$title=$langs->trans("MembersStatisticsByProperties");
-print load_fiche_titre($title, $mesg);
+print load_fiche_titre($title, '');
dol_mkdir($dir);
$tab='byproperties';
$data = array();
-$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, d.morphy as code";
+$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, d.morphy as code";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
+$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY d.morphy";
@@ -87,7 +88,7 @@ if ($resql)
if ($obj->code == 'phy') $foundphy++;
if ($obj->code == 'mor') $foundmor++;
- $data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate));
+ $data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate));
$i++;
}
@@ -120,22 +121,21 @@ print '
';
diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php
index f5816f46aca..79aa5ab6a82 100644
--- a/htdocs/adherents/stats/geo.php
+++ b/htdocs/adherents/stats/geo.php
@@ -77,8 +77,10 @@ if ($mode)
$tab='statscountry';
$data = array();
- $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label";
- $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
+ $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label";
+ $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
+ $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
+ $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY c.label, c.code";
@@ -92,10 +94,12 @@ if ($mode)
$tab='statsstate';
$data = array();
- $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, c.nom as label2"; //
- $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
+ $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; //
+ $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
+ $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
+ $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY co.label, co.code, c.nom";
@@ -108,10 +112,12 @@ if ($mode)
$tab='statsregion'; //onglet
$data = array(); //tableau de donnée
- $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, r.nom as label2";
- $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
+ $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2";
+ $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
+ $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
+ $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY co.label, co.code, r.nom"; //+
@@ -124,9 +130,10 @@ if ($mode)
$tab='statstown';
$data = array();
- $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label, d.town as label2";
+ $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
+ $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY c.label, c.code, d.town";
@@ -154,7 +161,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'code'=>$obj->code,
'nb'=>$obj->nb,
- 'lastdate'=>$db->jdate($obj->lastdate)
+ 'lastdate'=>$db->jdate($obj->lastdate),
+ 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
if ($mode == 'memberbyregion') //+
@@ -164,7 +172,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb,
- 'lastdate'=>$db->jdate($obj->lastdate)
+ 'lastdate'=>$db->jdate($obj->lastdate),
+ 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
if ($mode == 'memberbystate')
@@ -173,7 +182,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb,
- 'lastdate'=>$db->jdate($obj->lastdate)
+ 'lastdate'=>$db->jdate($obj->lastdate),
+ 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
if ($mode == 'memberbytown')
@@ -182,7 +192,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb,
- 'lastdate'=>$db->jdate($obj->lastdate)
+ 'lastdate'=>$db->jdate($obj->lastdate),
+ 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
@@ -289,9 +300,9 @@ if ($mode)
if ($label2) print '
'.$label2.'
';
print '
'.$langs->trans("NbOfMembers").'
';
print '
'.$langs->trans("LastMemberDate").'
';
+ print '
'.$langs->trans("LatestSubscriptionDate").'
';
print '';
- $oldyear=0;
foreach ($data as $val)
{
$year = $val['year'];
@@ -300,8 +311,8 @@ if ($mode)
if ($label2) print '
\n";
diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
index 0fe747d0a86..a2a6009cd6a 100644
--- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
+++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
@@ -122,14 +122,14 @@ class PaymentSocialContribution extends CommonObject
}
// Clean parameters
- if (isset($this->fk_charge)) $this->fk_charge=trim($this->fk_charge);
+ if (isset($this->fk_charge)) $this->fk_charge= (int) $this->fk_charge;
if (isset($this->amount)) $this->amount=trim($this->amount);
- if (isset($this->fk_typepaiement)) $this->fk_typepaiement=trim($this->fk_typepaiement);
+ if (isset($this->fk_typepaiement)) $this->fk_typepaiement= (int) $this->fk_typepaiement;
if (isset($this->num_paiement)) $this->num_paiement=trim($this->num_paiement);
if (isset($this->note)) $this->note=trim($this->note);
- if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
- if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
- if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
+ if (isset($this->fk_bank)) $this->fk_bank= (int) $this->fk_bank;
+ if (isset($this->fk_user_creat)) $this->fk_user_creat= (int) $this->fk_user_creat;
+ if (isset($this->fk_user_modif)) $this->fk_user_modif= (int) $this->fk_user_modif;
$totalamount = 0;
foreach ($this->amounts as $key => $value) // How payment is dispatch
@@ -299,14 +299,14 @@ class PaymentSocialContribution extends CommonObject
// Clean parameters
- if (isset($this->fk_charge)) $this->fk_charge=trim($this->fk_charge);
+ if (isset($this->fk_charge)) $this->fk_charge= (int) $this->fk_charge;
if (isset($this->amount)) $this->amount=trim($this->amount);
- if (isset($this->fk_typepaiement)) $this->fk_typepaiement=trim($this->fk_typepaiement);
+ if (isset($this->fk_typepaiement)) $this->fk_typepaiement= (int) $this->fk_typepaiement;
if (isset($this->num_paiement)) $this->num_paiement=trim($this->num_paiement);
if (isset($this->note)) $this->note=trim($this->note);
- if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
- if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
- if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
+ if (isset($this->fk_bank)) $this->fk_bank= (int) $this->fk_bank;
+ if (isset($this->fk_user_creat)) $this->fk_user_creat= (int) $this->fk_user_creat;
+ if (isset($this->fk_user_modif)) $this->fk_user_modif= (int) $this->fk_user_modif;
@@ -337,10 +337,10 @@ class PaymentSocialContribution extends CommonObject
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
- if (! $error)
- {
- if (! $notrigger)
- {
+ //if (! $error)
+ //{
+ // if (! $notrigger)
+ // {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
@@ -350,8 +350,8 @@ class PaymentSocialContribution extends CommonObject
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
- }
- }
+ // }
+ //}
// Commit or rollback
if ($error)
@@ -478,13 +478,6 @@ class PaymentSocialContribution extends CommonObject
{
$this->error=$object->error;
$error++;
- }
-
- if (! $error)
- {
-
-
-
}
unset($object->context['createfromclone']);
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 8c83c342ab4..f083ef59a2d 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -913,6 +913,7 @@ class Contrat extends CommonObject
$sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL");
$sql.= ")";
$resql=$this->db->query($sql);
+
if ($resql)
{
$error=0;
@@ -930,8 +931,8 @@ class Contrat extends CommonObject
{
$modCodeContract = new $module();
- if (!empty($modCodeContract->code_auto)) {
- // Update ref
+ if (! empty($modCodeContract->code_auto)) {
+ // Force the ref to a draft value if numbering module is an automatic numbering
$sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
if ($this->db->query($sql))
{
@@ -940,9 +941,6 @@ class Contrat extends CommonObject
$this->ref="(PROV".$this->id.")";
}
}
- } else {
- $error++;
- $this->error='Failed to get PROV number';
}
}
diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php
index 73cbd572e9d..272ac1532a6 100644
--- a/htdocs/core/actions_linkedfiles.inc.php
+++ b/htdocs/core/actions_linkedfiles.inc.php
@@ -29,7 +29,7 @@
// Submit file/link
if (GETPOST('sendit', 'alpha') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- if (! empty($_FILES))
+ if (! empty($_FILES))
{
if (is_array($_FILES['userfile']['tmp_name'])) $userfiles=$_FILES['userfile']['tmp_name'];
else $userfiles=array($_FILES['userfile']['tmp_name']);
diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php
index 79d4f17d8ee..34070520aa5 100644
--- a/htdocs/core/boxes/modules_boxes.php
+++ b/htdocs/core/boxes/modules_boxes.php
@@ -397,7 +397,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
$orders = array();
$i = 0;
- $dirwidget=array_merge(array('/core/boxes/'));
+ //$dirwidget=array_merge(array('/core/boxes/'), $conf->modules_parts['widgets']);
+ $dirwidget=array('/core/boxes/'); // $conf->modules_parts['widgets'] is not required
if (is_array($forcedirwidget))
{
$dirwidget=$forcedirwidget;
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index e23b32c5fb7..3c0e979cbed 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -1,11 +1,12 @@
- * Copyright (C) 2003 Jean-Louis Bergamo
- * Copyright (C) 2004-2015 Laurent Destailleur
- * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) Dan Potter
+ * Copyright (C) Eric Seigne
+ * Copyright (C) 2000-2005 Rodolphe Quiedeville
+ * Copyright (C) 2003 Jean-Louis Bergamo
+ * Copyright (C) 2004-2015 Laurent Destailleur
+ * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2019 Frédéric France
*
* 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
@@ -1429,7 +1430,7 @@ class CMailFile
* Return a formatted address string for SMTP protocol
*
* @param string $address Example: 'John Doe , Alan Smith ' or 'john@doe.com, alan@smith.com'
- * @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between "
+ * @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between ", 4 label or email, 5 mailto link
* @param int $encode 0=No encode name, 1=Encode name to RFC2822
* @param int $maxnumberofemail 0=No limit. Otherwise, maximum number of emails returned ($address may contains several email separated with ','). Add '...' if there is more.
* @return string If format 0: '' or 'John Doe ' or '=?UTF-8?B?Sm9obiBEb2U=?= '
@@ -1437,6 +1438,7 @@ class CMailFile
* If format 2: 'john@doe.com'
* If format 3: '' or '"John Doe" ' or '"=?UTF-8?B?Sm9obiBEb2U=?=" '
* If format 4: 'John Doe' or 'john@doe.com' if no label exists
+ * If format 5: John Doe or john@doe.com if no label exists
*/
public static function getValidAddress($address, $format, $encode = 0, $maxnumberofemail = 0)
{
@@ -1466,6 +1468,10 @@ class CMailFile
$i++;
$newemail='';
+ if ($format == 5) {
+ $newemail = $name?$name:$email;
+ $newemail = ''.$newemail.'';
+ }
if ($format == 4)
{
$newemail = $name?$name:$email;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index f6232fd9394..e962e59264c 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -6378,6 +6378,7 @@ abstract class CommonObject
}
if (($mode == 'create' || $mode == 'edit') && abs($visibility) != 1 && abs($visibility) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
+ elseif($mode == 'view' && empty($visibility)) continue;
if (empty($perms)) continue;
// Load language if required
diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php
index 9d9445df91c..ddaef527630 100644
--- a/htdocs/core/class/commonorder.class.php
+++ b/htdocs/core/class/commonorder.class.php
@@ -82,7 +82,7 @@ abstract class CommonOrderLine extends CommonObjectLine
* @deprecated
* @see subprice
*/
- var $price;
+ public $price;
/**
* Unit price before taxes
diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php
index 6c86c987d17..b23ea6edf5d 100644
--- a/htdocs/core/class/ctypent.class.php
+++ b/htdocs/core/class/ctypent.class.php
@@ -109,7 +109,7 @@ class Ctypent // extends CommonObject
$sql.= " ".(! isset($this->id)?'NULL':"'".$this->db->escape($this->id)."'").",";
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
$sql.= " ".(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").",";
- $sql.= " ".(! isset($this->active)?'NULL':"'".$this->db->active($this->active)."'").",";
+ $sql.= " ".(! isset($this->active)?'NULL':"'".$this->db->escape($this->active)."'").",";
$sql.= " ".(! isset($this->module)?'NULL':"'".$this->db->escape($this->module)."'")."";
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index a83ff1083e6..1e76e7d9cf9 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -553,11 +553,11 @@ class Form
{
if ($type == 'info' || $type == 'help') return $text;
}
- // If info or help with smartphone, show only text (tooltip on lick does not works with dialog on smaprtphone)
- if (! empty($conf->dol_no_mouse_hover) && ! empty($tooltiptrigger))
- {
- if ($type == 'info' || $type == 'help') return $text;
- }
+ // If info or help with smartphone, show only text (tooltip on click does not works with dialog on smaprtphone)
+ //if (! empty($conf->dol_no_mouse_hover) && ! empty($tooltiptrigger))
+ //{
+ //if ($type == 'info' || $type == 'help') return ''.$text.''';
+ //}
$img='';
if ($type == 'info') $img = img_help(0, $alt);
@@ -2747,23 +2747,23 @@ class Form
}
if ($objp->quantity == 1)
{
- $opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
- $outval.= price($objp->fprice, 0, $langs, 0, 0, -1, $conf->currency)."/";
+ $opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/";
+ $outval.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/";
$opt.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
$outval.=$langs->transnoentities("Unit");
}
else
{
- $opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
- $outval.= price($objp->fprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
+ $opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
+ $outval.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
$opt.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
$outval.= ' '.$langs->transnoentities("Units");
}
if ($objp->quantity >= 1)
{
- $opt.=" (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
- $outval.=" (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
+ $opt.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
+ $outval.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
}
if ($objp->remise_percent >= 1)
{
@@ -2854,7 +2854,7 @@ class Form
$langs->load('stocks');
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, pfp.fk_soc,";
- $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,";
+ $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
@@ -2914,7 +2914,7 @@ class Form
}
if ($objp->quantity == 1)
{
- $opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
+ $opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/";
}
$opt.= $objp->quantity.' ';
@@ -2930,7 +2930,7 @@ class Form
if ($objp->quantity > 1)
{
$opt.=" - ";
- $opt.= price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit");
+ $opt.= price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit");
}
if ($objp->duration) $opt .= " - ".$objp->duration;
$opt .= "\n";
@@ -6651,7 +6651,7 @@ class Form
$objp = $this->db->fetch_object($resqllist);
print '
';
- print '
';
+ print '
';
print '';
print '
';
print '
' . $objp->ref . '
';
diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php
index 1758480af8f..166e0ce2044 100644
--- a/htdocs/core/class/html.formadmin.class.php
+++ b/htdocs/core/class/html.formadmin.class.php
@@ -62,7 +62,9 @@ class FormAdmin
public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0)
{
// phpcs:enable
- global $langs;
+ global $conf, $langs;
+
+ if (!empty($conf->global->MAIN_DEFAULT_LANGUAGE_FILTER)) $filter[$conf->global->MAIN_DEFAULT_LANGUAGE_FILTER] = 1;
$langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT, 12);
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 5e875be176d..1ea48c90091 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -77,9 +77,10 @@ class FormFile
* @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
* @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*')
* @param string $sectiondir If upload must be done inside a particular directory (is sectiondir defined, sectionid must not be)
+ * @param int $usewithoutform 0=Default, 1=Disable ';
- if (empty($sectionid)) $out .= ' ';
+ if (empty($usewithoutform))
+ {
+ $out .= '';
+ if (empty($sectionid)) $out .= ' ';
+ }
$out .= "\n\n";
@@ -205,12 +206,16 @@ class FormFile
$langs->load('link');
$title = $langs->trans("LinkANewFile");
$out .= load_fiche_titre($title, null, null);
- $out .= '
';
diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
index 7dd893b8dab..f877c193750 100644
--- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
+++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
@@ -58,6 +58,8 @@ CREATE TABLE llx_pos_cash_fence(
-- For 10.0
+DROP TABLE llx_cotisation;
+
ALTER TABLE llx_loan ADD COLUMN insurance_amount double(24,8) DEFAULT 0;
ALTER TABLE llx_facture DROP INDEX idx_facture_uk_facnumber;
@@ -237,3 +239,6 @@ ALTER TABLE llx_facturedet_rec ADD COLUMN fk_product_fournisseur_price integer D
ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_author integer;
ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_modif integer;
+ALTER TABLE llx_expensereport_det MODIFY COLUMN value_unit double(24,8) NOT NULL;
+ALTER TABLE llx_expensereport_det ADD COLUMN subprice double(24,8) DEFAULT 0 NOT NULL after qty;
+
diff --git a/htdocs/install/mysql/tables/llx_expensereport_det.sql b/htdocs/install/mysql/tables/llx_expensereport_det.sql
index fc0bd6e697f..59bfd60b0ca 100644
--- a/htdocs/install/mysql/tables/llx_expensereport_det.sql
+++ b/htdocs/install/mysql/tables/llx_expensereport_det.sql
@@ -27,7 +27,8 @@ CREATE TABLE llx_expensereport_det
comments text NOT NULL,
product_type integer DEFAULT -1,
qty real NOT NULL,
- value_unit real NOT NULL,
+ subprice double(24,8) DEFAULT 0 NOT NULL, -- P.U. HT (example 100)
+ value_unit double(24,8) NOT NULL, -- P.U. TTC (example 120)
remise_percent real,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3), -- Vat rate
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 1b3a69306eb..45b5f8fe95c 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -186,7 +186,7 @@ if (! GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'a
{
// Current version is $conf->global->MAIN_VERSION_LAST_UPGRADE
// Version to install is DOL_VERSION
- $dolibarrlastupgradeversionarray=preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_UPGRADE:$conf->global->MAIN_VERSION_LAST_INSTALL);
+ $dolibarrlastupgradeversionarray=preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_UPGRADE:(isset($conf->global->MAIN_VERSION_LAST_INSTALL)?$conf->global->MAIN_VERSION_LAST_INSTALL:''));
// Chaque action de migration doit renvoyer une ligne sur 4 colonnes avec
// dans la 1ere colonne, la description de l'action a faire
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 477f611bf39..6b3568bea31 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1857,4 +1857,5 @@ DisableProspectCustomerType=Disable the "Prospect + Customer" third party type (
MAIN_OPTIMIZEFORTEXTBROWSER=Simplify interface for blind person
MAIN_OPTIMIZEFORTEXTBROWSERDesc=Enable this option if you are a blind person, or if you use the application from a text browser like Lynx or Links.
ThisValueCanOverwrittenOnUserLevel=This value can be overwritten by each user from its user page - tab '%s'
-DefaultCustomerType=Default thirdparty type for "New customer" creation form
\ No newline at end of file
+DefaultCustomerType=Default thirdparty type for "New customer" creation form
+ABankAccountMustBeDefinedOnPaymentModeSetup=Note: The bank account must be defined on the module of each payment mode (Paypal, Stripe, ...) to have this feature working.
diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang
index 6cc85024843..cff8f7d657b 100644
--- a/htdocs/langs/en_US/blockedlog.lang
+++ b/htdocs/langs/en_US/blockedlog.lang
@@ -14,9 +14,9 @@ OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to prev
AddedByAuthority=Stored into remote authority
NotAddedByAuthorityYet=Not yet stored into remote authority
ShowDetails=Show stored details
-logPAYMENT_VARIOUS_CREATE=Payment (not assigned to invoice) created
-logPAYMENT_VARIOUS_MODIFY=Payment (not assigned to invoice) modified
-logPAYMENT_VARIOUS_DELETE=Payment (not assigned to invoice) logical deletion
+logPAYMENT_VARIOUS_CREATE=Payment (not assigned to an invoice) created
+logPAYMENT_VARIOUS_MODIFY=Payment (not assigned to an invoice) modified
+logPAYMENT_VARIOUS_DELETE=Payment (not assigned to an invoice) logical deletion
logPAYMENT_ADD_TO_BANK=Payment added to bank
logPAYMENT_CUSTOMER_CREATE=Customer payment created
logPAYMENT_CUSTOMER_DELETE=Customer payment logical deletion
diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index 765edad6687..a8af38d5240 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -2,7 +2,7 @@
ModuleBuilderDesc=This tool must be used by only by experienced users or developers. It gives you utilities to build or edit your own module. Documentation for alternative manual development is here.
EnterNameOfModuleDesc=Enter name of the module/application to create with no spaces. Use uppercase to separate words (For example: MyModule, EcommerceForShop, SyncWithMySystem...)
EnterNameOfObjectDesc=Enter name of the object to create with no spaces. Use uppercase to separate words (For example: MyObject, Student, Teacher...). The CRUD class file, but also API file, pages to list/add/edit/delete object and SQL files will be generated.
-ModuleBuilderDesc2=Path where modules are generated/edited (first alternative directory defined into %s): %s
+ModuleBuilderDesc2=Path where modules are generated/edited (first directory for external modules defined into %s): %s
ModuleBuilderDesc3=Generated/editable modules found: %s
ModuleBuilderDesc4=A module is detected as 'editable' when the file %s exists in root of module directory
NewModule=New module
@@ -100,4 +100,8 @@ UseAboutPage=Disable the about page
UseDocFolder=Disable the documentation folder
UseSpecificReadme=Use a specific ReadMe
RealPathOfModule=Real path of module
-ContentCantBeEmpty=Content of file can't be empty
\ No newline at end of file
+ContentCantBeEmpty=Content of file can't be empty
+WidgetDesc=You can generate and edit here the widgets that will be embedded with your module.
+CLIDesc=You can generate here some command line scripts you want to provide with your module.
+CLIFile=CLI File
+NoCLIFile=No CLI files
\ No newline at end of file
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index bf1d6ae5812..401ccc5462e 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -338,3 +338,4 @@ CloneDestinationReference=Destination product reference
ErrorCopyProductCombinations=There was an error while copying the product variants
ErrorDestinationProductNotFound=Destination product not found
ErrorProductCombinationNotFound=Product variant not found
+ActionAvailableOnVariantProductOnly=Action only available on the variant of product
\ No newline at end of file
diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang
index 2ede3bc474e..3072dae1df6 100644
--- a/htdocs/langs/en_US/trips.lang
+++ b/htdocs/langs/en_US/trips.lang
@@ -73,23 +73,19 @@ EX_PAR_VP=Parking PV
EX_CAM_VP=PV maintenance and repair
DefaultCategoryCar=Default transportation mode
DefaultRangeNumber=Default range number
-
+UploadANewFileNow=Upload a new document now
Error_EXPENSEREPORT_ADDON_NotDefined=Error, the rule for expense report numbering ref was not defined into setup of module 'Expense Report'
ErrorDoubleDeclaration=You have declared another expense report into a similar date range.
AucuneLigne=There is no expense report declared yet
-
ModePaiement=Payment mode
-
VALIDATOR=User responsible for approval
VALIDOR=Approved by
AUTHOR=Recorded by
AUTHORPAIEMENT=Paid by
REFUSEUR=Denied by
CANCEL_USER=Deleted by
-
MOTIF_REFUS=Reason
MOTIF_CANCEL=Reason
-
DATE_REFUS=Deny date
DATE_SAVE=Validation date
DATE_CANCEL=Cancelation date
@@ -140,7 +136,6 @@ OnExpense=Expense line
ExpenseReportRuleSave=Expense report rule saved
ExpenseReportRuleErrorOnSave=Error: %s
RangeNum=Range %d
-
ExpenseReportConstraintViolationError=Constraint violation id [%s]: %s is superior to %s %s
byEX_DAY=by day (limitation to %s)
byEX_MON=by month (limitation to %s)
@@ -151,7 +146,6 @@ nolimitbyEX_DAY=by day (no limitation)
nolimitbyEX_MON=by month (no limitation)
nolimitbyEX_YEA=by year (no limitation)
nolimitbyEX_EXP=by line (no limitation)
-
CarCategory=Category of car
ExpenseRangeOffset=Offset amount: %s
RangeIk=Mileage range
diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang
index 53ac720d862..fb35cb5e112 100644
--- a/htdocs/langs/en_US/users.lang
+++ b/htdocs/langs/en_US/users.lang
@@ -109,4 +109,4 @@ UserLogoff=User logout
UserLogged=User logged
DateEmployment=Employment Start Date
DateEmploymentEnd=Employment End Date
-CantDisableYourself=You can disable your own user record
\ No newline at end of file
+CantDisableYourself=You can't disable your own user record
\ No newline at end of file
diff --git a/htdocs/loan/createschedule.php b/htdocs/loan/createschedule.php
index 96c84b2306a..4fe644e5521 100644
--- a/htdocs/loan/createschedule.php
+++ b/htdocs/loan/createschedule.php
@@ -154,12 +154,12 @@ print '';
print '