";
+
// Other attributes
$parameters=array('socid'=>$object->id, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 8b6dfa38657..7fae79d44a7 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -227,7 +227,7 @@ function dol_shutdown()
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get, 4 = post then get then cookie)
* @param int $filter Filter to apply when $check is set to custom. (See http://php.net/manual/en/filter.filters.php for détails)
* @param mixed $options Options to pass to filter_var when $check is set to custom
- * @return string||string[] Value found (string or array), or '' if check fails
+ * @return string|string[] Value found (string or array), or '' if check fails
*/
function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
{
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index b26e6766a4e..57ade3645b1 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
+require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$langs->load("companies");
@@ -396,6 +397,16 @@ if (empty($reshook))
}
}
+ // Categories association
+ $custcats = GETPOST( 'custcats', 'array' );
+ if (!empty( $custcats )) {
+ $cat = new Categorie( $db );
+ foreach ($custcats as $id_category) {
+ $cat->fetch( $id_category );
+ $cat->add_type( $object, 'customer' );
+ }
+ }
+
// Logo/Photo save
$dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/";
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
@@ -500,6 +511,22 @@ if (empty($reshook))
$error = $object->error; $errors = $object->errors;
}
+ // Categories association
+ // First we delete all categories association
+ $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_societe';
+ $sql .= ' WHERE fk_soc = ' . $object->id;
+ $db->query( $sql );
+
+ // Then we add the associated categories
+ $categories = GETPOST( 'custcats', 'array' );
+ if (!empty( $categories )) {
+ $cat = new Categorie( $db );
+ foreach ($categories as $id_category) {
+ $cat->fetch( $id_category );
+ $cat->add_type( $object, 'customer' );
+ }
+ }
+
// Logo/Photo save
$dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos";
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
@@ -1197,6 +1224,12 @@ else
print '';
}
+ // Categories
+ print '