@@ -37,42 +37,42 @@ discard block |
||
| 37 | 37 | $h = 0; |
| 38 | 38 | $head = array(); |
| 39 | 39 | |
| 40 | - $head[$h][0] = DOL_URL_ROOT . '/compta/bank/card.php?id=' . $object->id; |
|
| 40 | + $head[$h][0] = DOL_URL_ROOT.'/compta/bank/card.php?id='.$object->id; |
|
| 41 | 41 | $head[$h][1] = $langs->trans("Card"); |
| 42 | 42 | $head[$h][2] = 'bankname'; |
| 43 | 43 | $h++; |
| 44 | 44 | |
| 45 | - $head[$h][0] = DOL_URL_ROOT . "/compta/bank/bankentries_list.php?id=" . $object->id; |
|
| 45 | + $head[$h][0] = DOL_URL_ROOT."/compta/bank/bankentries_list.php?id=".$object->id; |
|
| 46 | 46 | $head[$h][1] = $langs->trans("BankTransactions"); |
| 47 | 47 | $head[$h][2] = 'journal'; |
| 48 | 48 | $h++; |
| 49 | 49 | |
| 50 | 50 | // if ($conf->global->MAIN_FEATURES_LEVEL >= 1) |
| 51 | 51 | // { |
| 52 | - $head[$h][0] = DOL_URL_ROOT . "/compta/bank/treso.php?account=" . $object->id; |
|
| 52 | + $head[$h][0] = DOL_URL_ROOT."/compta/bank/treso.php?account=".$object->id; |
|
| 53 | 53 | $head[$h][1] = $langs->trans("PlannedTransactions"); |
| 54 | 54 | $head[$h][2] = 'cash'; |
| 55 | 55 | $h++; |
| 56 | 56 | // } |
| 57 | 57 | |
| 58 | - $head[$h][0] = DOL_URL_ROOT . "/compta/bank/annuel.php?account=" . $object->id; |
|
| 58 | + $head[$h][0] = DOL_URL_ROOT."/compta/bank/annuel.php?account=".$object->id; |
|
| 59 | 59 | $head[$h][1] = $langs->trans("IOMonthlyReporting"); |
| 60 | 60 | $head[$h][2] = 'annual'; |
| 61 | 61 | $h++; |
| 62 | 62 | |
| 63 | - $head[$h][0] = DOL_URL_ROOT . "/compta/bank/graph.php?account=" . $object->id; |
|
| 63 | + $head[$h][0] = DOL_URL_ROOT."/compta/bank/graph.php?account=".$object->id; |
|
| 64 | 64 | $head[$h][1] = $langs->trans("Graph"); |
| 65 | 65 | $head[$h][2] = 'graph'; |
| 66 | 66 | $h++; |
| 67 | 67 | |
| 68 | 68 | if ($object->courant != Account::TYPE_CASH) |
| 69 | 69 | { |
| 70 | - $nbReceipts=0; |
|
| 70 | + $nbReceipts = 0; |
|
| 71 | 71 | |
| 72 | 72 | // List of all standing receipts |
| 73 | 73 | $sql = "SELECT COUNT(DISTINCT(b.num_releve)) as nb"; |
| 74 | - $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; |
|
| 75 | - $sql.= " WHERE b.fk_account = ".$object->id; |
|
| 74 | + $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; |
|
| 75 | + $sql .= " WHERE b.fk_account = ".$object->id; |
|
| 76 | 76 | |
| 77 | 77 | $resql = $db->query($sql); |
| 78 | 78 | if ($resql) |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $head[$h][0] = DOL_URL_ROOT."/compta/bank/releve.php?account=".$object->id; |
| 86 | 86 | $head[$h][1] = $langs->trans("AccountStatements"); |
| 87 | - if (($nbReceipts) > 0) $head[$h][1].= ' <span class="badge">'.($nbReceipts).'</span>'; |
|
| 87 | + if (($nbReceipts) > 0) $head[$h][1] .= ' <span class="badge">'.($nbReceipts).'</span>'; |
|
| 88 | 88 | $head[$h][2] = 'statement'; |
| 89 | 89 | $h++; |
| 90 | 90 | } |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | // Attached files |
| 93 | 93 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
| 94 | 94 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
| 95 | - $upload_dir = $conf->bank->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
| 96 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
| 97 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
| 98 | - $head[$h][0] = DOL_URL_ROOT . "/compta/bank/document.php?account=" . $object->id; |
|
| 95 | + $upload_dir = $conf->bank->dir_output."/".dol_sanitizeFileName($object->ref); |
|
| 96 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
| 97 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
| 98 | + $head[$h][0] = DOL_URL_ROOT."/compta/bank/document.php?account=".$object->id; |
|
| 99 | 99 | $head[$h][1] = $langs->trans("Documents"); |
| 100 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 100 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
| 101 | 101 | $head[$h][2] = 'document'; |
| 102 | 102 | $h++; |
| 103 | 103 | |
@@ -128,12 +128,12 @@ discard block |
||
| 128 | 128 | $h = 0; |
| 129 | 129 | $head = array(); |
| 130 | 130 | |
| 131 | - $head[$h][0] = DOL_URL_ROOT . '/admin/bank.php'; |
|
| 131 | + $head[$h][0] = DOL_URL_ROOT.'/admin/bank.php'; |
|
| 132 | 132 | $head[$h][1] = $langs->trans("Miscellaneous"); |
| 133 | 133 | $head[$h][2] = 'general'; |
| 134 | 134 | $h++; |
| 135 | 135 | |
| 136 | - $head[$h][0] = DOL_URL_ROOT . '/admin/chequereceipts.php'; |
|
| 136 | + $head[$h][0] = DOL_URL_ROOT.'/admin/chequereceipts.php'; |
|
| 137 | 137 | $head[$h][1] = $langs->trans("CheckReceiptShort"); |
| 138 | 138 | $head[$h][2] = 'checkreceipts'; |
| 139 | 139 | $h++; |
@@ -178,16 +178,16 @@ discard block |
||
| 178 | 178 | // Entries must be declared in modules descriptor with line |
| 179 | 179 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 180 | 180 | // $this->tabs = array('entity:-tabname); to remove a tab |
| 181 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'various_payment'); |
|
| 181 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'various_payment'); |
|
| 182 | 182 | |
| 183 | 183 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
| 184 | 184 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
| 185 | - $upload_dir = $conf->banque->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
| 186 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
| 187 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
| 185 | + $upload_dir = $conf->banque->dir_output."/".dol_sanitizeFileName($object->ref); |
|
| 186 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
| 187 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
| 188 | 188 | $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/document.php?id='.$object->id; |
| 189 | 189 | $head[$h][1] = $langs->trans('Documents'); |
| 190 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 190 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
| 191 | 191 | $head[$h][2] = 'documents'; |
| 192 | 192 | $h++; |
| 193 | 193 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $head[$h][2] = 'info'; |
| 197 | 197 | $h++; |
| 198 | 198 | |
| 199 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'various_payment', 'remove'); |
|
| 199 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'various_payment', 'remove'); |
|
| 200 | 200 | |
| 201 | 201 | return $head; |
| 202 | 202 | } |
@@ -252,12 +252,12 @@ discard block |
||
| 252 | 252 | if (empty($account->cle)) |
| 253 | 253 | $account->cle = $account->cle_rib; |
| 254 | 254 | |
| 255 | - dol_syslog("bank.lib::checkBanForAccount account->code_banque=" . $account->code_banque . " account->code_guichet=" . $account->code_guichet . " account->number=" . $account->number . " account->cle=" . $account->cle . " account->iban=" . $account->iban . " country_code=" . $country_code, LOG_DEBUG); |
|
| 255 | + dol_syslog("bank.lib::checkBanForAccount account->code_banque=".$account->code_banque." account->code_guichet=".$account->code_guichet." account->number=".$account->number." account->cle=".$account->cle." account->iban=".$account->iban." country_code=".$country_code, LOG_DEBUG); |
|
| 256 | 256 | |
| 257 | 257 | if ($country_code == 'FR') { // France rules |
| 258 | 258 | $coef = array(62, 34, 3); |
| 259 | 259 | // Concatenation des differents codes. |
| 260 | - $rib = strtolower(trim($account->code_banque) . trim($account->code_guichet) . trim($account->number) . trim($account->cle)); |
|
| 260 | + $rib = strtolower(trim($account->code_banque).trim($account->code_guichet).trim($account->number).trim($account->cle)); |
|
| 261 | 261 | // On remplace les eventuelles lettres par des chiffres. |
| 262 | 262 | //$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678912345678"); //Ne marche pas |
| 263 | 263 | $rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz", "12345678912345678923456789"); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | if ($country_code == 'ES') { // Spanish rules |
| 284 | 284 | $CCC = strtolower(trim($account->number)); |
| 285 | - $rib = strtolower(trim($account->code_banque) . trim($account->code_guichet)); |
|
| 285 | + $rib = strtolower(trim($account->code_banque).trim($account->code_guichet)); |
|
| 286 | 286 | $cle_rib = strtolower(checkES($rib, $CCC)); |
| 287 | 287 | if ($cle_rib == strtolower($account->cle)) { |
| 288 | 288 | return true; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | return $keycontrol; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - $ccc = $IentOfi . $InumCta; |
|
| 327 | + $ccc = $IentOfi.$InumCta; |
|
| 328 | 328 | $numbers = "1234567890"; |
| 329 | 329 | |
| 330 | 330 | $i = 0; |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $sum = 0; |
| 357 | 357 | |
| 358 | 358 | for ($i = 0; $i < 11; $i++) { |
| 359 | - $sum += $values[$i] * (int) substr($InumCta, $i, 1);//int to cast result of substr to a number |
|
| 359 | + $sum += $values[$i] * (int) substr($InumCta, $i, 1); //int to cast result of substr to a number |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | $key = 11 - $sum % 11; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $h = 0; |
| 35 | 35 | $head = array(); |
| 36 | 36 | |
| 37 | - $head[$h][0] = DOL_URL_ROOT . '/accountancy/admin/fiscalyear_card.php?id=' . $object->id; |
|
| 37 | + $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/fiscalyear_card.php?id='.$object->id; |
|
| 38 | 38 | $head[$h][1] = $langs->trans("Card"); |
| 39 | 39 | $head[$h][2] = 'card'; |
| 40 | 40 | $h++; |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | // Entries must be declared in modules descriptor with line |
| 44 | 44 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 45 | 45 | // $this->tabs = array('entity:-tabname); to remove a tab |
| 46 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear'); |
|
| 46 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'fiscalyear'); |
|
| 47 | 47 | |
| 48 | - $head[$h][0] = DOL_URL_ROOT . '/accountancy/admin/fiscalyear_info.php?id=' . $object->id; |
|
| 48 | + $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/fiscalyear_info.php?id='.$object->id; |
|
| 49 | 49 | $head[$h][1] = $langs->trans("Info"); |
| 50 | 50 | $head[$h][2] = 'info'; |
| 51 | 51 | $h++; |
| 52 | 52 | |
| 53 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'fiscalyear','remove'); |
|
| 53 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'fiscalyear', 'remove'); |
|
| 54 | 54 | |
| 55 | 55 | return $head; |
| 56 | 56 | } |
| 57 | 57 | \ No newline at end of file |
@@ -32,139 +32,139 @@ |
||
| 32 | 32 | function dol_ch_controle_bvrb($bvrb) |
| 33 | 33 | { |
| 34 | 34 | // Init array for control |
| 35 | - $tableau[0][0]=0; |
|
| 36 | - $tableau[0][1]=9; |
|
| 37 | - $tableau[0][2]=4; |
|
| 38 | - $tableau[0][3]=6; |
|
| 39 | - $tableau[0][4]=8; |
|
| 40 | - $tableau[0][5]=2; |
|
| 41 | - $tableau[0][6]=7; |
|
| 42 | - $tableau[0][7]=1; |
|
| 43 | - $tableau[0][8]=3; |
|
| 44 | - $tableau[0][9]=5; |
|
| 45 | - $tableau[0][10]=0; |
|
| 46 | - |
|
| 47 | - $tableau[1][0]=9; |
|
| 48 | - $tableau[1][1]=4; |
|
| 49 | - $tableau[1][2]=6; |
|
| 50 | - $tableau[1][3]=8; |
|
| 51 | - $tableau[1][4]=2; |
|
| 52 | - $tableau[1][5]=7; |
|
| 53 | - $tableau[1][6]=1; |
|
| 54 | - $tableau[1][7]=3; |
|
| 55 | - $tableau[1][8]=5; |
|
| 56 | - $tableau[1][9]=0; |
|
| 57 | - $tableau[1][10]=9; |
|
| 58 | - |
|
| 59 | - $tableau[2][0]=4; |
|
| 60 | - $tableau[2][1]=6; |
|
| 61 | - $tableau[2][2]=8; |
|
| 62 | - $tableau[2][3]=2; |
|
| 63 | - $tableau[2][4]=7; |
|
| 64 | - $tableau[2][5]=1; |
|
| 65 | - $tableau[2][6]=3; |
|
| 66 | - $tableau[2][7]=5; |
|
| 67 | - $tableau[2][8]=0; |
|
| 68 | - $tableau[2][9]=9; |
|
| 69 | - $tableau[2][10]=8; |
|
| 70 | - |
|
| 71 | - $tableau[3][0]=6; |
|
| 72 | - $tableau[3][1]=8; |
|
| 73 | - $tableau[3][2]=2; |
|
| 74 | - $tableau[3][3]=7; |
|
| 75 | - $tableau[3][4]=1; |
|
| 76 | - $tableau[3][5]=3; |
|
| 77 | - $tableau[3][6]=5; |
|
| 78 | - $tableau[3][7]=0; |
|
| 79 | - $tableau[3][8]=9; |
|
| 80 | - $tableau[3][9]=4; |
|
| 81 | - $tableau[3][10]=7; |
|
| 82 | - |
|
| 83 | - $tableau[4][0]=8; |
|
| 84 | - $tableau[4][1]=2; |
|
| 85 | - $tableau[4][2]=7; |
|
| 86 | - $tableau[4][3]=1; |
|
| 87 | - $tableau[4][4]=3; |
|
| 88 | - $tableau[4][5]=5; |
|
| 89 | - $tableau[4][6]=0; |
|
| 90 | - $tableau[4][7]=9; |
|
| 91 | - $tableau[4][8]=4; |
|
| 92 | - $tableau[4][9]=6; |
|
| 93 | - $tableau[4][10]=6; |
|
| 94 | - |
|
| 95 | - $tableau[5][0]=2; |
|
| 96 | - $tableau[5][1]=7; |
|
| 97 | - $tableau[5][2]=1; |
|
| 98 | - $tableau[5][3]=3; |
|
| 99 | - $tableau[5][4]=5; |
|
| 100 | - $tableau[5][5]=0; |
|
| 101 | - $tableau[5][6]=9; |
|
| 102 | - $tableau[5][7]=4; |
|
| 103 | - $tableau[5][8]=6; |
|
| 104 | - $tableau[5][9]=8; |
|
| 105 | - $tableau[5][10]=5; |
|
| 106 | - |
|
| 107 | - $tableau[6][0]=7; |
|
| 108 | - $tableau[6][1]=1; |
|
| 109 | - $tableau[6][2]=3; |
|
| 110 | - $tableau[6][3]=5; |
|
| 111 | - $tableau[6][4]=0; |
|
| 112 | - $tableau[6][5]=9; |
|
| 113 | - $tableau[6][6]=4; |
|
| 114 | - $tableau[6][7]=6; |
|
| 115 | - $tableau[6][8]=8; |
|
| 116 | - $tableau[6][9]=2; |
|
| 117 | - $tableau[6][10]=4; |
|
| 118 | - |
|
| 119 | - $tableau[7][0]=1; |
|
| 120 | - $tableau[7][1]=3; |
|
| 121 | - $tableau[7][2]=5; |
|
| 122 | - $tableau[7][3]=0; |
|
| 123 | - $tableau[7][4]=9; |
|
| 124 | - $tableau[7][5]=4; |
|
| 125 | - $tableau[7][6]=6; |
|
| 126 | - $tableau[7][7]=8; |
|
| 127 | - $tableau[7][8]=2; |
|
| 128 | - $tableau[7][9]=7; |
|
| 129 | - $tableau[7][10]=3; |
|
| 130 | - |
|
| 131 | - $tableau[8][0]=3; |
|
| 132 | - $tableau[8][1]=5; |
|
| 133 | - $tableau[8][2]=0; |
|
| 134 | - $tableau[8][3]=9; |
|
| 135 | - $tableau[8][4]=4; |
|
| 136 | - $tableau[8][5]=6; |
|
| 137 | - $tableau[8][6]=8; |
|
| 138 | - $tableau[8][7]=2; |
|
| 139 | - $tableau[8][8]=7; |
|
| 140 | - $tableau[8][9]=1; |
|
| 141 | - $tableau[8][10]=2; |
|
| 142 | - |
|
| 143 | - $tableau[9][0]=5; |
|
| 144 | - $tableau[9][1]=0; |
|
| 145 | - $tableau[9][2]=9; |
|
| 146 | - $tableau[9][3]=4; |
|
| 147 | - $tableau[9][4]=6; |
|
| 148 | - $tableau[9][5]=8; |
|
| 149 | - $tableau[9][6]=2; |
|
| 150 | - $tableau[9][7]=7; |
|
| 151 | - $tableau[9][8]=1; |
|
| 152 | - $tableau[9][9]=3; |
|
| 153 | - $tableau[9][10]=1; |
|
| 35 | + $tableau[0][0] = 0; |
|
| 36 | + $tableau[0][1] = 9; |
|
| 37 | + $tableau[0][2] = 4; |
|
| 38 | + $tableau[0][3] = 6; |
|
| 39 | + $tableau[0][4] = 8; |
|
| 40 | + $tableau[0][5] = 2; |
|
| 41 | + $tableau[0][6] = 7; |
|
| 42 | + $tableau[0][7] = 1; |
|
| 43 | + $tableau[0][8] = 3; |
|
| 44 | + $tableau[0][9] = 5; |
|
| 45 | + $tableau[0][10] = 0; |
|
| 46 | + |
|
| 47 | + $tableau[1][0] = 9; |
|
| 48 | + $tableau[1][1] = 4; |
|
| 49 | + $tableau[1][2] = 6; |
|
| 50 | + $tableau[1][3] = 8; |
|
| 51 | + $tableau[1][4] = 2; |
|
| 52 | + $tableau[1][5] = 7; |
|
| 53 | + $tableau[1][6] = 1; |
|
| 54 | + $tableau[1][7] = 3; |
|
| 55 | + $tableau[1][8] = 5; |
|
| 56 | + $tableau[1][9] = 0; |
|
| 57 | + $tableau[1][10] = 9; |
|
| 58 | + |
|
| 59 | + $tableau[2][0] = 4; |
|
| 60 | + $tableau[2][1] = 6; |
|
| 61 | + $tableau[2][2] = 8; |
|
| 62 | + $tableau[2][3] = 2; |
|
| 63 | + $tableau[2][4] = 7; |
|
| 64 | + $tableau[2][5] = 1; |
|
| 65 | + $tableau[2][6] = 3; |
|
| 66 | + $tableau[2][7] = 5; |
|
| 67 | + $tableau[2][8] = 0; |
|
| 68 | + $tableau[2][9] = 9; |
|
| 69 | + $tableau[2][10] = 8; |
|
| 70 | + |
|
| 71 | + $tableau[3][0] = 6; |
|
| 72 | + $tableau[3][1] = 8; |
|
| 73 | + $tableau[3][2] = 2; |
|
| 74 | + $tableau[3][3] = 7; |
|
| 75 | + $tableau[3][4] = 1; |
|
| 76 | + $tableau[3][5] = 3; |
|
| 77 | + $tableau[3][6] = 5; |
|
| 78 | + $tableau[3][7] = 0; |
|
| 79 | + $tableau[3][8] = 9; |
|
| 80 | + $tableau[3][9] = 4; |
|
| 81 | + $tableau[3][10] = 7; |
|
| 82 | + |
|
| 83 | + $tableau[4][0] = 8; |
|
| 84 | + $tableau[4][1] = 2; |
|
| 85 | + $tableau[4][2] = 7; |
|
| 86 | + $tableau[4][3] = 1; |
|
| 87 | + $tableau[4][4] = 3; |
|
| 88 | + $tableau[4][5] = 5; |
|
| 89 | + $tableau[4][6] = 0; |
|
| 90 | + $tableau[4][7] = 9; |
|
| 91 | + $tableau[4][8] = 4; |
|
| 92 | + $tableau[4][9] = 6; |
|
| 93 | + $tableau[4][10] = 6; |
|
| 94 | + |
|
| 95 | + $tableau[5][0] = 2; |
|
| 96 | + $tableau[5][1] = 7; |
|
| 97 | + $tableau[5][2] = 1; |
|
| 98 | + $tableau[5][3] = 3; |
|
| 99 | + $tableau[5][4] = 5; |
|
| 100 | + $tableau[5][5] = 0; |
|
| 101 | + $tableau[5][6] = 9; |
|
| 102 | + $tableau[5][7] = 4; |
|
| 103 | + $tableau[5][8] = 6; |
|
| 104 | + $tableau[5][9] = 8; |
|
| 105 | + $tableau[5][10] = 5; |
|
| 106 | + |
|
| 107 | + $tableau[6][0] = 7; |
|
| 108 | + $tableau[6][1] = 1; |
|
| 109 | + $tableau[6][2] = 3; |
|
| 110 | + $tableau[6][3] = 5; |
|
| 111 | + $tableau[6][4] = 0; |
|
| 112 | + $tableau[6][5] = 9; |
|
| 113 | + $tableau[6][6] = 4; |
|
| 114 | + $tableau[6][7] = 6; |
|
| 115 | + $tableau[6][8] = 8; |
|
| 116 | + $tableau[6][9] = 2; |
|
| 117 | + $tableau[6][10] = 4; |
|
| 118 | + |
|
| 119 | + $tableau[7][0] = 1; |
|
| 120 | + $tableau[7][1] = 3; |
|
| 121 | + $tableau[7][2] = 5; |
|
| 122 | + $tableau[7][3] = 0; |
|
| 123 | + $tableau[7][4] = 9; |
|
| 124 | + $tableau[7][5] = 4; |
|
| 125 | + $tableau[7][6] = 6; |
|
| 126 | + $tableau[7][7] = 8; |
|
| 127 | + $tableau[7][8] = 2; |
|
| 128 | + $tableau[7][9] = 7; |
|
| 129 | + $tableau[7][10] = 3; |
|
| 130 | + |
|
| 131 | + $tableau[8][0] = 3; |
|
| 132 | + $tableau[8][1] = 5; |
|
| 133 | + $tableau[8][2] = 0; |
|
| 134 | + $tableau[8][3] = 9; |
|
| 135 | + $tableau[8][4] = 4; |
|
| 136 | + $tableau[8][5] = 6; |
|
| 137 | + $tableau[8][6] = 8; |
|
| 138 | + $tableau[8][7] = 2; |
|
| 139 | + $tableau[8][8] = 7; |
|
| 140 | + $tableau[8][9] = 1; |
|
| 141 | + $tableau[8][10] = 2; |
|
| 142 | + |
|
| 143 | + $tableau[9][0] = 5; |
|
| 144 | + $tableau[9][1] = 0; |
|
| 145 | + $tableau[9][2] = 9; |
|
| 146 | + $tableau[9][3] = 4; |
|
| 147 | + $tableau[9][4] = 6; |
|
| 148 | + $tableau[9][5] = 8; |
|
| 149 | + $tableau[9][6] = 2; |
|
| 150 | + $tableau[9][7] = 7; |
|
| 151 | + $tableau[9][8] = 1; |
|
| 152 | + $tableau[9][9] = 3; |
|
| 153 | + $tableau[9][10] = 1; |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | // Clean data |
| 157 | - $bv=str_replace(' ','',$bvrb); |
|
| 157 | + $bv = str_replace(' ', '', $bvrb); |
|
| 158 | 158 | |
| 159 | 159 | // Make control |
| 160 | - $report=0; |
|
| 161 | - while (dol_strlen($bv)>1) |
|
| 160 | + $report = 0; |
|
| 161 | + while (dol_strlen($bv) > 1) |
|
| 162 | 162 | { |
| 163 | - $match=substr($bv,0,1); |
|
| 164 | - $report=$tableau[$report][$match]; |
|
| 165 | - $bv=substr($bv,1); |
|
| 163 | + $match = substr($bv, 0, 1); |
|
| 164 | + $report = $tableau[$report][$match]; |
|
| 165 | + $bv = substr($bv, 1); |
|
| 166 | 166 | } |
| 167 | - $controle=$tableau[$report][10]; |
|
| 167 | + $controle = $tableau[$report][10]; |
|
| 168 | 168 | |
| 169 | - return ($controle==$bv); |
|
| 169 | + return ($controle == $bv); |
|
| 170 | 170 | } |
@@ -24,20 +24,20 @@ |
||
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | // Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth) |
| 27 | -$supportedoauth2array=array( |
|
| 27 | +$supportedoauth2array = array( |
|
| 28 | 28 | 'OAUTH_GOOGLE_NAME'=>'google', |
| 29 | 29 | ); |
| 30 | 30 | if ($conf->global->MAIN_FEATURES_LEVEL >= 2) |
| 31 | 31 | { |
| 32 | - $supportedoauth2array['OAUTH_STRIPE_TEST_NAME']='stripetest'; |
|
| 33 | - $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME']='stripelive'; |
|
| 32 | + $supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = 'stripetest'; |
|
| 33 | + $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = 'stripelive'; |
|
| 34 | 34 | } |
| 35 | -$supportedoauth2array['OAUTH_GITHUB_NAME']='github'; |
|
| 35 | +$supportedoauth2array['OAUTH_GITHUB_NAME'] = 'github'; |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | // API access parameters OAUTH |
| 40 | -$list = array ( |
|
| 40 | +$list = array( |
|
| 41 | 41 | array( |
| 42 | 42 | 'OAUTH_AMAZON_NAME', |
| 43 | 43 | 'OAUTH_AMAZON_ID', |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
| 44 | 44 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
| 45 | 45 | $upload_dir = $conf->holiday->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); |
| 46 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
| 47 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
| 46 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
| 47 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
| 48 | 48 | $head[$h][0] = DOL_URL_ROOT.'/holiday/document.php?id='.$object->id; |
| 49 | 49 | $head[$h][1] = $langs->trans('Documents'); |
| 50 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 50 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
| 51 | 51 | $head[$h][2] = 'documents'; |
| 52 | 52 | $h++; |
| 53 | 53 | |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | // Entries must be declared in modules descriptor with line |
| 56 | 56 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 57 | 57 | // $this->tabs = array('entity:-tabname); to remove a tab |
| 58 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'holiday'); |
|
| 58 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday'); |
|
| 59 | 59 | |
| 60 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'holiday','remove'); |
|
| 60 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'holiday', 'remove'); |
|
| 61 | 61 | |
| 62 | 62 | return $head; |
| 63 | 63 | } |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | // Entries must be declared in modules descriptor with line |
| 85 | 85 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 86 | 86 | // $this->tabs = array('entity:-tabname); to remove a tab |
| 87 | - complete_head_from_modules($conf,$langs,null,$head,$h,'holiday_admin'); |
|
| 87 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'holiday_admin'); |
|
| 88 | 88 | |
| 89 | - complete_head_from_modules($conf,$langs,null,$head,$h,'holiday_admin','remove'); |
|
| 89 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'holiday_admin', 'remove'); |
|
| 90 | 90 | |
| 91 | 91 | return $head; |
| 92 | 92 | } |
@@ -31,15 +31,15 @@ discard block |
||
| 31 | 31 | * @param string[] $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) |
| 32 | 32 | * @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) |
| 33 | 33 | */ |
| 34 | -function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addheaders=array()) |
|
| 34 | +function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = 1, $addheaders = array()) |
|
| 35 | 35 | { |
| 36 | 36 | //declaring of global variables |
| 37 | 37 | global $conf, $langs; |
| 38 | - $USE_PROXY=empty($conf->global->MAIN_PROXY_USE)?0:$conf->global->MAIN_PROXY_USE; |
|
| 39 | - $PROXY_HOST=empty($conf->global->MAIN_PROXY_HOST)?0:$conf->global->MAIN_PROXY_HOST; |
|
| 40 | - $PROXY_PORT=empty($conf->global->MAIN_PROXY_PORT)?0:$conf->global->MAIN_PROXY_PORT; |
|
| 41 | - $PROXY_USER=empty($conf->global->MAIN_PROXY_USER)?0:$conf->global->MAIN_PROXY_USER; |
|
| 42 | - $PROXY_PASS=empty($conf->global->MAIN_PROXY_PASS)?0:$conf->global->MAIN_PROXY_PASS; |
|
| 38 | + $USE_PROXY = empty($conf->global->MAIN_PROXY_USE) ? 0 : $conf->global->MAIN_PROXY_USE; |
|
| 39 | + $PROXY_HOST = empty($conf->global->MAIN_PROXY_HOST) ? 0 : $conf->global->MAIN_PROXY_HOST; |
|
| 40 | + $PROXY_PORT = empty($conf->global->MAIN_PROXY_PORT) ? 0 : $conf->global->MAIN_PROXY_PORT; |
|
| 41 | + $PROXY_USER = empty($conf->global->MAIN_PROXY_USER) ? 0 : $conf->global->MAIN_PROXY_USER; |
|
| 42 | + $PROXY_PASS = empty($conf->global->MAIN_PROXY_PASS) ? 0 : $conf->global->MAIN_PROXY_PASS; |
|
| 43 | 43 | |
| 44 | 44 | dol_syslog("getURLContent postorget=".$postorget." URL=".$url." param=".$param); |
| 45 | 45 | |
@@ -54,45 +54,45 @@ discard block |
||
| 54 | 54 | curl_setopt($ch, CURLOPT_VERBOSE, 1); |
| 55 | 55 | curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function'); |
| 56 | 56 | |
| 57 | - @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation?true:false)); // We use @ here because this may return warning if safe mode is on or open_basedir is on |
|
| 57 | + @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation ?true:false)); // We use @ here because this may return warning if safe mode is on or open_basedir is on |
|
| 58 | 58 | |
| 59 | 59 | if (count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders); |
| 60 | - curl_setopt($ch, CURLINFO_HEADER_OUT, true); // To be able to retrieve request header and log it |
|
| 60 | + curl_setopt($ch, CURLINFO_HEADER_OUT, true); // To be able to retrieve request header and log it |
|
| 61 | 61 | |
| 62 | 62 | // By default use tls decied by PHP. |
| 63 | 63 | // You can force, if supported a version like TLSv1 or TLSv1.2 |
| 64 | - if (! empty($conf->global->MAIN_CURL_SSLVERSION)) curl_setopt($ch, CURLOPT_SSLVERSION, $conf->global->MAIN_CURL_SSLVERSION); |
|
| 64 | + if (!empty($conf->global->MAIN_CURL_SSLVERSION)) curl_setopt($ch, CURLOPT_SSLVERSION, $conf->global->MAIN_CURL_SSLVERSION); |
|
| 65 | 65 | //curl_setopt($ch, CURLOPT_SSLVERSION, 6); for tls 1.2 |
| 66 | 66 | |
| 67 | 67 | //turning off the server and peer verification(TrustManager Concept). |
| 68 | 68 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
| 69 | 69 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); |
| 70 | 70 | |
| 71 | - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)?5:$conf->global->MAIN_USE_CONNECT_TIMEOUT); |
|
| 72 | - curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT)?30:$conf->global->MAIN_USE_RESPONSE_TIMEOUT); |
|
| 71 | + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); |
|
| 72 | + curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); |
|
| 73 | 73 | |
| 74 | 74 | //curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true); // PHP 5.5 |
| 75 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // We want response |
|
| 75 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // We want response |
|
| 76 | 76 | if ($postorget == 'POST') |
| 77 | 77 | { |
| 78 | - curl_setopt($ch, CURLOPT_POST, 1); // POST |
|
| 79 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields |
|
| 78 | + curl_setopt($ch, CURLOPT_POST, 1); // POST |
|
| 79 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields |
|
| 80 | 80 | } |
| 81 | 81 | else if ($postorget == 'PUT') |
| 82 | 82 | { |
| 83 | 83 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' |
| 84 | - if (! is_array($param)) parse_str($param, $array_param); |
|
| 84 | + if (!is_array($param)) parse_str($param, $array_param); |
|
| 85 | 85 | else |
| 86 | 86 | { |
| 87 | 87 | dol_syslog("parameter param must be a string", LOG_WARNING); |
| 88 | - $array_param=$param; |
|
| 88 | + $array_param = $param; |
|
| 89 | 89 | } |
| 90 | - curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields |
|
| 90 | + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields |
|
| 91 | 91 | } |
| 92 | 92 | else if ($postorget == 'PUTALREADYFORMATED') |
| 93 | 93 | { |
| 94 | 94 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' |
| 95 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string |
|
| 95 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string |
|
| 96 | 96 | } |
| 97 | 97 | else if ($postorget == 'HEAD') |
| 98 | 98 | { |
@@ -101,42 +101,42 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | else if ($postorget == 'DELETE') |
| 103 | 103 | { |
| 104 | - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); // POST |
|
| 104 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); // POST |
|
| 105 | 105 | } |
| 106 | 106 | else |
| 107 | 107 | { |
| 108 | - curl_setopt($ch, CURLOPT_POST, 0); // GET |
|
| 108 | + curl_setopt($ch, CURLOPT_POST, 0); // GET |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | //if USE_PROXY constant set at begin of this method. |
| 112 | 112 | if ($USE_PROXY) |
| 113 | 113 | { |
| 114 | - dol_syslog("getURLContent set proxy to ".$PROXY_HOST. ":" . $PROXY_PORT." - ".$PROXY_USER. ":" . $PROXY_PASS); |
|
| 114 | + dol_syslog("getURLContent set proxy to ".$PROXY_HOST.":".$PROXY_PORT." - ".$PROXY_USER.":".$PROXY_PASS); |
|
| 115 | 115 | //curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); // Curl 7.10 |
| 116 | - curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST. ":" . $PROXY_PORT); |
|
| 117 | - if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER. ":" . $PROXY_PASS); |
|
| 116 | + curl_setopt($ch, CURLOPT_PROXY, $PROXY_HOST.":".$PROXY_PORT); |
|
| 117 | + if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER.":".$PROXY_PASS); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | //getting response from server |
| 121 | 121 | $response = curl_exec($ch); |
| 122 | 122 | |
| 123 | - $request = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request |
|
| 123 | + $request = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request |
|
| 124 | 124 | |
| 125 | 125 | dol_syslog("getURLContent request=".$request); |
| 126 | 126 | //dol_syslog("getURLContent response =".response); // This may contains binary data, so we dont output it |
| 127 | - dol_syslog("getURLContent response size=".strlen($response)); // This may contains binary data, so we dont output it |
|
| 127 | + dol_syslog("getURLContent response size=".strlen($response)); // This may contains binary data, so we dont output it |
|
| 128 | 128 | |
| 129 | - $rep=array(); |
|
| 129 | + $rep = array(); |
|
| 130 | 130 | if (curl_errno($ch)) |
| 131 | 131 | { |
| 132 | 132 | // Ad keys to $rep |
| 133 | - $rep['content']=$response; |
|
| 133 | + $rep['content'] = $response; |
|
| 134 | 134 | |
| 135 | 135 | // moving to display page to display curl errors |
| 136 | - $rep['curl_error_no']=curl_errno($ch); |
|
| 137 | - $rep['curl_error_msg']=curl_error($ch); |
|
| 136 | + $rep['curl_error_no'] = curl_errno($ch); |
|
| 137 | + $rep['curl_error_msg'] = curl_error($ch); |
|
| 138 | 138 | |
| 139 | - dol_syslog("getURLContent response array is ".join(',',$rep)); |
|
| 139 | + dol_syslog("getURLContent response array is ".join(',', $rep)); |
|
| 140 | 140 | } |
| 141 | 141 | else |
| 142 | 142 | { |
@@ -149,9 +149,9 @@ discard block |
||
| 149 | 149 | dol_syslog("getURLContent http_code=".$rep['http_code']); |
| 150 | 150 | |
| 151 | 151 | // Add more keys to $rep |
| 152 | - $rep['content']=$response; |
|
| 153 | - $rep['curl_error_no']=''; |
|
| 154 | - $rep['curl_error_msg']=''; |
|
| 152 | + $rep['content'] = $response; |
|
| 153 | + $rep['curl_error_no'] = ''; |
|
| 154 | + $rep['curl_error_msg'] = ''; |
|
| 155 | 155 | |
| 156 | 156 | //closing the curl |
| 157 | 157 | curl_close($ch); |
@@ -170,10 +170,10 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | function getDomainFromURL($url) |
| 172 | 172 | { |
| 173 | - $tmpdomain = preg_replace('/^https?:\/\//i', '', $url); // Remove http(s):// |
|
| 174 | - $tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after domain |
|
| 175 | - $tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...) |
|
| 176 | - $tmpdomain = preg_replace('/^[^\.]+\./', '', $tmpdomain); // Remove part www. before domain name |
|
| 173 | + $tmpdomain = preg_replace('/^https?:\/\//i', '', $url); // Remove http(s):// |
|
| 174 | + $tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after domain |
|
| 175 | + $tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...) |
|
| 176 | + $tmpdomain = preg_replace('/^[^\.]+\./', '', $tmpdomain); // Remove part www. before domain name |
|
| 177 | 177 | |
| 178 | 178 | return $tmpdomain; |
| 179 | 179 | } |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | function getRootURLFromURL($url) |
| 190 | 190 | { |
| 191 | - $prefix=''; |
|
| 191 | + $prefix = ''; |
|
| 192 | 192 | $tmpurl = $url; |
| 193 | 193 | if (preg_match('/^(https?:\/\/)/i', $tmpurl, $reg)) $prefix = $reg[1]; |
| 194 | - $tmpurl = preg_replace('/^https?:\/\//i', '', $tmpurl); // Remove http(s):// |
|
| 195 | - $tmpurl = preg_replace('/\/.*$/i', '', $tmpurl); // Remove part after domain |
|
| 194 | + $tmpurl = preg_replace('/^https?:\/\//i', '', $tmpurl); // Remove http(s):// |
|
| 195 | + $tmpurl = preg_replace('/\/.*$/i', '', $tmpurl); // Remove part after domain |
|
| 196 | 196 | |
| 197 | 197 | return $prefix.$tmpurl; |
| 198 | 198 | } |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | * @return int|object <=0 if KO, Object if OK |
| 38 | 38 | * @see rebuildObjectSql |
| 39 | 39 | */ |
| 40 | -function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='', $addfieldentry=array() ,$delfieldentry='') |
|
| 40 | +function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = '', $addfieldentry = array(), $delfieldentry = '') |
|
| 41 | 41 | { |
| 42 | 42 | global $db, $langs; |
| 43 | 43 | |
| 44 | 44 | if (empty($objectname)) return -1; |
| 45 | - if (empty($readdir)) $readdir=$destdir; |
|
| 45 | + if (empty($readdir)) $readdir = $destdir; |
|
| 46 | 46 | |
| 47 | - if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) |
|
| 47 | + if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) |
|
| 48 | 48 | { |
| 49 | 49 | dol_print_error('', 'Bad parameter addfieldentry with a property arrayofkeyval defined but that is not an array.'); |
| 50 | 50 | return -1; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | return -2; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if (! preg_match('/^(price|boolean|sellist|integer|date|timestamp|varchar|double|text|html)/', $addfieldentry['type'])) |
|
| 67 | + if (!preg_match('/^(price|boolean|sellist|integer|date|timestamp|varchar|double|text|html)/', $addfieldentry['type'])) |
|
| 68 | 68 | |
| 69 | 69 | { |
| 70 | 70 | setEventMessages($langs->trans('BadFormatForType', $objectname), null, 'errors'); |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - $pathoffiletoeditsrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; |
|
| 76 | - $pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : ''); |
|
| 77 | - if (! dol_is_file($pathoffiletoeditsrc)) |
|
| 75 | + $pathoffiletoeditsrc = $readdir.'/class/'.strtolower($objectname).'.class.php'; |
|
| 76 | + $pathoffiletoedittarget = $destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : ''); |
|
| 77 | + if (!dol_is_file($pathoffiletoeditsrc)) |
|
| 78 | 78 | { |
| 79 | 79 | $langs->load("errors"); |
| 80 | 80 | setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors'); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | try |
| 88 | 88 | { |
| 89 | 89 | include_once $pathoffiletoeditsrc; |
| 90 | - if (class_exists($objectname)) $object=new $objectname($db); |
|
| 90 | + if (class_exists($objectname)) $object = new $objectname($db); |
|
| 91 | 91 | else return -4; |
| 92 | 92 | |
| 93 | 93 | // Backup old file |
@@ -101,83 +101,83 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | if (is_array($addfieldentry) && count($addfieldentry)) |
| 103 | 103 | { |
| 104 | - $name=$addfieldentry['name']; |
|
| 104 | + $name = $addfieldentry['name']; |
|
| 105 | 105 | unset($addfieldentry['name']); |
| 106 | 106 | |
| 107 | - $object->fields[$name]=$addfieldentry; |
|
| 107 | + $object->fields[$name] = $addfieldentry; |
|
| 108 | 108 | } |
| 109 | - if (! empty($delfieldentry)) |
|
| 109 | + if (!empty($delfieldentry)) |
|
| 110 | 110 | { |
| 111 | - $name=$delfieldentry; |
|
| 111 | + $name = $delfieldentry; |
|
| 112 | 112 | unset($object->fields[$name]); |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | dol_sort_array($object->fields, 'position'); |
| 117 | 117 | |
| 118 | - $i=0; |
|
| 118 | + $i = 0; |
|
| 119 | 119 | $texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n"; |
| 120 | - $texttoinsert.= "\t".'/**'."\n"; |
|
| 121 | - $texttoinsert.= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n"; |
|
| 122 | - $texttoinsert.= "\t".' */'."\n"; |
|
| 123 | - $texttoinsert.= "\t".'public $fields=array('."\n"; |
|
| 120 | + $texttoinsert .= "\t".'/**'."\n"; |
|
| 121 | + $texttoinsert .= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n"; |
|
| 122 | + $texttoinsert .= "\t".' */'."\n"; |
|
| 123 | + $texttoinsert .= "\t".'public $fields=array('."\n"; |
|
| 124 | 124 | |
| 125 | 125 | if (count($object->fields)) |
| 126 | 126 | { |
| 127 | 127 | |
| 128 | - foreach($object->fields as $key => $val) |
|
| 128 | + foreach ($object->fields as $key => $val) |
|
| 129 | 129 | { |
| 130 | 130 | $i++; |
| 131 | - $texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',"; |
|
| 132 | - $texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).","; |
|
| 133 | - $texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).","; |
|
| 134 | - $texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).","; |
|
| 135 | - $texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).","; |
|
| 136 | - if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',"; |
|
| 137 | - if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].","; |
|
| 138 | - if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].","; |
|
| 139 | - if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',"; |
|
| 140 | - if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',"; |
|
| 141 | - if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; |
|
| 142 | - if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\","; |
|
| 143 | - if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',"; |
|
| 131 | + $texttoinsert .= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',"; |
|
| 132 | + $texttoinsert .= " 'enabled'=>".($val['enabled'] != '' ? $val['enabled'] : 1).","; |
|
| 133 | + $texttoinsert .= " 'visible'=>".($val['visible'] != '' ? $val['visible'] : -1).","; |
|
| 134 | + $texttoinsert .= " 'position'=>".($val['position'] != '' ? $val['position'] : 50).","; |
|
| 135 | + $texttoinsert .= " 'notnull'=>".($val['notnull'] != '' ? $val['notnull'] : -1).","; |
|
| 136 | + if ($val['default']) $texttoinsert .= " 'default'=>'".$val['default']."',"; |
|
| 137 | + if ($val['index']) $texttoinsert .= " 'index'=>".$val['index'].","; |
|
| 138 | + if ($val['searchall']) $texttoinsert .= " 'searchall'=>".$val['searchall'].","; |
|
| 139 | + if ($val['isameasure']) $texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',"; |
|
| 140 | + if ($val['foreignkey']) $texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',"; |
|
| 141 | + if ($val['help']) $texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; |
|
| 142 | + if ($val['comment']) $texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\","; |
|
| 143 | + if ($val['showoncombobox']) $texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',"; |
|
| 144 | 144 | if ($val['arrayofkeyval']) |
| 145 | 145 | { |
| 146 | - $texttoinsert.= " 'arrayofkeyval'=>array("; |
|
| 147 | - $i=0; |
|
| 148 | - foreach($val['arrayofkeyval'] as $key2 => $val2) |
|
| 146 | + $texttoinsert .= " 'arrayofkeyval'=>array("; |
|
| 147 | + $i = 0; |
|
| 148 | + foreach ($val['arrayofkeyval'] as $key2 => $val2) |
|
| 149 | 149 | { |
| 150 | - if ($i) $texttoinsert.=", "; |
|
| 151 | - $texttoinsert.="'".$key2."'=>'".$val2."'"; |
|
| 150 | + if ($i) $texttoinsert .= ", "; |
|
| 151 | + $texttoinsert .= "'".$key2."'=>'".$val2."'"; |
|
| 152 | 152 | $i++; |
| 153 | 153 | } |
| 154 | - $texttoinsert.= ")"; |
|
| 154 | + $texttoinsert .= ")"; |
|
| 155 | 155 | } |
| 156 | - $texttoinsert.= "),\n"; |
|
| 156 | + $texttoinsert .= "),\n"; |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - $texttoinsert.= "\t".');'."\n"; |
|
| 160 | + $texttoinsert .= "\t".');'."\n"; |
|
| 161 | 161 | //print ($texttoinsert);exit; |
| 162 | 162 | |
| 163 | 163 | if (count($object->fields)) |
| 164 | 164 | { |
| 165 | - $typetotypephp=array('integer'=>'integer', 'varchar'=>'string'); |
|
| 165 | + $typetotypephp = array('integer'=>'integer', 'varchar'=>'string'); |
|
| 166 | 166 | |
| 167 | - foreach($object->fields as $key => $val) |
|
| 167 | + foreach ($object->fields as $key => $val) |
|
| 168 | 168 | { |
| 169 | 169 | $i++; |
| 170 | 170 | //$typephp=$typetotypephp[$val['type']]; |
| 171 | - $texttoinsert.= "\t".'public $'.$key.";"; |
|
| 171 | + $texttoinsert .= "\t".'public $'.$key.";"; |
|
| 172 | 172 | //if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; |
| 173 | 173 | //if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; |
| 174 | 174 | //$texttoinsert.= ($val['notnull']?' NOT NULL':''); |
| 175 | 175 | //if ($i < count($object->fields)) $texttoinsert.=";"; |
| 176 | - $texttoinsert.= "\n"; |
|
| 176 | + $texttoinsert .= "\n"; |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $texttoinsert.= "\t".'// END MODULEBUILDER PROPERTIES'; |
|
| 180 | + $texttoinsert .= "\t".'// END MODULEBUILDER PROPERTIES'; |
|
| 181 | 181 | |
| 182 | 182 | //print($texttoinsert);exit; |
| 183 | 183 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | return $object; |
| 193 | 193 | } |
| 194 | - catch(Exception $e) |
|
| 194 | + catch (Exception $e) |
|
| 195 | 195 | { |
| 196 | 196 | print $e->getMessage(); |
| 197 | 197 | return -5; |
@@ -210,21 +210,21 @@ discard block |
||
| 210 | 210 | * @return int <=0 if KO, >0 if OK |
| 211 | 211 | * @see rebuildObjectClass |
| 212 | 212 | */ |
| 213 | -function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='', $object=null) |
|
| 213 | +function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '', $object = null) |
|
| 214 | 214 | { |
| 215 | 215 | global $db, $langs; |
| 216 | 216 | |
| 217 | 217 | $error = 0; |
| 218 | 218 | |
| 219 | 219 | if (empty($objectname)) return -1; |
| 220 | - if (empty($readdir)) $readdir=$destdir; |
|
| 220 | + if (empty($readdir)) $readdir = $destdir; |
|
| 221 | 221 | |
| 222 | - $pathoffiletoclasssrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; |
|
| 222 | + $pathoffiletoclasssrc = $readdir.'/class/'.strtolower($objectname).'.class.php'; |
|
| 223 | 223 | |
| 224 | 224 | // Edit .sql file |
| 225 | - $pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
|
| 226 | - $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : ''); |
|
| 227 | - if (! dol_is_file($pathoffiletoeditsrc)) |
|
| 225 | + $pathoffiletoeditsrc = $readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
|
| 226 | + $pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : ''); |
|
| 227 | + if (!dol_is_file($pathoffiletoeditsrc)) |
|
| 228 | 228 | { |
| 229 | 229 | $langs->load("errors"); |
| 230 | 230 | setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors'); |
@@ -234,14 +234,14 @@ discard block |
||
| 234 | 234 | // Load object from myobject.class.php |
| 235 | 235 | try |
| 236 | 236 | { |
| 237 | - if (! is_object($object)) |
|
| 237 | + if (!is_object($object)) |
|
| 238 | 238 | { |
| 239 | 239 | include_once $pathoffiletoclasssrc; |
| 240 | - if (class_exists($objectname)) $object=new $objectname($db); |
|
| 240 | + if (class_exists($objectname)) $object = new $objectname($db); |
|
| 241 | 241 | else return -1; |
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | - catch(Exception $e) |
|
| 244 | + catch (Exception $e) |
|
| 245 | 245 | { |
| 246 | 246 | print $e->getMessage(); |
| 247 | 247 | } |
@@ -251,38 +251,38 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); |
| 253 | 253 | |
| 254 | - $i=0; |
|
| 254 | + $i = 0; |
|
| 255 | 255 | $texttoinsert = '-- BEGIN MODULEBUILDER FIELDS'."\n"; |
| 256 | 256 | if (count($object->fields)) |
| 257 | 257 | { |
| 258 | - foreach($object->fields as $key => $val) |
|
| 258 | + foreach ($object->fields as $key => $val) |
|
| 259 | 259 | { |
| 260 | 260 | $i++; |
| 261 | 261 | |
| 262 | 262 | $type = $val['type']; |
| 263 | - $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php' |
|
| 263 | + $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php' |
|
| 264 | 264 | |
| 265 | - if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database |
|
| 266 | - else if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database |
|
| 265 | + if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database |
|
| 266 | + else if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database |
|
| 267 | 267 | else if ($type == 'link' || $type == 'sellist') $type = 'integer'; |
| 268 | - $texttoinsert.= "\t".$key." ".$type; |
|
| 269 | - if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; |
|
| 270 | - if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; |
|
| 268 | + $texttoinsert .= "\t".$key." ".$type; |
|
| 269 | + if ($key == 'rowid') $texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY'; |
|
| 270 | + if ($key == 'entity') $texttoinsert .= ' DEFAULT 1'; |
|
| 271 | 271 | else |
| 272 | 272 | { |
| 273 | 273 | if ($val['default'] != '') |
| 274 | 274 | { |
| 275 | - if (preg_match('/^null$/i', $val['default'])) $texttoinsert.= " DEFAULT NULL"; |
|
| 276 | - else if (preg_match('/varchar/', $type )) $texttoinsert.= " DEFAULT '".$db->escape($val['default'])."'"; |
|
| 277 | - else $texttoinsert.= (($val['default'] > 0)?' DEFAULT '.$val['default']:''); |
|
| 275 | + if (preg_match('/^null$/i', $val['default'])) $texttoinsert .= " DEFAULT NULL"; |
|
| 276 | + else if (preg_match('/varchar/', $type)) $texttoinsert .= " DEFAULT '".$db->escape($val['default'])."'"; |
|
| 277 | + else $texttoinsert .= (($val['default'] > 0) ? ' DEFAULT '.$val['default'] : ''); |
|
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | - $texttoinsert.= (($val['notnull'] > 0)?' NOT NULL':''); |
|
| 281 | - if ($i < count($object->fields)) $texttoinsert.=", "; |
|
| 282 | - $texttoinsert.= "\n"; |
|
| 280 | + $texttoinsert .= (($val['notnull'] > 0) ? ' NOT NULL' : ''); |
|
| 281 | + if ($i < count($object->fields)) $texttoinsert .= ", "; |
|
| 282 | + $texttoinsert .= "\n"; |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | - $texttoinsert.= "\t".'-- END MODULEBUILDER FIELDS'; |
|
| 285 | + $texttoinsert .= "\t".'-- END MODULEBUILDER FIELDS'; |
|
| 286 | 286 | |
| 287 | 287 | $contentsql = preg_replace('/-- BEGIN MODULEBUILDER FIELDS.*END MODULEBUILDER FIELDS/ims', $texttoinsert, $contentsql); |
| 288 | 288 | |
@@ -297,35 +297,35 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // Edit .key.sql file |
| 300 | - $pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'; |
|
| 301 | - $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : ''); |
|
| 300 | + $pathoffiletoeditsrc = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'; |
|
| 301 | + $pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : ''); |
|
| 302 | 302 | |
| 303 | 303 | $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); |
| 304 | 304 | |
| 305 | - $i=0; |
|
| 305 | + $i = 0; |
|
| 306 | 306 | $texttoinsert = '-- BEGIN MODULEBUILDER INDEXES'."\n"; |
| 307 | 307 | if (count($object->fields)) |
| 308 | 308 | { |
| 309 | - foreach($object->fields as $key => $val) |
|
| 309 | + foreach ($object->fields as $key => $val) |
|
| 310 | 310 | { |
| 311 | 311 | $i++; |
| 312 | - if (! empty($val['index'])) |
|
| 312 | + if (!empty($val['index'])) |
|
| 313 | 313 | { |
| 314 | - $texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");"; |
|
| 315 | - $texttoinsert.= "\n"; |
|
| 314 | + $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");"; |
|
| 315 | + $texttoinsert .= "\n"; |
|
| 316 | 316 | } |
| 317 | - if (! empty($val['foreignkey'])) |
|
| 317 | + if (!empty($val['foreignkey'])) |
|
| 318 | 318 | { |
| 319 | - $tmp=explode('.',$val['foreignkey']); |
|
| 320 | - if (! empty($tmp[0]) && ! empty($tmp[1])) |
|
| 319 | + $tmp = explode('.', $val['foreignkey']); |
|
| 320 | + if (!empty($tmp[0]) && !empty($tmp[1])) |
|
| 321 | 321 | { |
| 322 | - $texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".$tmp[0]."(".$tmp[1].");"; |
|
| 323 | - $texttoinsert.= "\n"; |
|
| 322 | + $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".$tmp[0]."(".$tmp[1].");"; |
|
| 323 | + $texttoinsert .= "\n"; |
|
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | - $texttoinsert.= '-- END MODULEBUILDER INDEXES'; |
|
| 328 | + $texttoinsert .= '-- END MODULEBUILDER INDEXES'; |
|
| 329 | 329 | |
| 330 | 330 | $contentsql = preg_replace('/-- BEGIN MODULEBUILDER INDEXES.*END MODULEBUILDER INDEXES/ims', $texttoinsert, $contentsql); |
| 331 | 331 | |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | $head[$h][2] = 'general'; |
| 43 | 43 | $h++; |
| 44 | 44 | |
| 45 | - if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_ACTIVE)) |
|
| 46 | - && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
|
| 45 | + if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_MEMBER_ACTIVE)) |
|
| 46 | + && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) |
|
| 47 | 47 | { |
| 48 | 48 | $langs->load("ldap"); |
| 49 | 49 | |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | $h++; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if (! empty($user->rights->adherent->cotisation->lire)) |
|
| 56 | + if (!empty($user->rights->adherent->cotisation->lire)) |
|
| 57 | 57 | { |
| 58 | - $nbSubscription = is_array($object->subscriptions)?count($object->subscriptions):0; |
|
| 58 | + $nbSubscription = is_array($object->subscriptions) ?count($object->subscriptions) : 0; |
|
| 59 | 59 | $head[$h][0] = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$object->id; |
| 60 | 60 | $head[$h][1] = $langs->trans("Subscriptions"); |
| 61 | 61 | $head[$h][2] = 'subscription'; |
| 62 | - if ($nbSubscription > 0) $head[$h][1].= ' <span class="badge">'.$nbSubscription.'</span>'; |
|
| 62 | + if ($nbSubscription > 0) $head[$h][1] .= ' <span class="badge">'.$nbSubscription.'</span>'; |
|
| 63 | 63 | $h++; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -67,45 +67,45 @@ discard block |
||
| 67 | 67 | // Entries must be declared in modules descriptor with line |
| 68 | 68 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 69 | 69 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
| 70 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'member'); |
|
| 70 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'member'); |
|
| 71 | 71 | |
| 72 | 72 | $nbNote = 0; |
| 73 | - if(!empty($object->note)) $nbNote++; |
|
| 74 | - if(!empty($object->note_private)) $nbNote++; |
|
| 75 | - if(!empty($object->note_public)) $nbNote++; |
|
| 73 | + if (!empty($object->note)) $nbNote++; |
|
| 74 | + if (!empty($object->note_private)) $nbNote++; |
|
| 75 | + if (!empty($object->note_public)) $nbNote++; |
|
| 76 | 76 | $head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$object->id; |
| 77 | 77 | $head[$h][1] = $langs->trans("Note"); |
| 78 | 78 | $head[$h][2] = 'note'; |
| 79 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
| 79 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
| 80 | 80 | $h++; |
| 81 | 81 | |
| 82 | 82 | // Attachments |
| 83 | 83 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
| 84 | 84 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
| 85 | - $upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir(0,0,0,1,$object,'member'); |
|
| 86 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
| 87 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
| 85 | + $upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'member'); |
|
| 86 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
| 87 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
| 88 | 88 | $head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id; |
| 89 | 89 | $head[$h][1] = $langs->trans('Documents'); |
| 90 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 90 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
| 91 | 91 | $head[$h][2] = 'document'; |
| 92 | 92 | $h++; |
| 93 | 93 | |
| 94 | 94 | // Show agenda tab |
| 95 | - if (! empty($conf->agenda->enabled)) |
|
| 95 | + if (!empty($conf->agenda->enabled)) |
|
| 96 | 96 | { |
| 97 | 97 | $head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id; |
| 98 | 98 | $head[$h][1] = $langs->trans("Events"); |
| 99 | - if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) |
|
| 99 | + if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) |
|
| 100 | 100 | { |
| 101 | - $head[$h][1].= '/'; |
|
| 102 | - $head[$h][1].= $langs->trans("Agenda"); |
|
| 101 | + $head[$h][1] .= '/'; |
|
| 102 | + $head[$h][1] .= $langs->trans("Agenda"); |
|
| 103 | 103 | } |
| 104 | 104 | $head[$h][2] = 'agenda'; |
| 105 | 105 | $h++; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'member','remove'); |
|
| 108 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'member', 'remove'); |
|
| 109 | 109 | |
| 110 | 110 | return $head; |
| 111 | 111 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | global $langs, $conf, $user; |
| 122 | 122 | |
| 123 | - $h=0; |
|
| 123 | + $h = 0; |
|
| 124 | 124 | $head = array(); |
| 125 | 125 | |
| 126 | 126 | $head[$h][0] = DOL_URL_ROOT.'/adherents/type.php?rowid='.$object->id; |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | $head[$h][2] = 'card'; |
| 129 | 129 | $h++; |
| 130 | 130 | |
| 131 | - if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE)) |
|
| 132 | - && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
|
| 131 | + if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE)) |
|
| 132 | + && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) |
|
| 133 | 133 | { |
| 134 | 134 | $langs->load("ldap"); |
| 135 | 135 | |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | // Entries must be declared in modules descriptor with line |
| 144 | 144 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 145 | 145 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
| 146 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'membertype'); |
|
| 146 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'membertype'); |
|
| 147 | 147 | |
| 148 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'membertype','remove'); |
|
| 148 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'membertype', 'remove'); |
|
| 149 | 149 | |
| 150 | 150 | return $head; |
| 151 | 151 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | // Entries must be declared in modules descriptor with line |
| 177 | 177 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 178 | 178 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
| 179 | - complete_head_from_modules($conf,$langs,'',$head,$h,'member_admin'); |
|
| 179 | + complete_head_from_modules($conf, $langs, '', $head, $h, 'member_admin'); |
|
| 180 | 180 | |
| 181 | 181 | $head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_extrafields.php'; |
| 182 | 182 | $head[$h][1] = $langs->trans("ExtraFieldsMember"); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $head[$h][2] = 'website'; |
| 194 | 194 | $h++; |
| 195 | 195 | |
| 196 | - complete_head_from_modules($conf,$langs,'',$head,$h,'member_admin','remove'); |
|
| 196 | + complete_head_from_modules($conf, $langs, '', $head, $h, 'member_admin', 'remove'); |
|
| 197 | 197 | |
| 198 | 198 | return $head; |
| 199 | 199 | } |
@@ -246,9 +246,9 @@ discard block |
||
| 246 | 246 | // Entries must be declared in modules descriptor with line |
| 247 | 247 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 248 | 248 | // $this->tabs = array('entity:-tabname); to remove a tab |
| 249 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'member_stats'); |
|
| 249 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'member_stats'); |
|
| 250 | 250 | |
| 251 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'member_stats','remove'); |
|
| 251 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'member_stats', 'remove'); |
|
| 252 | 252 | |
| 253 | 253 | return $head; |
| 254 | 254 | } |
@@ -280,9 +280,9 @@ discard block |
||
| 280 | 280 | // Entries must be declared in modules descriptor with line |
| 281 | 281 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 282 | 282 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
| 283 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'subscription'); |
|
| 283 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'subscription'); |
|
| 284 | 284 | |
| 285 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'subscription','remove'); |
|
| 285 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'subscription', 'remove'); |
|
| 286 | 286 | |
| 287 | 287 | return $head; |
| 288 | 288 | } |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) |
| 44 | 44 | { |
| 45 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
| 45 | + $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
|
| 46 | 46 | $head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$object->id; |
| 47 | 47 | $head[$h][1] = $langs->trans("ContactsAddresses"); |
| 48 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
| 48 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
| 49 | 49 | $head[$h][2] = 'contact'; |
| 50 | 50 | $h++; |
| 51 | 51 | } |
@@ -54,28 +54,28 @@ discard block |
||
| 54 | 54 | // Entries must be declared in modules descriptor with line |
| 55 | 55 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 56 | 56 | // $this->tabs = array('entity:-tabname); to remove a tab |
| 57 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'contract'); |
|
| 57 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'contract'); |
|
| 58 | 58 | |
| 59 | 59 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
| 60 | 60 | { |
| 61 | 61 | $nbNote = 0; |
| 62 | - if(!empty($object->note_private)) $nbNote++; |
|
| 63 | - if(!empty($object->note_public)) $nbNote++; |
|
| 62 | + if (!empty($object->note_private)) $nbNote++; |
|
| 63 | + if (!empty($object->note_public)) $nbNote++; |
|
| 64 | 64 | $head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id; |
| 65 | 65 | $head[$h][1] = $langs->trans("Notes"); |
| 66 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
| 66 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
| 67 | 67 | $head[$h][2] = 'note'; |
| 68 | 68 | $h++; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
| 72 | 72 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
| 73 | - $upload_dir = $conf->contrat->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
| 74 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
| 75 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
| 73 | + $upload_dir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref); |
|
| 74 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
| 75 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
| 76 | 76 | $head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id; |
| 77 | 77 | $head[$h][1] = $langs->trans("Documents"); |
| 78 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
| 78 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
| 79 | 79 | $head[$h][2] = 'documents'; |
| 80 | 80 | $h++; |
| 81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $head[$h][2] = 'info'; |
| 85 | 85 | $h++; |
| 86 | 86 | |
| 87 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'contract','remove'); |
|
| 87 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'contract', 'remove'); |
|
| 88 | 88 | |
| 89 | 89 | return $head; |
| 90 | 90 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | // Entries must be declared in modules descriptor with line |
| 111 | 111 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
| 112 | 112 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
| 113 | - complete_head_from_modules($conf,$langs,null,$head,$h,'contract_admin'); |
|
| 113 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'contract_admin'); |
|
| 114 | 114 | |
| 115 | 115 | $head[$h][0] = DOL_URL_ROOT.'/contrat/admin/contract_extrafields.php'; |
| 116 | 116 | $head[$h][1] = $langs->trans("ExtraFields"); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | |
| 127 | - complete_head_from_modules($conf,$langs,null,$head,$h,'contract_admin','remove'); |
|
| 127 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'contract_admin', 'remove'); |
|
| 128 | 128 | |
| 129 | 129 | return $head; |
| 130 | 130 | } |