Standardize code

This commit is contained in:
Laurent Destailleur 2017-10-28 16:55:25 +02:00
parent b9ca66943f
commit adc4db0f85
2 changed files with 17 additions and 7 deletions

View File

@ -289,15 +289,24 @@ function exportWebSite($website)
/**
* Open a zip with all data of web site and load it into database.
*
* @param string $filename Path of zip file
* @param string $pathtofile Path of zip file
* @return int <0 if KO, >0 if OK
*/
function importWebSite($filename)
function importWebSite($pathtofile)
{
$result = 0;
$filename = basename($pathtofile);
if (! preg_match('/^website_(.*)-(.*)$/', $filename, $reg))
{
$this->errors[]='Bad format for filename '.$filename.'. Must be website_XXX-VERSION.';
return -1;
}
//$sql = array("INSERT INTO ".MAIN_DB_PREFIX."website(ref, entity, description, status) values('sellyoursaas', '.$conf->entity.', Portal to sell your SaaS', 1)");
$websitecode = $reg[1];
$sql = "INSERT INTO ".MAIN_DB_PREFIX."website(ref, entity, description, status) values('".$websitecode."', ".$conf->entity.", 'Portal to sell your SaaS. Do not remove this entry.', 1)";
$resql = $db->query($sql);
return $result;

View File

@ -3691,8 +3691,9 @@ class Societe extends CommonObject
* Adds it to non existing supplied categories.
* Existing categories are left untouch.
*
* @param int[]|int $categories Category or categories IDs
* @param string $type Category type (customer or supplier)
* @param int[]|int $categories Category ID or array of Categories IDs
* @param string $type Category type ('customer' or 'supplier')
* @return int <0 if KO, >0 if OK
*/
public function setCategories($categories, $type)
{
@ -3707,7 +3708,7 @@ class Societe extends CommonObject
$type_text = 'supplier';
} else {
dol_syslog(__METHOD__ . ': Type ' . $type . 'is an unknown company category type. Done nothing.', LOG_ERR);
return;
return -1;
}
// Handle single category
@ -3740,7 +3741,7 @@ class Societe extends CommonObject
}
}
return;
return 1;
}