| @@ -19,7 +19,6 @@ | ||
| 19 | 19 | use Luracast\Restler\Restler; | 
| 20 | 20 | use Luracast\Restler\RestException; | 
| 21 | 21 | use Luracast\Restler\Defaults; | 
| 22 | -use Luracast\Restler\Format\UploadFormat; | |
| 23 | 22 | |
| 24 | 23 | require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; | 
| 25 | 24 | |
| @@ -29,52 +29,52 @@ discard block | ||
| 29 | 29 | class DolibarrApi | 
| 30 | 30 |  { | 
| 31 | 31 | |
| 32 | - /** | |
| 33 | - * @var DoliDb $db Database object | |
| 34 | - */ | |
| 35 | - static protected $db; | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * @var Restler $r Restler object | |
| 39 | - */ | |
| 40 | - var $r; | |
| 41 | - | |
| 42 | - /** | |
| 43 | - * Constructor | |
| 44 | - * | |
| 45 | - * @param DoliDb $db Database handler | |
| 46 | - * @param string $cachedir Cache dir | |
| 47 | - * @param boolean $refreshCache Update cache | |
| 48 | - */ | |
| 49 | - function __construct($db, $cachedir='', $refreshCache=false) | |
| 50 | -    { | |
| 51 | - global $conf, $dolibarr_main_url_root; | |
| 32 | + /** | |
| 33 | + * @var DoliDb $db Database object | |
| 34 | + */ | |
| 35 | + static protected $db; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * @var Restler $r Restler object | |
| 39 | + */ | |
| 40 | + var $r; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * Constructor | |
| 44 | + * | |
| 45 | + * @param DoliDb $db Database handler | |
| 46 | + * @param string $cachedir Cache dir | |
| 47 | + * @param boolean $refreshCache Update cache | |
| 48 | + */ | |
| 49 | + function __construct($db, $cachedir='', $refreshCache=false) | |
| 50 | +	{ | |
| 51 | + global $conf, $dolibarr_main_url_root; | |
| 52 | 52 | |
| 53 | - if (empty($cachedir)) $cachedir = $conf->api->dir_temp; | |
| 54 | - Defaults::$cacheDirectory = $cachedir; | |
| 53 | + if (empty($cachedir)) $cachedir = $conf->api->dir_temp; | |
| 54 | + Defaults::$cacheDirectory = $cachedir; | |
| 55 | 55 | |
| 56 | - $this->db = $db; | |
| 57 | - $production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true ); | |
| 58 | - $this->r = new Restler($production_mode, $refreshCache); | |
| 56 | + $this->db = $db; | |
| 57 | + $production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true ); | |
| 58 | + $this->r = new Restler($production_mode, $refreshCache); | |
| 59 | 59 | |
| 60 | -        $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); | |
| 61 | - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file | |
| 60 | +		$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); | |
| 61 | + $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file | |
| 62 | 62 | |
| 63 | -        $urlwithouturlrootautodetect=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim(DOL_MAIN_URL_ROOT)); | |
| 64 | - $urlwithrootautodetect=$urlwithouturlroot.DOL_URL_ROOT; // This is to use local domain autodetected by dolibarr from url | |
| 63 | +		$urlwithouturlrootautodetect=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim(DOL_MAIN_URL_ROOT)); | |
| 64 | + $urlwithrootautodetect=$urlwithouturlroot.DOL_URL_ROOT; // This is to use local domain autodetected by dolibarr from url | |
| 65 | 65 | |
| 66 | - $this->r->setBaseUrls($urlwithouturlroot, $urlwithouturlrootautodetect); | |
| 67 | - $this->r->setAPIVersion(1); | |
| 68 | - } | |
| 66 | + $this->r->setBaseUrls($urlwithouturlroot, $urlwithouturlrootautodetect); | |
| 67 | + $this->r->setAPIVersion(1); | |
| 68 | + } | |
| 69 | 69 | |
| 70 | - /** | |
| 71 | - * Executed method when API is called without parameter | |
| 72 | - * | |
| 73 | - * Display a short message an return a http code 200 | |
| 74 | - * | |
| 75 | - * @return array | |
| 76 | - */ | |
| 77 | - /* Disabled, most APIs does not share same signature for method index | |
| 70 | + /** | |
| 71 | + * Executed method when API is called without parameter | |
| 72 | + * | |
| 73 | + * Display a short message an return a http code 200 | |
| 74 | + * | |
| 75 | + * @return array | |
| 76 | + */ | |
| 77 | + /* Disabled, most APIs does not share same signature for method index | |
| 78 | 78 | function index() | 
| 79 | 79 |      { | 
| 80 | 80 | return array( | 
| @@ -86,124 +86,124 @@ discard block | ||
| 86 | 86 | }*/ | 
| 87 | 87 | |
| 88 | 88 | |
| 89 | - /** | |
| 90 | - * Clean sensible object datas | |
| 91 | - * | |
| 92 | - * @param object $object Object to clean | |
| 93 | - * @return array Array of cleaned object properties | |
| 94 | - */ | |
| 95 | -    function _cleanObjectDatas($object) { | |
| 89 | + /** | |
| 90 | + * Clean sensible object datas | |
| 91 | + * | |
| 92 | + * @param object $object Object to clean | |
| 93 | + * @return array Array of cleaned object properties | |
| 94 | + */ | |
| 95 | +	function _cleanObjectDatas($object) { | |
| 96 | 96 | |
| 97 | - // Remove $db object property for object | |
| 98 | - unset($object->db); | |
| 97 | + // Remove $db object property for object | |
| 98 | + unset($object->db); | |
| 99 | 99 | unset($object->ismultientitymanaged); | 
| 100 | 100 | unset($object->restrictiononfksoc); | 
| 101 | 101 | |
| 102 | - // Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses | |
| 103 | - unset($object->linkedObjects); | |
| 104 | - | |
| 105 | - unset($object->lignes); // we don't want lignes, we want only ->lines | |
| 106 | - | |
| 107 | - unset($object->fields); | |
| 108 | - unset($object->oldline); | |
| 109 | - | |
| 110 | - unset($object->error); | |
| 111 | - unset($object->errors); | |
| 112 | - | |
| 113 | - unset($object->ref_previous); | |
| 114 | - unset($object->ref_next); | |
| 115 | - unset($object->ref_int); | |
| 116 | - | |
| 117 | - unset($object->projet); // Should be fk_project | |
| 118 | - unset($object->project); // Should be fk_project | |
| 119 | - unset($object->author); // Should be fk_user_author | |
| 120 | - unset($object->timespent_old_duration); | |
| 121 | - unset($object->timespent_id); | |
| 122 | - unset($object->timespent_duration); | |
| 123 | - unset($object->timespent_date); | |
| 124 | - unset($object->timespent_datehour); | |
| 125 | - unset($object->timespent_withhour); | |
| 126 | - unset($object->timespent_fk_user); | |
| 127 | - unset($object->timespent_note); | |
| 128 | - | |
| 129 | - unset($object->statuts); | |
| 130 | - unset($object->statuts_short); | |
| 131 | - unset($object->statuts_logo); | |
| 132 | - unset($object->statuts_long); | |
| 133 | - unset($object->labelstatut); | |
| 134 | - unset($object->labelstatut_short); | |
| 135 | - | |
| 136 | - unset($object->element); | |
| 137 | - unset($object->fk_element); | |
| 138 | - unset($object->table_element); | |
| 139 | - unset($object->table_element_line); | |
| 140 | - unset($object->class_element_line); | |
| 141 | - unset($object->picto); | |
| 142 | - | |
| 143 | - unset($object->facturee); // Replace with billed | |
| 144 | - unset($object->fieldsforcombobox); | |
| 102 | + // Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses | |
| 103 | + unset($object->linkedObjects); | |
| 104 | + | |
| 105 | + unset($object->lignes); // we don't want lignes, we want only ->lines | |
| 106 | + | |
| 107 | + unset($object->fields); | |
| 108 | + unset($object->oldline); | |
| 109 | + | |
| 110 | + unset($object->error); | |
| 111 | + unset($object->errors); | |
| 112 | + | |
| 113 | + unset($object->ref_previous); | |
| 114 | + unset($object->ref_next); | |
| 115 | + unset($object->ref_int); | |
| 116 | + | |
| 117 | + unset($object->projet); // Should be fk_project | |
| 118 | + unset($object->project); // Should be fk_project | |
| 119 | + unset($object->author); // Should be fk_user_author | |
| 120 | + unset($object->timespent_old_duration); | |
| 121 | + unset($object->timespent_id); | |
| 122 | + unset($object->timespent_duration); | |
| 123 | + unset($object->timespent_date); | |
| 124 | + unset($object->timespent_datehour); | |
| 125 | + unset($object->timespent_withhour); | |
| 126 | + unset($object->timespent_fk_user); | |
| 127 | + unset($object->timespent_note); | |
| 128 | + | |
| 129 | + unset($object->statuts); | |
| 130 | + unset($object->statuts_short); | |
| 131 | + unset($object->statuts_logo); | |
| 132 | + unset($object->statuts_long); | |
| 133 | + unset($object->labelstatut); | |
| 134 | + unset($object->labelstatut_short); | |
| 135 | + | |
| 136 | + unset($object->element); | |
| 137 | + unset($object->fk_element); | |
| 138 | + unset($object->table_element); | |
| 139 | + unset($object->table_element_line); | |
| 140 | + unset($object->class_element_line); | |
| 141 | + unset($object->picto); | |
| 142 | + | |
| 143 | + unset($object->facturee); // Replace with billed | |
| 144 | + unset($object->fieldsforcombobox); | |
| 145 | 145 | unset($object->comments); | 
| 146 | 146 | |
| 147 | - unset($object->skip_update_total); | |
| 148 | - unset($object->context); | |
| 149 | - | |
| 150 | - // Remove the $oldcopy property because it is not supported by the JSON | |
| 151 | - // encoder. The following error is generated when trying to serialize | |
| 152 | - // it: "Error encoding/decoding JSON: Type is not supported" | |
| 153 | - // Note: Event if this property was correctly handled by the JSON | |
| 154 | - // encoder, it should be ignored because keeping it would let the API | |
| 155 | - // have a very strange behavior: calling PUT and then GET on the same | |
| 156 | - // resource would give different results: | |
| 157 | -        // PUT /objects/{id} -> returns object with oldcopy = previous version of the object | |
| 158 | -        // GET /objects/{id} -> returns object with oldcopy empty | |
| 159 | - unset($object->oldcopy); | |
| 160 | - | |
| 161 | - // If object has lines, remove $db property | |
| 162 | -        if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0)  { | |
| 163 | - $nboflines = count($object->lines); | |
| 164 | - for ($i=0; $i < $nboflines; $i++) | |
| 165 | -            { | |
| 166 | - $this->_cleanObjectDatas($object->lines[$i]); | |
| 167 | - | |
| 168 | - unset($object->lines[$i]->contact); | |
| 169 | - unset($object->lines[$i]->contact_id); | |
| 170 | - unset($object->lines[$i]->country); | |
| 171 | - unset($object->lines[$i]->country_id); | |
| 172 | - unset($object->lines[$i]->country_code); | |
| 173 | - unset($object->lines[$i]->mode_reglement_id); | |
| 174 | - unset($object->lines[$i]->mode_reglement_code); | |
| 175 | - unset($object->lines[$i]->mode_reglement); | |
| 176 | - unset($object->lines[$i]->cond_reglement_id); | |
| 177 | - unset($object->lines[$i]->cond_reglement_code); | |
| 178 | - unset($object->lines[$i]->cond_reglement); | |
| 179 | - unset($object->lines[$i]->fk_delivery_address); | |
| 180 | - unset($object->lines[$i]->fk_projet); | |
| 181 | - unset($object->lines[$i]->thirdparty); | |
| 182 | - unset($object->lines[$i]->user); | |
| 183 | - unset($object->lines[$i]->model_pdf); | |
| 184 | - unset($object->lines[$i]->modelpdf); | |
| 185 | - unset($object->lines[$i]->note_public); | |
| 186 | - unset($object->lines[$i]->note_private); | |
| 187 | - unset($object->lines[$i]->fk_incoterms); | |
| 188 | - unset($object->lines[$i]->libelle_incoterms); | |
| 189 | - unset($object->lines[$i]->location_incoterms); | |
| 190 | - unset($object->lines[$i]->name); | |
| 191 | - unset($object->lines[$i]->lastname); | |
| 192 | - unset($object->lines[$i]->firstname); | |
| 193 | - unset($object->lines[$i]->civility_id); | |
| 194 | - unset($object->lines[$i]->fk_multicurrency); | |
| 195 | - unset($object->lines[$i]->multicurrency_code); | |
| 196 | - unset($object->lines[$i]->shipping_method_id); | |
| 197 | - } | |
| 198 | - } | |
| 199 | - | |
| 200 | - if (! empty($object->thirdparty) && is_object($object->thirdparty)) | |
| 201 | -        { | |
| 202 | - $this->_cleanObjectDatas($object->thirdparty); | |
| 203 | - } | |
| 147 | + unset($object->skip_update_total); | |
| 148 | + unset($object->context); | |
| 149 | + | |
| 150 | + // Remove the $oldcopy property because it is not supported by the JSON | |
| 151 | + // encoder. The following error is generated when trying to serialize | |
| 152 | + // it: "Error encoding/decoding JSON: Type is not supported" | |
| 153 | + // Note: Event if this property was correctly handled by the JSON | |
| 154 | + // encoder, it should be ignored because keeping it would let the API | |
| 155 | + // have a very strange behavior: calling PUT and then GET on the same | |
| 156 | + // resource would give different results: | |
| 157 | +		// PUT /objects/{id} -> returns object with oldcopy = previous version of the object | |
| 158 | +		// GET /objects/{id} -> returns object with oldcopy empty | |
| 159 | + unset($object->oldcopy); | |
| 160 | + | |
| 161 | + // If object has lines, remove $db property | |
| 162 | +		if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0)  { | |
| 163 | + $nboflines = count($object->lines); | |
| 164 | + for ($i=0; $i < $nboflines; $i++) | |
| 165 | +			{ | |
| 166 | + $this->_cleanObjectDatas($object->lines[$i]); | |
| 167 | + | |
| 168 | + unset($object->lines[$i]->contact); | |
| 169 | + unset($object->lines[$i]->contact_id); | |
| 170 | + unset($object->lines[$i]->country); | |
| 171 | + unset($object->lines[$i]->country_id); | |
| 172 | + unset($object->lines[$i]->country_code); | |
| 173 | + unset($object->lines[$i]->mode_reglement_id); | |
| 174 | + unset($object->lines[$i]->mode_reglement_code); | |
| 175 | + unset($object->lines[$i]->mode_reglement); | |
| 176 | + unset($object->lines[$i]->cond_reglement_id); | |
| 177 | + unset($object->lines[$i]->cond_reglement_code); | |
| 178 | + unset($object->lines[$i]->cond_reglement); | |
| 179 | + unset($object->lines[$i]->fk_delivery_address); | |
| 180 | + unset($object->lines[$i]->fk_projet); | |
| 181 | + unset($object->lines[$i]->thirdparty); | |
| 182 | + unset($object->lines[$i]->user); | |
| 183 | + unset($object->lines[$i]->model_pdf); | |
| 184 | + unset($object->lines[$i]->modelpdf); | |
| 185 | + unset($object->lines[$i]->note_public); | |
| 186 | + unset($object->lines[$i]->note_private); | |
| 187 | + unset($object->lines[$i]->fk_incoterms); | |
| 188 | + unset($object->lines[$i]->libelle_incoterms); | |
| 189 | + unset($object->lines[$i]->location_incoterms); | |
| 190 | + unset($object->lines[$i]->name); | |
| 191 | + unset($object->lines[$i]->lastname); | |
| 192 | + unset($object->lines[$i]->firstname); | |
| 193 | + unset($object->lines[$i]->civility_id); | |
| 194 | + unset($object->lines[$i]->fk_multicurrency); | |
| 195 | + unset($object->lines[$i]->multicurrency_code); | |
| 196 | + unset($object->lines[$i]->shipping_method_id); | |
| 197 | + } | |
| 198 | + } | |
| 199 | + | |
| 200 | + if (! empty($object->thirdparty) && is_object($object->thirdparty)) | |
| 201 | +		{ | |
| 202 | + $this->_cleanObjectDatas($object->thirdparty); | |
| 203 | + } | |
| 204 | 204 | |
| 205 | 205 | return $object; | 
| 206 | - } | |
| 206 | + } | |
| 207 | 207 | |
| 208 | 208 | /** | 
| 209 | 209 | * Check user access to a resource | 
| @@ -245,25 +245,25 @@ discard block | ||
| 245 | 245 | */ | 
| 246 | 246 | function _checkFilters($sqlfilters) | 
| 247 | 247 |  	{ | 
| 248 | - //$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; | |
| 249 | -	    //$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters); | |
| 250 | - $tmp=$sqlfilters; | |
| 251 | - $ok=0; | |
| 252 | - $i=0; $nb=count($tmp); | |
| 253 | - $counter=0; | |
| 254 | - while ($i < $nb) | |
| 255 | -	    { | |
| 256 | -	        if ($tmp[$i]=='(') $counter++; | |
| 257 | - if ($tmp[$i]==')') $counter--; | |
| 258 | - if ($counter < 0) | |
| 259 | -            { | |
| 260 | - $error="Bad sqlfilters=".$sqlfilters; | |
| 261 | - dol_syslog($error, LOG_WARNING); | |
| 262 | - return false; | |
| 263 | - } | |
| 264 | - $i++; | |
| 265 | - } | |
| 266 | - return true; | |
| 248 | + //$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; | |
| 249 | +		//$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters); | |
| 250 | + $tmp=$sqlfilters; | |
| 251 | + $ok=0; | |
| 252 | + $i=0; $nb=count($tmp); | |
| 253 | + $counter=0; | |
| 254 | + while ($i < $nb) | |
| 255 | +		{ | |
| 256 | +			if ($tmp[$i]=='(') $counter++; | |
| 257 | + if ($tmp[$i]==')') $counter--; | |
| 258 | + if ($counter < 0) | |
| 259 | +			{ | |
| 260 | + $error="Bad sqlfilters=".$sqlfilters; | |
| 261 | + dol_syslog($error, LOG_WARNING); | |
| 262 | + return false; | |
| 263 | + } | |
| 264 | + $i++; | |
| 265 | + } | |
| 266 | + return true; | |
| 267 | 267 | } | 
| 268 | 268 | |
| 269 | 269 | /** | 
| @@ -274,22 +274,22 @@ discard block | ||
| 274 | 274 | */ | 
| 275 | 275 | static function _forge_criteria_callback($matches) | 
| 276 | 276 |  	{ | 
| 277 | - global $db; | |
| 278 | - | |
| 279 | -	    //dol_syslog("Convert matches ".$matches[1]); | |
| 280 | - if (empty($matches[1])) return ''; | |
| 281 | -	    $tmp=explode(':',$matches[1]); | |
| 282 | - if (count($tmp) < 3) return ''; | |
| 283 | - | |
| 284 | - $tmpescaped=$tmp[2]; | |
| 285 | -	    if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) | |
| 286 | -	    { | |
| 287 | - $tmpescaped = "'".$db->escape($regbis[1])."'"; | |
| 288 | - } | |
| 289 | - else | |
| 290 | -	    { | |
| 291 | - $tmpescaped = $db->escape($tmpescaped); | |
| 292 | - } | |
| 293 | - return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped; | |
| 277 | + global $db; | |
| 278 | + | |
| 279 | +		//dol_syslog("Convert matches ".$matches[1]); | |
| 280 | + if (empty($matches[1])) return ''; | |
| 281 | +		$tmp=explode(':',$matches[1]); | |
| 282 | + if (count($tmp) < 3) return ''; | |
| 283 | + | |
| 284 | + $tmpescaped=$tmp[2]; | |
| 285 | +		if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) | |
| 286 | +		{ | |
| 287 | + $tmpescaped = "'".$db->escape($regbis[1])."'"; | |
| 288 | + } | |
| 289 | + else | |
| 290 | +		{ | |
| 291 | + $tmpescaped = $db->escape($tmpescaped); | |
| 292 | + } | |
| 293 | + return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped; | |
| 294 | 294 | } | 
| 295 | 295 | } | 
| @@ -18,7 +18,6 @@ | ||
| 18 | 18 | */ | 
| 19 | 19 | |
| 20 | 20 | use Luracast\Restler\RestException; | 
| 21 | -use Luracast\Restler\Format\UploadFormat; | |
| 22 | 21 | |
| 23 | 22 | |
| 24 | 23 | require_once DOL_DOCUMENT_ROOT.'/main.inc.php'; | 
| @@ -108,12 +108,12 @@ discard block | ||
| 108 | 108 | // Complete long filename | 
| 109 | 109 | foreach ($filters as $key => $value) | 
| 110 | 110 |  { | 
| 111 | - //if ($key == 'notolderthan') $filename.='-notolderthan'.$value; This filter key is already added before and does not need to be in filename | |
| 111 | + //if ($key == 'notolderthan') $filename.='-notolderthan'.$value; This filter key is already added before and does not need to be in filename | |
| 112 | 112 | if ($key == 'year') $filename.='-year'.$value; | 
| 113 | - if ($key == 'id') $filename.='-id'.$value; | |
| 114 | - if ($key == 'idfrom') $filename.='-idfrom'.$value; | |
| 115 | - if ($key == 'idto') $filename.='-idto'.$value; | |
| 116 | - if ($key == 'project') $filename.='-project'.$value; | |
| 113 | + if ($key == 'id') $filename.='-id'.$value; | |
| 114 | + if ($key == 'idfrom') $filename.='-idfrom'.$value; | |
| 115 | + if ($key == 'idto') $filename.='-idto'.$value; | |
| 116 | + if ($key == 'project') $filename.='-project'.$value; | |
| 117 | 117 | if ($key == 'logina') $filename.='-logina'.$value; // Author | 
| 118 | 118 | if ($key == 'logint') $filename.='-logint'.$value; // Assigned to | 
| 119 | 119 | } | 
| @@ -127,7 +127,7 @@ discard block | ||
| 127 | 127 |  	$langs->load("main"); | 
| 128 | 128 |  	$langs->load("errors"); | 
| 129 | 129 | llxHeaderVierge(); | 
| 130 | -    print '<div class="error">'.$langs->trans("ErrorWrongValueForParameterX",'format').'</div>'; | |
| 130 | +	print '<div class="error">'.$langs->trans("ErrorWrongValueForParameterX",'format').'</div>'; | |
| 131 | 131 | llxFooterVierge(); | 
| 132 | 132 | exit; | 
| 133 | 133 | } | 
| @@ -162,7 +162,7 @@ discard block | ||
| 162 | 162 | $result=readfile($outputfile); | 
| 163 | 163 | if (! $result) print 'File '.$outputfile.' was empty.'; | 
| 164 | 164 | |
| 165 | -	    //header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); | |
| 165 | +		//header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); | |
| 166 | 166 | exit; | 
| 167 | 167 | } | 
| 168 | 168 | else | 
| @@ -152,7 +152,7 @@ | ||
| 152 | 152 | */ | 
| 153 | 153 | function llxFooterVierge() | 
| 154 | 154 |  { | 
| 155 | -    printCommonFooter('public'); | |
| 155 | +	printCommonFooter('public'); | |
| 156 | 156 | |
| 157 | 157 | print "</body>\n"; | 
| 158 | 158 | print "</html>\n"; | 
| @@ -58,10 +58,10 @@ discard block | ||
| 58 | 58 | |
| 59 | 59 |  	header("Content-type: text/html; charset=".$conf->file->character_set_client); | 
| 60 | 60 | print "<html>\n"; | 
| 61 | - print "<head>\n"; | |
| 62 | - print "<title>".$title."</title>\n"; | |
| 63 | - if ($head) print $head."\n"; | |
| 64 | - print "</head>\n"; | |
| 61 | + print "<head>\n"; | |
| 62 | + print "<title>".$title."</title>\n"; | |
| 63 | + if ($head) print $head."\n"; | |
| 64 | + print "</head>\n"; | |
| 65 | 65 | print '<body class="public_body">'."\n"; | 
| 66 | 66 | } | 
| 67 | 67 | |
| @@ -72,9 +72,9 @@ discard block | ||
| 72 | 72 | */ | 
| 73 | 73 | function llxFooterVierge() | 
| 74 | 74 |  { | 
| 75 | -    printCommonFooter('public'); | |
| 75 | +	printCommonFooter('public'); | |
| 76 | 76 | |
| 77 | - print "</body>\n"; | |
| 77 | + print "</body>\n"; | |
| 78 | 78 | print "</html>\n"; | 
| 79 | 79 | } | 
| 80 | 80 | |
| @@ -77,7 +77,7 @@ | ||
| 77 | 77 | |
| 78 | 78 | $resql=$db->query($sql); | 
| 79 | 79 | |
| 80 | - //Update status communication of contact prospect | |
| 80 | + //Update status communication of contact prospect | |
| 81 | 81 | $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)"; | 
| 82 | 82 |  	dol_syslog("public/emailing/mailing-read.php : Mail read contact : ".$sql, LOG_DEBUG); | 
| 83 | 83 | |
| @@ -87,7 +87,7 @@ | ||
| 87 | 87 | $resql=$db->query($sql); | 
| 88 | 88 | if (! $resql) dol_print_error($db); | 
| 89 | 89 | |
| 90 | - // Update status communication of contact prospect | |
| 90 | + // Update status communication of contact prospect | |
| 91 | 91 | $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='contact' AND source_id is not null)"; | 
| 92 | 92 |  	dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe contact : ".$sql, LOG_DEBUG); | 
| 93 | 93 | |
| @@ -140,12 +140,12 @@ discard block | ||
| 140 | 140 |  	$appli=constant('DOL_APPLICATION_TITLE'); | 
| 141 | 141 | if (! empty($conf->global->MAIN_APPLICATION_TITLE)) | 
| 142 | 142 |  	{ | 
| 143 | - $appli=$conf->global->MAIN_APPLICATION_TITLE; | |
| 144 | -	    if (preg_match('/\d\.\d/', $appli)) | |
| 145 | -	    { | |
| 146 | -	        if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")";	// If new title contains a version that is different than core | |
| 147 | - } | |
| 148 | - else $appli.=" ".DOL_VERSION; | |
| 143 | + $appli=$conf->global->MAIN_APPLICATION_TITLE; | |
| 144 | +		if (preg_match('/\d\.\d/', $appli)) | |
| 145 | +		{ | |
| 146 | +			if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")";	// If new title contains a version that is different than core | |
| 147 | + } | |
| 148 | + else $appli.=" ".DOL_VERSION; | |
| 149 | 149 | } | 
| 150 | 150 | else $appli.=" ".DOL_VERSION; | 
| 151 | 151 | |
| @@ -167,7 +167,7 @@ discard block | ||
| 167 | 167 | } | 
| 168 | 168 | $content.="<br>\n"; | 
| 169 | 169 |  	$content.=$langs->transnoentitiesnoconv("TechnicalInformation").":<br>\n"; | 
| 170 | -    $content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."<br>\n"; | |
| 170 | +	$content.=$langs->transnoentitiesnoconv("OnlinePaymentSystem").': '.$paymentmethod."<br>\n"; | |
| 171 | 171 |  	$content.=$langs->transnoentitiesnoconv("ReturnURLAfterPayment").': '.$urlback."<br>\n"; | 
| 172 | 172 | $content.="tag=".$fulltag."<br>\n"; | 
| 173 | 173 | |
| @@ -245,13 +245,13 @@ | ||
| 245 | 245 | |
| 246 | 246 | if (empty($object->ref)) // For survey, id is a hex string | 
| 247 | 247 |  { | 
| 248 | -    $langs->load("errors"); | |
| 249 | -    print $langs->trans("ErrorRecordNotFound"); | |
| 248 | +	$langs->load("errors"); | |
| 249 | +	print $langs->trans("ErrorRecordNotFound"); | |
| 250 | 250 | |
| 251 | - llxFooterSurvey(); | |
| 251 | + llxFooterSurvey(); | |
| 252 | 252 | |
| 253 | - $db->close(); | |
| 254 | - exit(); | |
| 253 | + $db->close(); | |
| 254 | + exit(); | |
| 255 | 255 | } | 
| 256 | 256 | |
| 257 | 257 | // Define format of choices |