*
* 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
diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php
index 44726bb489c..41e43fdf433 100644
--- a/htdocs/product/inventory/list.php
+++ b/htdocs/product/inventory/list.php
@@ -205,7 +205,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index f91714aa3c1..8da82f45201 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1601,19 +1601,23 @@ class Project extends CommonObject
foreach (array('internal', 'external') as $source) {
$tab = $origin_project->liste_contact(-1, $source);
-
- foreach ($tab as $contacttoadd) {
- $clone_project->add_contact($contacttoadd['id'], $contacttoadd['code'], $contacttoadd['source'], $notrigger);
- if ($clone_project->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
- $langs->load("errors");
- $this->error .= $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
- $error++;
- } else {
- if ($clone_project->error != '') {
- $this->error .= $clone_project->error;
+ if (is_array($tab) && count($tab)>0) {
+ foreach ($tab as $contacttoadd) {
+ $clone_project->add_contact($contacttoadd['id'], $contacttoadd['code'], $contacttoadd['source'], $notrigger);
+ if ($clone_project->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
+ $langs->load("errors");
+ $this->error .= $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType");
$error++;
+ } else {
+ if ($clone_project->error != '') {
+ $this->error .= $clone_project->error;
+ $error++;
+ }
}
}
+ } elseif ($tab < 0) {
+ $this->error .= $origin_project->error;
+ $error++;
}
}
}
@@ -1660,7 +1664,7 @@ class Project extends CommonObject
foreach ($tasksarray as $tasktoclone) {
$result_clone = $taskstatic->createFromClone($user, $tasktoclone->id, $clone_project_id, $tasktoclone->fk_parent, $move_date, true, false, $clone_task_file, true, false);
if ($result_clone <= 0) {
- $this->error .= $result_clone->error;
+ $this->error .= $taskstatic->error;
$error++;
} else {
$new_task_id = $result_clone;
@@ -1714,6 +1718,7 @@ class Project extends CommonObject
global $user, $langs, $conf;
$error = 0;
+ $result = 0;
$taskstatic = new Task($this->db);
diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php
index 1af3488bf5c..ce9674dfd0a 100644
--- a/htdocs/projet/contact.php
+++ b/htdocs/projet/contact.php
@@ -94,7 +94,7 @@ if ($action == 'addcontact') {
foreach ($task_array as $task) {
$task_already_affected=false;
$personsLinked = $task->liste_contact(-1, $source);
- if (!is_array($personsLinked) && coun($personsLinked) < 0) {
+ if (!is_array($personsLinked) && count($personsLinked) < 0) {
setEventMessage($object->error, 'errors');
} else {
foreach ($personsLinked as $person) {
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 42280f57c67..06faaaa7ae9 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -404,8 +404,8 @@ if ($id > 0 || !empty($ref)) {
// Third party
print '| '.$langs->trans("ThirdParty").' | ';
- if ($projectstatic->societe->id) {
- print $projectstatic->societe->getNomUrl(1);
+ if ($projectstatic->thirdparty->id) {
+ print $projectstatic->thirdparty->getNomUrl(1);
} else {
print ' ';
}
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 83f27c11796..6271f0695fd 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -773,7 +773,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
print ' ';
}
if (!empty($conf->eventorganization->enabled)) {
- print 'usage_organize_event ? ' checked="checked"' : '')).'"> ';
+ print 'usage_organize_event ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
}
diff --git a/htdocs/public/partnership/index.php b/htdocs/public/partnership/index.php
new file mode 100644
index 00000000000..6a9a6f8a557
--- /dev/null
+++ b/htdocs/public/partnership/index.php
@@ -0,0 +1,26 @@
+
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/public/partnership/index.php
+ * \ingroup core
+ * \brief A redirect page to an error
+ */
+
+require '../../master.inc.php';
+
+header("Location: ".DOL_URL_ROOT.'/public/error-404.php');
diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php
new file mode 100644
index 00000000000..a46488ab5f9
--- /dev/null
+++ b/htdocs/public/partnership/new.php
@@ -0,0 +1,620 @@
+
+ * Copyright (C) 2001-2002 Jean-Louis Bergamo
+ * Copyright (C) 2006-2013 Laurent Destailleur
+ * Copyright (C) 2012 Regis Houssin
+ * Copyright (C) 2012 J. Fernando Lagrange
+ * Copyright (C) 2018-2019 Frédéric France
+ * Copyright (C) 2018 Alexandre Spangaro
+ * Copyright (C) 2021 Waël Almoman
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/public/partnership/new.php
+ * \ingroup member
+ * \brief Example of form to add a new member
+ */
+
+if (!defined('NOLOGIN')) {
+ define("NOLOGIN", 1); // This means this output page does not require to be logged.
+}
+if (!defined('NOCSRFCHECK')) {
+ define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
+}
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+
+// For MultiCompany module.
+// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
+// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
+$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
+if (is_numeric($entity)) {
+ define("DOLENTITY", $entity);
+}
+
+require '../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+
+// Init vars
+$errmsg = '';
+$num = 0;
+$error = 0;
+$backtopage = GETPOST('backtopage', 'alpha');
+$action = GETPOST('action', 'aZ09');
+
+// Load translation files
+$langs->loadLangs(array("main", "members", "companies", "install", "other"));
+
+// Security check
+if (empty($conf->partnership->enabled)) {
+ accessforbidden('', 0, 0, 1);
+}
+
+if (empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) {
+ print $langs->trans("Auto subscription form for public visitors has not been enabled");
+ exit;
+}
+
+// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$hookmanager->initHooks(array('publicnewpartnershipcard', 'globalcard'));
+
+$extrafields = new ExtraFields($db);
+
+$object = new Partnership($db);
+
+$user->loadDefaultValues();
+
+
+/**
+ * Show header for new partnership
+ *
+ * @param string $title Title
+ * @param string $head Head array
+ * @param int $disablejs More content into html header
+ * @param int $disablehead More content into html header
+ * @param array $arrayofjs Array of complementary js files
+ * @param array $arrayofcss Array of complementary css files
+ * @return void
+ */
+function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '')
+{
+ global $user, $conf, $langs, $mysoc;
+
+ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
+
+ print '';
+
+ // Define urllogo
+ $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
+
+ if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
+ $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
+ } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
+ $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo);
+ } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
+ $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
+ }
+
+ print '';
+
+ // Output html code for logo
+ if ($urllogo) {
+ print ' ';
+ print ' ';
+ print '  ';
+ print ' ';
+ if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
+ print ' ';
+ }
+ print ' ';
+ }
+
+ if (!empty($conf->global->PARTNERSHIP_IMAGE_PUBLIC_REGISTRATION)) {
+ print ' ';
+ print '  ';
+ print ' ';
+ }
+
+ print ' ';
+
+ print '';
+}
+
+/**
+ * Show footer for new member
+ *
+ * @return void
+ */
+function llxFooterVierge()
+{
+ print ' ';
+
+ printCommonFooter('public');
+
+ print "\n";
+ print " |