@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $sapi_type = php_sapi_name(); |
| 30 | 30 | $script_file = basename(__FILE__); |
| 31 | -$path=dirname(__FILE__).'/'; |
|
| 31 | +$path = dirname(__FILE__).'/'; |
|
| 32 | 32 | |
| 33 | 33 | // Test if batch mode |
| 34 | 34 | if (substr($sapi_type, 0, 3) == 'cgi') { |
@@ -45,17 +45,17 @@ discard block |
||
| 45 | 45 | $langs->load("main"); |
| 46 | 46 | |
| 47 | 47 | // Global variables |
| 48 | -$version='1.14'; |
|
| 49 | -$error=0; |
|
| 48 | +$version = '1.14'; |
|
| 49 | +$error = 0; |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | // -------------------- START OF YOUR CODE HERE -------------------- |
| 53 | 53 | @set_time_limit(0); |
| 54 | 54 | print "***** ".$script_file." (".$version.") *****\n"; |
| 55 | -$dir=DOL_DOCUMENT_ROOT."/langs"; |
|
| 55 | +$dir = DOL_DOCUMENT_ROOT."/langs"; |
|
| 56 | 56 | |
| 57 | 57 | // Check parameters |
| 58 | -if (! isset($argv[3])) { |
|
| 58 | +if (!isset($argv[3])) { |
|
| 59 | 59 | print "Usage: ".$script_file." lang_code_src lang_code_dest|all APIKEY [langfile.lang]\n"; |
| 60 | 60 | print "Example: ".$script_file." en_US pt_PT 123456\n"; |
| 61 | 61 | print "Rem: lang_code to use can be found on https://translate.google.com\n"; |
@@ -66,18 +66,18 @@ discard block |
||
| 66 | 66 | print 'Argument 1='.$argv[1]."\n"; |
| 67 | 67 | print 'Argument 2='.$argv[2]."\n"; |
| 68 | 68 | print 'Argument 3='.$argv[3]."\n"; |
| 69 | -$file=''; |
|
| 69 | +$file = ''; |
|
| 70 | 70 | if (isset($argv[4])) { |
| 71 | - $file=$argv[4]; |
|
| 71 | + $file = $argv[4]; |
|
| 72 | 72 | print 'Argument 4='.$argv[4]."\n"; |
| 73 | 73 | } |
| 74 | 74 | print 'Files will be generated/updated in directory '.$dir."\n"; |
| 75 | 75 | |
| 76 | 76 | if ($argv[2] != 'all') { |
| 77 | - if (! is_dir($dir.'/'.$argv[2])) { |
|
| 77 | + if (!is_dir($dir.'/'.$argv[2])) { |
|
| 78 | 78 | print 'Create directory '.$dir.'/'.$argv[2]."\n"; |
| 79 | - $result=mkdir($dir.'/'.$argv[2]); |
|
| 80 | - if (! $result) { |
|
| 79 | + $result = mkdir($dir.'/'.$argv[2]); |
|
| 80 | + if (!$result) { |
|
| 81 | 81 | $db->close(); |
| 82 | 82 | return -1; |
| 83 | 83 | } |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | |
| 106 | 106 | print "Generates ".GEN_NUMBER_SOCIETE." companies\n"; |
| 107 | 107 | for ($s = 0; $s < GEN_NUMBER_SOCIETE; $s++) { |
| 108 | - print "Company $s\n"; |
|
| 108 | + print "company $s\n"; |
|
| 109 | 109 | $soc = new Societe($db); |
| 110 | 110 | $soc->name = "Company num ".time()."$s"; |
| 111 | 111 | $soc->town = $listoftown[mt_rand(0, count($listoftown)-1)]; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $sapi_type = php_sapi_name(); |
| 29 | 29 | $script_file = basename(__FILE__); |
| 30 | -$path=dirname(__FILE__).'/'; |
|
| 30 | +$path = dirname(__FILE__).'/'; |
|
| 31 | 31 | |
| 32 | 32 | // Test si mode batch |
| 33 | 33 | $sapi_type = php_sapi_name(); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | // Recupere root dolibarr |
| 40 | 40 | //$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]); |
| 41 | -require __DIR__. '/../../htdocs/master.inc.php'; |
|
| 41 | +require __DIR__.'/../../htdocs/master.inc.php'; |
|
| 42 | 42 | include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
| 43 | 43 | include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
| 44 | 44 | include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; |
| 47 | 47 | include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
| 48 | 48 | |
| 49 | -$listoftown = array("Auray","Baden","Vannes","Pirouville","Haguenau","Souffelweiersheim","Illkirch-Graffenstaden","Lauterbourg","Picauville","Sainte-Mère Eglise","Le Bono"); |
|
| 50 | -$listoflastname = array("Joe","Marc","Steve","Laurent","Nico","Isabelle","Dorothee","Saby","Brigitte","Karine","Jose-Anne","Celine","Virginie"); |
|
| 49 | +$listoftown = array("Auray", "Baden", "Vannes", "Pirouville", "Haguenau", "Souffelweiersheim", "Illkirch-Graffenstaden", "Lauterbourg", "Picauville", "Sainte-Mère Eglise", "Le Bono"); |
|
| 50 | +$listoflastname = array("Joe", "Marc", "Steve", "Laurent", "Nico", "Isabelle", "Dorothee", "Saby", "Brigitte", "Karine", "Jose-Anne", "Celine", "Virginie"); |
|
| 51 | 51 | |
| 52 | 52 | // Global variables |
| 53 | 53 | $version = DOL_VERSION; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | $ret = $user->fetch('', 'admin'); |
| 75 | -if (! $ret > 0) { |
|
| 75 | +if (!$ret > 0) { |
|
| 76 | 76 | print 'A user with login "admin" and all permissions must be created to use this script.'."\n"; |
| 77 | 77 | exit; |
| 78 | 78 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product"; $productsid = array(); |
| 83 | -$resql=$db->query($sql); |
|
| 83 | +$resql = $db->query($sql); |
|
| 84 | 84 | if ($resql) { |
| 85 | 85 | $num = $db->num_rows($resql); |
| 86 | 86 | $i = 0; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $societesid = array(); |
| 95 | -$resql=$db->query($sql); |
|
| 95 | +$resql = $db->query($sql); |
|
| 96 | 96 | if ($resql) { |
| 97 | 97 | $num = $db->num_rows($resql); |
| 98 | 98 | $i = 0; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $commandesid = array(); |
| 109 | -$resql=$db->query($sql); |
|
| 109 | +$resql = $db->query($sql); |
|
| 110 | 110 | if ($resql) { |
| 111 | 111 | $num = $db->num_rows($resql); |
| 112 | 112 | $i = 0; |
@@ -126,18 +126,18 @@ discard block |
||
| 126 | 126 | print "Company $s\n"; |
| 127 | 127 | $soc = new Societe($db); |
| 128 | 128 | $soc->name = "Company num ".time()."$s"; |
| 129 | - $soc->town = $listoftown[mt_rand(0, count($listoftown)-1)]; |
|
| 130 | - $soc->client = mt_rand(1, 2); // Une societe sur 2 est prospect, l'autre client |
|
| 131 | - $soc->fournisseur = mt_rand(0, 1); // Une societe sur 2 est fournisseur |
|
| 132 | - $soc->code_client='CU'.time()."$s"; |
|
| 133 | - $soc->code_fournisseur='SU'.time()."$s"; |
|
| 134 | - $soc->tva_assuj=1; |
|
| 135 | - $soc->country_id=1; |
|
| 136 | - $soc->country_code='FR'; |
|
| 129 | + $soc->town = $listoftown[mt_rand(0, count($listoftown) - 1)]; |
|
| 130 | + $soc->client = mt_rand(1, 2); // Une societe sur 2 est prospect, l'autre client |
|
| 131 | + $soc->fournisseur = mt_rand(0, 1); // Une societe sur 2 est fournisseur |
|
| 132 | + $soc->code_client = 'CU'.time()."$s"; |
|
| 133 | + $soc->code_fournisseur = 'SU'.time()."$s"; |
|
| 134 | + $soc->tva_assuj = 1; |
|
| 135 | + $soc->country_id = 1; |
|
| 136 | + $soc->country_code = 'FR'; |
|
| 137 | 137 | // Un client sur 3 a une remise de 5% |
| 138 | - $user_remise=mt_rand(1, 3); |
|
| 139 | - if ($user_remise==3) { |
|
| 140 | - $soc->remise_percent=5; |
|
| 138 | + $user_remise = mt_rand(1, 3); |
|
| 139 | + if ($user_remise == 3) { |
|
| 140 | + $soc->remise_percent = 5; |
|
| 141 | 141 | } |
| 142 | 142 | print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n"; |
| 143 | 143 | $soc->note_private = 'Company created by the script generate-societe.php'; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $contact = new Contact($db); |
| 151 | 151 | $contact->socid = $soc->id; |
| 152 | 152 | $contact->lastname = "Lastname".$c; |
| 153 | - $contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)]; |
|
| 153 | + $contact->firstname = $listoflastname[mt_rand(0, count($listoflastname) - 1)]; |
|
| 154 | 154 | if ($contact->create($user)) { |
| 155 | 155 | } |
| 156 | 156 | } |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | } |
| 95 | 95 | $result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', 0); // If we create a contact with no company (shared contacts), no check on write permission |
| 96 | 96 | |
| 97 | -$permissiontoadd = $user->hasRight('societe', 'contact', 'creer'); // Used by the include of actions_dellink.inc.php |
|
| 97 | +$permissiontoadd = $user->hasRight('societe', 'contact', 'creer'); // Used by the include of actions_dellink.inc.php |
|
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | /* |
@@ -134,15 +134,15 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | foreach ($object->multilangs as $key => $value) { // enregistrement des nouvelles valeurs dans l'objet |
| 136 | 136 | if ($key == $current_lang) { |
| 137 | - $object->label = GETPOST("libelle-" . $key); |
|
| 138 | - $object->description = dol_htmlcleanlastbr(GETPOST("desc-" . $key, 'restricthtml')); |
|
| 139 | - $object->other = dol_htmlcleanlastbr(GETPOST("other-" . $key, 'restricthtml')); |
|
| 137 | + $object->label = GETPOST("libelle-".$key); |
|
| 138 | + $object->description = dol_htmlcleanlastbr(GETPOST("desc-".$key, 'restricthtml')); |
|
| 139 | + $object->other = dol_htmlcleanlastbr(GETPOST("other-".$key, 'restricthtml')); |
|
| 140 | 140 | |
| 141 | 141 | $object->update($object->id, $user); |
| 142 | 142 | } else { |
| 143 | - $object->multilangs[$key]["label"] = GETPOST("libelle-" . $key); |
|
| 144 | - $object->multilangs[$key]["description"] = dol_htmlcleanlastbr(GETPOST("desc-" . $key, 'restricthtml')); |
|
| 145 | - $object->multilangs[$key]["other"] = dol_htmlcleanlastbr(GETPOST("other-" . $key, 'restricthtml')); |
|
| 143 | + $object->multilangs[$key]["label"] = GETPOST("libelle-".$key); |
|
| 144 | + $object->multilangs[$key]["description"] = dol_htmlcleanlastbr(GETPOST("desc-".$key, 'restricthtml')); |
|
| 145 | + $object->multilangs[$key]["other"] = dol_htmlcleanlastbr(GETPOST("other-".$key, 'restricthtml')); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -235,9 +235,9 @@ discard block |
||
| 235 | 235 | if (empty($reshook)) { |
| 236 | 236 | if ($action == '') { |
| 237 | 237 | if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { |
| 238 | - print '<a class="butAction" href="' . DOL_URL_ROOT . '/product/traduction.php?action=add&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("Add") . '</a>'; |
|
| 238 | + print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=add&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Add").'</a>'; |
|
| 239 | 239 | if ($cnt_trans > 0) { |
| 240 | - print '<a class="butAction" href="' . DOL_URL_ROOT . '/product/traduction.php?action=edit&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("Modify") . '</a>'; |
|
| 240 | + print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>'; |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | } |
@@ -155,7 +155,7 @@ |
||
| 155 | 155 | )); |
| 156 | 156 | |
| 157 | 157 | // Retrieve all extrafields if not already not know (should not happen) |
| 158 | - if (! is_object($extrafields)) { |
|
| 158 | + if (!is_object($extrafields)) { |
|
| 159 | 159 | $extrafields = new ExtraFields($this->db); |
| 160 | 160 | $extrafields->fetch_name_optionals_label($product->table_element); |
| 161 | 161 | } |
@@ -246,7 +246,7 @@ |
||
| 246 | 246 | $supplierinvoicestatic->id = $objp->facid; |
| 247 | 247 | $supplierinvoicestatic->ref = $objp->ref; |
| 248 | 248 | $supplierinvoicestatic->ref_supplier = $objp->ref_supplier; |
| 249 | - $supplierinvoicestatic->libelle = $objp->label; // deprecated |
|
| 249 | + $supplierinvoicestatic->libelle = $objp->label; // deprecated |
|
| 250 | 250 | $supplierinvoicestatic->label = $objp->label; |
| 251 | 251 | $supplierinvoicestatic->total_ht = $objp->total_ht; |
| 252 | 252 | $supplierinvoicestatic->total_ttc = $objp->total_ttc; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $address = SwissQrBill\DataGroup\Element\CombinedAddress::create( |
| 121 | 121 | $this->emetteur->name, |
| 122 | 122 | $this->emetteur->address, |
| 123 | - $this->emetteur->zip . " " . $this->emetteur->town, |
|
| 123 | + $this->emetteur->zip." ".$this->emetteur->town, |
|
| 124 | 124 | $this->emetteur->country_code |
| 125 | 125 | ); |
| 126 | 126 | if (!$address->isValid()) { |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $address = SwissQrBill\DataGroup\Element\CombinedAddress::create( |
| 176 | 176 | $object->thirdparty->name, |
| 177 | 177 | $object->thirdparty->address, |
| 178 | - $object->thirdparty->zip . " " . $object->thirdparty->town, |
|
| 178 | + $object->thirdparty->zip." ".$object->thirdparty->town, |
|
| 179 | 179 | $object->thirdparty->country_code |
| 180 | 180 | ); |
| 181 | 181 | if (!$address->isValid()) { |
@@ -363,7 +363,7 @@ |
||
| 363 | 363 | if ($typefield == 'Text' || $typefield == 'TextAuto') { |
| 364 | 364 | // If $newvalue start with an equal sign we don't want it to be interpreted as a formula, so we add a '. Such transformation should be |
| 365 | 365 | // done by SetCellValueByColumnAndRow but it is not, so we do it ourself. |
| 366 | - $newvalue = (dol_substr($newvalue, 0, 1) === '=' ? '\'' : '') . $newvalue; |
|
| 366 | + $newvalue = (dol_substr($newvalue, 0, 1) === '=' ? '\'' : '').$newvalue; |
|
| 367 | 367 | $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $newvalue); |
| 368 | 368 | $coord = $this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row + 1)->getCoordinate(); |
| 369 | 369 | $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@'); |
@@ -244,7 +244,7 @@ |
||
| 244 | 244 | |
| 245 | 245 | $this->id = $obj->rowid; |
| 246 | 246 | $this->ref = $obj->rowid; |
| 247 | - $this->date_start = $this->db->jdate($obj->date_start); |
|
| 247 | + $this->date_start = $this->db->jdate($obj->date_start); |
|
| 248 | 248 | $this->date_end = $this->db->jdate($obj->date_end); |
| 249 | 249 | $this->label = $obj->label; |
| 250 | 250 | $this->statut = $obj->status; |