diff --git a/dev/translation/txpush.sh b/dev/translation/txpush.sh
index 75b21ede212..89529b8d965 100755
--- a/dev/translation/txpush.sh
+++ b/dev/translation/txpush.sh
@@ -30,8 +30,9 @@ then
else
for file in `find htdocs/langs/$1/*.lang -type f`
do
+ echo $file
export basefile=`basename $file | sed -s s/\.lang//g`
- echo "tx push --skip -r dolibarr.$basfile -t -l $1 $2 $3 $4"
+ echo "tx push --skip -r dolibarr.$basefile -t -l $1 $2 $3 $4"
tx push --skip -r dolibarr.$basefile -t -l $1 $2 $3 $4
done
fi
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 94e31fc24ba..6d279074ed9 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -326,25 +326,8 @@ if (empty($reshook))
if ($result >= 0 && ! count($object->errors))
{
- // Categories association
- // First we delete all categories association
- $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_member';
- $sql .= ' WHERE fk_member = ' . $object->id;
- $resql = $db->query($sql);
- if (! $resql) dol_print_error($db);
-
- // Then we add the associated categories
$categories = GETPOST('memcats', 'array');
-
- if (! empty($categories))
- {
- $cat = new Categorie($db);
- foreach ($categories as $id_category)
- {
- $cat->fetch($id_category);
- $cat->add_type($object, 'member');
- }
- }
+ $object->setCategories($categories);
// Logo/Photo save
$dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1,$object,'member').'/photos';
@@ -560,15 +543,7 @@ if (empty($reshook))
{
// Categories association
$memcats = GETPOST('memcats', 'array');
- if (! empty($memcats))
- {
- $cat = new Categorie($db);
- foreach ($memcats as $id_category)
- {
- $cat->fetch($id_category);
- $cat->add_type($object, 'member');
- }
- }
+ $object->setCategories($memcats);
$db->commit();
$rowid=$object->id;
@@ -1478,7 +1453,14 @@ else
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
- print '
| '.$langs->trans("Password").' | '.preg_replace('/./i','*',$object->pass).' |
';
+ print '| '.$langs->trans("Password").' | '.preg_replace('/./i','*',$object->pass);
+ if ((! empty($object->pass) || ! empty($object->pass_crypted)) && empty($object->user_id))
+ {
+ $langs->load("errors");
+ $htmltext=$langs->trans("WarningPasswordSetWithNoAccount");
+ print ' '.$form->textwithpicto('', $htmltext,1,'warning');
+ }
+ print ' |
';
}
// Address
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 58bb8283029..29cc0aac249 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -540,10 +540,12 @@ class Adherent extends CommonObject
if ($result >= 0)
{
+ //var_dump($this->user_login);exit;
+ //var_dump($this->login);exit;
+ $luser->login=$this->login;
$luser->civility_id=$this->civility_id;
$luser->firstname=$this->firstname;
$luser->lastname=$this->lastname;
- $luser->login=$this->user_login;
$luser->pass=$this->pass;
$luser->societe_id=$this->societe;
@@ -1957,6 +1959,49 @@ class Adherent extends CommonObject
}
}
+ /**
+ * Sets object to supplied categories.
+ *
+ * Deletes object from existing categories not supplied.
+ * Adds it to non existing supplied categories.
+ * Existing categories are left untouch.
+ *
+ * @param int[]|int $categories Category or categories IDs
+ */
+ public function setCategories($categories)
+ {
+ // Handle single category
+ if (!is_array($categories)) {
+ $categories = array($categories);
+ }
+
+ // Get current categories
+ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ $c = new Categorie($this->db);
+ $existing = $c->containing($this->id, Categorie::TYPE_MEMBER, 'id');
+
+ // Diff
+ if (is_array($existing)) {
+ $to_del = array_diff($existing, $categories);
+ $to_add = array_diff($categories, $existing);
+ } else {
+ $to_del = array(); // Nothing to delete
+ $to_add = $categories;
+ }
+
+ // Process
+ foreach ($to_del as $del) {
+ $c->fetch($del);
+ $c->del_type($this, 'member');
+ }
+ foreach ($to_add as $add) {
+ $c->fetch($add);
+ $c->add_type($this, 'member');
+ }
+
+ return;
+ }
+
/**
* Function used to replace a thirdparty id with another one.
*
diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php
index 1e0e78db868..8cd5d031b41 100644
--- a/htdocs/admin/fichinter.php
+++ b/htdocs/admin/fichinter.php
@@ -203,7 +203,6 @@ else if ($action == 'set_FICHINTER_FREE_TEXT')
else if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
{
$draft= GETPOST('FICHINTER_DRAFT_WATERMARK','alpha');
-
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
@@ -544,7 +543,7 @@ print '';
print '';
print "\n";
-
+print '';
// print products on fichinter
$var=! $var;
print '