\n";
+ $i++;
}
// Total
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index 877dde34af0..0bcc11bf351 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -681,6 +681,7 @@ while ($i < min($num, $limit))
$memberstatic->datefin= $datefin;
$memberstatic->socid = $obj->fk_soc;
$memberstatic->photo = $obj->photo;
+ $memberstatic->morphy = $obj->morphy;
if (! empty($obj->fk_soc)) {
$memberstatic->fetch_thirdparty();
diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index 912995d7817..09a4e95c0ae 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -476,7 +476,7 @@ if (! empty($conf->barcode->enabled)) {
}
// Logo
-print '
';
+print '
';
print '
';
print '';
print '
';
@@ -493,7 +493,7 @@ print '
';
print '
';
// Logo (squarred)
-print '
';
+print '
';
print '
';
print '';
print '
';
diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php
index 4f1fad15343..e5acf71857e 100644
--- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php
+++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php
@@ -18,10 +18,10 @@
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
-* @author PrestaShop SA
-* @copyright 2007-2013 PrestaShop SA
-* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
+* @author PrestaShop SA
+* @copyright 2007-2013 PrestaShop SA
+* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
* PrestaShop Webservice Library
* @package PrestaShopWebservice
*/
@@ -395,52 +395,6 @@ class PrestaShopWebservice
self::checkStatusCode($request['status_code']);// check the response validity
return self::parseXML($request['response']);
}
-
- /**
- * Delete (DELETE) a resource.
- * Unique parameter must take :
- * 'resource' => Resource name
- * 'id' => ID or array which contains IDs of a resource(s) you want to delete
- *
- * delete(array('resource' => 'orders', 'id' => 1));
- * // Following code will not be executed if an exception is thrown.
- * echo 'Successfully deleted.';
- * }
- * catch (PrestaShopWebserviceException $ex)
- * {
- * echo 'Error : '.$ex->getMessage();
- * }
- * ?>
- *
- *
- * @param array $options Array representing resource to delete.
- * @return boolean True
- */
- public function delete($options)
- {
- if (isset($options['url'])) {
- $url = $options['url'];
- } elseif (isset($options['resource']) && isset($options['id'])) {
- if (is_array($options['id']))
- $url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']';
- else
- $url = $this->url.'/api/'.$options['resource'].'/'.$options['id'];
- }
- if (isset($options['id_shop'])) {
- $url .= '&id_shop='.$options['id_shop'];
- }
- if (isset($options['id_group_shop'])) {
- $url .= '&id_group_shop='.$options['id_group_shop'];
- }
- $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
- self::checkStatusCode($request['status_code']);// check the response validity
- return true;
- }
}
/**
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index 79d152fb7bf..61fb0448c8b 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -65,27 +65,27 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
if ($action == 'update' && empty($_POST["cancel"]))
{
- dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT"), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS", 'int'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT", 'int'), 'chaine', 0, '', $conf->entity);
// Send mode parameters
- dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS"), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE", 'aZ09'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT", 'int'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW", 'none'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS", 'int'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS", 'int'), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY"), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED", 'int'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
// Content parameters
- dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO"), 'chaine', 0, '', $conf->entity);
- dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE', 'alphanohtml'), 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
@@ -101,8 +101,8 @@ $mode='emailfortest';
$trackid=(($action == 'testhtml')?"testhtml":"test");
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
-if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test';
-if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtml';
+if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') $action='test';
+if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') $action='testhtml';
@@ -821,7 +821,7 @@ else
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->fromid=$user->id;
$formmail->fromalsorobot=1;
- $formmail->fromtype=(GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
+ $formmail->fromtype=(GETPOSTISSET('fromtype')?GETPOST('fromtype', 'aZ09'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
$formmail->withfromreadonly=1;
$formmail->withsubstit=1;
$formmail->withfrom=1;
@@ -847,7 +847,7 @@ else
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
// Init list of files
- if (GETPOST("mode")=='init')
+ if (GETPOST("mode", "aZ09")=='init')
{
$formmail->clear_attached_files();
}
diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php
index 7660144f7ca..074216dee3e 100644
--- a/htdocs/api/class/api.class.php
+++ b/htdocs/api/class/api.class.php
@@ -178,6 +178,7 @@ class DolibarrApi
unset($object->lines[$i]->cond_reglement);
unset($object->lines[$i]->fk_delivery_address);
unset($object->lines[$i]->fk_projet);
+ unset($object->lines[$i]->fk_project);
unset($object->lines[$i]->thirdparty);
unset($object->lines[$i]->user);
unset($object->lines[$i]->model_pdf);
@@ -290,6 +291,7 @@ class DolibarrApi
if (count($tmp) < 3) return '';
$tmpescaped=$tmp[2];
+ $regbis = array();
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis))
{
$tmpescaped = "'".$db->escape($regbis[1])."'";
diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php
index 60f5a54eeba..50102b76b93 100644
--- a/htdocs/api/class/api_setup.class.php
+++ b/htdocs/api/class/api_setup.class.php
@@ -197,13 +197,64 @@ class Setup extends DolibarrApi
* @throws RestException
*/
public function getCountryByID($id, $lang = '')
+ {
+ return $this->_fetchCcountry($id, '', '', $lang);
+ }
+
+ /**
+ * Get country by Code.
+ *
+ * @param string $code Code of country
+ * @param string $lang Code of the language the name of the
+ * country must be translated to
+ * @return array Array of cleaned object properties
+ *
+ * @url GET dictionary/countries/byCode/{code}
+ *
+ * @throws RestException
+ */
+ public function getCountryByCode($code, $lang = '')
+ {
+ return $this->_fetchCcountry('', $code, '', $lang);
+ }
+
+ /**
+ * Get country by Iso.
+ *
+ * @param string $iso ISO of country
+ * @param string $lang Code of the language the name of the
+ * country must be translated to
+ * @return array Array of cleaned object properties
+ *
+ * @url GET dictionary/countries/byISO/{iso}
+ *
+ * @throws RestException
+ */
+ public function getCountryByISO($iso, $lang = '')
+ {
+ return $this->_fetchCcountry('', '', $iso, $lang);
+ }
+
+ /**
+ * Get country.
+ *
+ * @param int $id ID of country
+ * @param string $code Code of country
+ * @param string $iso ISO of country
+ * @param string $lang Code of the language the name of the
+ * country must be translated to
+ * @return array Array of cleaned object properties
+ *
+ * @throws RestException
+ */
+ private function _fetchCcountry($id, $code = '', $iso = '', $lang = '')
{
$country = new Ccountry($this->db);
- if ($country->fetch($id) < 0) {
+ $result = $country->fetch($id, $code, $iso);
+ if ($result < 0) {
throw new RestException(503, 'Error when retrieving country : '.$country->error);
- }
- elseif ($country->fetch($id) == 0) {
+ } elseif ($result == 0) {
throw new RestException(404, 'country not found');
}
@@ -320,6 +371,66 @@ class Setup extends DolibarrApi
}
}
+ /**
+ * Get the list of shipment methods.
+ *
+ * @param string $sortfield Sort field
+ * @param string $sortorder Sort order
+ * @param int $limit Number of items per page
+ * @param int $page Page number (starting from zero)
+ * @param int $active Payment term is active or not {@min 0} {@max 1}
+ * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
+ *
+ * @return array List of shipment methods
+ *
+ * @url GET dictionary/shipment_methods
+ *
+ * @throws RestException
+ */
+ public function getListOfShipmentMethods($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
+ {
+ $list = array();
+ $sql = "SELECT t.rowid, t.code, t.libelle, t.description, t.tracking";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t";
+ $sql.= " WHERE t.active = ".$active;
+ // Add sql filters
+ if ($sqlfilters)
+ {
+ if (! DolibarrApi::_checkFilters($sqlfilters))
+ {
+ throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
+ }
+ $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
+ }
+
+
+ $sql.= $this->db->order($sortfield, $sortorder);
+
+ if ($limit) {
+ if ($page < 0) {
+ $page = 0;
+ }
+ $offset = $limit * $page;
+
+ $sql .= $this->db->plimit($limit, $offset);
+ }
+
+ $result = $this->db->query($sql);
+
+ if ($result) {
+ $num = $this->db->num_rows($result);
+ $min = min($num, ($limit <= 0 ? $num : $limit));
+ for ($i = 0; $i < $min; $i++) {
+ $list[] = $this->db->fetch_object($result);
+ }
+ } else {
+ throw new RestException(503, 'Error when retrieving list of shipment methods : '.$this->db->lasterror());
+ }
+
+ return $list;
+ }
+
/**
* Get the list of events types.
*
diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php
index 459bd2d8edc..916939b378e 100644
--- a/htdocs/asset/type.php
+++ b/htdocs/asset/type.php
@@ -615,7 +615,7 @@ if ($rowid > 0)
if (empty($reshook))
{
print '
';
- foreach($extrafields->attribute_label as $key=>$label)
+ foreach($extrafields->attributes[$object->element]['label'] as $key=>$label)
{
if (isset($_POST["options_" . $key])) {
if (is_array($_POST["options_" . $key])) {
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 0949fa1a334..17fae31ef7d 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -79,6 +79,7 @@ $permissionnote=$user->rights->bom->write; // Used by the include of actions_set
$permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php
$permissionedit=$user->rights->bom->write; // Used by the include of actions_lineupdown.inc.php
$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php
+$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
/*
@@ -93,11 +94,11 @@ if (empty($reshook))
{
$error=0;
- $permissiontoadd = $user->rights->bom->write;
- $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
- if (empty($backtopage)) {
- if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist;
+
+ if (empty($backtopage) || ($cancel && empty($id))) {
+ //var_dump($backurlforlist);exit;
+ if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__');
}
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
@@ -218,7 +219,7 @@ if ($action == 'create')
dol_fiche_head(array(), '');
- print '
'."\n";
+ print '
'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
@@ -252,7 +253,9 @@ if (($id || $ref) && $action == 'edit')
dol_fiche_head();
- print '