@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | $this->llxHeader('', $this->title, '', '', 0, 0, $arrayofjs, $arrayofcss); |
111 | 111 | |
112 | - $newcardbutton = '<a class="butActionNew" href="' . BASE_URI . '/categories/card.php?action=create&type=' . $this->type . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $this->type) . '"><span class="valignmiddle">' . Globals::$langs->trans("NewCategory") . '</span>'; |
|
112 | + $newcardbutton = '<a class="butActionNew" href="'.BASE_URI.'/categories/card.php?action=create&type='.$this->type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$this->type).'"><span class="valignmiddle">'.Globals::$langs->trans("NewCategory").'</span>'; |
|
113 | 113 | $newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
114 | 114 | $newcardbutton .= '</a>'; |
115 | 115 | |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | /* |
124 | 124 | * Zone recherche produit/service |
125 | 125 | */ |
126 | - print '<form method="post" action="index.php?type=' . $this->type . '">'; |
|
127 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
128 | - print '<input type="hidden" name="type" value="' . $this->type . '">'; |
|
126 | + print '<form method="post" action="index.php?type='.$this->type.'">'; |
|
127 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
128 | + print '<input type="hidden" name="type" value="'.$this->type.'">'; |
|
129 | 129 | |
130 | 130 | |
131 | 131 | print '<table class="noborder nohover" width="100%">'; |
132 | 132 | print '<tr class="liste_titre">'; |
133 | - print '<td colspan="3">' . Globals::$langs->trans("Search") . '</td>'; |
|
133 | + print '<td colspan="3">'.Globals::$langs->trans("Search").'</td>'; |
|
134 | 134 | print '</tr>'; |
135 | 135 | print '<tr class="oddeven"><td>'; |
136 | - print Globals::$langs->trans("Name") . ':</td><td><input class="flat inputsearch" type="text" name="catname" value="' . $catname . '"/></td><td><input type="submit" class="button" value="' . Globals::$langs->trans("Search") . '"></td></tr>'; |
|
136 | + print Globals::$langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.$catname.'"/></td><td><input type="submit" class="button" value="'.Globals::$langs->trans("Search").'"></td></tr>'; |
|
137 | 137 | /* |
138 | 138 | // faire une rech dans une sous categorie uniquement |
139 | 139 | print '<tr '.$bc[0].'><td>'; |
@@ -158,17 +158,17 @@ discard block |
||
158 | 158 | $cats = $categstatic->rechercher($id, $catname, $this->typetext); |
159 | 159 | |
160 | 160 | print '<table class="noborder" width="100%">'; |
161 | - print '<tr class="liste_titre"><td colspan="2">' . Globals::$langs->trans("FoundCats") . '</td></tr>'; |
|
161 | + print '<tr class="liste_titre"><td colspan="2">'.Globals::$langs->trans("FoundCats").'</td></tr>'; |
|
162 | 162 | |
163 | 163 | foreach ($cats as $cat) { |
164 | - print "\t" . '<tr class="oddeven">' . "\n"; |
|
164 | + print "\t".'<tr class="oddeven">'."\n"; |
|
165 | 165 | print "\t\t<td>"; |
166 | 166 | $categstatic->id = $cat->id; |
167 | 167 | $categstatic->ref = $cat->label; |
168 | 168 | $categstatic->label = $cat->label; |
169 | 169 | $categstatic->type = $cat->type; |
170 | 170 | $categstatic->color = $cat->color; |
171 | - print '<span class="noborderoncategories" ' . ($categstatic->color ? ' style="background: #' . $categstatic->color . ';"' : ' style="background: #aaa"') . '>'; |
|
171 | + print '<span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>'; |
|
172 | 172 | print $categstatic->getNomUrl(1, ''); |
173 | 173 | print '</span>'; |
174 | 174 | print "</td>\n"; |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | $data[] = array( |
209 | 209 | 'rowid' => $val['rowid'], |
210 | 210 | 'fk_menu' => $val['fk_parent'], |
211 | - 'entry' => '<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" ' . ($categstatic->color ? ' style="background: #' . $categstatic->color . ';"' : ' style="background: #aaa"') . '>' . $li . '</span></td>' . |
|
211 | + 'entry' => '<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>'.$li.'</span></td>'. |
|
212 | 212 | //'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'. |
213 | - '<td align="right" width="20px;"><a href="' . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $val['id'] . '&type=' . $this->type . '">' . img_view() . '</a></td>' . |
|
213 | + '<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$this->type.'">'.img_view().'</a></td>'. |
|
214 | 214 | '</tr></table>' |
215 | 215 | ); |
216 | 216 | } |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | //print_barre_liste('', 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, 0, '', 0, $newcardbutton, '', 0, 1, 1); |
220 | 220 | |
221 | 221 | print '<table class="liste nohover" width="100%">'; |
222 | - print '<tr class="liste_titre"><td>' . Globals::$langs->trans("Categories") . '</td><td></td><td align="right">'; |
|
222 | + print '<tr class="liste_titre"><td>'.Globals::$langs->trans("Categories").'</td><td></td><td align="right">'; |
|
223 | 223 | if (!empty($conf->use_javascript_ajax)) { |
224 | - print '<div id="iddivjstreecontrol"><a class="notasortlink" href="#">' . img_picto('', 'object_category') . ' ' . Globals::$langs->trans("UndoExpandAll") . '</a> | <a class="notasortlink" href="#">' . img_picto('', 'object_category-expanded') . ' ' . Globals::$langs->trans("ExpandAll") . '</a></div>'; |
|
224 | + print '<div id="iddivjstreecontrol"><a class="notasortlink" href="#">'.img_picto('', 'object_category').' '.Globals::$langs->trans("UndoExpandAll").'</a> | <a class="notasortlink" href="#">'.img_picto('', 'object_category-expanded').' '.Globals::$langs->trans("ExpandAll").'</a></div>'; |
|
225 | 225 | } |
226 | 226 | print '</td></tr>'; |
227 | 227 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | print '</td></tr>'; |
234 | 234 | } else { |
235 | 235 | print '<tr class="pair">'; |
236 | - print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>' . img_picto_common('', 'treemenu/branchbottom.gif') . '</td>'; |
|
236 | + print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>'; |
|
237 | 237 | print '<td valign="middle">'; |
238 | 238 | print Globals::$langs->trans("NoCategoryYet"); |
239 | 239 | print '</td>'; |
@@ -178,8 +178,9 @@ |
||
178 | 178 | print "\t</tr>\n"; |
179 | 179 | } |
180 | 180 | print "</table>"; |
181 | - } else |
|
182 | - print ' '; |
|
181 | + } else { |
|
182 | + print ' '; |
|
183 | + } |
|
183 | 184 | |
184 | 185 | |
185 | 186 | //print '</td></tr></table>'; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function draw() |
62 | 62 | { |
63 | 63 | header('Cache-Control: Public, must-revalidate'); |
64 | - header("Content-type: text/html; charset=" . Globals::$conf->file->character_set_client); |
|
64 | + header("Content-type: text/html; charset=".Globals::$conf->file->character_set_client); |
|
65 | 65 | |
66 | 66 | // Need global variable $title to be defined by caller (like dol_loginfunction) |
67 | 67 | // Caller can also set $morelogincontent = array(['options']=>array('js'=>..., 'table'=>...); |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | $php_self = DolUtils::dol_escape_htmltag($_SERVER['PHP_SELF']); |
97 | - $php_self .= DolUtils::dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?' . DolUtils::dol_escape_htmltag($_SERVER["QUERY_STRING"]) : ''; |
|
97 | + $php_self .= DolUtils::dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.DolUtils::dol_escape_htmltag($_SERVER["QUERY_STRING"]) : ''; |
|
98 | 98 | if (!preg_match('/mainmenu=/', $php_self)) { |
99 | - $php_self .= (preg_match('/\?/', $php_self) ? '&' : '?') . 'mainmenu=home'; |
|
99 | + $php_self .= (preg_match('/\?/', $php_self) ? '&' : '?').'mainmenu=home'; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $this->url = $php_self; |
@@ -110,28 +110,28 @@ discard block |
||
110 | 110 | ); |
111 | 111 | */ |
112 | 112 | $arrayofjs = array( |
113 | - DOL_BASE_URI . '/includes/jstz/jstz.min.js' . (empty(Globals::$conf->dol_use_jmobile) ? '' : '?version=' . urlencode(DOL_VERSION)), |
|
114 | - DOL_BASE_URI . '/core/js/dst.js' . (empty(Globals::$conf->dol_use_jmobile) ? '' : '?version=' . urlencode(DOL_VERSION)) |
|
113 | + DOL_BASE_URI.'/includes/jstz/jstz.min.js'.(empty(Globals::$conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION)), |
|
114 | + DOL_BASE_URI.'/core/js/dst.js'.(empty(Globals::$conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION)) |
|
115 | 115 | ); |
116 | 116 | |
117 | 117 | // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. |
118 | 118 | // We must keep the @, some tools use it to know it is login page and find true dolibarr version. |
119 | 119 | // $titleofloginpage = Globals::$langs->trans('Login') . ' @ ' . $titletruedolibarrversion; |
120 | - $titleofloginpage = Globals::$langs->trans('Login') . ' @ ' . DOL_VERSION; |
|
120 | + $titleofloginpage = Globals::$langs->trans('Login').' @ '.DOL_VERSION; |
|
121 | 121 | |
122 | 122 | $disablenofollow = 1; |
123 | - if (!preg_match('/' . constant('DOL_APPLICATION_TITLE') . '/', $this->title)) { |
|
123 | + if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $this->title)) { |
|
124 | 124 | $disablenofollow = 0; |
125 | 125 | } |
126 | 126 | |
127 | 127 | print $this->top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow); |
128 | 128 | |
129 | 129 | |
130 | - $colorbackhmenu1 = '60,70,100'; // topmenu |
|
130 | + $colorbackhmenu1 = '60,70,100'; // topmenu |
|
131 | 131 | if (!isset(Globals::$conf->global->THEME_ELDY_TOPMENU_BACK1)) { |
132 | 132 | Globals::$conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; |
133 | 133 | } |
134 | 134 | $colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty(Globals::$conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : Globals::$conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1); |
135 | - $colorbackhmenu1 = join(',', DolUtils2::colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' |
|
135 | + $colorbackhmenu1 = join(',', DolUtils2::colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' |
|
136 | 136 | } |
137 | 137 | } |
@@ -70,21 +70,21 @@ discard block |
||
70 | 70 | if ($action == 'create' || filter_input(INPUT_POST, "addcat") == 'addcat') { |
71 | 71 | DolUtils::dol_set_focus('#label'); |
72 | 72 | |
73 | - print '<form action="' . $_SERVER['PHP_SELF'] . '?type=' . $type . '" method="POST">'; |
|
74 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
75 | - print '<input type="hidden" name="urlfrom" value="' . $urlfrom . '">'; |
|
73 | + print '<form action="'.$_SERVER['PHP_SELF'].'?type='.$type.'" method="POST">'; |
|
74 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
75 | + print '<input type="hidden" name="urlfrom" value="'.$urlfrom.'">'; |
|
76 | 76 | print '<input type="hidden" name="action" value="add">'; |
77 | 77 | print '<input type="hidden" name="addcat" value="addcat">'; |
78 | - print '<input type="hidden" name="id" value="' . DolUtils::GETPOST('origin', 'alpha') . '">'; |
|
79 | - print '<input type="hidden" name="type" value="' . $type . '">'; |
|
80 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
78 | + print '<input type="hidden" name="id" value="'.DolUtils::GETPOST('origin', 'alpha').'">'; |
|
79 | + print '<input type="hidden" name="type" value="'.$type.'">'; |
|
80 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
81 | 81 | if ($origin) |
82 | 82 | { |
83 | - print '<input type="hidden" name="origin" value="' . $origin . '">'; |
|
83 | + print '<input type="hidden" name="origin" value="'.$origin.'">'; |
|
84 | 84 | } |
85 | 85 | if ($catorigin) |
86 | 86 | { |
87 | - print '<input type="hidden" name="catorigin" value="' . $catorigin . '">'; |
|
87 | + print '<input type="hidden" name="catorigin" value="'.$catorigin.'">'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | print load_fiche_titre($langs->trans("CreateCat")); |
@@ -95,29 +95,29 @@ discard block |
||
95 | 95 | |
96 | 96 | // Ref |
97 | 97 | print '<tr>'; |
98 | - print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("Ref") . '</td><td><input id="label" class="minwidth100" name="label" value="' . $label . '">'; |
|
98 | + print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="minwidth100" name="label" value="'.$label.'">'; |
|
99 | 99 | print'</td></tr>'; |
100 | 100 | |
101 | 101 | // Description |
102 | - print '<tr><td class="tdtop">' . $langs->trans("Description") . '</td><td>'; |
|
102 | + print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>'; |
|
103 | 103 | //require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
104 | 104 | $doleditor = new DolEditor('description', $description, '', 200, 'dolibarr_notes', '', false, true, Globals::$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_6, '90%'); |
105 | 105 | $doleditor->Create(); |
106 | 106 | print '</td></tr>'; |
107 | 107 | |
108 | 108 | // Color |
109 | - print '<tr><td>' . $langs->trans("Color") . '</td><td>'; |
|
109 | + print '<tr><td>'.$langs->trans("Color").'</td><td>'; |
|
110 | 110 | print $formother->selectColor($color, 'color'); |
111 | 111 | print '</td></tr>'; |
112 | 112 | |
113 | 113 | // Parent category |
114 | - print '<tr><td>' . $langs->trans("AddIn") . '</td><td>'; |
|
114 | + print '<tr><td>'.$langs->trans("AddIn").'</td><td>'; |
|
115 | 115 | print $form->select_all_categories($type, $catorigin, 'parent'); |
116 | 116 | print ajax_combobox('parent'); |
117 | 117 | print '</td></tr>'; |
118 | 118 | |
119 | 119 | $parameters = array(); |
120 | - $reshook = Globals::$hookManager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
120 | + $reshook = Globals::$hookManager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
121 | 121 | print Globals::$hookManager->resPrint; |
122 | 122 | if (empty($reshook)) { |
123 | 123 | print $object->showOptionals($extrafields, 'edit'); |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | DolUtils::dol_fiche_end(''); |
129 | 129 | |
130 | 130 | print '<div class="center">'; |
131 | - print '<input type="submit" class="button" value="' . $langs->trans("CreateThisCat") . '" name="creation" />'; |
|
131 | + print '<input type="submit" class="button" value="'.$langs->trans("CreateThisCat").'" name="creation" />'; |
|
132 | 132 | print ' '; |
133 | - print '<input type="submit" class="button" value="' . $langs->trans("Cancel") . '" name="cancel" />'; |
|
133 | + print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel" />'; |
|
134 | 134 | print '</div>'; |
135 | 135 | |
136 | 136 | print '</form>'; |
@@ -144,34 +144,34 @@ discard block |
||
144 | 144 | // Action ajout d'une categorie |
145 | 145 | if ($this->cancel) { |
146 | 146 | if ($this->urlfrom) { |
147 | - header("Location: " . $urlfrom); |
|
147 | + header("Location: ".$urlfrom); |
|
148 | 148 | exit; |
149 | 149 | } |
150 | 150 | if ($idProdOrigin) { |
151 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idProdOrigin . '&type=' . $this->type); |
|
151 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$this->type); |
|
152 | 152 | exit; |
153 | 153 | } |
154 | 154 | if ($idCompanyOrigin) { |
155 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idCompanyOrigin . '&type=' . $this->type); |
|
155 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$this->type); |
|
156 | 156 | exit; |
157 | 157 | } |
158 | 158 | if ($idSupplierOrigin) { |
159 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idSupplierOrigin . '&type=' . $this->type); |
|
159 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$this->type); |
|
160 | 160 | exit; |
161 | 161 | } |
162 | 162 | if ($idMemberOrigin) { |
163 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idMemberOrigin . '&type=' . $this->type); |
|
163 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$this->type); |
|
164 | 164 | exit; |
165 | 165 | } |
166 | 166 | if ($idContactOrigin) { |
167 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idContactOrigin . '&type=' . $this->type); |
|
167 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$this->type); |
|
168 | 168 | exit; |
169 | 169 | } |
170 | 170 | if ($idProjectOrigin) { |
171 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idProjectOrigin . '&type=' . $this->type); |
|
171 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$this->type); |
|
172 | 172 | exit; |
173 | 173 | } |
174 | - header("Location: " . DOL_URL_ROOT . '/categories/index.php?leftmenu=cat&type=' . $this->type); |
|
174 | + header("Location: ".DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$this->type); |
|
175 | 175 | exit; |
176 | 176 | } |
177 | 177 | |
@@ -214,39 +214,39 @@ discard block |
||
214 | 214 | // Action confirmation de creation categorie |
215 | 215 | if ($this->action == 'confirmed') { |
216 | 216 | if ($urlfrom) { |
217 | - header("Location: " . $urlfrom); |
|
217 | + header("Location: ".$urlfrom); |
|
218 | 218 | exit; |
219 | 219 | } |
220 | 220 | if ($backtopage) { |
221 | - header("Location: " . $backtopage); |
|
221 | + header("Location: ".$backtopage); |
|
222 | 222 | exit; |
223 | 223 | } |
224 | 224 | if ($idProdOrigin) { |
225 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idProdOrigin . '&type=' . $this->type . '&mesg=' . urlencode(Globals::$langs->trans("CatCreated"))); |
|
225 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$this->type.'&mesg='.urlencode(Globals::$langs->trans("CatCreated"))); |
|
226 | 226 | exit; |
227 | 227 | } |
228 | 228 | if ($idCompanyOrigin) { |
229 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idCompanyOrigin . '&type=' . $this->type . '&mesg=' . urlencode(Globals::$langs->trans("CatCreated"))); |
|
229 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$this->type.'&mesg='.urlencode(Globals::$langs->trans("CatCreated"))); |
|
230 | 230 | exit; |
231 | 231 | } |
232 | 232 | if ($idSupplierOrigin) { |
233 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idSupplierOrigin . '&type=' . $this->type . '&mesg=' . urlencode(Globals::$langs->trans("CatCreated"))); |
|
233 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$this->type.'&mesg='.urlencode(Globals::$langs->trans("CatCreated"))); |
|
234 | 234 | exit; |
235 | 235 | } |
236 | 236 | if ($idMemberOrigin) { |
237 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idMemberOrigin . '&type=' . $this->type . '&mesg=' . urlencode(Globals::$langs->trans("CatCreated"))); |
|
237 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$this->type.'&mesg='.urlencode(Globals::$langs->trans("CatCreated"))); |
|
238 | 238 | exit; |
239 | 239 | } |
240 | 240 | if ($idContactOrigin) { |
241 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idContactOrigin . '&type=' . $this->type . '&mesg=' . urlencode(Globals::$langs->trans("CatCreated"))); |
|
241 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$this->type.'&mesg='.urlencode(Globals::$langs->trans("CatCreated"))); |
|
242 | 242 | exit; |
243 | 243 | } |
244 | 244 | if ($idProjectOrigin) { |
245 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $idProjectOrigin . '&type=' . $this->type . '&mesg=' . urlencode(Globals::$langs->trans("CatCreated"))); |
|
245 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$this->type.'&mesg='.urlencode(Globals::$langs->trans("CatCreated"))); |
|
246 | 246 | exit; |
247 | 247 | } |
248 | 248 | |
249 | - header("Location: " . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $result . '&type=' . $this->type); |
|
249 | + header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$result.'&type='.$this->type); |
|
250 | 250 | exit; |
251 | 251 | } |
252 | 252 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | if ($elementtype == 'contact') |
228 | 228 | $elementtype = 'socpeople'; |
229 | 229 | |
230 | - $table = $elementtype . '_extrafields'; |
|
230 | + $table = $elementtype.'_extrafields'; |
|
231 | 231 | if ($elementtype == 'categorie') |
232 | 232 | $table = 'categories_extrafields'; |
233 | 233 | |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | 'default' => $default_value |
273 | 273 | ); |
274 | 274 | |
275 | - $result = Config::$dbEngine->DDLAddField(MAIN_DB_PREFIX . $table, $attrname, $field_desc); |
|
275 | + $result = Config::$dbEngine->DDLAddField(MAIN_DB_PREFIX.$table, $attrname, $field_desc); |
|
276 | 276 | if ($result > 0) { |
277 | 277 | if ($unique) { |
278 | - $sql = "ALTER TABLE " . MAIN_DB_PREFIX . $table . " ADD UNIQUE INDEX uk_" . $table . "_" . $attrname . " (" . $attrname . ")"; |
|
278 | + $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")"; |
|
279 | 279 | $resql = Config::$dbEngine->query($sql, 1, 'dml'); |
280 | 280 | } |
281 | 281 | return 1; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $params = ''; |
345 | 345 | } |
346 | 346 | |
347 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "extrafields("; |
|
347 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields("; |
|
348 | 348 | $sql .= " name,"; |
349 | 349 | $sql .= " label,"; |
350 | 350 | $sql .= " type,"; |
@@ -367,30 +367,30 @@ discard block |
||
367 | 367 | $sql .= " enabled,"; |
368 | 368 | $sql .= " help"; |
369 | 369 | $sql .= " )"; |
370 | - $sql .= " VALUES('" . $attrname . "',"; |
|
371 | - $sql .= " '" . Config::$dbEngine->escape($label) . "',"; |
|
372 | - $sql .= " '" . Config::$dbEngine->escape($type) . "',"; |
|
373 | - $sql .= " " . $pos . ","; |
|
374 | - $sql .= " '" . Config::$dbEngine->escape($size) . "',"; |
|
375 | - $sql .= " " . ($entity === '' ? Globals::$conf->entity : $entity) . ","; |
|
376 | - $sql .= " '" . Config::$dbEngine->escape($elementtype) . "',"; |
|
377 | - $sql .= " " . $unique . ","; |
|
378 | - $sql .= " " . $required . ","; |
|
379 | - $sql .= " '" . Config::$dbEngine->escape($params) . "',"; |
|
380 | - $sql .= " " . $alwayseditable . ","; |
|
381 | - $sql .= " " . ($perms ? "'" . Config::$dbEngine->escape($perms) . "'" : "null") . ","; |
|
382 | - $sql .= " " . ($langfile ? "'" . Config::$dbEngine->escape($langfile) . "'" : "null") . ","; |
|
383 | - $sql .= " '" . Config::$dbEngine->escape($list) . "',"; |
|
384 | - $sql .= " " . ($default ? "'" . Config::$dbEngine->escape($default) . "'" : "null") . ","; |
|
385 | - $sql .= " " . ($computed ? "'" . Config::$dbEngine->escape($computed) . "'" : "null") . ","; |
|
386 | - $sql .= " " . (is_object(Globals::$user) ? Globals::$user->id : 0) . ","; |
|
387 | - $sql .= " " . (is_object(Globals::$user) ? Globals::$user->id : 0) . ","; |
|
388 | - $sql .= "'" . Config::$dbEngine->idate(dol_now()) . "',"; |
|
389 | - $sql .= " " . ($enabled ? "'" . Config::$dbEngine->escape($enabled) . "'" : "1") . ","; |
|
390 | - $sql .= " " . ($help ? "'" . Config::$dbEngine->escape($help) . "'" : "null"); |
|
370 | + $sql .= " VALUES('".$attrname."',"; |
|
371 | + $sql .= " '".Config::$dbEngine->escape($label)."',"; |
|
372 | + $sql .= " '".Config::$dbEngine->escape($type)."',"; |
|
373 | + $sql .= " ".$pos.","; |
|
374 | + $sql .= " '".Config::$dbEngine->escape($size)."',"; |
|
375 | + $sql .= " ".($entity === '' ? Globals::$conf->entity : $entity).","; |
|
376 | + $sql .= " '".Config::$dbEngine->escape($elementtype)."',"; |
|
377 | + $sql .= " ".$unique.","; |
|
378 | + $sql .= " ".$required.","; |
|
379 | + $sql .= " '".Config::$dbEngine->escape($params)."',"; |
|
380 | + $sql .= " ".$alwayseditable.","; |
|
381 | + $sql .= " ".($perms ? "'".Config::$dbEngine->escape($perms)."'" : "null").","; |
|
382 | + $sql .= " ".($langfile ? "'".Config::$dbEngine->escape($langfile)."'" : "null").","; |
|
383 | + $sql .= " '".Config::$dbEngine->escape($list)."',"; |
|
384 | + $sql .= " ".($default ? "'".Config::$dbEngine->escape($default)."'" : "null").","; |
|
385 | + $sql .= " ".($computed ? "'".Config::$dbEngine->escape($computed)."'" : "null").","; |
|
386 | + $sql .= " ".(is_object(Globals::$user) ? Globals::$user->id : 0).","; |
|
387 | + $sql .= " ".(is_object(Globals::$user) ? Globals::$user->id : 0).","; |
|
388 | + $sql .= "'".Config::$dbEngine->idate(dol_now())."',"; |
|
389 | + $sql .= " ".($enabled ? "'".Config::$dbEngine->escape($enabled)."'" : "1").","; |
|
390 | + $sql .= " ".($help ? "'".Config::$dbEngine->escape($help)."'" : "null"); |
|
391 | 391 | $sql .= ')'; |
392 | 392 | |
393 | - DolUtils::dol_syslog(get_class($this) . "::create_label", LOG_DEBUG); |
|
393 | + DolUtils::dol_syslog(get_class($this)."::create_label", LOG_DEBUG); |
|
394 | 394 | if (Config::$dbEngine->query($sql)) { |
395 | 395 | return 1; |
396 | 396 | } else { |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | if ($elementtype == 'contact') |
416 | 416 | $elementtype = 'socpeople'; |
417 | 417 | |
418 | - $table = $elementtype . '_extrafields'; |
|
418 | + $table = $elementtype.'_extrafields'; |
|
419 | 419 | if ($elementtype == 'categorie') |
420 | 420 | $table = 'categories_extrafields'; |
421 | 421 | |
@@ -430,15 +430,15 @@ discard block |
||
430 | 430 | |
431 | 431 | if (!$error) { |
432 | 432 | $sql = "SELECT COUNT(rowid) as nb"; |
433 | - $sql .= " FROM " . MAIN_DB_PREFIX . "extrafields"; |
|
434 | - $sql .= " WHERE elementtype = '" . $elementtype . "'"; |
|
435 | - $sql .= " AND name = '" . $attrname . "'"; |
|
433 | + $sql .= " FROM ".MAIN_DB_PREFIX."extrafields"; |
|
434 | + $sql .= " WHERE elementtype = '".$elementtype."'"; |
|
435 | + $sql .= " AND name = '".$attrname."'"; |
|
436 | 436 | //$sql.= " AND entity IN (0,".Globals::$conf->entity.")"; Do not test on entity here. We want to see if there is still on field remaning in other entities before deleting field in table |
437 | 437 | $resql = Config::$dbEngine->query($sql); |
438 | 438 | if ($resql) { |
439 | 439 | $obj = Config::$dbEngine->fetch_object($resql); |
440 | 440 | if ($obj->nb <= 0) { |
441 | - $result = Config::$dbEngine->DDLDropField(MAIN_DB_PREFIX . $table, $attrname); // This also drop the unique key |
|
441 | + $result = Config::$dbEngine->DDLDropField(MAIN_DB_PREFIX.$table, $attrname); // This also drop the unique key |
|
442 | 442 | if ($result < 0) { |
443 | 443 | $this->error = Config::$dbEngine->lasterror(); |
444 | 444 | $error++; |
@@ -472,12 +472,12 @@ discard block |
||
472 | 472 | $elementtype = 'socpeople'; |
473 | 473 | |
474 | 474 | if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname)) { |
475 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "extrafields"; |
|
476 | - $sql .= " WHERE name = '" . $attrname . "'"; |
|
477 | - $sql .= " AND entity IN (0," . Globals::$conf->entity . ')'; |
|
478 | - $sql .= " AND elementtype = '" . $elementtype . "'"; |
|
475 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; |
|
476 | + $sql .= " WHERE name = '".$attrname."'"; |
|
477 | + $sql .= " AND entity IN (0,".Globals::$conf->entity.')'; |
|
478 | + $sql .= " AND elementtype = '".$elementtype."'"; |
|
479 | 479 | |
480 | - DolUtils::dol_syslog(get_class($this) . "::delete_label", LOG_DEBUG); |
|
480 | + DolUtils::dol_syslog(get_class($this)."::delete_label", LOG_DEBUG); |
|
481 | 481 | $resql = Config::$dbEngine->query($sql); |
482 | 482 | if ($resql) { |
483 | 483 | return 1; |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | if ($elementtype == 'contact') |
522 | 522 | $elementtype = 'socpeople'; |
523 | 523 | |
524 | - $table = $elementtype . '_extrafields'; |
|
524 | + $table = $elementtype.'_extrafields'; |
|
525 | 525 | if ($elementtype == 'categorie') |
526 | 526 | $table = 'categories_extrafields'; |
527 | 527 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | $field_desc = array('type' => $typedb, 'value' => $lengthdb, 'null' => ($required ? 'NOT NULL' : 'NULL'), 'default' => $default); |
560 | 560 | |
561 | 561 | if ($type != 'separate') { // No table update when separate type |
562 | - $result = Config::$dbEngine->DDLUpdateField(MAIN_DB_PREFIX . $table, $attrname, $field_desc); |
|
562 | + $result = Config::$dbEngine->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc); |
|
563 | 563 | } |
564 | 564 | if ($result > 0 || $type == 'separate') { |
565 | 565 | if ($label) { |
@@ -568,11 +568,11 @@ discard block |
||
568 | 568 | if ($result > 0) { |
569 | 569 | $sql = ''; |
570 | 570 | if ($unique) { |
571 | - $sql = "ALTER TABLE " . MAIN_DB_PREFIX . $table . " ADD UNIQUE INDEX uk_" . $table . "_" . $attrname . " (" . $attrname . ")"; |
|
571 | + $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")"; |
|
572 | 572 | } else { |
573 | - $sql = "ALTER TABLE " . MAIN_DB_PREFIX . $table . " DROP INDEX uk_" . $table . "_" . $attrname; |
|
573 | + $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." DROP INDEX uk_".$table."_".$attrname; |
|
574 | 574 | } |
575 | - DolUtils::dol_syslog(get_class($this) . '::update', LOG_DEBUG); |
|
575 | + DolUtils::dol_syslog(get_class($this).'::update', LOG_DEBUG); |
|
576 | 576 | $resql = Config::$dbEngine->query($sql, 1, 'dml'); |
577 | 577 | return 1; |
578 | 578 | } else { |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | { |
618 | 618 | // phpcs:enable |
619 | 619 | // global $conf, $user; |
620 | - DolUtils::dol_syslog(get_class($this) . "::update_label " . $attrname . ", " . $label . ", " . $type . ", " . $size . ", " . $elementtype . ", " . $unique . ", " . $required . ", " . $pos . ", " . $alwayseditable . ", " . $perms . ", " . $list . ", " . $default . ", " . $computed . ", " . $entity . ", " . $langfile . ", " . $enabled . ", " . $totalizable); |
|
620 | + DolUtils::dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled.", ".$totalizable); |
|
621 | 621 | |
622 | 622 | // Clean parameters |
623 | 623 | if ($elementtype == 'thirdparty') |
@@ -652,21 +652,21 @@ discard block |
||
652 | 652 | |
653 | 653 | if ($entity === '' || $entity != '0') { |
654 | 654 | // We dont want on all entities, we delete all and current |
655 | - $sql_del = "DELETE FROM " . MAIN_DB_PREFIX . "extrafields"; |
|
656 | - $sql_del .= " WHERE name = '" . $attrname . "'"; |
|
657 | - $sql_del .= " AND entity IN (0, " . ($entity === '' ? Globals::$conf->entity : $entity) . ")"; |
|
658 | - $sql_del .= " AND elementtype = '" . $elementtype . "'"; |
|
655 | + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; |
|
656 | + $sql_del .= " WHERE name = '".$attrname."'"; |
|
657 | + $sql_del .= " AND entity IN (0, ".($entity === '' ? Globals::$conf->entity : $entity).")"; |
|
658 | + $sql_del .= " AND elementtype = '".$elementtype."'"; |
|
659 | 659 | } else { |
660 | 660 | // We want on all entities ($entities = '0'), we delete on all only (we keep setup specific to each entity) |
661 | - $sql_del = "DELETE FROM " . MAIN_DB_PREFIX . "extrafields"; |
|
662 | - $sql_del .= " WHERE name = '" . $attrname . "'"; |
|
661 | + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; |
|
662 | + $sql_del .= " WHERE name = '".$attrname."'"; |
|
663 | 663 | $sql_del .= " AND entity = 0"; |
664 | - $sql_del .= " AND elementtype = '" . $elementtype . "'"; |
|
664 | + $sql_del .= " AND elementtype = '".$elementtype."'"; |
|
665 | 665 | } |
666 | 666 | $resql1 = Config::$dbEngine->query($sql_del); |
667 | 667 | |
668 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "extrafields("; |
|
669 | - $sql .= " name,"; // This is code |
|
668 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields("; |
|
669 | + $sql .= " name,"; // This is code |
|
670 | 670 | $sql .= " entity,"; |
671 | 671 | $sql .= " label,"; |
672 | 672 | $sql .= " type,"; |
@@ -689,28 +689,28 @@ discard block |
||
689 | 689 | $sql .= " enabled,"; |
690 | 690 | $sql .= " help"; |
691 | 691 | $sql .= ") VALUES ("; |
692 | - $sql .= "'" . $attrname . "',"; |
|
693 | - $sql .= " " . ($entity === '' ? Globals::$conf->entity : $entity) . ","; |
|
694 | - $sql .= " '" . Config::$dbEngine->escape($label) . "',"; |
|
695 | - $sql .= " '" . Config::$dbEngine->escape($type) . "',"; |
|
696 | - $sql .= " '" . Config::$dbEngine->escape($size) . "',"; |
|
697 | - $sql .= " '" . Config::$dbEngine->escape($elementtype) . "',"; |
|
698 | - $sql .= " " . $unique . ","; |
|
699 | - $sql .= " " . $required . ","; |
|
700 | - $sql .= " " . ($perms ? "'" . Config::$dbEngine->escape($perms) . "'" : "null") . ","; |
|
701 | - $sql .= " " . ($langfile ? "'" . Config::$dbEngine->escape($langfile) . "'" : "null") . ","; |
|
702 | - $sql .= " " . $pos . ","; |
|
703 | - $sql .= " '" . Config::$dbEngine->escape($alwayseditable) . "',"; |
|
704 | - $sql .= " '" . Config::$dbEngine->escape($params) . "',"; |
|
705 | - $sql .= " '" . Config::$dbEngine->escape($list) . "', "; |
|
706 | - $sql .= " " . $totalizable . ","; |
|
707 | - $sql .= " " . (($default != '') ? "'" . Config::$dbEngine->escape($default) . "'" : "null") . ","; |
|
708 | - $sql .= " " . ($computed ? "'" . Config::$dbEngine->escape($computed) . "'" : "null") . ","; |
|
709 | - $sql .= " " . Globals::$user->id . ","; |
|
710 | - $sql .= " " . Globals::$user->id . ","; |
|
711 | - $sql .= "'" . Config::$dbEngine->idate(dol_now()) . "',"; |
|
712 | - $sql .= "'" . Config::$dbEngine->escape($enabled) . "',"; |
|
713 | - $sql .= " " . ($help ? "'" . Config::$dbEngine->escape($help) . "'" : "null"); |
|
692 | + $sql .= "'".$attrname."',"; |
|
693 | + $sql .= " ".($entity === '' ? Globals::$conf->entity : $entity).","; |
|
694 | + $sql .= " '".Config::$dbEngine->escape($label)."',"; |
|
695 | + $sql .= " '".Config::$dbEngine->escape($type)."',"; |
|
696 | + $sql .= " '".Config::$dbEngine->escape($size)."',"; |
|
697 | + $sql .= " '".Config::$dbEngine->escape($elementtype)."',"; |
|
698 | + $sql .= " ".$unique.","; |
|
699 | + $sql .= " ".$required.","; |
|
700 | + $sql .= " ".($perms ? "'".Config::$dbEngine->escape($perms)."'" : "null").","; |
|
701 | + $sql .= " ".($langfile ? "'".Config::$dbEngine->escape($langfile)."'" : "null").","; |
|
702 | + $sql .= " ".$pos.","; |
|
703 | + $sql .= " '".Config::$dbEngine->escape($alwayseditable)."',"; |
|
704 | + $sql .= " '".Config::$dbEngine->escape($params)."',"; |
|
705 | + $sql .= " '".Config::$dbEngine->escape($list)."', "; |
|
706 | + $sql .= " ".$totalizable.","; |
|
707 | + $sql .= " ".(($default != '') ? "'".Config::$dbEngine->escape($default)."'" : "null").","; |
|
708 | + $sql .= " ".($computed ? "'".Config::$dbEngine->escape($computed)."'" : "null").","; |
|
709 | + $sql .= " ".Globals::$user->id.","; |
|
710 | + $sql .= " ".Globals::$user->id.","; |
|
711 | + $sql .= "'".Config::$dbEngine->idate(dol_now())."',"; |
|
712 | + $sql .= "'".Config::$dbEngine->escape($enabled)."',"; |
|
713 | + $sql .= " ".($help ? "'".Config::$dbEngine->escape($help)."'" : "null"); |
|
714 | 714 | $sql .= ")"; |
715 | 715 | |
716 | 716 | $resql2 = Config::$dbEngine->query($sql); |
@@ -754,14 +754,14 @@ discard block |
||
754 | 754 | $array_name_label = array(); |
755 | 755 | |
756 | 756 | // To avoid conflicts with external modules. TODO Remove this. |
757 | - if (!$forceload &&!empty(Globals::$conf->global->MAIN_EXTRAFIELDS_DISABLED)) |
|
757 | + if (!$forceload && !empty(Globals::$conf->global->MAIN_EXTRAFIELDS_DISABLED)) |
|
758 | 758 | return $array_name_label; |
759 | 759 | |
760 | 760 | // Set array of label of entity |
761 | 761 | // TODO Remove completely loading of label. This should be done by presentation. |
762 | 762 | $labelmulticompany = array(); |
763 | 763 | if (!empty(Globals::$conf->multicompany->enabled)) { |
764 | - $sql_entity_name = 'SELECT rowid, label FROM ' . MAIN_DB_PREFIX . 'entity WHERE rowid in (0,' . Globals::$conf->entity . ')'; |
|
764 | + $sql_entity_name = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid in (0,'.Globals::$conf->entity.')'; |
|
765 | 765 | $resql_entity_name = Config::$dbEngine->query($sql_entity_name); |
766 | 766 | if ($resql_entity_name) { |
767 | 767 | while ($obj = Config::$dbEngine->fetch_object($resql_entity_name)) { |
@@ -771,13 +771,13 @@ discard block |
||
771 | 771 | } |
772 | 772 | |
773 | 773 | // We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management. |
774 | - DolUtils::dol_syslog("fetch_name_optionals_label elementtype=" . $elementtype); |
|
774 | + DolUtils::dol_syslog("fetch_name_optionals_label elementtype=".$elementtype); |
|
775 | 775 | |
776 | 776 | $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help"; |
777 | - $sql .= " FROM " . MAIN_DB_PREFIX . "extrafields"; |
|
778 | - $sql .= " WHERE entity IN (0," . Globals::$conf->entity . ")"; |
|
777 | + $sql .= " FROM ".MAIN_DB_PREFIX."extrafields"; |
|
778 | + $sql .= " WHERE entity IN (0,".Globals::$conf->entity.")"; |
|
779 | 779 | if ($elementtype) |
780 | - $sql .= " AND elementtype = '" . $elementtype . "'"; // Filed with object->table_element |
|
780 | + $sql .= " AND elementtype = '".$elementtype."'"; // Filed with object->table_element |
|
781 | 781 | $sql .= " ORDER BY pos"; |
782 | 782 | |
783 | 783 | $resql = Config::$dbEngine->select($sql); |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | $this->attribute_list[$tab->name] = $tab->list; |
810 | 810 | $this->attribute_totalizable[$tab->name] = $tab->totalizable; |
811 | 811 | $this->attribute_entityid[$tab->name] = $tab->entity; |
812 | - $this->attribute_entitylabel[$tab->name] = (empty($labelmulticompany[$tab->entity]) ? 'Entity' . $tab->entity : $labelmulticompany[$tab->entity]); |
|
812 | + $this->attribute_entitylabel[$tab->name] = (empty($labelmulticompany[$tab->entity]) ? 'Entity'.$tab->entity : $labelmulticompany[$tab->entity]); |
|
813 | 813 | |
814 | 814 | // New usage |
815 | 815 | $this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type; |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | $this->attributes[$tab->elementtype]['list'][$tab->name] = $tab->list; |
829 | 829 | $this->attributes[$tab->elementtype]['totalizable'][$tab->name] = $tab->totalizable; |
830 | 830 | $this->attributes[$tab->elementtype]['entityid'][$tab->name] = $tab->entity; |
831 | - $this->attributes[$tab->elementtype]['entitylabel'][$tab->name] = (empty($labelmulticompany[$tab->entity]) ? 'Entity' . $tab->entity : $labelmulticompany[$tab->entity]); |
|
831 | + $this->attributes[$tab->elementtype]['entitylabel'][$tab->name] = (empty($labelmulticompany[$tab->entity]) ? 'Entity'.$tab->entity : $labelmulticompany[$tab->entity]); |
|
832 | 832 | $this->attributes[$tab->elementtype]['enabled'][$tab->name] = $tab->enabled; |
833 | 833 | $this->attributes[$tab->elementtype]['help'][$tab->name] = $tab->help; |
834 | 834 | } |
@@ -861,13 +861,13 @@ discard block |
||
861 | 861 | // global $conf, $langs, $form; |
862 | 862 | |
863 | 863 | if (!is_object($form)) { |
864 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; |
|
864 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; |
|
865 | 865 | $form = new Form(Config::$dbEngine); |
866 | 866 | } |
867 | 867 | |
868 | 868 | $out = ''; |
869 | 869 | |
870 | - $keyprefix = $keyprefix . 'options_'; // Because we work on extrafields |
|
870 | + $keyprefix = $keyprefix.'options_'; // Because we work on extrafields |
|
871 | 871 | |
872 | 872 | if (!empty($extrafieldsobjectkey)) { |
873 | 873 | $label = $this->attributes[$extrafieldsobjectkey]['label'][$key]; |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1); |
884 | 884 | $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; |
885 | 885 | $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; |
886 | - $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
886 | + $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
887 | 887 | } else { // Old usage |
888 | 888 | $label = $this->attribute_label[$key]; |
889 | 889 | $type = $this->attribute_type[$key]; |
@@ -897,12 +897,12 @@ discard block |
||
897 | 897 | $langfile = $this->attribute_langfile[$key]; |
898 | 898 | $list = $this->attribute_list[$key]; |
899 | 899 | $totalizable = $this->attribute_totalizable[$key]; |
900 | - $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
900 | + $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
901 | 901 | } |
902 | 902 | |
903 | 903 | if ($computed) { |
904 | 904 | if (!preg_match('/^search_/', $keyprefix)) |
905 | - return '<span class="opacitymedium">' . Globals::$langs->trans("AutomaticallyCalculated") . '</span>'; |
|
905 | + return '<span class="opacitymedium">'.Globals::$langs->trans("AutomaticallyCalculated").'</span>'; |
|
906 | 906 | else |
907 | 907 | return ''; |
908 | 908 | } |
@@ -942,31 +942,31 @@ discard block |
||
942 | 942 | $value = '-1'; |
943 | 943 | |
944 | 944 | // TODO Must also support $moreparam |
945 | - $out = $form->selectDate($value, $keyprefix . $key . $keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); |
|
945 | + $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); |
|
946 | 946 | } |
947 | 947 | elseif (in_array($type, array('int', 'integer'))) { |
948 | 948 | $tmp = explode(',', $size); |
949 | 949 | $newsize = $tmp[0]; |
950 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" maxlength="' . $newsize . '" value="' . dol_escape_htmltag($value) . '"' . ($moreparam ? $moreparam : '') . '>'; |
|
950 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').'>'; |
|
951 | 951 | } elseif (preg_match('/varchar/', $type)) { |
952 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" maxlength="' . $size . '" value="' . dol_escape_htmltag($value) . '"' . ($moreparam ? $moreparam : '') . '>'; |
|
952 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').'>'; |
|
953 | 953 | } elseif (in_array($type, array('mail', 'phone', 'url'))) { |
954 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . dol_escape_htmltag($value) . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
954 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>'; |
|
955 | 955 | } elseif ($type == 'text') { |
956 | 956 | if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field |
957 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
958 | - $doleditor = new DolEditor($keyprefix . $key . $keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%'); |
|
957 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
958 | + $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%'); |
|
959 | 959 | $out = $doleditor->Create(1); |
960 | 960 | } else { |
961 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . dol_escape_htmltag($value) . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
961 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>'; |
|
962 | 962 | } |
963 | 963 | } elseif ($type == 'html') { |
964 | 964 | if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field |
965 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
966 | - $doleditor = new DolEditor($keyprefix . $key . $keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, !empty(Globals::$conf->fckeditor->enabled) && Globals::$conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%'); |
|
965 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
966 | + $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, !empty(Globals::$conf->fckeditor->enabled) && Globals::$conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%'); |
|
967 | 967 | $out = $doleditor->Create(1); |
968 | 968 | } else { |
969 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . dol_escape_htmltag($value) . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
969 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>'; |
|
970 | 970 | } |
971 | 971 | } elseif ($type == 'boolean') { |
972 | 972 | $checked = ''; |
@@ -975,33 +975,33 @@ discard block |
||
975 | 975 | } else { |
976 | 976 | $checked = ' value="1" '; |
977 | 977 | } |
978 | - $out = '<input type="checkbox" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" ' . $checked . ' ' . ($moreparam ? $moreparam : '') . '>'; |
|
978 | + $out = '<input type="checkbox" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam ? $moreparam : '').'>'; |
|
979 | 979 | } elseif ($type == 'price') { |
980 | 980 | if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. |
981 | 981 | $value = price($value); |
982 | 982 | } |
983 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . $value . '" ' . ($moreparam ? $moreparam : '') . '> ' . Globals::$langs->getCurrencySymbol(Globals::$conf->currency); |
|
983 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'> '.Globals::$langs->getCurrencySymbol(Globals::$conf->currency); |
|
984 | 984 | } elseif ($type == 'double') { |
985 | 985 | if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. |
986 | 986 | $value = price($value); |
987 | 987 | } |
988 | - $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . $value . '" ' . ($moreparam ? $moreparam : '') . '> '; |
|
988 | + $out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'> '; |
|
989 | 989 | } elseif ($type == 'select') { |
990 | 990 | $out = ''; |
991 | - if (!empty(Globals::$conf->use_javascript_ajax) &&!empty(Globals::$conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) { |
|
992 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
993 | - $out .= ajax_combobox($keyprefix . $key . $keysuffix, array(), 0); |
|
991 | + if (!empty(Globals::$conf->use_javascript_ajax) && !empty(Globals::$conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) { |
|
992 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
993 | + $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); |
|
994 | 994 | } |
995 | 995 | |
996 | - $out .= '<select class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
996 | + $out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>'; |
|
997 | 997 | $out .= '<option value="0"> </option>'; |
998 | 998 | foreach ($param['options'] as $key => $val) { |
999 | 999 | if ((string) $key == '') |
1000 | 1000 | continue; |
1001 | 1001 | list($val, $parent) = explode('|', $val); |
1002 | - $out .= '<option value="' . $key . '"'; |
|
1002 | + $out .= '<option value="'.$key.'"'; |
|
1003 | 1003 | $out .= (((string) $value == (string) $key) ? ' selected' : ''); |
1004 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
1004 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
1005 | 1005 | $out .= '>'; |
1006 | 1006 | if ($langfile && $val) |
1007 | 1007 | $out .= Globals::$langs->trans($val); |
@@ -1013,12 +1013,12 @@ discard block |
||
1013 | 1013 | } |
1014 | 1014 | elseif ($type == 'sellist') { |
1015 | 1015 | $out = ''; |
1016 | - if (!empty(Globals::$conf->use_javascript_ajax) &&!empty(Globals::$conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) { |
|
1017 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1018 | - $out .= ajax_combobox($keyprefix . $key . $keysuffix, array(), 0); |
|
1016 | + if (!empty(Globals::$conf->use_javascript_ajax) && !empty(Globals::$conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) { |
|
1017 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
1018 | + $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | - $out .= '<select class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
1021 | + $out .= '<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : '').'>'; |
|
1022 | 1022 | if (is_array($param['options'])) { |
1023 | 1023 | $param_list = array_keys($param['options']); |
1024 | 1024 | $InfoFieldList = explode(":", $param_list[0]); |
@@ -1029,19 +1029,19 @@ discard block |
||
1029 | 1029 | // 2 : key fields name (if differ of rowid) |
1030 | 1030 | // 3 : key field parent (for dependent lists) |
1031 | 1031 | // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value |
1032 | - $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2] . ' as rowid'); |
|
1032 | + $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid'); |
|
1033 | 1033 | |
1034 | 1034 | |
1035 | 1035 | if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) { |
1036 | 1036 | if (strpos($InfoFieldList[4], 'extra.') !== false) { |
1037 | - $keyList = 'main.' . $InfoFieldList[2] . ' as rowid'; |
|
1037 | + $keyList = 'main.'.$InfoFieldList[2].' as rowid'; |
|
1038 | 1038 | } else { |
1039 | - $keyList = $InfoFieldList[2] . ' as rowid'; |
|
1039 | + $keyList = $InfoFieldList[2].' as rowid'; |
|
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) { |
1043 | 1043 | list($parentName, $parentField) = explode('|', $InfoFieldList[3]); |
1044 | - $keyList .= ', ' . $parentField; |
|
1044 | + $keyList .= ', '.$parentField; |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | $fields_label = explode('|', $InfoFieldList[1]); |
@@ -1051,8 +1051,8 @@ discard block |
||
1051 | 1051 | } |
1052 | 1052 | |
1053 | 1053 | $sqlwhere = ''; |
1054 | - $sql = 'SELECT ' . $keyList; |
|
1055 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; |
|
1054 | + $sql = 'SELECT '.$keyList; |
|
1055 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; |
|
1056 | 1056 | if (!empty($InfoFieldList[4])) { |
1057 | 1057 | // can use curent entity filter |
1058 | 1058 | if (strpos($InfoFieldList[4], '$ENTITY$') !== false) { |
@@ -1071,24 +1071,24 @@ discard block |
||
1071 | 1071 | } |
1072 | 1072 | //We have to join on extrafield table |
1073 | 1073 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
1074 | - $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra'; |
|
1075 | - $sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4]; |
|
1074 | + $sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra'; |
|
1075 | + $sqlwhere .= ' WHERE extra.fk_object=main.'.$InfoFieldList[2].' AND '.$InfoFieldList[4]; |
|
1076 | 1076 | } else { |
1077 | - $sqlwhere .= ' WHERE ' . $InfoFieldList[4]; |
|
1077 | + $sqlwhere .= ' WHERE '.$InfoFieldList[4]; |
|
1078 | 1078 | } |
1079 | 1079 | } else { |
1080 | 1080 | $sqlwhere .= ' WHERE 1=1'; |
1081 | 1081 | } |
1082 | 1082 | // Some tables may have field, some other not. For the moment we disable it. |
1083 | 1083 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
1084 | - $sqlwhere .= ' AND entity = ' . Globals::$conf->entity; |
|
1084 | + $sqlwhere .= ' AND entity = '.Globals::$conf->entity; |
|
1085 | 1085 | } |
1086 | 1086 | $sql .= $sqlwhere; |
1087 | 1087 | //print $sql; |
1088 | 1088 | |
1089 | - $sql .= ' ORDER BY ' . implode(', ', $fields_label); |
|
1089 | + $sql .= ' ORDER BY '.implode(', ', $fields_label); |
|
1090 | 1090 | |
1091 | - DolUtils::dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
1091 | + DolUtils::dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
1092 | 1092 | $resql = Config::$dbEngine->query($sql); |
1093 | 1093 | if ($resql) { |
1094 | 1094 | $out .= '<option value="0"> </option>'; |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | if (is_array($fields_label)) { |
1105 | 1105 | $notrans = true; |
1106 | 1106 | foreach ($fields_label as $field_toshow) { |
1107 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
1107 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
1108 | 1108 | } |
1109 | 1109 | } else { |
1110 | 1110 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -1115,12 +1115,12 @@ discard block |
||
1115 | 1115 | foreach ($fields_label as $field_toshow) { |
1116 | 1116 | $translabel = Globals::$langs->trans($obj->$field_toshow); |
1117 | 1117 | if ($translabel != $obj->$field_toshow) { |
1118 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
1118 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
1119 | 1119 | } else { |
1120 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
1120 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
1121 | 1121 | } |
1122 | 1122 | } |
1123 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
1123 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
1124 | 1124 | } else { |
1125 | 1125 | if (!$notrans) { |
1126 | 1126 | $translabel = Globals::$langs->trans($obj->{$InfoFieldList[1]}); |
@@ -1133,38 +1133,38 @@ discard block |
||
1133 | 1133 | if (empty($labeltoshow)) |
1134 | 1134 | $labeltoshow = '(not defined)'; |
1135 | 1135 | if ($value == $obj->rowid) { |
1136 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
1136 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | if (!empty($InfoFieldList[3]) && $parentField) { |
1140 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
1140 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
1143 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
1144 | 1144 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
1145 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
1146 | - $out .= '>' . $labeltoshow . '</option>'; |
|
1145 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
1146 | + $out .= '>'.$labeltoshow.'</option>'; |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | $i++; |
1150 | 1150 | } |
1151 | 1151 | Config::$dbEngine->free($resql); |
1152 | 1152 | } else { |
1153 | - print 'Error in request ' . $sql . ' ' . Config::$dbEngine->lasterror() . '. Check setup of extra parameters.<br>'; |
|
1153 | + print 'Error in request '.$sql.' '.Config::$dbEngine->lasterror().'. Check setup of extra parameters.<br>'; |
|
1154 | 1154 | } |
1155 | 1155 | } |
1156 | 1156 | $out .= '</select>'; |
1157 | 1157 | } elseif ($type == 'checkbox') { |
1158 | 1158 | $value_arr = explode(',', $value); |
1159 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, (empty($param['options']) ? null : $param['options']), $value_arr, '', 0, '', 0, '100%'); |
|
1159 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ? null : $param['options']), $value_arr, '', 0, '', 0, '100%'); |
|
1160 | 1160 | } elseif ($type == 'radio') { |
1161 | 1161 | $out = ''; |
1162 | 1162 | foreach ($param['options'] as $keyopt => $val) { |
1163 | - $out .= '<input class="flat ' . $morecss . '" type="radio" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" ' . ($moreparam ? $moreparam : ''); |
|
1164 | - $out .= ' value="' . $keyopt . '"'; |
|
1165 | - $out .= ' id="' . $keyprefix . $key . $keysuffix . '_' . $keyopt . '"'; |
|
1163 | + $out .= '<input class="flat '.$morecss.'" type="radio" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam ? $moreparam : ''); |
|
1164 | + $out .= ' value="'.$keyopt.'"'; |
|
1165 | + $out .= ' id="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'"'; |
|
1166 | 1166 | $out .= ($value == $keyopt ? 'checked' : ''); |
1167 | - $out .= '/><label for="' . $keyprefix . $key . $keysuffix . '_' . $keyopt . '">' . $val . '</label><br>'; |
|
1167 | + $out .= '/><label for="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'">'.$val.'</label><br>'; |
|
1168 | 1168 | } |
1169 | 1169 | } elseif ($type == 'chkbxlst') { |
1170 | 1170 | if (is_array($value)) { |
@@ -1183,17 +1183,17 @@ discard block |
||
1183 | 1183 | // 2 : key fields name (if differ of rowid) |
1184 | 1184 | // 3 : key field parent (for dependent lists) |
1185 | 1185 | // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value |
1186 | - $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2] . ' as rowid'); |
|
1186 | + $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid'); |
|
1187 | 1187 | |
1188 | 1188 | if (count($InfoFieldList) > 3 && !empty($InfoFieldList[3])) { |
1189 | - list ( $parentName, $parentField ) = explode('|', $InfoFieldList[3]); |
|
1190 | - $keyList .= ', ' . $parentField; |
|
1189 | + list ($parentName, $parentField) = explode('|', $InfoFieldList[3]); |
|
1190 | + $keyList .= ', '.$parentField; |
|
1191 | 1191 | } |
1192 | 1192 | if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) { |
1193 | 1193 | if (strpos($InfoFieldList[4], 'extra.') !== false) { |
1194 | - $keyList = 'main.' . $InfoFieldList[2] . ' as rowid'; |
|
1194 | + $keyList = 'main.'.$InfoFieldList[2].' as rowid'; |
|
1195 | 1195 | } else { |
1196 | - $keyList = $InfoFieldList[2] . ' as rowid'; |
|
1196 | + $keyList = $InfoFieldList[2].' as rowid'; |
|
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | |
@@ -1204,8 +1204,8 @@ discard block |
||
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | $sqlwhere = ''; |
1207 | - $sql = 'SELECT ' . $keyList; |
|
1208 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; |
|
1207 | + $sql = 'SELECT '.$keyList; |
|
1208 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; |
|
1209 | 1209 | if (!empty($InfoFieldList[4])) { |
1210 | 1210 | |
1211 | 1211 | // can use SELECT request |
@@ -1229,11 +1229,11 @@ discard block |
||
1229 | 1229 | // Init des compteurs |
1230 | 1230 | $nbPregRepl = $nbPregSel = 0; |
1231 | 1231 | // On retire toutes les parenthèses sans = avant |
1232 | - $InfoFieldList[4] = preg_replace('#([^=])(\([^)^(]*(' . $word . ')[^)^(]*\))#', '$1 $3 ', $InfoFieldList[4], -1, $nbPregRepl); |
|
1232 | + $InfoFieldList[4] = preg_replace('#([^=])(\([^)^(]*('.$word.')[^)^(]*\))#', '$1 $3 ', $InfoFieldList[4], -1, $nbPregRepl); |
|
1233 | 1233 | // On retire les espaces autour des = et parenthèses |
1234 | 1234 | $InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]); |
1235 | 1235 | // On retire toutes les parenthèses avec = avant |
1236 | - $InfoFieldList[4] = preg_replace('#\b[a-zA-Z0-9-\.-_]+\b=\([^)^(]*(' . $word . ')[^)^(]*\)#', '$1 ', $InfoFieldList[4], -1, $nbPregSel); |
|
1236 | + $InfoFieldList[4] = preg_replace('#\b[a-zA-Z0-9-\.-_]+\b=\([^)^(]*('.$word.')[^)^(]*\)#', '$1 ', $InfoFieldList[4], -1, $nbPregSel); |
|
1237 | 1237 | // On retire les espaces autour des = et parenthèses |
1238 | 1238 | $InfoFieldList[4] = preg_replace('# *(=|\(|\)) *#', '$1', $InfoFieldList[4]); |
1239 | 1239 | |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | // Si l'on a un AND ou un OR, avant ou après |
1245 | - preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition); |
|
1245 | + preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#', $InfoFieldList[4], $matchCondition); |
|
1246 | 1246 | while (!empty($matchCondition[0])) { |
1247 | 1247 | // If the two sides differ but are not empty |
1248 | 1248 | if (!empty($matchCondition[1]) && !empty($matchCondition[3]) && $matchCondition[1] != $matchCondition[3]) { |
@@ -1250,10 +1250,10 @@ discard block |
||
1250 | 1250 | $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); |
1251 | 1251 | } else { |
1252 | 1252 | if (!empty($matchCondition[1])) { |
1253 | - $boolCond = (( $matchCondition[1] == "AND" ) ? ' AND 1 ' : ' OR 0 '); |
|
1254 | - $InfoFieldList[4] = str_replace($matchCondition[0], $boolCond . $matchCondition[3], $InfoFieldList[4]); |
|
1253 | + $boolCond = (($matchCondition[1] == "AND") ? ' AND 1 ' : ' OR 0 '); |
|
1254 | + $InfoFieldList[4] = str_replace($matchCondition[0], $boolCond.$matchCondition[3], $InfoFieldList[4]); |
|
1255 | 1255 | } else if (!empty($matchCondition[3])) { |
1256 | - $boolCond = (( $matchCondition[3] == "AND" ) ? ' 1 AND ' : ' 0 OR'); |
|
1256 | + $boolCond = (($matchCondition[3] == "AND") ? ' 1 AND ' : ' 0 OR'); |
|
1257 | 1257 | $InfoFieldList[4] = str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]); |
1258 | 1258 | } else { |
1259 | 1259 | $InfoFieldList[4] = 1; |
@@ -1261,7 +1261,7 @@ discard block |
||
1261 | 1261 | } |
1262 | 1262 | |
1263 | 1263 | // Si l'on a un AND ou un OR, avant ou après |
1264 | - preg_match('#(AND|OR|) *(' . $word . ') *(AND|OR|)#', $InfoFieldList[4], $matchCondition); |
|
1264 | + preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#', $InfoFieldList[4], $matchCondition); |
|
1265 | 1265 | } |
1266 | 1266 | } else { |
1267 | 1267 | $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); |
@@ -1269,23 +1269,23 @@ discard block |
||
1269 | 1269 | |
1270 | 1270 | // We have to join on extrafield table |
1271 | 1271 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
1272 | - $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra'; |
|
1273 | - $sqlwhere .= ' WHERE extra.fk_object=main.' . $InfoFieldList[2] . ' AND ' . $InfoFieldList[4]; |
|
1272 | + $sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra'; |
|
1273 | + $sqlwhere .= ' WHERE extra.fk_object=main.'.$InfoFieldList[2].' AND '.$InfoFieldList[4]; |
|
1274 | 1274 | } else { |
1275 | - $sqlwhere .= ' WHERE ' . $InfoFieldList[4]; |
|
1275 | + $sqlwhere .= ' WHERE '.$InfoFieldList[4]; |
|
1276 | 1276 | } |
1277 | 1277 | } else { |
1278 | 1278 | $sqlwhere .= ' WHERE 1=1'; |
1279 | 1279 | } |
1280 | 1280 | // Some tables may have field, some other not. For the moment we disable it. |
1281 | 1281 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
1282 | - $sqlwhere .= ' AND entity = ' . Globals::$conf->entity; |
|
1282 | + $sqlwhere .= ' AND entity = '.Globals::$conf->entity; |
|
1283 | 1283 | } |
1284 | 1284 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
1285 | 1285 | // print $sql; |
1286 | 1286 | |
1287 | 1287 | $sql .= $sqlwhere; |
1288 | - DolUtils::dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
1288 | + DolUtils::dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
1289 | 1289 | $resql = Config::$dbEngine->query($sql); |
1290 | 1290 | if ($resql) { |
1291 | 1291 | $num = Config::$dbEngine->num_rows($resql); |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | if (is_array($fields_label)) { |
1304 | 1304 | $notrans = true; |
1305 | 1305 | foreach ($fields_label as $field_toshow) { |
1306 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
1306 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
1307 | 1307 | } |
1308 | 1308 | } else { |
1309 | 1309 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -1314,9 +1314,9 @@ discard block |
||
1314 | 1314 | foreach ($fields_label as $field_toshow) { |
1315 | 1315 | $translabel = Globals::$langs->trans($obj->$field_toshow); |
1316 | 1316 | if ($translabel != $obj->$field_toshow) { |
1317 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
1317 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
1318 | 1318 | } else { |
1319 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
1319 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
1320 | 1320 | } |
1321 | 1321 | } |
1322 | 1322 | |
@@ -1338,32 +1338,32 @@ discard block |
||
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | if (!empty($InfoFieldList[3]) && $parentField) { |
1341 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
1341 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | $data[$obj->rowid] = $labeltoshow; |
1345 | 1345 | } |
1346 | 1346 | |
1347 | - $i ++; |
|
1347 | + $i++; |
|
1348 | 1348 | } |
1349 | 1349 | Config::$dbEngine->free($resql); |
1350 | 1350 | |
1351 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, '', 0, '100%'); |
|
1351 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%'); |
|
1352 | 1352 | } else { |
1353 | - print 'Error in request ' . $sql . ' ' . Config::$dbEngine->lasterror() . '. Check setup of extra parameters.<br>'; |
|
1353 | + print 'Error in request '.$sql.' '.Config::$dbEngine->lasterror().'. Check setup of extra parameters.<br>'; |
|
1354 | 1354 | } |
1355 | 1355 | } |
1356 | 1356 | } elseif ($type == 'link') { |
1357 | - $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath' |
|
1357 | + $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath' |
|
1358 | 1358 | $showempty = (($required && $default != '') ? 0 : 1); |
1359 | - $out = $form->selectForForms($param_list[0], $keyprefix . $key . $keysuffix, $value, $showempty); |
|
1359 | + $out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty); |
|
1360 | 1360 | } elseif ($type == 'password') { |
1361 | 1361 | // If prefix is 'search_', field is used as a filter, we use a common text field. |
1362 | 1362 | $out = '<input style="display:none" type="text" name="fakeusernameremembered">'; // Hidden field to reduce impact of evil Google Chrome autopopulate bug. |
1363 | - $out .= '<input autocomplete="new-password" type="' . ($keyprefix == 'search_' ? 'text' : 'password') . '" class="flat ' . $morecss . '" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . $value . '" ' . ($moreparam ? $moreparam : '') . '>'; |
|
1363 | + $out .= '<input autocomplete="new-password" type="'.($keyprefix == 'search_' ? 'text' : 'password').'" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'>'; |
|
1364 | 1364 | } |
1365 | 1365 | if (!empty($hidden)) { |
1366 | - $out = '<input type="hidden" value="' . $value . '" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '"/>'; |
|
1366 | + $out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>'; |
|
1367 | 1367 | } |
1368 | 1368 | /* Add comments |
1369 | 1369 | if ($type == 'date') $out.=' (YYYY-MM-DD)'; |
@@ -1398,7 +1398,7 @@ discard block |
||
1398 | 1398 | $langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key]; |
1399 | 1399 | $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1); |
1400 | 1400 | $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; |
1401 | - $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
1401 | + $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
1402 | 1402 | } else { // Old usage |
1403 | 1403 | $label = $this->attribute_label[$key]; |
1404 | 1404 | $type = $this->attribute_type[$key]; |
@@ -1412,11 +1412,11 @@ discard block |
||
1412 | 1412 | $langfile = $this->attribute_langfile[$key]; |
1413 | 1413 | $list = dol_eval($this->attribute_list[$key], 1); |
1414 | 1414 | $help = ''; // Not supported with old syntax |
1415 | - $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
1415 | + $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | if ($hidden) |
1419 | - return ''; // This is a protection. If field is hidden, we should just not call this method. |
|
1419 | + return ''; // This is a protection. If field is hidden, we should just not call this method. |
|
1420 | 1420 | |
1421 | 1421 | |
1422 | 1422 | |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | if (!empty($value)) { |
1448 | 1448 | $checked = ' checked '; |
1449 | 1449 | } |
1450 | - $value = '<input type="checkbox" ' . $checked . ' ' . ($moreparam ? $moreparam : '') . ' readonly disabled>'; |
|
1450 | + $value = '<input type="checkbox" '.$checked.' '.($moreparam ? $moreparam : '').' readonly disabled>'; |
|
1451 | 1451 | } elseif ($type == 'mail') { |
1452 | 1452 | $value = dol_print_email($value, 0, 0, 0, 64, 1, 1); |
1453 | 1453 | } elseif ($type == 'url') { |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | |
1472 | 1472 | if (count($InfoFieldList) >= 3) { |
1473 | 1473 | $selectkey = $InfoFieldList[2]; |
1474 | - $keyList = $InfoFieldList[2] . ' as rowid'; |
|
1474 | + $keyList = $InfoFieldList[2].' as rowid'; |
|
1475 | 1475 | } |
1476 | 1476 | |
1477 | 1477 | $fields_label = explode('|', $InfoFieldList[1]); |
@@ -1480,22 +1480,22 @@ discard block |
||
1480 | 1480 | $keyList .= implode(', ', $fields_label); |
1481 | 1481 | } |
1482 | 1482 | |
1483 | - $sql = 'SELECT ' . $keyList; |
|
1484 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; |
|
1483 | + $sql = 'SELECT '.$keyList; |
|
1484 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; |
|
1485 | 1485 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
1486 | 1486 | $sql .= ' as main'; |
1487 | 1487 | } |
1488 | 1488 | if ($selectkey == 'rowid' && empty($value)) { |
1489 | - $sql .= " WHERE " . $selectkey . "=0"; |
|
1489 | + $sql .= " WHERE ".$selectkey."=0"; |
|
1490 | 1490 | } elseif ($selectkey == 'rowid') { |
1491 | - $sql .= " WHERE " . $selectkey . "=" . Config::$dbEngine->escape($value); |
|
1491 | + $sql .= " WHERE ".$selectkey."=".Config::$dbEngine->escape($value); |
|
1492 | 1492 | } else { |
1493 | - $sql .= " WHERE " . $selectkey . "='" . Config::$dbEngine->escape($value) . "'"; |
|
1493 | + $sql .= " WHERE ".$selectkey."='".Config::$dbEngine->escape($value)."'"; |
|
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | //$sql.= ' AND entity = '.Globals::$conf->entity; |
1497 | 1497 | |
1498 | - DolUtils::dol_syslog(get_class($this) . ':showOutputField:$type=sellist', LOG_DEBUG); |
|
1498 | + DolUtils::dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG); |
|
1499 | 1499 | $resql = Config::$dbEngine->query($sql); |
1500 | 1500 | if ($resql) { |
1501 | 1501 | $value = ''; // value was used, so now we reste it to use it to build final output |
@@ -1512,9 +1512,9 @@ discard block |
||
1512 | 1512 | $translabel = Globals::$langs->trans($obj->$field_toshow); |
1513 | 1513 | } |
1514 | 1514 | if ($translabel != $field_toshow) { |
1515 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
1515 | + $value .= dol_trunc($translabel, 18).' '; |
|
1516 | 1516 | } else { |
1517 | - $value .= $obj->$field_toshow . ' '; |
|
1517 | + $value .= $obj->$field_toshow.' '; |
|
1518 | 1518 | } |
1519 | 1519 | } |
1520 | 1520 | } else { |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | } |
1530 | 1530 | } |
1531 | 1531 | } else |
1532 | - DolUtils::dol_syslog(get_class($this) . '::showOutputField error ' . Config::$dbEngine->lasterror(), LOG_WARNING); |
|
1532 | + DolUtils::dol_syslog(get_class($this).'::showOutputField error '.Config::$dbEngine->lasterror(), LOG_WARNING); |
|
1533 | 1533 | } |
1534 | 1534 | elseif ($type == 'radio') { |
1535 | 1535 | $value = $param['options'][$value]; |
@@ -1539,10 +1539,10 @@ discard block |
||
1539 | 1539 | $toprint = array(); |
1540 | 1540 | if (is_array($value_arr)) { |
1541 | 1541 | foreach ($value_arr as $keyval => $valueval) { |
1542 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">' . $param['options'][$valueval] . '</li>'; |
|
1542 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.$param['options'][$valueval].'</li>'; |
|
1543 | 1543 | } |
1544 | 1544 | } |
1545 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
1545 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
1546 | 1546 | } elseif ($type == 'chkbxlst') { |
1547 | 1547 | $value_arr = explode(',', $value); |
1548 | 1548 | |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | |
1555 | 1555 | if (count($InfoFieldList) >= 3) { |
1556 | 1556 | $selectkey = $InfoFieldList[2]; |
1557 | - $keyList = $InfoFieldList[2] . ' as rowid'; |
|
1557 | + $keyList = $InfoFieldList[2].' as rowid'; |
|
1558 | 1558 | } |
1559 | 1559 | |
1560 | 1560 | $fields_label = explode('|', $InfoFieldList[1]); |
@@ -1563,15 +1563,15 @@ discard block |
||
1563 | 1563 | $keyList .= implode(', ', $fields_label); |
1564 | 1564 | } |
1565 | 1565 | |
1566 | - $sql = 'SELECT ' . $keyList; |
|
1567 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0]; |
|
1566 | + $sql = 'SELECT '.$keyList; |
|
1567 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$InfoFieldList[0]; |
|
1568 | 1568 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
1569 | 1569 | $sql .= ' as main'; |
1570 | 1570 | } |
1571 | 1571 | // $sql.= " WHERE ".$selectkey."='".Config::$dbEngine->escape($value)."'"; |
1572 | 1572 | // $sql.= ' AND entity = '.Globals::$conf->entity; |
1573 | 1573 | |
1574 | - DolUtils::dol_syslog(get_class($this) . ':showOutputField:$type=chkbxlst', LOG_DEBUG); |
|
1574 | + DolUtils::dol_syslog(get_class($this).':showOutputField:$type=chkbxlst', LOG_DEBUG); |
|
1575 | 1575 | $resql = Config::$dbEngine->query($sql); |
1576 | 1576 | if ($resql) { |
1577 | 1577 | $value = ''; // value was used, so now we reste it to use it to build final output |
@@ -1588,9 +1588,9 @@ discard block |
||
1588 | 1588 | $translabel = Globals::$langs->trans($obj->$field_toshow); |
1589 | 1589 | } |
1590 | 1590 | if ($translabel != $field_toshow) { |
1591 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">' . dol_trunc($translabel, 18) . '</li>'; |
|
1591 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.dol_trunc($translabel, 18).'</li>'; |
|
1592 | 1592 | } else { |
1593 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">' . $obj->$field_toshow . '</li>'; |
|
1593 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.$obj->$field_toshow.'</li>'; |
|
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | } else { |
@@ -1599,23 +1599,23 @@ discard block |
||
1599 | 1599 | $translabel = Globals::$langs->trans($obj->{$InfoFieldList[1]}); |
1600 | 1600 | } |
1601 | 1601 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
1602 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">' . dol_trunc($translabel, 18) . '</li>'; |
|
1602 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.dol_trunc($translabel, 18).'</li>'; |
|
1603 | 1603 | } else { |
1604 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
1604 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #aaa">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
1605 | 1605 | } |
1606 | 1606 | } |
1607 | 1607 | } |
1608 | 1608 | } |
1609 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
1609 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
1610 | 1610 | } else { |
1611 | - DolUtils::dol_syslog(get_class($this) . '::showOutputField error ' . Config::$dbEngine->lasterror(), LOG_WARNING); |
|
1611 | + DolUtils::dol_syslog(get_class($this).'::showOutputField error '.Config::$dbEngine->lasterror(), LOG_WARNING); |
|
1612 | 1612 | } |
1613 | 1613 | } elseif ($type == 'link') { |
1614 | 1614 | $out = ''; |
1615 | 1615 | |
1616 | 1616 | // Only if something to display (perf) |
1617 | 1617 | if ($value) { // If we have -1 here, pb is into sert, not into ouptu |
1618 | - $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath' |
|
1618 | + $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath' |
|
1619 | 1619 | |
1620 | 1620 | $InfoFieldList = explode(":", $param_list[0]); |
1621 | 1621 | $classname = $InfoFieldList[0]; |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | { |
1701 | 1701 | // global $langs; |
1702 | 1702 | |
1703 | - $out = '<tr class="trextrafieldseparator trextrafieldseparator' . $key . '"><td colspan="2"><strong>'; |
|
1703 | + $out = '<tr class="trextrafieldseparator trextrafieldseparator'.$key.'"><td colspan="2"><strong>'; |
|
1704 | 1704 | $out .= Globals::$langs->trans($this->attributes[$object->table_element]['label'][$key]); |
1705 | 1705 | $out .= '</strong></td></tr>'; |
1706 | 1706 | return $out; |
@@ -1748,7 +1748,7 @@ discard block |
||
1748 | 1748 | |
1749 | 1749 | if ($this->attributes[$object->table_element]['required'][$key]) { // Value is required |
1750 | 1750 | // Check if empty without using GETPOST, value can be alpha, int, array, etc... |
1751 | - if ((!is_array($_POST["options_" . $key]) && empty($_POST["options_" . $key]) && $_POST["options_" . $key] != '0') || (is_array($_POST["options_" . $key]) && empty($_POST["options_" . $key]))) { |
|
1751 | + if ((!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0') || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) { |
|
1752 | 1752 | //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; |
1753 | 1753 | $nofillrequired++; |
1754 | 1754 | $error_field_required[] = Globals::$langs->transnoentitiesnoconv($value); |
@@ -1758,31 +1758,31 @@ discard block |
||
1758 | 1758 | if (in_array($key_type, array('date'))) { |
1759 | 1759 | // Clean parameters |
1760 | 1760 | // TODO GMT date in memory must be GMT so we should add gm=true in parameters |
1761 | - $value_key = dol_mktime(0, 0, 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]); |
|
1761 | + $value_key = dol_mktime(0, 0, 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); |
|
1762 | 1762 | } elseif (in_array($key_type, array('datetime'))) { |
1763 | 1763 | // Clean parameters |
1764 | 1764 | // TODO GMT date in memory must be GMT so we should add gm=true in parameters |
1765 | - $value_key = dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]); |
|
1765 | + $value_key = dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); |
|
1766 | 1766 | } else if (in_array($key_type, array('checkbox', 'chkbxlst'))) { |
1767 | - $value_arr = GETPOST("options_" . $key, 'array'); // check if an array |
|
1767 | + $value_arr = GETPOST("options_".$key, 'array'); // check if an array |
|
1768 | 1768 | if (!empty($value_arr)) { |
1769 | 1769 | $value_key = implode($value_arr, ','); |
1770 | 1770 | } else { |
1771 | 1771 | $value_key = ''; |
1772 | 1772 | } |
1773 | 1773 | } else if (in_array($key_type, array('price', 'double'))) { |
1774 | - $value_arr = GETPOST("options_" . $key, 'alpha'); |
|
1774 | + $value_arr = GETPOST("options_".$key, 'alpha'); |
|
1775 | 1775 | $value_key = price2num($value_arr); |
1776 | 1776 | } else { |
1777 | - $value_key = GETPOST("options_" . $key); |
|
1777 | + $value_key = GETPOST("options_".$key); |
|
1778 | 1778 | } |
1779 | 1779 | |
1780 | - $object->array_options["options_" . $key] = $value_key; |
|
1780 | + $object->array_options["options_".$key] = $value_key; |
|
1781 | 1781 | } |
1782 | 1782 | |
1783 | 1783 | if ($nofillrequired) { |
1784 | 1784 | Globals::$langs->load('errors'); |
1785 | - setEventMessages(Globals::$langs->trans('ErrorFieldsRequired') . ' : ' . implode(', ', $error_field_required), null, 'errors'); |
|
1785 | + setEventMessages(Globals::$langs->trans('ErrorFieldsRequired').' : '.implode(', ', $error_field_required), null, 'errors'); |
|
1786 | 1786 | return -1; |
1787 | 1787 | } else { |
1788 | 1788 | return 1; |
@@ -1822,20 +1822,20 @@ discard block |
||
1822 | 1822 | |
1823 | 1823 | if (in_array($key_type, array('date', 'datetime'))) { |
1824 | 1824 | // Clean parameters |
1825 | - $value_key = dol_mktime($_POST[$keysuffix . "options_" . $key . $keyprefix . "hour"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "min"], 0, $_POST[$keysuffix . "options_" . $key . $keyprefix . "month"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "day"], $_POST[$keysuffix . "options_" . $key . $keyprefix . "year"]); |
|
1825 | + $value_key = dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]); |
|
1826 | 1826 | } else if (in_array($key_type, array('checkbox', 'chkbxlst'))) { |
1827 | - $value_arr = GETPOST($keysuffix . "options_" . $key . $keyprefix); |
|
1827 | + $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); |
|
1828 | 1828 | // Make sure we get an array even if there's only one checkbox |
1829 | 1829 | $value_arr = (array) $value_arr; |
1830 | 1830 | $value_key = implode(',', $value_arr); |
1831 | 1831 | } else if (in_array($key_type, array('price', 'double'))) { |
1832 | - $value_arr = GETPOST($keysuffix . "options_" . $key . $keyprefix); |
|
1832 | + $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); |
|
1833 | 1833 | $value_key = price2num($value_arr); |
1834 | 1834 | } else { |
1835 | - $value_key = GETPOST($keysuffix . "options_" . $key . $keyprefix); |
|
1835 | + $value_key = GETPOST($keysuffix."options_".$key.$keyprefix); |
|
1836 | 1836 | } |
1837 | 1837 | |
1838 | - $array_options[$keysuffix . "options_" . $key] = $value_key; // No keyprefix here. keyprefix is used only for read. |
|
1838 | + $array_options[$keysuffix."options_".$key] = $value_key; // No keyprefix here. keyprefix is used only for read. |
|
1839 | 1839 | } |
1840 | 1840 | |
1841 | 1841 | return $array_options; |
@@ -172,15 +172,19 @@ discard block |
||
172 | 172 | */ |
173 | 173 | function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1') |
174 | 174 | { |
175 | - if (empty($attrname)) |
|
176 | - return -1; |
|
177 | - if (empty($label)) |
|
178 | - return -1; |
|
179 | - |
|
180 | - if ($elementtype == 'thirdparty') |
|
181 | - $elementtype = 'societe'; |
|
182 | - if ($elementtype == 'contact') |
|
183 | - $elementtype = 'socpeople'; |
|
175 | + if (empty($attrname)) { |
|
176 | + return -1; |
|
177 | + } |
|
178 | + if (empty($label)) { |
|
179 | + return -1; |
|
180 | + } |
|
181 | + |
|
182 | + if ($elementtype == 'thirdparty') { |
|
183 | + $elementtype = 'societe'; |
|
184 | + } |
|
185 | + if ($elementtype == 'contact') { |
|
186 | + $elementtype = 'socpeople'; |
|
187 | + } |
|
184 | 188 | |
185 | 189 | // Create field into database except for separator type which is not stored in database |
186 | 190 | if ($type != 'separate') { |
@@ -195,10 +199,10 @@ discard block |
||
195 | 199 | $this->error = ''; |
196 | 200 | $this->errno = 0; |
197 | 201 | return 1; |
198 | - } else |
|
199 | - return -2; |
|
200 | - } |
|
201 | - else { |
|
202 | + } else { |
|
203 | + return -2; |
|
204 | + } |
|
205 | + } else { |
|
202 | 206 | return -1; |
203 | 207 | } |
204 | 208 | } |
@@ -222,14 +226,17 @@ discard block |
||
222 | 226 | */ |
223 | 227 | private function create($attrname, $type = 'varchar', $length = 255, $elementtype = 'member', $unique = 0, $required = 0, $default_value = '', $param = '', $perms = '', $list = '0', $computed = '') |
224 | 228 | { |
225 | - if ($elementtype == 'thirdparty') |
|
226 | - $elementtype = 'societe'; |
|
227 | - if ($elementtype == 'contact') |
|
228 | - $elementtype = 'socpeople'; |
|
229 | + if ($elementtype == 'thirdparty') { |
|
230 | + $elementtype = 'societe'; |
|
231 | + } |
|
232 | + if ($elementtype == 'contact') { |
|
233 | + $elementtype = 'socpeople'; |
|
234 | + } |
|
229 | 235 | |
230 | 236 | $table = $elementtype . '_extrafields'; |
231 | - if ($elementtype == 'categorie') |
|
232 | - $table = 'categories_extrafields'; |
|
237 | + if ($elementtype == 'categorie') { |
|
238 | + $table = 'categories_extrafields'; |
|
239 | + } |
|
233 | 240 | |
234 | 241 | if (!empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/", $attrname) && !is_numeric($attrname)) { |
235 | 242 | if ($type == 'boolean') { |
@@ -262,8 +269,9 @@ discard block |
||
262 | 269 | } else { |
263 | 270 | $typedb = $type; |
264 | 271 | $lengthdb = $length; |
265 | - if ($type == 'varchar' && empty($lengthdb)) |
|
266 | - $lengthdb = '255'; |
|
272 | + if ($type == 'varchar' && empty($lengthdb)) { |
|
273 | + $lengthdb = '255'; |
|
274 | + } |
|
267 | 275 | } |
268 | 276 | $field_desc = array( |
269 | 277 | 'type' => $typedb, |
@@ -318,22 +326,29 @@ discard block |
||
318 | 326 | // phpcs:enable |
319 | 327 | // global $conf, $user; |
320 | 328 | |
321 | - if ($elementtype == 'thirdparty') |
|
322 | - $elementtype = 'societe'; |
|
323 | - if ($elementtype == 'contact') |
|
324 | - $elementtype = 'socpeople'; |
|
329 | + if ($elementtype == 'thirdparty') { |
|
330 | + $elementtype = 'societe'; |
|
331 | + } |
|
332 | + if ($elementtype == 'contact') { |
|
333 | + $elementtype = 'socpeople'; |
|
334 | + } |
|
325 | 335 | |
326 | 336 | // Clean parameters |
327 | - if (empty($pos)) |
|
328 | - $pos = 0; |
|
329 | - if (empty($list)) |
|
330 | - $list = '0'; |
|
331 | - if (empty($required)) |
|
332 | - $required = 0; |
|
333 | - if (empty($unique)) |
|
334 | - $unique = 0; |
|
335 | - if (empty($alwayseditable)) |
|
336 | - $alwayseditable = 0; |
|
337 | + if (empty($pos)) { |
|
338 | + $pos = 0; |
|
339 | + } |
|
340 | + if (empty($list)) { |
|
341 | + $list = '0'; |
|
342 | + } |
|
343 | + if (empty($required)) { |
|
344 | + $required = 0; |
|
345 | + } |
|
346 | + if (empty($unique)) { |
|
347 | + $unique = 0; |
|
348 | + } |
|
349 | + if (empty($alwayseditable)) { |
|
350 | + $alwayseditable = 0; |
|
351 | + } |
|
337 | 352 | |
338 | 353 | if (!empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname) && !is_numeric($attrname)) { |
339 | 354 | if (is_array($param) && count($param) > 0) { |
@@ -410,14 +425,17 @@ discard block |
||
410 | 425 | */ |
411 | 426 | function delete($attrname, $elementtype = 'member') |
412 | 427 | { |
413 | - if ($elementtype == 'thirdparty') |
|
414 | - $elementtype = 'societe'; |
|
415 | - if ($elementtype == 'contact') |
|
416 | - $elementtype = 'socpeople'; |
|
428 | + if ($elementtype == 'thirdparty') { |
|
429 | + $elementtype = 'societe'; |
|
430 | + } |
|
431 | + if ($elementtype == 'contact') { |
|
432 | + $elementtype = 'socpeople'; |
|
433 | + } |
|
417 | 434 | |
418 | 435 | $table = $elementtype . '_extrafields'; |
419 | - if ($elementtype == 'categorie') |
|
420 | - $table = 'categories_extrafields'; |
|
436 | + if ($elementtype == 'categorie') { |
|
437 | + $table = 'categories_extrafields'; |
|
438 | + } |
|
421 | 439 | |
422 | 440 | $error = 0; |
423 | 441 | |
@@ -466,10 +484,12 @@ discard block |
||
466 | 484 | // phpcs:enable |
467 | 485 | // global $conf; |
468 | 486 | |
469 | - if ($elementtype == 'thirdparty') |
|
470 | - $elementtype = 'societe'; |
|
471 | - if ($elementtype == 'contact') |
|
472 | - $elementtype = 'socpeople'; |
|
487 | + if ($elementtype == 'thirdparty') { |
|
488 | + $elementtype = 'societe'; |
|
489 | + } |
|
490 | + if ($elementtype == 'contact') { |
|
491 | + $elementtype = 'socpeople'; |
|
492 | + } |
|
473 | 493 | |
474 | 494 | if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname)) { |
475 | 495 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "extrafields"; |
@@ -516,14 +536,17 @@ discard block |
||
516 | 536 | */ |
517 | 537 | function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0) |
518 | 538 | { |
519 | - if ($elementtype == 'thirdparty') |
|
520 | - $elementtype = 'societe'; |
|
521 | - if ($elementtype == 'contact') |
|
522 | - $elementtype = 'socpeople'; |
|
539 | + if ($elementtype == 'thirdparty') { |
|
540 | + $elementtype = 'societe'; |
|
541 | + } |
|
542 | + if ($elementtype == 'contact') { |
|
543 | + $elementtype = 'socpeople'; |
|
544 | + } |
|
523 | 545 | |
524 | 546 | $table = $elementtype . '_extrafields'; |
525 | - if ($elementtype == 'categorie') |
|
526 | - $table = 'categories_extrafields'; |
|
547 | + if ($elementtype == 'categorie') { |
|
548 | + $table = 'categories_extrafields'; |
|
549 | + } |
|
527 | 550 | |
528 | 551 | if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname)) { |
529 | 552 | if ($type == 'boolean') { |
@@ -620,24 +643,31 @@ discard block |
||
620 | 643 | DolUtils::dol_syslog(get_class($this) . "::update_label " . $attrname . ", " . $label . ", " . $type . ", " . $size . ", " . $elementtype . ", " . $unique . ", " . $required . ", " . $pos . ", " . $alwayseditable . ", " . $perms . ", " . $list . ", " . $default . ", " . $computed . ", " . $entity . ", " . $langfile . ", " . $enabled . ", " . $totalizable); |
621 | 644 | |
622 | 645 | // Clean parameters |
623 | - if ($elementtype == 'thirdparty') |
|
624 | - $elementtype = 'societe'; |
|
625 | - if ($elementtype == 'contact') |
|
626 | - $elementtype = 'socpeople'; |
|
627 | - |
|
628 | - if (empty($pos)) |
|
629 | - $pos = 0; |
|
630 | - if (empty($list)) |
|
631 | - $list = '0'; |
|
646 | + if ($elementtype == 'thirdparty') { |
|
647 | + $elementtype = 'societe'; |
|
648 | + } |
|
649 | + if ($elementtype == 'contact') { |
|
650 | + $elementtype = 'socpeople'; |
|
651 | + } |
|
652 | + |
|
653 | + if (empty($pos)) { |
|
654 | + $pos = 0; |
|
655 | + } |
|
656 | + if (empty($list)) { |
|
657 | + $list = '0'; |
|
658 | + } |
|
632 | 659 | if (empty($totalizable)) { |
633 | 660 | $totalizable = 0; |
634 | 661 | } |
635 | - if (empty($required)) |
|
636 | - $required = 0; |
|
637 | - if (empty($unique)) |
|
638 | - $unique = 0; |
|
639 | - if (empty($alwayseditable)) |
|
640 | - $alwayseditable = 0; |
|
662 | + if (empty($required)) { |
|
663 | + $required = 0; |
|
664 | + } |
|
665 | + if (empty($unique)) { |
|
666 | + $unique = 0; |
|
667 | + } |
|
668 | + if (empty($alwayseditable)) { |
|
669 | + $alwayseditable = 0; |
|
670 | + } |
|
641 | 671 | |
642 | 672 | if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/", $attrname)) { |
643 | 673 | Config::$dbEngine->begin(); |
@@ -741,21 +771,26 @@ discard block |
||
741 | 771 | // phpcs:enable |
742 | 772 | // global $conf; |
743 | 773 | |
744 | - if (empty($elementtype)) |
|
745 | - return array(); |
|
774 | + if (empty($elementtype)) { |
|
775 | + return array(); |
|
776 | + } |
|
746 | 777 | |
747 | - if ($elementtype == 'thirdparty') |
|
748 | - $elementtype = 'societe'; |
|
749 | - if ($elementtype == 'contact') |
|
750 | - $elementtype = 'socpeople'; |
|
751 | - if ($elementtype == 'order_supplier') |
|
752 | - $elementtype = 'commande_fournisseur'; |
|
778 | + if ($elementtype == 'thirdparty') { |
|
779 | + $elementtype = 'societe'; |
|
780 | + } |
|
781 | + if ($elementtype == 'contact') { |
|
782 | + $elementtype = 'socpeople'; |
|
783 | + } |
|
784 | + if ($elementtype == 'order_supplier') { |
|
785 | + $elementtype = 'commande_fournisseur'; |
|
786 | + } |
|
753 | 787 | |
754 | 788 | $array_name_label = array(); |
755 | 789 | |
756 | 790 | // To avoid conflicts with external modules. TODO Remove this. |
757 | - if (!$forceload &&!empty(Globals::$conf->global->MAIN_EXTRAFIELDS_DISABLED)) |
|
758 | - return $array_name_label; |
|
791 | + if (!$forceload &&!empty(Globals::$conf->global->MAIN_EXTRAFIELDS_DISABLED)) { |
|
792 | + return $array_name_label; |
|
793 | + } |
|
759 | 794 | |
760 | 795 | // Set array of label of entity |
761 | 796 | // TODO Remove completely loading of label. This should be done by presentation. |
@@ -776,8 +811,10 @@ discard block |
||
776 | 811 | $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help"; |
777 | 812 | $sql .= " FROM " . MAIN_DB_PREFIX . "extrafields"; |
778 | 813 | $sql .= " WHERE entity IN (0," . Globals::$conf->entity . ")"; |
779 | - if ($elementtype) |
|
780 | - $sql .= " AND elementtype = '" . $elementtype . "'"; // Filed with object->table_element |
|
814 | + if ($elementtype) { |
|
815 | + $sql .= " AND elementtype = '" . $elementtype . "'"; |
|
816 | + } |
|
817 | + // Filed with object->table_element |
|
781 | 818 | $sql .= " ORDER BY pos"; |
782 | 819 | |
783 | 820 | $resql = Config::$dbEngine->select($sql); |
@@ -901,10 +938,11 @@ discard block |
||
901 | 938 | } |
902 | 939 | |
903 | 940 | if ($computed) { |
904 | - if (!preg_match('/^search_/', $keyprefix)) |
|
905 | - return '<span class="opacitymedium">' . Globals::$langs->trans("AutomaticallyCalculated") . '</span>'; |
|
906 | - else |
|
907 | - return ''; |
|
941 | + if (!preg_match('/^search_/', $keyprefix)) { |
|
942 | + return '<span class="opacitymedium">' . Globals::$langs->trans("AutomaticallyCalculated") . '</span>'; |
|
943 | + } else { |
|
944 | + return ''; |
|
945 | + } |
|
908 | 946 | } |
909 | 947 | |
910 | 948 | if (empty($morecss)) { |
@@ -938,13 +976,13 @@ discard block |
||
938 | 976 | $showtime = in_array($type, array('datetime')) ? 1 : 0; |
939 | 977 | |
940 | 978 | // Do not show current date when field not required (see selectDate() method) |
941 | - if (!$required && $value == '') |
|
942 | - $value = '-1'; |
|
979 | + if (!$required && $value == '') { |
|
980 | + $value = '-1'; |
|
981 | + } |
|
943 | 982 | |
944 | 983 | // TODO Must also support $moreparam |
945 | 984 | $out = $form->selectDate($value, $keyprefix . $key . $keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); |
946 | - } |
|
947 | - elseif (in_array($type, array('int', 'integer'))) { |
|
985 | + } elseif (in_array($type, array('int', 'integer'))) { |
|
948 | 986 | $tmp = explode(',', $size); |
949 | 987 | $newsize = $tmp[0]; |
950 | 988 | $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" maxlength="' . $newsize . '" value="' . dol_escape_htmltag($value) . '"' . ($moreparam ? $moreparam : '') . '>'; |
@@ -996,22 +1034,23 @@ discard block |
||
996 | 1034 | $out .= '<select class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" ' . ($moreparam ? $moreparam : '') . '>'; |
997 | 1035 | $out .= '<option value="0"> </option>'; |
998 | 1036 | foreach ($param['options'] as $key => $val) { |
999 | - if ((string) $key == '') |
|
1000 | - continue; |
|
1037 | + if ((string) $key == '') { |
|
1038 | + continue; |
|
1039 | + } |
|
1001 | 1040 | list($val, $parent) = explode('|', $val); |
1002 | 1041 | $out .= '<option value="' . $key . '"'; |
1003 | 1042 | $out .= (((string) $value == (string) $key) ? ' selected' : ''); |
1004 | 1043 | $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
1005 | 1044 | $out .= '>'; |
1006 | - if ($langfile && $val) |
|
1007 | - $out .= Globals::$langs->trans($val); |
|
1008 | - else |
|
1009 | - $out .= $val; |
|
1045 | + if ($langfile && $val) { |
|
1046 | + $out .= Globals::$langs->trans($val); |
|
1047 | + } else { |
|
1048 | + $out .= $val; |
|
1049 | + } |
|
1010 | 1050 | $out .= '</option>'; |
1011 | 1051 | } |
1012 | 1052 | $out .= '</select>'; |
1013 | - } |
|
1014 | - elseif ($type == 'sellist') { |
|
1053 | + } elseif ($type == 'sellist') { |
|
1015 | 1054 | $out = ''; |
1016 | 1055 | if (!empty(Globals::$conf->use_javascript_ajax) &&!empty(Globals::$conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) { |
1017 | 1056 | include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
@@ -1130,8 +1169,9 @@ discard block |
||
1130 | 1169 | $labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18); |
1131 | 1170 | } |
1132 | 1171 | } |
1133 | - if (empty($labeltoshow)) |
|
1134 | - $labeltoshow = '(not defined)'; |
|
1172 | + if (empty($labeltoshow)) { |
|
1173 | + $labeltoshow = '(not defined)'; |
|
1174 | + } |
|
1135 | 1175 | if ($value == $obj->rowid) { |
1136 | 1176 | $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
1137 | 1177 | } |
@@ -1330,8 +1370,9 @@ discard block |
||
1330 | 1370 | $labeltoshow = dol_trunc($obj->{$InfoFieldList[1]}, 18); |
1331 | 1371 | } |
1332 | 1372 | } |
1333 | - if (empty($labeltoshow)) |
|
1334 | - $labeltoshow = '(not defined)'; |
|
1373 | + if (empty($labeltoshow)) { |
|
1374 | + $labeltoshow = '(not defined)'; |
|
1375 | + } |
|
1335 | 1376 | |
1336 | 1377 | if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) { |
1337 | 1378 | $data[$obj->rowid] = $labeltoshow; |
@@ -1415,8 +1456,10 @@ discard block |
||
1415 | 1456 | $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) |
1416 | 1457 | } |
1417 | 1458 | |
1418 | - if ($hidden) |
|
1419 | - return ''; // This is a protection. If field is hidden, we should just not call this method. |
|
1459 | + if ($hidden) { |
|
1460 | + return ''; |
|
1461 | + } |
|
1462 | + // This is a protection. If field is hidden, we should just not call this method. |
|
1420 | 1463 | |
1421 | 1464 | |
1422 | 1465 | |
@@ -1457,12 +1500,12 @@ discard block |
||
1457 | 1500 | } elseif ($type == 'price') { |
1458 | 1501 | $value = price($value, 0, Globals::$langs, 0, 0, -1, Globals::$conf->currency); |
1459 | 1502 | } elseif ($type == 'select') { |
1460 | - if ($langfile && $param['options'][$value]) |
|
1461 | - $value = Globals::$langs->trans($param['options'][$value]); |
|
1462 | - else |
|
1463 | - $value = $param['options'][$value]; |
|
1464 | - } |
|
1465 | - elseif ($type == 'sellist') { |
|
1503 | + if ($langfile && $param['options'][$value]) { |
|
1504 | + $value = Globals::$langs->trans($param['options'][$value]); |
|
1505 | + } else { |
|
1506 | + $value = $param['options'][$value]; |
|
1507 | + } |
|
1508 | + } elseif ($type == 'sellist') { |
|
1466 | 1509 | $param_list = array_keys($param['options']); |
1467 | 1510 | $InfoFieldList = explode(":", $param_list[0]); |
1468 | 1511 | |
@@ -1528,10 +1571,10 @@ discard block |
||
1528 | 1571 | $value = $obj->{$InfoFieldList[1]}; |
1529 | 1572 | } |
1530 | 1573 | } |
1531 | - } else |
|
1532 | - DolUtils::dol_syslog(get_class($this) . '::showOutputField error ' . Config::$dbEngine->lasterror(), LOG_WARNING); |
|
1533 | - } |
|
1534 | - elseif ($type == 'radio') { |
|
1574 | + } else { |
|
1575 | + DolUtils::dol_syslog(get_class($this) . '::showOutputField error ' . Config::$dbEngine->lasterror(), LOG_WARNING); |
|
1576 | + } |
|
1577 | + } elseif ($type == 'radio') { |
|
1535 | 1578 | $value = $param['options'][$value]; |
1536 | 1579 | } elseif ($type == 'checkbox') { |
1537 | 1580 | $value_arr = explode(',', $value); |
@@ -1640,8 +1683,9 @@ discard block |
||
1640 | 1683 | $value = dol_trunc(preg_replace('/./i', '*', $value), 8, 'right', 'UTF-8', 1); |
1641 | 1684 | } else { |
1642 | 1685 | $showsize = round($size); |
1643 | - if ($showsize > 48) |
|
1644 | - $showsize = 48; |
|
1686 | + if ($showsize > 48) { |
|
1687 | + $showsize = 48; |
|
1688 | + } |
|
1645 | 1689 | } |
1646 | 1690 | |
1647 | 1691 | //print $type.'-'.$size; |
@@ -1661,10 +1705,11 @@ discard block |
||
1661 | 1705 | { |
1662 | 1706 | // global $conf, $langs; |
1663 | 1707 | |
1664 | - if (!empty($extrafieldsobjectkey)) |
|
1665 | - $type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; |
|
1666 | - else |
|
1667 | - $type = $this->attribute_type[$key]; |
|
1708 | + if (!empty($extrafieldsobjectkey)) { |
|
1709 | + $type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; |
|
1710 | + } else { |
|
1711 | + $type = $this->attribute_type[$key]; |
|
1712 | + } |
|
1668 | 1713 | |
1669 | 1714 | $align = ''; |
1670 | 1715 | |
@@ -1720,18 +1765,21 @@ discard block |
||
1720 | 1765 | $nofillrequired = ''; // For error when required field left blank |
1721 | 1766 | $error_field_required = array(); |
1722 | 1767 | |
1723 | - if (is_array($this->attributes[$object->table_element]['label'])) |
|
1724 | - $extralabels = $this->attributes[$object->table_element]['label']; |
|
1768 | + if (is_array($this->attributes[$object->table_element]['label'])) { |
|
1769 | + $extralabels = $this->attributes[$object->table_element]['label']; |
|
1770 | + } |
|
1725 | 1771 | |
1726 | 1772 | if (is_array($extralabels)) { |
1727 | 1773 | // Get extra fields |
1728 | 1774 | foreach ($extralabels as $key => $value) { |
1729 | - if (!empty($onlykey) && $key != $onlykey) |
|
1730 | - continue; |
|
1775 | + if (!empty($onlykey) && $key != $onlykey) { |
|
1776 | + continue; |
|
1777 | + } |
|
1731 | 1778 | |
1732 | 1779 | $key_type = $this->attributes[$object->table_element]['type'][$key]; |
1733 | - if ($key_type == 'separate') |
|
1734 | - continue; |
|
1780 | + if ($key_type == 'separate') { |
|
1781 | + continue; |
|
1782 | + } |
|
1735 | 1783 | |
1736 | 1784 | $enabled = 1; |
1737 | 1785 | if (isset($this->attributes[$object->table_element]['list'][$key])) { |
@@ -1741,10 +1789,12 @@ discard block |
||
1741 | 1789 | if (isset($this->attributes[$object->table_element]['perms'][$key])) { |
1742 | 1790 | $perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1); |
1743 | 1791 | } |
1744 | - if (empty($enabled)) |
|
1745 | - continue; |
|
1746 | - if (empty($perms)) |
|
1747 | - continue; |
|
1792 | + if (empty($enabled)) { |
|
1793 | + continue; |
|
1794 | + } |
|
1795 | + if (empty($perms)) { |
|
1796 | + continue; |
|
1797 | + } |
|
1748 | 1798 | |
1749 | 1799 | if ($this->attributes[$object->table_element]['required'][$key]) { // Value is required |
1750 | 1800 | // Check if empty without using GETPOST, value can be alpha, int, array, etc... |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public $skype; |
56 | 56 | public $twitter; |
57 | 57 | public $facebook; |
58 | - public $job; // job position |
|
58 | + public $job; // job position |
|
59 | 59 | public $signature; |
60 | 60 | |
61 | 61 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public $address; |
65 | 65 | public $zip; |
66 | 66 | public $town; |
67 | - public $state_id; // The state/department |
|
67 | + public $state_id; // The state/department |
|
68 | 68 | public $state_code; |
69 | 69 | public $state; |
70 | 70 | public $office_phone; |
@@ -118,26 +118,26 @@ discard block |
||
118 | 118 | public $datepreviouslogin; |
119 | 119 | public $photo; |
120 | 120 | public $lang; |
121 | - public $rights; // Array of permissions user->rights->permx |
|
122 | - public $all_permissions_are_loaded; // All permission are loaded |
|
123 | - public $nb_rights; // Number of rights granted to the user |
|
124 | - private $_tab_loaded = array(); // Cache array of already loaded permissions |
|
125 | - public $conf; // To store personal config |
|
126 | - public $default_values; // To store default values for user |
|
127 | - public $lastsearch_values_tmp; // To store current search criterias for user |
|
128 | - public $lastsearch_values; // To store last saved search criterias for user |
|
129 | - public $users = array(); // To store all tree of users hierarchy |
|
130 | - public $parentof; // To store an array of all parents for all ids. |
|
121 | + public $rights; // Array of permissions user->rights->permx |
|
122 | + public $all_permissions_are_loaded; // All permission are loaded |
|
123 | + public $nb_rights; // Number of rights granted to the user |
|
124 | + private $_tab_loaded = array(); // Cache array of already loaded permissions |
|
125 | + public $conf; // To store personal config |
|
126 | + public $default_values; // To store default values for user |
|
127 | + public $lastsearch_values_tmp; // To store current search criterias for user |
|
128 | + public $lastsearch_values; // To store last saved search criterias for user |
|
129 | + public $users = array(); // To store all tree of users hierarchy |
|
130 | + public $parentof; // To store an array of all parents for all ids. |
|
131 | 131 | private $cache_childids; |
132 | - public $accountancy_code; // Accountancy code in prevision of the complete accountancy module |
|
133 | - public $thm; // Average cost of employee - Used for valuation of time spent |
|
134 | - public $tjm; // Average cost of employee |
|
135 | - public $salary; // Monthly salary - Denormalized value from llx_user_employment |
|
136 | - public $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment |
|
137 | - public $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment |
|
138 | - public $color; // Define background color for user in agenda |
|
139 | - public $dateemployment; // Define date of employment by company |
|
140 | - public $dateemploymentend; // Define date of employment end by company |
|
132 | + public $accountancy_code; // Accountancy code in prevision of the complete accountancy module |
|
133 | + public $thm; // Average cost of employee - Used for valuation of time spent |
|
134 | + public $tjm; // Average cost of employee |
|
135 | + public $salary; // Monthly salary - Denormalized value from llx_user_employment |
|
136 | + public $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment |
|
137 | + public $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment |
|
138 | + public $color; // Define background color for user in agenda |
|
139 | + public $dateemployment; // Define date of employment by company |
|
140 | + public $dateemploymentend; // Define date of employment end by company |
|
141 | 141 | public $default_c_exp_tax_cat; |
142 | 142 | public $default_range; |
143 | 143 | public $fields = array( |
@@ -212,37 +212,37 @@ discard block |
||
212 | 212 | $sql .= " u.color,"; |
213 | 213 | $sql .= " u.dateemployment, u.dateemploymentend,"; |
214 | 214 | $sql .= " u.ref_int, u.ref_ext,"; |
215 | - $sql .= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode |
|
215 | + $sql .= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode |
|
216 | 216 | $sql .= " c.code as country_code, c.label as country,"; |
217 | 217 | $sql .= " d.code_departement as state_code, d.nom as state"; |
218 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
219 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON u.fk_country = c.rowid"; |
|
220 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_departements as d ON u.fk_state = d.rowid"; |
|
218 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
219 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid"; |
|
220 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid"; |
|
221 | 221 | |
222 | 222 | if ($entity < 0) { |
223 | 223 | if ((empty(Globals::$conf->multicompany->enabled) || empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (!empty(Globals::$user->entity))) { |
224 | - $sql .= " WHERE u.entity IN (0," . Globals::$conf->entity . ")"; |
|
224 | + $sql .= " WHERE u.entity IN (0,".Globals::$conf->entity.")"; |
|
225 | 225 | } else { |
226 | - $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
226 | + $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
227 | 227 | } |
228 | 228 | } else { // The fetch was forced on an entity |
229 | 229 | if (!empty(Globals::$conf->multicompany->enabled) && !empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
230 | - $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
230 | + $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
231 | 231 | } else { |
232 | - $sql .= " WHERE u.entity IN (0, " . (($entity != '' && $entity >= 0) ? $entity : Globals::$conf->entity) . ")"; // search in entity provided in parameter |
|
232 | + $sql .= " WHERE u.entity IN (0, ".(($entity != '' && $entity >= 0) ? $entity : Globals::$conf->entity).")"; // search in entity provided in parameter |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | 236 | if ($sid) { // permet une recherche du user par son SID ActiveDirectory ou Samba |
237 | 237 | //$sql .= " AND (u.ldap_sid = '" . Config::$dbEngine->escape($sid) . "' OR u.login = '" . Config::$dbEngine->escape($login) . "') LIMIT 1"; |
238 | - $sql .= " AND (u.ldap_sid = '" . $sid . "' OR u.login = '" . Config::$dbEngine->escape($login) . "') LIMIT 1"; |
|
238 | + $sql .= " AND (u.ldap_sid = '".$sid."' OR u.login = '".Config::$dbEngine->escape($login)."') LIMIT 1"; |
|
239 | 239 | } else if ($login) { |
240 | 240 | // $sql .= " AND u.login = '" . Config::$dbEngine->escape($login) . "'"; |
241 | - $sql .= " AND u.login = '" . $login . "'"; |
|
241 | + $sql .= " AND u.login = '".$login."'"; |
|
242 | 242 | } else { |
243 | - $sql .= " AND u.rowid = " . $id; |
|
243 | + $sql .= " AND u.rowid = ".$id; |
|
244 | 244 | } |
245 | - $sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities |
|
245 | + $sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities |
|
246 | 246 | |
247 | 247 | $result = Config::$dbEngine->select($sql); |
248 | 248 | // echo "<p>SQL in 2477 of User: '$sql'</p>"; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $this->datelastlogin = $obj->datel; |
329 | 329 | $this->datepreviouslogin = $obj->datep; |
330 | 330 | |
331 | - $this->societe_id = $obj->fk_soc; // deprecated |
|
331 | + $this->societe_id = $obj->fk_soc; // deprecated |
|
332 | 332 | $this->contact_id = $obj->fk_socpeople; // deprecated |
333 | 333 | $this->socid = $obj->fk_soc; |
334 | 334 | $this->contactid = $obj->fk_socpeople; |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $this->fetch_optionals(); |
350 | 350 | } else { |
351 | 351 | $this->error = "USERNOTFOUND"; |
352 | - DolUtils::dol_syslog(get_class($this) . "::fetch user not found", LOG_DEBUG); |
|
352 | + DolUtils::dol_syslog(get_class($this)."::fetch user not found", LOG_DEBUG); |
|
353 | 353 | return 0; |
354 | 354 | } |
355 | 355 | } else { |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | // To get back the global configuration unique to the user |
361 | 361 | if ($loadpersonalconf) { |
362 | 362 | // Load user->conf for user |
363 | - $sql = "SELECT param, value FROM " . MAIN_DB_PREFIX . "user_param"; |
|
364 | - $sql .= " WHERE fk_user = " . $this->id; |
|
365 | - $sql .= " AND entity = " . Globals::$conf->entity; |
|
363 | + $sql = "SELECT param, value FROM ".MAIN_DB_PREFIX."user_param"; |
|
364 | + $sql .= " WHERE fk_user = ".$this->id; |
|
365 | + $sql .= " AND entity = ".Globals::$conf->entity; |
|
366 | 366 | //DolUtils::dol_syslog(get_class($this).'::fetch load personalized conf', LOG_DEBUG); |
367 | 367 | $resql = Config::$dbEngine->select($sql); |
368 | 368 | if (is_array($resql)) { |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | // global $conf; |
401 | 401 | // Load user->default_values for user. TODO Save this in memcached ? |
402 | 402 | $sql = "SELECT rowid, entity, type, page, param, value"; |
403 | - $sql .= " FROM " . MAIN_DB_PREFIX . "default_values"; |
|
404 | - $sql .= " WHERE entity IN (" . ($this->entity > 0 ? $this->entity . ", " : "") . Globals::$conf->entity . ")"; // Entity of user (if defined) + current entity |
|
405 | - $sql .= " AND user_id IN (0" . ($this->id > 0 ? ", " . $this->id : "") . ")"; // User 0 (all) + me (if defined) |
|
403 | + $sql .= " FROM ".MAIN_DB_PREFIX."default_values"; |
|
404 | + $sql .= " WHERE entity IN (".($this->entity > 0 ? $this->entity.", " : "").Globals::$conf->entity.")"; // Entity of user (if defined) + current entity |
|
405 | + $sql .= " AND user_id IN (0".($this->id > 0 ? ", ".$this->id : "").")"; // User 0 (all) + me (if defined) |
|
406 | 406 | $resql = Config::$dbEngine->select($sql); |
407 | 407 | if (is_array($resql)) { |
408 | 408 | foreach ($resql as $array) { |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | |
451 | 451 | $entity = (!empty($entity) ? $entity : Globals::$conf->entity); |
452 | 452 | |
453 | - DolUtils::dol_syslog(get_class($this) . "::addrights $rid, $allmodule, $allperms, $entity"); |
|
453 | + DolUtils::dol_syslog(get_class($this)."::addrights $rid, $allmodule, $allperms, $entity"); |
|
454 | 454 | $error = 0; |
455 | 455 | $whereforadd = ''; |
456 | 456 | |
@@ -460,9 +460,9 @@ discard block |
||
460 | 460 | // Si on a demande ajout d'un droit en particulier, on recupere |
461 | 461 | // les caracteristiques (module, perms et subperms) de ce droit. |
462 | 462 | $sql = "SELECT module, perms, subperms"; |
463 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
464 | - $sql .= " WHERE id = '" . Config::$dbEngine->escape($rid) . "'"; |
|
465 | - $sql .= " AND entity = " . $entity; |
|
463 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
464 | + $sql .= " WHERE id = '".Config::$dbEngine->escape($rid)."'"; |
|
465 | + $sql .= " AND entity = ".$entity; |
|
466 | 466 | |
467 | 467 | $result = Config::$dbEngine->query($sql); |
468 | 468 | if ($result) { |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | } |
477 | 477 | |
478 | 478 | // Where pour la liste des droits a ajouter |
479 | - $whereforadd = "id=" . Config::$dbEngine->escape($rid); |
|
479 | + $whereforadd = "id=".Config::$dbEngine->escape($rid); |
|
480 | 480 | // Ajout des droits induits |
481 | 481 | if (!empty($subperms)) { |
482 | 482 | $whereforadd .= " OR (module='$module' AND perms='$perms' AND (subperms='lire' OR subperms='read'))"; |
@@ -493,9 +493,9 @@ discard block |
||
493 | 493 | if ($allmodule == 'allmodules') { |
494 | 494 | $whereforadd = 'allmodules'; |
495 | 495 | } else { |
496 | - $whereforadd = "module='" . Config::$dbEngine->escape($allmodule) . "'"; |
|
496 | + $whereforadd = "module='".Config::$dbEngine->escape($allmodule)."'"; |
|
497 | 497 | if (!empty($allperms)) { |
498 | - $whereforadd .= " AND perms='" . Config::$dbEngine->escape($allperms) . "'"; |
|
498 | + $whereforadd .= " AND perms='".Config::$dbEngine->escape($allperms)."'"; |
|
499 | 499 | } |
500 | 500 | } |
501 | 501 | } |
@@ -505,10 +505,10 @@ discard block |
||
505 | 505 | if (!empty($whereforadd)) { |
506 | 506 | //print "$module-$perms-$subperms"; |
507 | 507 | $sql = "SELECT id"; |
508 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
509 | - $sql .= " WHERE entity = " . $entity; |
|
508 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
509 | + $sql .= " WHERE entity = ".$entity; |
|
510 | 510 | if (!empty($whereforadd) && $whereforadd != 'allmodules') { |
511 | - $sql .= " AND " . $whereforadd; |
|
511 | + $sql .= " AND ".$whereforadd; |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | $result = Config::$dbEngine->query($sql); |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | $obj = Config::$dbEngine->fetch_object($result); |
520 | 520 | $nid = $obj->id; |
521 | 521 | |
522 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights WHERE fk_user = " . $this->id . " AND fk_id=" . $nid . " AND entity = " . $entity; |
|
522 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = ".$this->id." AND fk_id=".$nid." AND entity = ".$entity; |
|
523 | 523 | if (!Config::$dbEngine->query($sql)) |
524 | 524 | $error++; |
525 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_rights (entity, fk_user, fk_id) VALUES (" . $entity . ", " . $this->id . ", " . $nid . ")"; |
|
525 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_rights (entity, fk_user, fk_id) VALUES (".$entity.", ".$this->id.", ".$nid.")"; |
|
526 | 526 | if (!Config::$dbEngine->query($sql)) |
527 | 527 | $error++; |
528 | 528 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | |
538 | 538 | if (!$error && !$notrigger) { |
539 | 539 | Globals::$langs->load("other"); |
540 | - $this->context = array('audit' => Globals::$langs->trans("PermissionsAdd") . ($rid ? ' (id=' . $rid . ')' : '')); |
|
540 | + $this->context = array('audit' => Globals::$langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : '')); |
|
541 | 541 | |
542 | 542 | // Call trigger |
543 | 543 | $result = $this->call_trigger('USER_MODIFY', Globals::$user); |
@@ -581,9 +581,9 @@ discard block |
||
581 | 581 | // Si on a demande supression d'un droit en particulier, on recupere |
582 | 582 | // les caracteristiques module, perms et subperms de ce droit. |
583 | 583 | $sql = "SELECT module, perms, subperms"; |
584 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
585 | - $sql .= " WHERE id = '" . Config::$dbEngine->escape($rid) . "'"; |
|
586 | - $sql .= " AND entity = " . $entity; |
|
584 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
585 | + $sql .= " WHERE id = '".Config::$dbEngine->escape($rid)."'"; |
|
586 | + $sql .= " AND entity = ".$entity; |
|
587 | 587 | |
588 | 588 | $result = Config::$dbEngine->query($sql); |
589 | 589 | if ($result) { |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | |
599 | 599 | // Where pour la liste des droits a supprimer |
600 | - $wherefordel = "id=" . Config::$dbEngine->escape($rid); |
|
600 | + $wherefordel = "id=".Config::$dbEngine->escape($rid); |
|
601 | 601 | // Suppression des droits induits |
602 | 602 | if ($subperms == 'lire' || $subperms == 'read') { |
603 | 603 | $wherefordel .= " OR (module='$module' AND perms='$perms' AND subperms IS NOT NULL)"; |
@@ -612,9 +612,9 @@ discard block |
||
612 | 612 | if ($allmodule == 'allmodules') { |
613 | 613 | $wherefordel = 'allmodules'; |
614 | 614 | } else { |
615 | - $wherefordel = "module='" . Config::$dbEngine->escape($allmodule) . "'"; |
|
615 | + $wherefordel = "module='".Config::$dbEngine->escape($allmodule)."'"; |
|
616 | 616 | if (!empty($allperms)) { |
617 | - $whereforadd .= " AND perms='" . Config::$dbEngine->escape($allperms) . "'"; |
|
617 | + $whereforadd .= " AND perms='".Config::$dbEngine->escape($allperms)."'"; |
|
618 | 618 | } |
619 | 619 | } |
620 | 620 | } |
@@ -624,10 +624,10 @@ discard block |
||
624 | 624 | if (!empty($wherefordel)) { |
625 | 625 | //print "$module-$perms-$subperms"; |
626 | 626 | $sql = "SELECT id"; |
627 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
628 | - $sql .= " WHERE entity = " . $entity; |
|
627 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
628 | + $sql .= " WHERE entity = ".$entity; |
|
629 | 629 | if (!empty($wherefordel) && $wherefordel != 'allmodules') { |
630 | - $sql .= " AND " . $wherefordel; |
|
630 | + $sql .= " AND ".$wherefordel; |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | $result = Config::$dbEngine->query($sql); |
@@ -638,9 +638,9 @@ discard block |
||
638 | 638 | $obj = Config::$dbEngine->fetch_object($result); |
639 | 639 | $nid = $obj->id; |
640 | 640 | |
641 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights"; |
|
642 | - $sql .= " WHERE fk_user = " . $this->id . " AND fk_id=" . $nid; |
|
643 | - $sql .= " AND entity = " . $entity; |
|
641 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights"; |
|
642 | + $sql .= " WHERE fk_user = ".$this->id." AND fk_id=".$nid; |
|
643 | + $sql .= " AND entity = ".$entity; |
|
644 | 644 | if (!Config::$dbEngine->query($sql)) { |
645 | 645 | $error++; |
646 | 646 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | if (!$error && !$notrigger) { |
657 | 657 | Globals::$langs->load("other"); |
658 | - $this->context = array('audit' => Globals::$langs->trans("PermissionsDelete") . ($rid ? ' (id=' . $rid . ')' : '')); |
|
658 | + $this->context = array('audit' => Globals::$langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : '')); |
|
659 | 659 | |
660 | 660 | // Call trigger |
661 | 661 | $result = $this->call_trigger('USER_MODIFY', Globals::$user); |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | */ |
683 | 683 | function clearrights() |
684 | 684 | { |
685 | - DolUtils::dol_syslog(get_class($this) . "::clearrights reset user->rights"); |
|
685 | + DolUtils::dol_syslog(get_class($this)."::clearrights reset user->rights"); |
|
686 | 686 | $this->rights = ''; |
687 | 687 | $this->all_permissions_are_loaded = false; |
688 | 688 | $this->_tab_loaded = array(); |
@@ -715,19 +715,19 @@ discard block |
||
715 | 715 | // Recuperation des droits utilisateurs + recuperation des droits groupes |
716 | 716 | // D'abord les droits utilisateurs |
717 | 717 | $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; |
718 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user_rights as ur"; |
|
719 | - $sql .= ", " . MAIN_DB_PREFIX . "rights_def as r"; |
|
718 | + $sql .= " FROM ".MAIN_DB_PREFIX."user_rights as ur"; |
|
719 | + $sql .= ", ".MAIN_DB_PREFIX."rights_def as r"; |
|
720 | 720 | $sql .= " WHERE r.id = ur.fk_id"; |
721 | 721 | if (!empty(Globals::$conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY)) { |
722 | - $sql .= " AND r.entity IN (0," . (!empty(Globals::$conf->multicompany->enabled) && !empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE) ? "1," : "") . Globals::$conf->entity . ")"; |
|
722 | + $sql .= " AND r.entity IN (0,".(!empty(Globals::$conf->multicompany->enabled) && !empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE) ? "1," : "").Globals::$conf->entity.")"; |
|
723 | 723 | } else { |
724 | - $sql .= " AND ur.entity = " . Globals::$conf->entity; |
|
724 | + $sql .= " AND ur.entity = ".Globals::$conf->entity; |
|
725 | 725 | } |
726 | - $sql .= " AND ur.fk_user= " . $this->id; |
|
726 | + $sql .= " AND ur.fk_user= ".$this->id; |
|
727 | 727 | $sql .= " AND r.perms IS NOT NULL"; |
728 | 728 | if ($moduletag) { |
729 | 729 | // $sql .= " AND r.module = '" . Config::$dbEngine->escape($moduletag) . "'"; |
730 | - $sql .= " AND r.module = '" . $moduletag . "'"; |
|
730 | + $sql .= " AND r.module = '".$moduletag."'"; |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | $resql = Config::$dbEngine->select($sql); |
@@ -768,25 +768,25 @@ discard block |
||
768 | 768 | |
769 | 769 | // Maintenant les droits groupes |
770 | 770 | $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; |
771 | - $sql .= " FROM " . MAIN_DB_PREFIX . "usergroup_rights as gr,"; |
|
772 | - $sql .= " " . MAIN_DB_PREFIX . "usergroup_user as gu,"; |
|
773 | - $sql .= " " . MAIN_DB_PREFIX . "rights_def as r"; |
|
771 | + $sql .= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,"; |
|
772 | + $sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu,"; |
|
773 | + $sql .= " ".MAIN_DB_PREFIX."rights_def as r"; |
|
774 | 774 | $sql .= " WHERE r.id = gr.fk_id"; |
775 | 775 | if (!empty(Globals::$conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY)) { |
776 | 776 | if (!empty(Globals::$conf->multicompany->enabled) && !empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
777 | - $sql .= " AND gu.entity IN (0," . Globals::$conf->entity . ")"; |
|
777 | + $sql .= " AND gu.entity IN (0,".Globals::$conf->entity.")"; |
|
778 | 778 | } else { |
779 | - $sql .= " AND r.entity = " . Globals::$conf->entity; |
|
779 | + $sql .= " AND r.entity = ".Globals::$conf->entity; |
|
780 | 780 | } |
781 | 781 | } else { |
782 | - $sql .= " AND gr.entity = " . Globals::$conf->entity; |
|
783 | - $sql .= " AND r.entity = " . Globals::$conf->entity; |
|
782 | + $sql .= " AND gr.entity = ".Globals::$conf->entity; |
|
783 | + $sql .= " AND r.entity = ".Globals::$conf->entity; |
|
784 | 784 | } |
785 | 785 | $sql .= " AND gr.fk_usergroup = gu.fk_usergroup"; |
786 | - $sql .= " AND gu.fk_user = " . $this->id; |
|
786 | + $sql .= " AND gu.fk_user = ".$this->id; |
|
787 | 787 | $sql .= " AND r.perms IS NOT NULL"; |
788 | 788 | if ($moduletag) { |
789 | - $sql .= " AND r.module = '" . $moduletag . "'"; |
|
789 | + $sql .= " AND r.module = '".$moduletag."'"; |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | $resql = Config::$dbEngine->select($sql); |
@@ -866,12 +866,12 @@ discard block |
||
866 | 866 | Config::$dbEngine->begin(); |
867 | 867 | |
868 | 868 | // Deactivate user |
869 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
870 | - $sql .= " SET statut = " . $this->statut; |
|
871 | - $sql .= " WHERE rowid = " . $this->id; |
|
869 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
870 | + $sql .= " SET statut = ".$this->statut; |
|
871 | + $sql .= " WHERE rowid = ".$this->id; |
|
872 | 872 | $result = Config::$dbEngine->query($sql); |
873 | 873 | |
874 | - DolUtils::dol_syslog(get_class($this) . "::setstatus", LOG_DEBUG); |
|
874 | + DolUtils::dol_syslog(get_class($this)."::setstatus", LOG_DEBUG); |
|
875 | 875 | if ($result) { |
876 | 876 | // Call trigger |
877 | 877 | $result = $this->call_trigger('USER_ENABLEDISABLE', Globals::$user); |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | } |
909 | 909 | |
910 | 910 | // Get current categories |
911 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
911 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
912 | 912 | $c = new Categorie(Config::$dbEngine); |
913 | 913 | $existing = $c->containing($this->id, Categorie::TYPE_USER, 'id'); |
914 | 914 | |
@@ -951,10 +951,10 @@ discard block |
||
951 | 951 | |
952 | 952 | $this->fetch($this->id); |
953 | 953 | |
954 | - DolUtils::dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
|
954 | + DolUtils::dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
|
955 | 955 | |
956 | 956 | // Remove rights |
957 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights WHERE fk_user = " . $this->id; |
|
957 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = ".$this->id; |
|
958 | 958 | |
959 | 959 | if (!$error && !Config::$dbEngine->query($sql)) { |
960 | 960 | $error++; |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | } |
963 | 963 | |
964 | 964 | // Remove group |
965 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "usergroup_user WHERE fk_user = " . $this->id; |
|
965 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user WHERE fk_user = ".$this->id; |
|
966 | 966 | if (!$error && !Config::$dbEngine->query($sql)) { |
967 | 967 | $error++; |
968 | 968 | $this->error = Config::$dbEngine->lasterror(); |
@@ -970,7 +970,7 @@ discard block |
||
970 | 970 | |
971 | 971 | // If contact, remove link |
972 | 972 | if ($this->contact_id) { |
973 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "socpeople SET fk_user_creat = null WHERE rowid = " . $this->contact_id; |
|
973 | + $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET fk_user_creat = null WHERE rowid = ".$this->contact_id; |
|
974 | 974 | if (!$error && !Config::$dbEngine->query($sql)) { |
975 | 975 | $error++; |
976 | 976 | $this->error = Config::$dbEngine->lasterror(); |
@@ -982,14 +982,14 @@ discard block |
||
982 | 982 | $result = $this->deleteExtraFields(); |
983 | 983 | if ($result < 0) { |
984 | 984 | $error++; |
985 | - DolUtils::dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR); |
|
985 | + DolUtils::dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); |
|
986 | 986 | } |
987 | 987 | } |
988 | 988 | |
989 | 989 | // Remove user |
990 | 990 | if (!$error) { |
991 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . $this->id; |
|
992 | - DolUtils::dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
|
991 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->id; |
|
992 | + DolUtils::dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
|
993 | 993 | if (!Config::$dbEngine->query($sql)) { |
994 | 994 | $error++; |
995 | 995 | $this->error = Config::$dbEngine->lasterror(); |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | if (!isset($this->entity)) { |
1031 | 1031 | $this->entity = Globals::$conf->entity; // If not defined, we use default value |
1032 | 1032 | } |
1033 | - DolUtils::dol_syslog(get_class($this) . "::create login=" . $this->login . ", user=" . (is_object(Globals::$user) ? Globals::$user->id : ''), LOG_DEBUG); |
|
1033 | + DolUtils::dol_syslog(get_class($this)."::create login=".$this->login.", user=".(is_object(Globals::$user) ? Globals::$user->id : ''), LOG_DEBUG); |
|
1034 | 1034 | |
1035 | 1035 | // Check parameters |
1036 | 1036 | if (!empty(Globals::$conf->global->USER_MAIL_REQUIRED) && !isValidEMail($this->email)) { |
@@ -1049,11 +1049,11 @@ discard block |
||
1049 | 1049 | $error = 0; |
1050 | 1050 | Config::$dbEngine->begin(); |
1051 | 1051 | |
1052 | - $sql = "SELECT login FROM " . MAIN_DB_PREFIX . "user"; |
|
1053 | - $sql .= " WHERE login ='" . Config::$dbEngine->escape($this->login) . "'"; |
|
1054 | - $sql .= " AND entity IN (0," . Config::$dbEngine->escape(Globals::$conf->entity) . ")"; |
|
1052 | + $sql = "SELECT login FROM ".MAIN_DB_PREFIX."user"; |
|
1053 | + $sql .= " WHERE login ='".Config::$dbEngine->escape($this->login)."'"; |
|
1054 | + $sql .= " AND entity IN (0,".Config::$dbEngine->escape(Globals::$conf->entity).")"; |
|
1055 | 1055 | |
1056 | - DolUtils::dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
|
1056 | + DolUtils::dol_syslog(get_class($this)."::create", LOG_DEBUG); |
|
1057 | 1057 | $resql = Config::$dbEngine->query($sql); |
1058 | 1058 | if ($resql) { |
1059 | 1059 | $num = Config::$dbEngine->num_rows($resql); |
@@ -1061,17 +1061,17 @@ discard block |
||
1061 | 1061 | |
1062 | 1062 | if ($num) { |
1063 | 1063 | $this->error = 'ErrorLoginAlreadyExists'; |
1064 | - DolUtils::dol_syslog(get_class($this) . "::create " . $this->error, LOG_WARNING); |
|
1064 | + DolUtils::dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); |
|
1065 | 1065 | Config::$dbEngine->rollback(); |
1066 | 1066 | return -6; |
1067 | 1067 | } else { |
1068 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user (datec,login,ldap_sid,entity)"; |
|
1069 | - $sql .= " VALUES('" . Config::$dbEngine->idate($this->datec) . "','" . Config::$dbEngine->escape($this->login) . "','" . Config::$dbEngine->escape($this->ldap_sid) . "'," . Config::$dbEngine->escape($this->entity) . ")"; |
|
1068 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user (datec,login,ldap_sid,entity)"; |
|
1069 | + $sql .= " VALUES('".Config::$dbEngine->idate($this->datec)."','".Config::$dbEngine->escape($this->login)."','".Config::$dbEngine->escape($this->ldap_sid)."',".Config::$dbEngine->escape($this->entity).")"; |
|
1070 | 1070 | $result = Config::$dbEngine->query($sql); |
1071 | 1071 | |
1072 | - DolUtils::dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
|
1072 | + DolUtils::dol_syslog(get_class($this)."::create", LOG_DEBUG); |
|
1073 | 1073 | if ($result) { |
1074 | - $this->id = Config::$dbEngine->last_insert_id(MAIN_DB_PREFIX . "user"); |
|
1074 | + $this->id = Config::$dbEngine->last_insert_id(MAIN_DB_PREFIX."user"); |
|
1075 | 1075 | |
1076 | 1076 | // Set default rights |
1077 | 1077 | if ($this->set_default_rights() < 0) { |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | if (!empty(Globals::$conf->global->STOCK_USERSTOCK_AUTOCREATE)) { |
1091 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
1091 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
1092 | 1092 | Globals::$langs->load("stocks"); |
1093 | 1093 | $entrepot = new Entrepot(Config::$dbEngine); |
1094 | 1094 | $entrepot->libelle = Globals::$langs->trans("PersonalStock", $this->getFullName(Globals::$langs)); |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | return $this->id; |
1113 | 1113 | } else { |
1114 | 1114 | //$this->error=$interface->error; |
1115 | - DolUtils::dol_syslog(get_class($this) . "::create " . $this->error, LOG_ERR); |
|
1115 | + DolUtils::dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); |
|
1116 | 1116 | Config::$dbEngine->rollback(); |
1117 | 1117 | return -3; |
1118 | 1118 | } |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | $this->employee = 0; |
1166 | 1166 | |
1167 | 1167 | if (empty($login)) { |
1168 | - $login = strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); |
|
1168 | + $login = strtolower(substr($contact->firstname, 0, 4)).strtolower(substr($contact->lastname, 0, 4)); |
|
1169 | 1169 | } |
1170 | 1170 | $this->login = $login; |
1171 | 1171 | |
@@ -1174,15 +1174,15 @@ discard block |
||
1174 | 1174 | // Cree et positionne $this->id |
1175 | 1175 | $result = $this->create(Globals::$user); |
1176 | 1176 | if ($result > 0) { |
1177 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
1178 | - $sql .= " SET fk_socpeople=" . $contact->id; |
|
1177 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
1178 | + $sql .= " SET fk_socpeople=".$contact->id; |
|
1179 | 1179 | if ($contact->socid) { |
1180 | - $sql .= ", fk_soc=" . $contact->socid; |
|
1180 | + $sql .= ", fk_soc=".$contact->socid; |
|
1181 | 1181 | } |
1182 | - $sql .= " WHERE rowid=" . $this->id; |
|
1182 | + $sql .= " WHERE rowid=".$this->id; |
|
1183 | 1183 | $resql = Config::$dbEngine->query($sql); |
1184 | 1184 | |
1185 | - DolUtils::dol_syslog(get_class($this) . "::create_from_contact", LOG_DEBUG); |
|
1185 | + DolUtils::dol_syslog(get_class($this)."::create_from_contact", LOG_DEBUG); |
|
1186 | 1186 | if ($resql) { |
1187 | 1187 | $this->context['createfromcontact'] = 'createfromcontact'; |
1188 | 1188 | |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | } |
1206 | 1206 | } else { |
1207 | 1207 | // $this->error deja positionne |
1208 | - DolUtils::dol_syslog(get_class($this) . "::create_from_contact - 0"); |
|
1208 | + DolUtils::dol_syslog(get_class($this)."::create_from_contact - 0"); |
|
1209 | 1209 | |
1210 | 1210 | Config::$dbEngine->rollback(); |
1211 | 1211 | return $result; |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | $this->country_id = $member->country_id; |
1240 | 1240 | |
1241 | 1241 | if (empty($login)) { |
1242 | - $login = strtolower(substr($member->firstname, 0, 4)) . strtolower(substr($member->lastname, 0, 4)); |
|
1242 | + $login = strtolower(substr($member->firstname, 0, 4)).strtolower(substr($member->lastname, 0, 4)); |
|
1243 | 1243 | } |
1244 | 1244 | $this->login = $login; |
1245 | 1245 | |
@@ -1254,11 +1254,11 @@ discard block |
||
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | if ($result > 0 && $member->fk_soc) { // If member is linked to a thirdparty |
1257 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
1258 | - $sql .= " SET fk_soc=" . $member->fk_soc; |
|
1259 | - $sql .= " WHERE rowid=" . $this->id; |
|
1257 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
1258 | + $sql .= " SET fk_soc=".$member->fk_soc; |
|
1259 | + $sql .= " WHERE rowid=".$this->id; |
|
1260 | 1260 | |
1261 | - DolUtils::dol_syslog(get_class($this) . "::create_from_member", LOG_DEBUG); |
|
1261 | + DolUtils::dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); |
|
1262 | 1262 | $resql = Config::$dbEngine->query($sql); |
1263 | 1263 | if ($resql) { |
1264 | 1264 | Config::$dbEngine->commit(); |
@@ -1293,9 +1293,9 @@ discard block |
||
1293 | 1293 | // phpcs:enable |
1294 | 1294 | global $conf; |
1295 | 1295 | |
1296 | - $sql = "SELECT id FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
1296 | + $sql = "SELECT id FROM ".MAIN_DB_PREFIX."rights_def"; |
|
1297 | 1297 | $sql .= " WHERE bydefault = 1"; |
1298 | - $sql .= " AND entity = " . Globals::$conf->entity; |
|
1298 | + $sql .= " AND entity = ".Globals::$conf->entity; |
|
1299 | 1299 | |
1300 | 1300 | $resql = Config::$dbEngine->query($sql); |
1301 | 1301 | if ($resql) { |
@@ -1312,10 +1312,10 @@ discard block |
||
1312 | 1312 | $i = 0; |
1313 | 1313 | while ($i < $num) { |
1314 | 1314 | |
1315 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights WHERE fk_user = $this->id AND fk_id=$rd[$i]"; |
|
1315 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = $this->id AND fk_id=$rd[$i]"; |
|
1316 | 1316 | $result = Config::$dbEngine->query($sql); |
1317 | 1317 | |
1318 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_rights (fk_user, fk_id) VALUES ($this->id, $rd[$i])"; |
|
1318 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_rights (fk_user, fk_id) VALUES ($this->id, $rd[$i])"; |
|
1319 | 1319 | $result = Config::$dbEngine->query($sql); |
1320 | 1320 | if (!$result) { |
1321 | 1321 | return -1; |
@@ -1343,7 +1343,7 @@ discard block |
||
1343 | 1343 | $nbrowsaffected = 0; |
1344 | 1344 | $error = 0; |
1345 | 1345 | |
1346 | - DolUtils::dol_syslog(get_class($this) . "::update notrigger=" . $notrigger . ", nosyncmember=" . $nosyncmember . ", nosyncmemberpass=" . $nosyncmemberpass); |
|
1346 | + DolUtils::dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncmember=".$nosyncmember.", nosyncmemberpass=".$nosyncmemberpass); |
|
1347 | 1347 | |
1348 | 1348 | // Clean parameters |
1349 | 1349 | $this->lastname = trim($this->lastname); |
@@ -1371,7 +1371,7 @@ discard block |
||
1371 | 1371 | $this->job = trim($this->job); |
1372 | 1372 | $this->signature = trim($this->signature); |
1373 | 1373 | $this->note = trim($this->note); |
1374 | - $this->openid = trim(empty($this->openid) ? '' : $this->openid); // Avoid warning |
|
1374 | + $this->openid = trim(empty($this->openid) ? '' : $this->openid); // Avoid warning |
|
1375 | 1375 | $this->admin = $this->admin ? $this->admin : 0; |
1376 | 1376 | $this->address = empty($this->address) ? '' : $this->address; |
1377 | 1377 | $this->zip = empty($this->zip) ? '' : $this->zip; |
@@ -1396,59 +1396,59 @@ discard block |
||
1396 | 1396 | Config::$dbEngine->begin(); |
1397 | 1397 | |
1398 | 1398 | // Update datas |
1399 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET"; |
|
1400 | - $sql .= " lastname = '" . Config::$dbEngine->escape($this->lastname) . "'"; |
|
1401 | - $sql .= ", firstname = '" . Config::$dbEngine->escape($this->firstname) . "'"; |
|
1402 | - $sql .= ", employee = " . $this->employee; |
|
1403 | - $sql .= ", login = '" . Config::$dbEngine->escape($this->login) . "'"; |
|
1404 | - $sql .= ", api_key = " . ($this->api_key ? "'" . Config::$dbEngine->escape($this->api_key) . "'" : "null"); |
|
1405 | - $sql .= ", gender = " . ($this->gender != -1 ? "'" . Config::$dbEngine->escape($this->gender) . "'" : "null"); // 'man' or 'woman' |
|
1406 | - $sql .= ", birth=" . (strval($this->birth) != '' ? "'" . Config::$dbEngine->idate($this->birth) . "'" : 'null'); |
|
1399 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; |
|
1400 | + $sql .= " lastname = '".Config::$dbEngine->escape($this->lastname)."'"; |
|
1401 | + $sql .= ", firstname = '".Config::$dbEngine->escape($this->firstname)."'"; |
|
1402 | + $sql .= ", employee = ".$this->employee; |
|
1403 | + $sql .= ", login = '".Config::$dbEngine->escape($this->login)."'"; |
|
1404 | + $sql .= ", api_key = ".($this->api_key ? "'".Config::$dbEngine->escape($this->api_key)."'" : "null"); |
|
1405 | + $sql .= ", gender = ".($this->gender != -1 ? "'".Config::$dbEngine->escape($this->gender)."'" : "null"); // 'man' or 'woman' |
|
1406 | + $sql .= ", birth=".(strval($this->birth) != '' ? "'".Config::$dbEngine->idate($this->birth)."'" : 'null'); |
|
1407 | 1407 | if (!empty(Globals::$user->admin)) { |
1408 | - $sql .= ", admin = " . $this->admin; // admin flag can be set/unset only by an admin user |
|
1409 | - } |
|
1410 | - $sql .= ", address = '" . Config::$dbEngine->escape($this->address) . "'"; |
|
1411 | - $sql .= ", zip = '" . Config::$dbEngine->escape($this->zip) . "'"; |
|
1412 | - $sql .= ", town = '" . Config::$dbEngine->escape($this->town) . "'"; |
|
1413 | - $sql .= ", fk_state = " . ((!empty($this->state_id) && $this->state_id > 0) ? "'" . Config::$dbEngine->escape($this->state_id) . "'" : "null"); |
|
1414 | - $sql .= ", fk_country = " . ((!empty($this->country_id) && $this->country_id > 0) ? "'" . Config::$dbEngine->escape($this->country_id) . "'" : "null"); |
|
1415 | - $sql .= ", office_phone = '" . Config::$dbEngine->escape($this->office_phone) . "'"; |
|
1416 | - $sql .= ", office_fax = '" . Config::$dbEngine->escape($this->office_fax) . "'"; |
|
1417 | - $sql .= ", user_mobile = '" . Config::$dbEngine->escape($this->user_mobile) . "'"; |
|
1418 | - $sql .= ", email = '" . Config::$dbEngine->escape($this->email) . "'"; |
|
1419 | - $sql .= ", skype = '" . Config::$dbEngine->escape($this->skype) . "'"; |
|
1420 | - $sql .= ", twitter = '" . Config::$dbEngine->escape($this->twitter) . "'"; |
|
1421 | - $sql .= ", facebook = '" . Config::$dbEngine->escape($this->facebook) . "'"; |
|
1422 | - $sql .= ", job = '" . Config::$dbEngine->escape($this->job) . "'"; |
|
1423 | - $sql .= ", signature = '" . Config::$dbEngine->escape($this->signature) . "'"; |
|
1424 | - $sql .= ", accountancy_code = '" . Config::$dbEngine->escape($this->accountancy_code) . "'"; |
|
1425 | - $sql .= ", color = '" . Config::$dbEngine->escape($this->color) . "'"; |
|
1426 | - $sql .= ", dateemployment=" . (strval($this->dateemployment) != '' ? "'" . Config::$dbEngine->idate($this->dateemployment) . "'" : 'null'); |
|
1427 | - $sql .= ", dateemploymentend=" . (strval($this->dateemploymentend) != '' ? "'" . Config::$dbEngine->idate($this->dateemploymentend) . "'" : 'null'); |
|
1428 | - $sql .= ", note = '" . Config::$dbEngine->escape($this->note) . "'"; |
|
1429 | - $sql .= ", photo = " . ($this->photo ? "'" . Config::$dbEngine->escape($this->photo) . "'" : "null"); |
|
1430 | - $sql .= ", openid = " . ($this->openid ? "'" . Config::$dbEngine->escape($this->openid) . "'" : "null"); |
|
1431 | - $sql .= ", fk_user = " . ($this->fk_user > 0 ? "'" . Config::$dbEngine->escape($this->fk_user) . "'" : "null"); |
|
1408 | + $sql .= ", admin = ".$this->admin; // admin flag can be set/unset only by an admin user |
|
1409 | + } |
|
1410 | + $sql .= ", address = '".Config::$dbEngine->escape($this->address)."'"; |
|
1411 | + $sql .= ", zip = '".Config::$dbEngine->escape($this->zip)."'"; |
|
1412 | + $sql .= ", town = '".Config::$dbEngine->escape($this->town)."'"; |
|
1413 | + $sql .= ", fk_state = ".((!empty($this->state_id) && $this->state_id > 0) ? "'".Config::$dbEngine->escape($this->state_id)."'" : "null"); |
|
1414 | + $sql .= ", fk_country = ".((!empty($this->country_id) && $this->country_id > 0) ? "'".Config::$dbEngine->escape($this->country_id)."'" : "null"); |
|
1415 | + $sql .= ", office_phone = '".Config::$dbEngine->escape($this->office_phone)."'"; |
|
1416 | + $sql .= ", office_fax = '".Config::$dbEngine->escape($this->office_fax)."'"; |
|
1417 | + $sql .= ", user_mobile = '".Config::$dbEngine->escape($this->user_mobile)."'"; |
|
1418 | + $sql .= ", email = '".Config::$dbEngine->escape($this->email)."'"; |
|
1419 | + $sql .= ", skype = '".Config::$dbEngine->escape($this->skype)."'"; |
|
1420 | + $sql .= ", twitter = '".Config::$dbEngine->escape($this->twitter)."'"; |
|
1421 | + $sql .= ", facebook = '".Config::$dbEngine->escape($this->facebook)."'"; |
|
1422 | + $sql .= ", job = '".Config::$dbEngine->escape($this->job)."'"; |
|
1423 | + $sql .= ", signature = '".Config::$dbEngine->escape($this->signature)."'"; |
|
1424 | + $sql .= ", accountancy_code = '".Config::$dbEngine->escape($this->accountancy_code)."'"; |
|
1425 | + $sql .= ", color = '".Config::$dbEngine->escape($this->color)."'"; |
|
1426 | + $sql .= ", dateemployment=".(strval($this->dateemployment) != '' ? "'".Config::$dbEngine->idate($this->dateemployment)."'" : 'null'); |
|
1427 | + $sql .= ", dateemploymentend=".(strval($this->dateemploymentend) != '' ? "'".Config::$dbEngine->idate($this->dateemploymentend)."'" : 'null'); |
|
1428 | + $sql .= ", note = '".Config::$dbEngine->escape($this->note)."'"; |
|
1429 | + $sql .= ", photo = ".($this->photo ? "'".Config::$dbEngine->escape($this->photo)."'" : "null"); |
|
1430 | + $sql .= ", openid = ".($this->openid ? "'".Config::$dbEngine->escape($this->openid)."'" : "null"); |
|
1431 | + $sql .= ", fk_user = ".($this->fk_user > 0 ? "'".Config::$dbEngine->escape($this->fk_user)."'" : "null"); |
|
1432 | 1432 | if (isset($this->thm) || $this->thm != '') { |
1433 | - $sql .= ", thm= " . ($this->thm != '' ? "'" . Config::$dbEngine->escape($this->thm) . "'" : "null"); |
|
1433 | + $sql .= ", thm= ".($this->thm != '' ? "'".Config::$dbEngine->escape($this->thm)."'" : "null"); |
|
1434 | 1434 | } |
1435 | 1435 | if (isset($this->tjm) || $this->tjm != '') { |
1436 | - $sql .= ", tjm= " . ($this->tjm != '' ? "'" . Config::$dbEngine->escape($this->tjm) . "'" : "null"); |
|
1436 | + $sql .= ", tjm= ".($this->tjm != '' ? "'".Config::$dbEngine->escape($this->tjm)."'" : "null"); |
|
1437 | 1437 | } |
1438 | 1438 | if (isset($this->salary) || $this->salary != '') { |
1439 | - $sql .= ", salary= " . ($this->salary != '' ? "'" . Config::$dbEngine->escape($this->salary) . "'" : "null"); |
|
1439 | + $sql .= ", salary= ".($this->salary != '' ? "'".Config::$dbEngine->escape($this->salary)."'" : "null"); |
|
1440 | 1440 | } |
1441 | 1441 | if (isset($this->salaryextra) || $this->salaryextra != '') { |
1442 | - $sql .= ", salaryextra= " . ($this->salaryextra != '' ? "'" . Config::$dbEngine->escape($this->salaryextra) . "'" : "null"); |
|
1442 | + $sql .= ", salaryextra= ".($this->salaryextra != '' ? "'".Config::$dbEngine->escape($this->salaryextra)."'" : "null"); |
|
1443 | 1443 | } |
1444 | - $sql .= ", weeklyhours= " . ($this->weeklyhours != '' ? "'" . Config::$dbEngine->escape($this->weeklyhours) . "'" : "null"); |
|
1445 | - $sql .= ", entity = '" . Config::$dbEngine->escape($this->entity) . "'"; |
|
1446 | - $sql .= ", default_range = " . ($this->default_range > 0 ? $this->default_range : 'null'); |
|
1447 | - $sql .= ", default_c_exp_tax_cat = " . ($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null'); |
|
1444 | + $sql .= ", weeklyhours= ".($this->weeklyhours != '' ? "'".Config::$dbEngine->escape($this->weeklyhours)."'" : "null"); |
|
1445 | + $sql .= ", entity = '".Config::$dbEngine->escape($this->entity)."'"; |
|
1446 | + $sql .= ", default_range = ".($this->default_range > 0 ? $this->default_range : 'null'); |
|
1447 | + $sql .= ", default_c_exp_tax_cat = ".($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null'); |
|
1448 | 1448 | |
1449 | - $sql .= " WHERE rowid = " . $this->id; |
|
1449 | + $sql .= " WHERE rowid = ".$this->id; |
|
1450 | 1450 | |
1451 | - DolUtils::dol_syslog(get_class($this) . "::update", LOG_DEBUG); |
|
1451 | + DolUtils::dol_syslog(get_class($this)."::update", LOG_DEBUG); |
|
1452 | 1452 | $resql = Config::$dbEngine->query($sql); |
1453 | 1453 | if ($resql) { |
1454 | 1454 | $nbrowsaffected += Config::$dbEngine->affected_rows($resql); |
@@ -1466,8 +1466,8 @@ discard block |
||
1466 | 1466 | |
1467 | 1467 | // If user is linked to a member, remove old link to this member |
1468 | 1468 | if ($this->fk_member > 0) { |
1469 | - DolUtils::dol_syslog(get_class($this) . "::update remove link with member. We will recreate it later", LOG_DEBUG); |
|
1470 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member = NULL where fk_member = " . $this->fk_member; |
|
1469 | + DolUtils::dol_syslog(get_class($this)."::update remove link with member. We will recreate it later", LOG_DEBUG); |
|
1470 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member; |
|
1471 | 1471 | $resql = Config::$dbEngine->query($sql); |
1472 | 1472 | if (!$resql) { |
1473 | 1473 | $this->error = Config::$dbEngine->error(); |
@@ -1476,8 +1476,8 @@ discard block |
||
1476 | 1476 | } |
1477 | 1477 | } |
1478 | 1478 | // Set link to user |
1479 | - DolUtils::dol_syslog(get_class($this) . "::update set link with member", LOG_DEBUG); |
|
1480 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member =" . ($this->fk_member > 0 ? $this->fk_member : 'null') . " where rowid = " . $this->id; |
|
1479 | + DolUtils::dol_syslog(get_class($this)."::update set link with member", LOG_DEBUG); |
|
1480 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member =".($this->fk_member > 0 ? $this->fk_member : 'null')." where rowid = ".$this->id; |
|
1481 | 1481 | $resql = Config::$dbEngine->query($sql); |
1482 | 1482 | if (!$resql) { |
1483 | 1483 | $this->error = Config::$dbEngine->error(); |
@@ -1487,9 +1487,9 @@ discard block |
||
1487 | 1487 | |
1488 | 1488 | if ($nbrowsaffected) { // If something has changed in data |
1489 | 1489 | if ($this->fk_member > 0 && !$nosyncmember) { |
1490 | - DolUtils::dol_syslog(get_class($this) . "::update user is linked with a member. We try to update member too.", LOG_DEBUG); |
|
1490 | + DolUtils::dol_syslog(get_class($this)."::update user is linked with a member. We try to update member too.", LOG_DEBUG); |
|
1491 | 1491 | |
1492 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
1492 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
1493 | 1493 | |
1494 | 1494 | // This user is linked with a member, so we also update member information |
1495 | 1495 | // if this is an update. |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | if ($result < 0) { |
1530 | 1530 | $this->error = $adh->error; |
1531 | 1531 | $this->errors = $adh->errors; |
1532 | - DolUtils::dol_syslog(get_class($this) . "::update error after calling adh->update to sync it with user: " . $this->error, LOG_ERR); |
|
1532 | + DolUtils::dol_syslog(get_class($this)."::update error after calling adh->update to sync it with user: ".$this->error, LOG_ERR); |
|
1533 | 1533 | $error++; |
1534 | 1534 | } |
1535 | 1535 | } else { |
@@ -1540,9 +1540,9 @@ discard block |
||
1540 | 1540 | } |
1541 | 1541 | |
1542 | 1542 | if ($this->contact_id > 0 && !$nosynccontact) { |
1543 | - DolUtils::dol_syslog(get_class($this) . "::update user is linked with a contact. We try to update contact too.", LOG_DEBUG); |
|
1543 | + DolUtils::dol_syslog(get_class($this)."::update user is linked with a contact. We try to update contact too.", LOG_DEBUG); |
|
1544 | 1544 | |
1545 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1545 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
1546 | 1546 | |
1547 | 1547 | // This user is linked with a contact, so we also update contact information |
1548 | 1548 | // if this is an update. |
@@ -1582,7 +1582,7 @@ discard block |
||
1582 | 1582 | if ($result < 0) { |
1583 | 1583 | $this->error = $tmpobj->error; |
1584 | 1584 | $this->errors = $tmpobj->errors; |
1585 | - DolUtils::dol_syslog(get_class($this) . "::update error after calling adh->update to sync it with user: " . $this->error, LOG_ERR); |
|
1585 | + DolUtils::dol_syslog(get_class($this)."::update error after calling adh->update to sync it with user: ".$this->error, LOG_ERR); |
|
1586 | 1586 | $error++; |
1587 | 1587 | } |
1588 | 1588 | } else { |
@@ -1616,7 +1616,7 @@ discard block |
||
1616 | 1616 | Config::$dbEngine->commit(); |
1617 | 1617 | return $nbrowsaffected; |
1618 | 1618 | } else { |
1619 | - DolUtils::dol_syslog(get_class($this) . "::update error=" . $this->error, LOG_ERR); |
|
1619 | + DolUtils::dol_syslog(get_class($this)."::update error=".$this->error, LOG_ERR); |
|
1620 | 1620 | Config::$dbEngine->rollback(); |
1621 | 1621 | return -1; |
1622 | 1622 | } |
@@ -1639,20 +1639,20 @@ discard block |
||
1639 | 1639 | // phpcs:enable |
1640 | 1640 | $now = dol_now(); |
1641 | 1641 | |
1642 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET"; |
|
1642 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; |
|
1643 | 1643 | $sql .= " datepreviouslogin = datelastlogin,"; |
1644 | - $sql .= " datelastlogin = '" . Config::$dbEngine->idate($now) . "',"; |
|
1645 | - $sql .= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion |
|
1646 | - $sql .= " WHERE rowid = " . $this->id; |
|
1644 | + $sql .= " datelastlogin = '".Config::$dbEngine->idate($now)."',"; |
|
1645 | + $sql .= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion |
|
1646 | + $sql .= " WHERE rowid = ".$this->id; |
|
1647 | 1647 | |
1648 | - DolUtils::dol_syslog(get_class($this) . "::update_last_login_date user->id=" . $this->id . " " . $sql, LOG_DEBUG); |
|
1648 | + DolUtils::dol_syslog(get_class($this)."::update_last_login_date user->id=".$this->id." ".$sql, LOG_DEBUG); |
|
1649 | 1649 | $resql = Config::$dbEngine->query($sql); |
1650 | 1650 | if ($resql) { |
1651 | 1651 | $this->datepreviouslogin = $this->datelastlogin; |
1652 | 1652 | $this->datelastlogin = $now; |
1653 | 1653 | return 1; |
1654 | 1654 | } else { |
1655 | - $this->error = Config::$dbEngine->lasterror() . ' sql=' . $sql; |
|
1655 | + $this->error = Config::$dbEngine->lasterror().' sql='.$sql; |
|
1656 | 1656 | return -1; |
1657 | 1657 | } |
1658 | 1658 | } |
@@ -1670,11 +1670,11 @@ discard block |
||
1670 | 1670 | function setPassword($user, $password = '', $changelater = 0, $notrigger = 0, $nosyncmember = 0) |
1671 | 1671 | { |
1672 | 1672 | //global $conf, Globals::$langs; |
1673 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; |
|
1673 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; |
|
1674 | 1674 | |
1675 | 1675 | $error = 0; |
1676 | 1676 | |
1677 | - DolUtils::dol_syslog(get_class($this) . "::setPassword user=" . Globals::$user->id . " password=" . preg_replace('/./i', '*', $password) . " changelater=" . $changelater . " notrigger=" . $notrigger . " nosyncmember=" . $nosyncmember, LOG_DEBUG); |
|
1677 | + DolUtils::dol_syslog(get_class($this)."::setPassword user=".Globals::$user->id." password=".preg_replace('/./i', '*', $password)." changelater=".$changelater." notrigger=".$notrigger." nosyncmember=".$nosyncmember, LOG_DEBUG); |
|
1678 | 1678 | |
1679 | 1679 | // If new password not provided, we generate one |
1680 | 1680 | if (!$password) { |
@@ -1692,17 +1692,17 @@ discard block |
||
1692 | 1692 | |
1693 | 1693 | Config::$dbEngine->begin(); |
1694 | 1694 | |
1695 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
1696 | - $sql .= " SET pass_crypted = '" . Config::$dbEngine->escape($password_crypted) . "',"; |
|
1695 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
1696 | + $sql .= " SET pass_crypted = '".Config::$dbEngine->escape($password_crypted)."',"; |
|
1697 | 1697 | $sql .= " pass_temp = null"; |
1698 | 1698 | if (!empty(Globals::$conf->global->DATABASE_PWD_ENCRYPTED)) { |
1699 | 1699 | $sql .= ", pass = null"; |
1700 | 1700 | } else { |
1701 | - $sql .= ", pass = '" . Config::$dbEngine->escape($password) . "'"; |
|
1701 | + $sql .= ", pass = '".Config::$dbEngine->escape($password)."'"; |
|
1702 | 1702 | } |
1703 | - $sql .= " WHERE rowid = " . $this->id; |
|
1703 | + $sql .= " WHERE rowid = ".$this->id; |
|
1704 | 1704 | |
1705 | - DolUtils::dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG); |
|
1705 | + DolUtils::dol_syslog(get_class($this)."::setPassword", LOG_DEBUG); |
|
1706 | 1706 | $result = Config::$dbEngine->query($sql); |
1707 | 1707 | if ($result) { |
1708 | 1708 | if (Config::$dbEngine->affected_rows($result)) { |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | $this->pass_indatabase_crypted = $password_crypted; |
1712 | 1712 | |
1713 | 1713 | if ($this->fk_member && !$nosyncmember) { |
1714 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
1714 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
1715 | 1715 | |
1716 | 1716 | // This user is linked with a member, so we also update members informations |
1717 | 1717 | // if this is an update. |
@@ -1722,7 +1722,7 @@ discard block |
||
1722 | 1722 | $result = $adh->setPassword(Globals::$user, $this->pass, (empty(Globals::$conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1), 1); // Cryptage non gere dans module adherent |
1723 | 1723 | if ($result < 0) { |
1724 | 1724 | $this->error = $adh->error; |
1725 | - DolUtils::dol_syslog(get_class($this) . "::setPassword " . $this->error, LOG_ERR); |
|
1725 | + DolUtils::dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR); |
|
1726 | 1726 | $error++; |
1727 | 1727 | } |
1728 | 1728 | } else { |
@@ -1731,7 +1731,7 @@ discard block |
||
1731 | 1731 | } |
1732 | 1732 | } |
1733 | 1733 | |
1734 | - DolUtils::dol_syslog(get_class($this) . "::setPassword notrigger=" . $notrigger . " error=" . $error, LOG_DEBUG); |
|
1734 | + DolUtils::dol_syslog(get_class($this)."::setPassword notrigger=".$notrigger." error=".$error, LOG_DEBUG); |
|
1735 | 1735 | |
1736 | 1736 | if (!$error && !$notrigger) { |
1737 | 1737 | // Call trigger |
@@ -1758,11 +1758,11 @@ discard block |
||
1758 | 1758 | } else { |
1759 | 1759 | // We store clear password in password temporary field. |
1760 | 1760 | // After receiving confirmation link, we will crypt it and store it in pass_crypted |
1761 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
1762 | - $sql .= " SET pass_temp = '" . Config::$dbEngine->escape($password) . "'"; |
|
1763 | - $sql .= " WHERE rowid = " . $this->id; |
|
1761 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
1762 | + $sql .= " SET pass_temp = '".Config::$dbEngine->escape($password)."'"; |
|
1763 | + $sql .= " WHERE rowid = ".$this->id; |
|
1764 | 1764 | |
1765 | - DolUtils::dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG); // No log |
|
1765 | + DolUtils::dol_syslog(get_class($this)."::setPassword", LOG_DEBUG); // No log |
|
1766 | 1766 | $result = Config::$dbEngine->query($sql); |
1767 | 1767 | if ($result) { |
1768 | 1768 | return $password; |
@@ -1788,7 +1788,7 @@ discard block |
||
1788 | 1788 | //global $conf, Globals::$langs; |
1789 | 1789 | //global $dolibarr_main_url_root; |
1790 | 1790 | |
1791 | - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; |
|
1791 | + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; |
|
1792 | 1792 | |
1793 | 1793 | $msgishtml = 0; |
1794 | 1794 | |
@@ -1813,36 +1813,36 @@ discard block |
||
1813 | 1813 | $subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword", $appli); |
1814 | 1814 | |
1815 | 1815 | // Define $urlwithroot |
1816 | - $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root)); |
|
1817 | - $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT; // This is to use external domain name found into config file |
|
1816 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); |
|
1817 | + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
1818 | 1818 | |
1819 | 1819 | if (!$changelater) { |
1820 | - $url = $urlwithroot . '/'; |
|
1820 | + $url = $urlwithroot.'/'; |
|
1821 | 1821 | |
1822 | - $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived") . ".\n"; |
|
1823 | - $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyIs") . " :\n\n"; |
|
1824 | - $mesg .= $outputlangs->transnoentitiesnoconv("Login") . " = " . $this->login . "\n"; |
|
1825 | - $mesg .= $outputlangs->transnoentitiesnoconv("Password") . " = " . $password . "\n\n"; |
|
1822 | + $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n"; |
|
1823 | + $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n"; |
|
1824 | + $mesg .= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; |
|
1825 | + $mesg .= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n"; |
|
1826 | 1826 | $mesg .= "\n"; |
1827 | 1827 | |
1828 | - $mesg .= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli) . ': ' . $url . "\n\n"; |
|
1828 | + $mesg .= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli).': '.$url."\n\n"; |
|
1829 | 1829 | $mesg .= "--\n"; |
1830 | 1830 | $mesg .= Globals::$user->getFullName($outputlangs); // Username that make then sending |
1831 | 1831 | |
1832 | - DolUtils::dol_syslog(get_class($this) . "::send_password changelater is off, url=" . $url); |
|
1832 | + DolUtils::dol_syslog(get_class($this)."::send_password changelater is off, url=".$url); |
|
1833 | 1833 | } else { |
1834 | - $url = $urlwithroot . '/user/passwordforgotten.php?action=validatenewpassword&username=' . $this->login . "&passwordhash=" . dol_hash($password); |
|
1834 | + $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); |
|
1835 | 1835 | |
1836 | - $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived") . "\n"; |
|
1837 | - $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyWillBe") . " :\n\n"; |
|
1838 | - $mesg .= $outputlangs->transnoentitiesnoconv("Login") . " = " . $this->login . "\n"; |
|
1839 | - $mesg .= $outputlangs->transnoentitiesnoconv("Password") . " = " . $password . "\n\n"; |
|
1836 | + $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n"; |
|
1837 | + $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n"; |
|
1838 | + $mesg .= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; |
|
1839 | + $mesg .= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n"; |
|
1840 | 1840 | $mesg .= "\n"; |
1841 | - $mesg .= $outputlangs->transnoentitiesnoconv("YouMustClickToChange") . " :\n"; |
|
1842 | - $mesg .= $url . "\n\n"; |
|
1843 | - $mesg .= $outputlangs->transnoentitiesnoconv("ForgetIfNothing") . "\n\n"; |
|
1841 | + $mesg .= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n"; |
|
1842 | + $mesg .= $url."\n\n"; |
|
1843 | + $mesg .= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n"; |
|
1844 | 1844 | |
1845 | - DolUtils::dol_syslog(get_class($this) . "::send_password changelater is on, url=" . $url); |
|
1845 | + DolUtils::dol_syslog(get_class($this)."::send_password changelater is on, url=".$url); |
|
1846 | 1846 | } |
1847 | 1847 | |
1848 | 1848 | $mailfile = new CMailFile( |
@@ -1853,7 +1853,7 @@ discard block |
||
1853 | 1853 | return 1; |
1854 | 1854 | } else { |
1855 | 1855 | Globals::$langs->trans("errors"); |
1856 | - $this->error = Globals::$langs->trans("ErrorFailedToSendPassword") . ' ' . $mailfile->error; |
|
1856 | + $this->error = Globals::$langs->trans("ErrorFailedToSendPassword").' '.$mailfile->error; |
|
1857 | 1857 | return -1; |
1858 | 1858 | } |
1859 | 1859 | } |
@@ -1878,8 +1878,8 @@ discard block |
||
1878 | 1878 | { |
1879 | 1879 | // phpcs:enable |
1880 | 1880 | $sql = "SELECT url, login, pass, poste "; |
1881 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user_clicktodial as u"; |
|
1882 | - $sql .= " WHERE u.fk_user = " . $this->id; |
|
1881 | + $sql .= " FROM ".MAIN_DB_PREFIX."user_clicktodial as u"; |
|
1882 | + $sql .= " WHERE u.fk_user = ".$this->id; |
|
1883 | 1883 | |
1884 | 1884 | $resql = Config::$dbEngine->query($sql); |
1885 | 1885 | if ($resql) { |
@@ -1913,21 +1913,21 @@ discard block |
||
1913 | 1913 | // phpcs:enable |
1914 | 1914 | Config::$dbEngine->begin(); |
1915 | 1915 | |
1916 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_clicktodial"; |
|
1917 | - $sql .= " WHERE fk_user = " . $this->id; |
|
1916 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_clicktodial"; |
|
1917 | + $sql .= " WHERE fk_user = ".$this->id; |
|
1918 | 1918 | |
1919 | - DolUtils::dol_syslog(get_class($this) . '::update_clicktodial', LOG_DEBUG); |
|
1919 | + DolUtils::dol_syslog(get_class($this).'::update_clicktodial', LOG_DEBUG); |
|
1920 | 1920 | $result = Config::$dbEngine->query($sql); |
1921 | 1921 | |
1922 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_clicktodial"; |
|
1922 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_clicktodial"; |
|
1923 | 1923 | $sql .= " (fk_user,url,login,pass,poste)"; |
1924 | - $sql .= " VALUES (" . $this->id; |
|
1925 | - $sql .= ", '" . Config::$dbEngine->escape($this->clicktodial_url) . "'"; |
|
1926 | - $sql .= ", '" . Config::$dbEngine->escape($this->clicktodial_login) . "'"; |
|
1927 | - $sql .= ", '" . Config::$dbEngine->escape($this->clicktodial_password) . "'"; |
|
1928 | - $sql .= ", '" . Config::$dbEngine->escape($this->clicktodial_poste) . "')"; |
|
1924 | + $sql .= " VALUES (".$this->id; |
|
1925 | + $sql .= ", '".Config::$dbEngine->escape($this->clicktodial_url)."'"; |
|
1926 | + $sql .= ", '".Config::$dbEngine->escape($this->clicktodial_login)."'"; |
|
1927 | + $sql .= ", '".Config::$dbEngine->escape($this->clicktodial_password)."'"; |
|
1928 | + $sql .= ", '".Config::$dbEngine->escape($this->clicktodial_poste)."')"; |
|
1929 | 1929 | |
1930 | - DolUtils::dol_syslog(get_class($this) . '::update_clicktodial', LOG_DEBUG); |
|
1930 | + DolUtils::dol_syslog(get_class($this).'::update_clicktodial', LOG_DEBUG); |
|
1931 | 1931 | $result = Config::$dbEngine->query($sql); |
1932 | 1932 | if ($result) { |
1933 | 1933 | Config::$dbEngine->commit(); |
@@ -1957,20 +1957,20 @@ discard block |
||
1957 | 1957 | |
1958 | 1958 | Config::$dbEngine->begin(); |
1959 | 1959 | |
1960 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "usergroup_user"; |
|
1961 | - $sql .= " WHERE fk_user = " . $this->id; |
|
1962 | - $sql .= " AND fk_usergroup = " . $group; |
|
1963 | - $sql .= " AND entity = " . $entity; |
|
1960 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user"; |
|
1961 | + $sql .= " WHERE fk_user = ".$this->id; |
|
1962 | + $sql .= " AND fk_usergroup = ".$group; |
|
1963 | + $sql .= " AND entity = ".$entity; |
|
1964 | 1964 | |
1965 | 1965 | $result = Config::$dbEngine->query($sql); |
1966 | 1966 | |
1967 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "usergroup_user (entity, fk_user, fk_usergroup)"; |
|
1968 | - $sql .= " VALUES (" . $entity . "," . $this->id . "," . $group . ")"; |
|
1967 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup_user (entity, fk_user, fk_usergroup)"; |
|
1968 | + $sql .= " VALUES (".$entity.",".$this->id.",".$group.")"; |
|
1969 | 1969 | |
1970 | 1970 | $result = Config::$dbEngine->query($sql); |
1971 | 1971 | if ($result) { |
1972 | 1972 | if (!$error && !$notrigger) { |
1973 | - $this->newgroupid = $group; // deprecated. Remove this. |
|
1973 | + $this->newgroupid = $group; // deprecated. Remove this. |
|
1974 | 1974 | $this->context = array('audit' => Globals::$langs->trans("UserSetInGroup"), 'newgroupid' => $group); |
1975 | 1975 | |
1976 | 1976 | // Call trigger |
@@ -1985,7 +1985,7 @@ discard block |
||
1985 | 1985 | Config::$dbEngine->commit(); |
1986 | 1986 | return 1; |
1987 | 1987 | } else { |
1988 | - DolUtils::dol_syslog(get_class($this) . "::SetInGroup " . $this->error, LOG_ERR); |
|
1988 | + DolUtils::dol_syslog(get_class($this)."::SetInGroup ".$this->error, LOG_ERR); |
|
1989 | 1989 | Config::$dbEngine->rollback(); |
1990 | 1990 | return -2; |
1991 | 1991 | } |
@@ -2014,15 +2014,15 @@ discard block |
||
2014 | 2014 | |
2015 | 2015 | Config::$dbEngine->begin(); |
2016 | 2016 | |
2017 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "usergroup_user"; |
|
2018 | - $sql .= " WHERE fk_user = " . $this->id; |
|
2019 | - $sql .= " AND fk_usergroup = " . $group; |
|
2020 | - $sql .= " AND entity = " . $entity; |
|
2017 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user"; |
|
2018 | + $sql .= " WHERE fk_user = ".$this->id; |
|
2019 | + $sql .= " AND fk_usergroup = ".$group; |
|
2020 | + $sql .= " AND entity = ".$entity; |
|
2021 | 2021 | |
2022 | 2022 | $result = Config::$dbEngine->query($sql); |
2023 | 2023 | if ($result) { |
2024 | 2024 | if (!$error && !$notrigger) { |
2025 | - $this->oldgroupid = $group; // deprecated. Remove this. |
|
2025 | + $this->oldgroupid = $group; // deprecated. Remove this. |
|
2026 | 2026 | $this->context = array('audit' => Globals::$langs->trans("UserRemovedFromGroup"), 'oldgroupid' => $group); |
2027 | 2027 | |
2028 | 2028 | // Call trigger |
@@ -2038,7 +2038,7 @@ discard block |
||
2038 | 2038 | return 1; |
2039 | 2039 | } else { |
2040 | 2040 | $this->error = $interface->error; |
2041 | - DolUtils::dol_syslog(get_class($this) . "::RemoveFromGroup " . $this->error, LOG_ERR); |
|
2041 | + DolUtils::dol_syslog(get_class($this)."::RemoveFromGroup ".$this->error, LOG_ERR); |
|
2042 | 2042 | Config::$dbEngine->rollback(); |
2043 | 2043 | return -2; |
2044 | 2044 | } |
@@ -2062,7 +2062,7 @@ discard block |
||
2062 | 2062 | function getPhotoUrl($width, $height, $cssclass = '', $imagesize = '') |
2063 | 2063 | { |
2064 | 2064 | // $result = '<a href="' . DOL_URL_ROOT . '/user/card.php?id=' . $this->id . '">'; |
2065 | - $result = '<a href="' . BASE_URI . '?controller=user&method=card&id=' . $this->id . '">'; |
|
2065 | + $result = '<a href="'.BASE_URI.'?controller=user&method=card&id='.$this->id.'">'; |
|
2066 | 2066 | $result .= Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize); |
2067 | 2067 | $result .= '</a>'; |
2068 | 2068 | |
@@ -2112,49 +2112,49 @@ discard block |
||
2112 | 2112 | |
2113 | 2113 | // Info Login |
2114 | 2114 | $label .= '<div class="centpercent">'; |
2115 | - $label .= '<u>' . Globals::$langs->trans("User") . '</u><br>'; |
|
2116 | - $label .= '<b>' . Globals::$langs->trans('Name') . ':</b> ' . $this->getFullName(Globals::$langs, ''); |
|
2115 | + $label .= '<u>'.Globals::$langs->trans("User").'</u><br>'; |
|
2116 | + $label .= '<b>'.Globals::$langs->trans('Name').':</b> '.$this->getFullName(Globals::$langs, ''); |
|
2117 | 2117 | if (!empty($this->login)) { |
2118 | - $label .= '<br><b>' . Globals::$langs->trans('Login') . ':</b> ' . $this->login; |
|
2118 | + $label .= '<br><b>'.Globals::$langs->trans('Login').':</b> '.$this->login; |
|
2119 | 2119 | } |
2120 | - $label .= '<br><b>' . Globals::$langs->trans("EMail") . ':</b> ' . $this->email; |
|
2120 | + $label .= '<br><b>'.Globals::$langs->trans("EMail").':</b> '.$this->email; |
|
2121 | 2121 | if (!empty($this->admin)) { |
2122 | - $label .= '<br><b>' . Globals::$langs->trans("Administrator") . '</b>: ' . DolUtils::yn($this->admin); |
|
2122 | + $label .= '<br><b>'.Globals::$langs->trans("Administrator").'</b>: '.DolUtils::yn($this->admin); |
|
2123 | 2123 | } |
2124 | 2124 | if (!empty($this->socid)) { // Add thirdparty for external users |
2125 | 2125 | $thirdpartystatic = new Societe($db); |
2126 | 2126 | $thirdpartystatic->fetch($this->socid); |
2127 | 2127 | if (empty($hidethirdpartylogo)) { |
2128 | - $companylink = ' ' . $thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company |
|
2128 | + $companylink = ' '.$thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company |
|
2129 | 2129 | } |
2130 | - $company = ' (' . Globals::$langs->trans("Company") . ': ' . $thirdpartystatic->name . ')'; |
|
2130 | + $company = ' ('.Globals::$langs->trans("Company").': '.$thirdpartystatic->name.')'; |
|
2131 | 2131 | } |
2132 | - $type = ($this->socid ? Globals::$langs->trans("External") . $company : Globals::$langs->trans("Internal")); |
|
2133 | - $label .= '<br><b>' . Globals::$langs->trans("Type") . ':</b> ' . $type; |
|
2134 | - $label .= '<br><b>' . Globals::$langs->trans("Status") . '</b>: ' . $this->getLibStatut(0); |
|
2132 | + $type = ($this->socid ? Globals::$langs->trans("External").$company : Globals::$langs->trans("Internal")); |
|
2133 | + $label .= '<br><b>'.Globals::$langs->trans("Type").':</b> '.$type; |
|
2134 | + $label .= '<br><b>'.Globals::$langs->trans("Status").'</b>: '.$this->getLibStatut(0); |
|
2135 | 2135 | $label .= '</div>'; |
2136 | 2136 | if ($infologin > 0) { |
2137 | 2137 | $label .= '<br>'; |
2138 | - $label .= '<br><u>' . Globals::$langs->trans("Connection") . '</u>'; |
|
2139 | - $label .= '<br><b>' . Globals::$langs->trans("IPAddress") . '</b>: ' . $_SERVER["REMOTE_ADDR"]; |
|
2138 | + $label .= '<br><u>'.Globals::$langs->trans("Connection").'</u>'; |
|
2139 | + $label .= '<br><b>'.Globals::$langs->trans("IPAddress").'</b>: '.$_SERVER["REMOTE_ADDR"]; |
|
2140 | 2140 | if (!empty(Globals::$conf->global->MAIN_MODULE_MULTICOMPANY)) { |
2141 | - $label .= '<br><b>' . Globals::$langs->trans("ConnectedOnMultiCompany") . ':</b> ' . Globals::$conf->entity . ' (user entity ' . $this->entity . ')'; |
|
2141 | + $label .= '<br><b>'.Globals::$langs->trans("ConnectedOnMultiCompany").':</b> '.Globals::$conf->entity.' (user entity '.$this->entity.')'; |
|
2142 | 2142 | } |
2143 | - $label .= '<br><b>' . Globals::$langs->trans("AuthenticationMode") . ':</b> ' . $_SESSION["dol_authmode"] . (empty($dolibarr_main_demo) ? '' : ' (demo)'); |
|
2144 | - $label .= '<br><b>' . Globals::$langs->trans("ConnectedSince") . ':</b> ' . DolUtils::dol_print_date($this->datelastlogin, "dayhour", 'tzuser'); |
|
2145 | - $label .= '<br><b>' . Globals::$langs->trans("PreviousConnexion") . ':</b> ' . DolUtils::dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser'); |
|
2146 | - $label .= '<br><b>' . Globals::$langs->trans("CurrentTheme") . ':</b> ' . Globals::$conf->theme; |
|
2147 | - $label .= '<br><b>' . Globals::$langs->trans("CurrentMenuManager") . ':</b> ' . Globals::$menuManager->name; |
|
2143 | + $label .= '<br><b>'.Globals::$langs->trans("AuthenticationMode").':</b> '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)'); |
|
2144 | + $label .= '<br><b>'.Globals::$langs->trans("ConnectedSince").':</b> '.DolUtils::dol_print_date($this->datelastlogin, "dayhour", 'tzuser'); |
|
2145 | + $label .= '<br><b>'.Globals::$langs->trans("PreviousConnexion").':</b> '.DolUtils::dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser'); |
|
2146 | + $label .= '<br><b>'.Globals::$langs->trans("CurrentTheme").':</b> '.Globals::$conf->theme; |
|
2147 | + $label .= '<br><b>'.Globals::$langs->trans("CurrentMenuManager").':</b> '.Globals::$menuManager->name; |
|
2148 | 2148 | $s = DolUtils::picto_from_langcode(Globals::$langs->getDefaultLang()); |
2149 | - $label .= '<br><b>' . Globals::$langs->trans("CurrentUserLanguage") . ':</b> ' . ($s ? $s . ' ' : '') . Globals::$langs->getDefaultLang(); |
|
2150 | - $label .= '<br><b>' . Globals::$langs->trans("Browser") . ':</b> ' . Globals::$conf->browser->name . (Globals::$conf->browser->version ? ' ' . Globals::$conf->browser->version : '') . ' (' . $_SERVER['HTTP_USER_AGENT'] . ')'; |
|
2151 | - $label .= '<br><b>' . Globals::$langs->trans("Layout") . ':</b> ' . Globals::$conf->browser->layout; |
|
2152 | - $label .= '<br><b>' . Globals::$langs->trans("Screen") . ':</b> ' . $_SESSION['dol_screenwidth'] . ' x ' . $_SESSION['dol_screenheight']; |
|
2149 | + $label .= '<br><b>'.Globals::$langs->trans("CurrentUserLanguage").':</b> '.($s ? $s.' ' : '').Globals::$langs->getDefaultLang(); |
|
2150 | + $label .= '<br><b>'.Globals::$langs->trans("Browser").':</b> '.Globals::$conf->browser->name.(Globals::$conf->browser->version ? ' '.Globals::$conf->browser->version : '').' ('.$_SERVER['HTTP_USER_AGENT'].')'; |
|
2151 | + $label .= '<br><b>'.Globals::$langs->trans("Layout").':</b> '.Globals::$conf->browser->layout; |
|
2152 | + $label .= '<br><b>'.Globals::$langs->trans("Screen").':</b> '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; |
|
2153 | 2153 | if (Globals::$conf->browser->layout == 'phone') { |
2154 | - $label .= '<br><b>' . Globals::$langs->trans("Phone") . ':</b> ' . Globals::$langs->trans("Yes"); |
|
2154 | + $label .= '<br><b>'.Globals::$langs->trans("Phone").':</b> '.Globals::$langs->trans("Yes"); |
|
2155 | 2155 | } |
2156 | 2156 | if (!empty($_SESSION["disablemodules"])) { |
2157 | - $label .= '<br><b>' . Globals::$langs->trans("DisabledModules") . ':</b> <br>' . join(', ', explode(',', $_SESSION["disablemodules"])); |
|
2157 | + $label .= '<br><b>'.Globals::$langs->trans("DisabledModules").':</b> <br>'.join(', ', explode(',', $_SESSION["disablemodules"])); |
|
2158 | 2158 | } |
2159 | 2159 | } |
2160 | 2160 | if ($infologin < 0) { |
@@ -2162,10 +2162,10 @@ discard block |
||
2162 | 2162 | } |
2163 | 2163 | |
2164 | 2164 | // $url = DOL_URL_ROOT . '/user/card.php?id=' . $this->id; |
2165 | - $url = BASE_URI . '?controller=user&method=card&id=' . $this->id; |
|
2165 | + $url = BASE_URI.'?controller=user&method=card&id='.$this->id; |
|
2166 | 2166 | if ($option == 'leave') { |
2167 | 2167 | //$url = DOL_URL_ROOT . '/holiday/list.php?id=' . $this->id; |
2168 | - $url = BASE_URI . '?controller=holiday&method=list&id=' . $this->id; |
|
2168 | + $url = BASE_URI.'?controller=holiday&method=list&id='.$this->id; |
|
2169 | 2169 | } |
2170 | 2170 | if ($option != 'nolink') { |
2171 | 2171 | // Add param to save lastsearch_values or not |
@@ -2178,16 +2178,16 @@ discard block |
||
2178 | 2178 | } |
2179 | 2179 | } |
2180 | 2180 | |
2181 | - $linkstart = '<a href="' . $url . '"'; |
|
2181 | + $linkstart = '<a href="'.$url.'"'; |
|
2182 | 2182 | $linkclose = ""; |
2183 | 2183 | if (empty($notooltip)) { |
2184 | 2184 | if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
2185 | 2185 | Globals::$langs->load("users"); |
2186 | 2186 | $label = Globals::$langs->trans("ShowUser"); |
2187 | - $linkclose .= ' alt="' . DolUtils::dol_escape_htmltag($label, 1) . '"'; |
|
2187 | + $linkclose .= ' alt="'.DolUtils::dol_escape_htmltag($label, 1).'"'; |
|
2188 | 2188 | } |
2189 | - $linkclose .= ' title="' . DolUtils::dol_escape_htmltag($label, 1) . '"'; |
|
2190 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
2189 | + $linkclose .= ' title="'.DolUtils::dol_escape_htmltag($label, 1).'"'; |
|
2190 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
2191 | 2191 | |
2192 | 2192 | /* |
2193 | 2193 | Globals::$hookManager->initHooks(array('userdao')); |
@@ -2197,7 +2197,7 @@ discard block |
||
2197 | 2197 | */ |
2198 | 2198 | } |
2199 | 2199 | |
2200 | - $linkstart .= $linkclose . '>'; |
|
2200 | + $linkstart .= $linkclose.'>'; |
|
2201 | 2201 | $linkend = '</a>'; |
2202 | 2202 | |
2203 | 2203 | //if ($withpictoimg == -1) $result.='<div class="nowrap">'; |
@@ -2209,15 +2209,15 @@ discard block |
||
2209 | 2209 | } |
2210 | 2210 | // Only picto |
2211 | 2211 | if ($withpictoimg > 0) { |
2212 | - $picto = '<!-- picto user --><div class="inline-block nopadding userimg' . ($morecss ? ' ' . $morecss : '') . '">' . img_object('', 'user', $paddafterimage . ' ' . ($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1) . '</div>'; |
|
2212 | + $picto = '<!-- picto user --><div class="inline-block nopadding userimg'.($morecss ? ' '.$morecss : '').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).'</div>'; |
|
2213 | 2213 | } else { // Picto must be a photo |
2214 | - $picto = '<!-- picto photo user --><div class="inline-block nopadding userimg' . ($morecss ? ' ' . $morecss : '') . '"' . ($paddafterimage ? ' ' . $paddafterimage : '') . '>' . Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto' . ($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1) . '</div>'; |
|
2214 | + $picto = '<!-- picto photo user --><div class="inline-block nopadding userimg'.($morecss ? ' '.$morecss : '').'"'.($paddafterimage ? ' '.$paddafterimage : '').'>'.Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1).'</div>'; |
|
2215 | 2215 | } |
2216 | 2216 | $result .= $picto; |
2217 | 2217 | } |
2218 | 2218 | if ($withpictoimg > -2 && $withpictoimg != 2) { |
2219 | 2219 | if (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
2220 | - $result .= '<div class="inline-block nopadding valignmiddle usertext' . ((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled') . ($morecss ? ' ' . $morecss : '') . '">'; |
|
2220 | + $result .= '<div class="inline-block nopadding valignmiddle usertext'.((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled').($morecss ? ' '.$morecss : '').'">'; |
|
2221 | 2221 | } |
2222 | 2222 | if ($mode == 'login') { |
2223 | 2223 | $result .= dol_trunc($this->login, $maxlen); |
@@ -2237,7 +2237,7 @@ discard block |
||
2237 | 2237 | global $action; |
2238 | 2238 | Globals::$hookManager->initHooks(array('userdao')); |
2239 | 2239 | $parameters = array('id' => $this->id, 'getnomurl' => $result); |
2240 | - $reshook = Globals::$hookManager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
2240 | + $reshook = Globals::$hookManager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
2241 | 2241 | if ($reshook > 0) { |
2242 | 2242 | $result = Globals::$hookManager->resPrint; |
2243 | 2243 | } else { |
@@ -2261,7 +2261,7 @@ discard block |
||
2261 | 2261 | $result = ''; |
2262 | 2262 | |
2263 | 2263 | // $linkstart = '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">'; |
2264 | - $linkstart = '<a href="' . BASE_URI . '?controller=user&method=card&id=' . $this->id . '">'; |
|
2264 | + $linkstart = '<a href="'.BASE_URI.'?controller=user&method=card&id='.$this->id.'">'; |
|
2265 | 2265 | $linkend = '</a>'; |
2266 | 2266 | |
2267 | 2267 | //Check user's rights to see an other user |
@@ -2271,7 +2271,7 @@ discard block |
||
2271 | 2271 | |
2272 | 2272 | if ($option == 'xxx') { |
2273 | 2273 | //$linkstart = '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">'; |
2274 | - $linkstart = '<a href="' . BASE_URI . '?controller=user&method=card.php&id=' . $this->id . '">'; |
|
2274 | + $linkstart = '<a href="'.BASE_URI.'?controller=user&method=card.php&id='.$this->id.'">'; |
|
2275 | 2275 | $linkend = '</a>'; |
2276 | 2276 | } |
2277 | 2277 | |
@@ -2328,9 +2328,9 @@ discard block |
||
2328 | 2328 | } |
2329 | 2329 | } elseif ($mode == 2) { |
2330 | 2330 | if ($statut == 1) { |
2331 | - return img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"') . ' ' . Globals::$langs->trans('Enabled'); |
|
2331 | + return img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.Globals::$langs->trans('Enabled'); |
|
2332 | 2332 | } elseif ($statut == 0) { |
2333 | - return img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"') . ' ' . Globals::$langs->trans('Disabled'); |
|
2333 | + return img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.Globals::$langs->trans('Disabled'); |
|
2334 | 2334 | } |
2335 | 2335 | } elseif ($mode == 3) { |
2336 | 2336 | if ($statut == 1) { |
@@ -2340,15 +2340,15 @@ discard block |
||
2340 | 2340 | } |
2341 | 2341 | } elseif ($mode == 4) { |
2342 | 2342 | if ($statut == 1) { |
2343 | - return img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"') . ' ' . Globals::$langs->trans('Enabled'); |
|
2343 | + return img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.Globals::$langs->trans('Enabled'); |
|
2344 | 2344 | } elseif ($statut == 0) { |
2345 | - return img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"') . ' ' . Globals::$langs->trans('Disabled'); |
|
2345 | + return img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.Globals::$langs->trans('Disabled'); |
|
2346 | 2346 | } |
2347 | 2347 | } elseif ($mode == 5) { |
2348 | 2348 | if ($statut == 1) { |
2349 | - return Globals::$langs->trans('Enabled') . ' ' . img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"'); |
|
2349 | + return Globals::$langs->trans('Enabled').' '.img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"'); |
|
2350 | 2350 | } elseif ($statut == 0) { |
2351 | - return Globals::$langs->trans('Disabled') . ' ' . img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"'); |
|
2351 | + return Globals::$langs->trans('Disabled').' '.img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"'); |
|
2352 | 2352 | } |
2353 | 2353 | } |
2354 | 2354 | } |
@@ -2369,11 +2369,11 @@ discard block |
||
2369 | 2369 | global $conf; |
2370 | 2370 | $dn = ''; |
2371 | 2371 | if ($mode == 0) { |
2372 | - $dn = Globals::$conf->global->LDAP_KEY_USERS . "=" . $info[Globals::$conf->global->LDAP_KEY_USERS] . "," . Globals::$conf->global->LDAP_USER_DN; |
|
2372 | + $dn = Globals::$conf->global->LDAP_KEY_USERS."=".$info[Globals::$conf->global->LDAP_KEY_USERS].",".Globals::$conf->global->LDAP_USER_DN; |
|
2373 | 2373 | } elseif ($mode == 1) { |
2374 | 2374 | $dn = Globals::$conf->global->LDAP_USER_DN; |
2375 | 2375 | } elseif ($mode == 2) { |
2376 | - $dn = Globals::$conf->global->LDAP_KEY_USERS . "=" . $info[Globals::$conf->global->LDAP_KEY_USERS]; |
|
2376 | + $dn = Globals::$conf->global->LDAP_KEY_USERS."=".$info[Globals::$conf->global->LDAP_KEY_USERS]; |
|
2377 | 2377 | } |
2378 | 2378 | return $dn; |
2379 | 2379 | } |
@@ -2571,8 +2571,8 @@ discard block |
||
2571 | 2571 | { |
2572 | 2572 | $sql = "SELECT u.rowid, u.login as ref, u.datec,"; |
2573 | 2573 | $sql .= " u.tms as date_modification, u.entity"; |
2574 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
2575 | - $sql .= " WHERE u.rowid = " . $id; |
|
2574 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
2575 | + $sql .= " WHERE u.rowid = ".$id; |
|
2576 | 2576 | |
2577 | 2577 | $result = Config::$dbEngine->query($sql); |
2578 | 2578 | if ($result) { |
@@ -2601,9 +2601,9 @@ discard block |
||
2601 | 2601 | function getNbOfEMailings() |
2602 | 2602 | { |
2603 | 2603 | $sql = "SELECT count(mc.email) as nb"; |
2604 | - $sql .= " FROM " . MAIN_DB_PREFIX . "mailing_cibles as mc"; |
|
2605 | - $sql .= " WHERE mc.email = '" . Config::$dbEngine->escape($this->email) . "'"; |
|
2606 | - $sql .= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes |
|
2604 | + $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; |
|
2605 | + $sql .= " WHERE mc.email = '".Config::$dbEngine->escape($this->email)."'"; |
|
2606 | + $sql .= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes |
|
2607 | 2607 | |
2608 | 2608 | $resql = Config::$dbEngine->query($sql); |
2609 | 2609 | if ($resql) { |
@@ -2631,19 +2631,19 @@ discard block |
||
2631 | 2631 | global $conf; |
2632 | 2632 | |
2633 | 2633 | $sql = "SELECT count(rowid) as nb"; |
2634 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user"; |
|
2634 | + $sql .= " FROM ".MAIN_DB_PREFIX."user"; |
|
2635 | 2635 | if ($option == 'superadmin') { |
2636 | 2636 | $sql .= " WHERE entity = 0"; |
2637 | 2637 | if ($admin >= 0) { |
2638 | - $sql .= " AND admin = " . $admin; |
|
2638 | + $sql .= " AND admin = ".$admin; |
|
2639 | 2639 | } |
2640 | 2640 | } else { |
2641 | - $sql .= " WHERE entity IN (" . getEntity('user', 0) . ")"; |
|
2641 | + $sql .= " WHERE entity IN (".getEntity('user', 0).")"; |
|
2642 | 2642 | if ($limitTo == 'active') { |
2643 | 2643 | $sql .= " AND statut = 1"; |
2644 | 2644 | } |
2645 | 2645 | if ($admin >= 0) { |
2646 | - $sql .= " AND admin = " . $admin; |
|
2646 | + $sql .= " AND admin = ".$admin; |
|
2647 | 2647 | } |
2648 | 2648 | } |
2649 | 2649 | |
@@ -2694,7 +2694,7 @@ discard block |
||
2694 | 2694 | |
2695 | 2695 | $result = $this->update(Globals::$user); |
2696 | 2696 | |
2697 | - DolUtils::dol_syslog(get_class($this) . "::update_ldap2dolibarr result=" . $result, LOG_DEBUG); |
|
2697 | + DolUtils::dol_syslog(get_class($this)."::update_ldap2dolibarr result=".$result, LOG_DEBUG); |
|
2698 | 2698 | |
2699 | 2699 | return $result; |
2700 | 2700 | } |
@@ -2709,10 +2709,10 @@ discard block |
||
2709 | 2709 | function get_children() |
2710 | 2710 | { |
2711 | 2711 | // phpcs:enable |
2712 | - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "user"; |
|
2713 | - $sql .= " WHERE fk_user = " . $this->id; |
|
2712 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user"; |
|
2713 | + $sql .= " WHERE fk_user = ".$this->id; |
|
2714 | 2714 | |
2715 | - DolUtils::dol_syslog(get_class($this) . "::get_children result=" . $result, LOG_DEBUG); |
|
2715 | + DolUtils::dol_syslog(get_class($this)."::get_children result=".$result, LOG_DEBUG); |
|
2716 | 2716 | $res = Config::$dbEngine->query($sql); |
2717 | 2717 | if ($res) { |
2718 | 2718 | $this->users = array(); |
@@ -2741,11 +2741,11 @@ discard block |
||
2741 | 2741 | |
2742 | 2742 | // Load array[child]=parent |
2743 | 2743 | $sql = "SELECT fk_user as id_parent, rowid as id_son"; |
2744 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user"; |
|
2744 | + $sql .= " FROM ".MAIN_DB_PREFIX."user"; |
|
2745 | 2745 | $sql .= " WHERE fk_user <> 0"; |
2746 | - $sql .= " AND entity IN (" . getEntity('user') . ")"; |
|
2746 | + $sql .= " AND entity IN (".getEntity('user').")"; |
|
2747 | 2747 | |
2748 | - DolUtils::dol_syslog(get_class($this) . "::loadParentOf", LOG_DEBUG); |
|
2748 | + DolUtils::dol_syslog(get_class($this)."::loadParentOf", LOG_DEBUG); |
|
2749 | 2749 | $resql = Config::$dbEngine->query($sql); |
2750 | 2750 | if ($resql) { |
2751 | 2751 | while ($obj = Config::$dbEngine->fetch_object($resql)) { |
@@ -2787,20 +2787,20 @@ discard block |
||
2787 | 2787 | |
2788 | 2788 | // Init $this->users array |
2789 | 2789 | $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.admin, u.statut, u.photo, u.entity"; // Distinct reduce pb with old tables with duplicates |
2790 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
2790 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
2791 | 2791 | // Add fields from hooks |
2792 | 2792 | $parameters = array(); |
2793 | - $reshook = Globals::$hookManager->executeHooks('printUserListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
2793 | + $reshook = Globals::$hookManager->executeHooks('printUserListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
2794 | 2794 | if ($reshook > 0) { |
2795 | 2795 | $sql .= Globals::$hookManager->resPrint; |
2796 | 2796 | } else { |
2797 | - $sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; |
|
2797 | + $sql .= " WHERE u.entity IN (".getEntity('user').")"; |
|
2798 | 2798 | } |
2799 | 2799 | if ($filter) { |
2800 | - $sql .= " AND " . $filter; |
|
2800 | + $sql .= " AND ".$filter; |
|
2801 | 2801 | } |
2802 | 2802 | |
2803 | - DolUtils::dol_syslog(get_class($this) . "::get_full_tree get user list", LOG_DEBUG); |
|
2803 | + DolUtils::dol_syslog(get_class($this)."::get_full_tree get user list", LOG_DEBUG); |
|
2804 | 2804 | $resql = Config::$dbEngine->query($sql); |
2805 | 2805 | if ($resql) { |
2806 | 2806 | $i = 0; |
@@ -2826,7 +2826,7 @@ discard block |
||
2826 | 2826 | } |
2827 | 2827 | |
2828 | 2828 | // We add the fullpath property to each elements of first level (no parent exists) |
2829 | - DolUtils::dol_syslog(get_class($this) . "::get_full_tree call to build_path_from_id_user", LOG_DEBUG); |
|
2829 | + DolUtils::dol_syslog(get_class($this)."::get_full_tree call to build_path_from_id_user", LOG_DEBUG); |
|
2830 | 2830 | foreach ($this->users as $key => $val) { |
2831 | 2831 | $result = $this->build_path_from_id_user($key, 0); // Process a branch from the root user key (this user has no parent) |
2832 | 2832 | if ($result < 0) { |
@@ -2838,18 +2838,18 @@ discard block |
||
2838 | 2838 | // Exclude leaf including $deleteafterid from tree |
2839 | 2839 | if ($deleteafterid) { |
2840 | 2840 | //print "Look to discard user ".$deleteafterid."\n"; |
2841 | - $keyfilter1 = '^' . $deleteafterid . '$'; |
|
2842 | - $keyfilter2 = '_' . $deleteafterid . '$'; |
|
2843 | - $keyfilter3 = '^' . $deleteafterid . '_'; |
|
2844 | - $keyfilter4 = '_' . $deleteafterid . '_'; |
|
2841 | + $keyfilter1 = '^'.$deleteafterid.'$'; |
|
2842 | + $keyfilter2 = '_'.$deleteafterid.'$'; |
|
2843 | + $keyfilter3 = '^'.$deleteafterid.'_'; |
|
2844 | + $keyfilter4 = '_'.$deleteafterid.'_'; |
|
2845 | 2845 | foreach ($this->users as $key => $val) { |
2846 | - if (preg_match('/' . $keyfilter1 . '/', $val['fullpath']) || preg_match('/' . $keyfilter2 . '/', $val['fullpath']) || preg_match('/' . $keyfilter3 . '/', $val['fullpath']) || preg_match('/' . $keyfilter4 . '/', $val['fullpath'])) { |
|
2846 | + if (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath']) || preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath'])) { |
|
2847 | 2847 | unset($this->users[$key]); |
2848 | 2848 | } |
2849 | 2849 | } |
2850 | 2850 | } |
2851 | 2851 | |
2852 | - DolUtils::dol_syslog(get_class($this) . "::get_full_tree dol_sort_array", LOG_DEBUG); |
|
2852 | + DolUtils::dol_syslog(get_class($this)."::get_full_tree dol_sort_array", LOG_DEBUG); |
|
2853 | 2853 | $this->users = dol_sort_array($this->users, 'fullname', 'asc', true, false); |
2854 | 2854 | |
2855 | 2855 | //var_dump($this->users); |
@@ -2877,10 +2877,10 @@ discard block |
||
2877 | 2877 | |
2878 | 2878 | $idtoscan = $this->id; |
2879 | 2879 | |
2880 | - DolUtils::dol_syslog("Build childid for id = " . $idtoscan); |
|
2880 | + DolUtils::dol_syslog("Build childid for id = ".$idtoscan); |
|
2881 | 2881 | foreach ($this->users as $id => $val) { |
2882 | 2882 | //var_dump($val['fullpath']); |
2883 | - if (preg_match('/_' . $idtoscan . '_/', $val['fullpath'])) { |
|
2883 | + if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) { |
|
2884 | 2884 | $childids[$val['id']] = $val['id']; |
2885 | 2885 | } |
2886 | 2886 | } |
@@ -2906,16 +2906,16 @@ discard block |
||
2906 | 2906 | function build_path_from_id_user($id_user, $protection = 0) |
2907 | 2907 | { |
2908 | 2908 | // phpcs:enable |
2909 | - DolUtils::dol_syslog(get_class($this) . "::build_path_from_id_user id_user=" . $id_user . " protection=" . $protection, LOG_DEBUG); |
|
2909 | + DolUtils::dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); |
|
2910 | 2910 | |
2911 | 2911 | if (!empty($this->users[$id_user]['fullpath'])) { |
2912 | 2912 | // Already defined |
2913 | - DolUtils::dol_syslog(get_class($this) . "::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING); |
|
2913 | + DolUtils::dol_syslog(get_class($this)."::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING); |
|
2914 | 2914 | return 0; |
2915 | 2915 | } |
2916 | 2916 | |
2917 | 2917 | // Define fullpath and fullname |
2918 | - $this->users[$id_user]['fullpath'] = '_' . $id_user; |
|
2918 | + $this->users[$id_user]['fullpath'] = '_'.$id_user; |
|
2919 | 2919 | $this->users[$id_user]['fullname'] = $this->users[$id_user]['lastname']; |
2920 | 2920 | $i = 0; |
2921 | 2921 | $cursor_user = $id_user; |
@@ -2924,11 +2924,11 @@ discard block |
||
2924 | 2924 | while (!empty($this->parentof[$cursor_user])) { |
2925 | 2925 | if (in_array($this->parentof[$cursor_user], Globals::$useridfound)) { |
2926 | 2926 | DolUtils::dol_syslog("The hierarchy of user has a recursive loop", LOG_WARNING); |
2927 | - return -1; // Should not happen. Protection against looping hierarchy |
|
2927 | + return -1; // Should not happen. Protection against looping hierarchy |
|
2928 | 2928 | } |
2929 | 2929 | Globals::$useridfound[] = $this->parentof[$cursor_user]; |
2930 | - $this->users[$id_user]['fullpath'] = '_' . $this->parentof[$cursor_user] . $this->users[$id_user]['fullpath']; |
|
2931 | - $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'] . ' >> ' . $this->users[$id_user]['fullname']; |
|
2930 | + $this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath']; |
|
2931 | + $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'].' >> '.$this->users[$id_user]['fullname']; |
|
2932 | 2932 | $i++; |
2933 | 2933 | $cursor_user = $this->parentof[$cursor_user]; |
2934 | 2934 | } |
@@ -2970,10 +2970,10 @@ discard block |
||
2970 | 2970 | $this->nb = array(); |
2971 | 2971 | |
2972 | 2972 | $sql = "SELECT count(u.rowid) as nb"; |
2973 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
2973 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
2974 | 2974 | $sql .= " WHERE u.statut > 0"; |
2975 | 2975 | //$sql.= " AND employee != 0"; |
2976 | - $sql .= " AND u.entity IN (" . getEntity('user') . ")"; |
|
2976 | + $sql .= " AND u.entity IN (".getEntity('user').")"; |
|
2977 | 2977 | |
2978 | 2978 | $resql = Config::$dbEngine->query($sql); |
2979 | 2979 | if ($resql) { |
@@ -3038,8 +3038,8 @@ discard block |
||
3038 | 3038 | } |
3039 | 3039 | |
3040 | 3040 | $sql = "SELECT rowid, email, user_mobile, civility, lastname, firstname"; |
3041 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user"; |
|
3042 | - $sql .= " WHERE rowid = '" . $rowid . "'"; |
|
3041 | + $sql .= " FROM ".MAIN_DB_PREFIX."user"; |
|
3042 | + $sql .= " WHERE rowid = '".$rowid."'"; |
|
3043 | 3043 | |
3044 | 3044 | $resql = Config::$dbEngine->query($sql); |
3045 | 3045 | if ($resql) { |
@@ -3049,7 +3049,7 @@ discard block |
||
3049 | 3049 | $obj = Config::$dbEngine->fetch_object($resql); |
3050 | 3050 | |
3051 | 3051 | if ($mode == 'email') { |
3052 | - $this->user_property = dolGetFirstLastname($obj->firstname, $obj->lastname) . " <" . $obj->email . ">"; |
|
3052 | + $this->user_property = dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">"; |
|
3053 | 3053 | } else if ($mode == 'mobile') { |
3054 | 3054 | $this->user_property = $obj->user_mobile; |
3055 | 3055 | } |
@@ -3076,7 +3076,7 @@ discard block |
||
3076 | 3076 | global $conf; |
3077 | 3077 | |
3078 | 3078 | $sql = "SELECT t.rowid"; |
3079 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t '; |
|
3079 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t '; |
|
3080 | 3080 | $sql .= " WHERE 1"; |
3081 | 3081 | |
3082 | 3082 | // Manage filter |
@@ -3084,25 +3084,25 @@ discard block |
||
3084 | 3084 | if (!empty($filter)) { |
3085 | 3085 | foreach ($filter as $key => $value) { |
3086 | 3086 | if ($key == 't.rowid') { |
3087 | - $sqlwhere[] = $key . '=' . $value; |
|
3087 | + $sqlwhere[] = $key.'='.$value; |
|
3088 | 3088 | } elseif (strpos($key, 'date') !== false) { |
3089 | - $sqlwhere[] = $key . ' = \'' . Config::$dbEngine->idate($value) . '\''; |
|
3089 | + $sqlwhere[] = $key.' = \''.Config::$dbEngine->idate($value).'\''; |
|
3090 | 3090 | } elseif ($key == 'customsql') { |
3091 | 3091 | $sqlwhere[] = $value; |
3092 | 3092 | } else { |
3093 | - $sqlwhere[] = $key . ' LIKE \'%' . Config::$dbEngine->escape($value) . '%\''; |
|
3093 | + $sqlwhere[] = $key.' LIKE \'%'.Config::$dbEngine->escape($value).'%\''; |
|
3094 | 3094 | } |
3095 | 3095 | } |
3096 | 3096 | } |
3097 | 3097 | if (count($sqlwhere) > 0) { |
3098 | - $sql .= ' AND (' . implode(' ' . $filtermode . ' ', $sqlwhere) . ')'; |
|
3098 | + $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; |
|
3099 | 3099 | } |
3100 | 3100 | $sql .= Config::$dbEngine->order($sortfield, $sortorder); |
3101 | 3101 | if ($limit) { |
3102 | 3102 | $sql .= Config::$dbEngine->plimit($limit + 1, $offset); |
3103 | 3103 | } |
3104 | 3104 | |
3105 | - DolUtils::dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); |
|
3105 | + DolUtils::dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); |
|
3106 | 3106 | |
3107 | 3107 | $resql = Config::$dbEngine->query($sql); |
3108 | 3108 | if ($resql) { |
@@ -520,16 +520,17 @@ discard block |
||
520 | 520 | $nid = $obj->id; |
521 | 521 | |
522 | 522 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights WHERE fk_user = " . $this->id . " AND fk_id=" . $nid . " AND entity = " . $entity; |
523 | - if (!Config::$dbEngine->query($sql)) |
|
524 | - $error++; |
|
523 | + if (!Config::$dbEngine->query($sql)) { |
|
524 | + $error++; |
|
525 | + } |
|
525 | 526 | $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_rights (entity, fk_user, fk_id) VALUES (" . $entity . ", " . $this->id . ", " . $nid . ")"; |
526 | - if (!Config::$dbEngine->query($sql)) |
|
527 | - $error++; |
|
527 | + if (!Config::$dbEngine->query($sql)) { |
|
528 | + $error++; |
|
529 | + } |
|
528 | 530 | |
529 | 531 | $i++; |
530 | 532 | } |
531 | - } |
|
532 | - else { |
|
533 | + } else { |
|
533 | 534 | $error++; |
534 | 535 | dol_print_error(Config::$dbEngine); |
535 | 536 | } |
@@ -2224,8 +2225,9 @@ discard block |
||
2224 | 2225 | } else { |
2225 | 2226 | $result .= $this->getFullName(Globals::$langs, '', ($mode == 'firstname' ? 2 : -1), $maxlen); |
2226 | 2227 | } |
2227 | - if (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) |
|
2228 | - $result .= '</div>'; |
|
2228 | + if (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
|
2229 | + $result .= '</div>'; |
|
2230 | + } |
|
2229 | 2231 | } |
2230 | 2232 | $result .= (($option == 'nolink') ? '' : $linkend); |
2231 | 2233 | //if ($withpictoimg == -1) $result.='</div>'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | class Interfaces |
25 | 25 | { |
26 | 26 | |
27 | - var $dir; // Directory with all core and external triggers files |
|
27 | + var $dir; // Directory with all core and external triggers files |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @var string[] Error codes (or messages) |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | // phpcs:enable |
63 | 63 | // Check parameters |
64 | 64 | if (!is_object($object) || !is_object($conf)) { // Error |
65 | - $this->error = 'function run_triggers called with wrong parameters action=' . $action . ' object=' . is_object($object) . ' user=' . is_object($user) . ' langs=' . is_object($langs) . ' conf=' . is_object($conf); |
|
66 | - DolUtils::dol_syslog(get_class($this) . '::run_triggers ' . $this->error, LOG_ERR); |
|
65 | + $this->error = 'function run_triggers called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf); |
|
66 | + DolUtils::dol_syslog(get_class($this).'::run_triggers '.$this->error, LOG_ERR); |
|
67 | 67 | $this->errors[] = $this->error; |
68 | 68 | return -1; |
69 | 69 | } |
70 | 70 | if (!is_object($langs)) { // Warning |
71 | - DolUtils::dol_syslog(get_class($this) . '::run_triggers was called with wrong parameters action=' . $action . ' object=' . is_object($object) . ' user=' . is_object($user) . ' langs=' . is_object($langs) . ' conf=' . is_object($conf), LOG_WARNING); |
|
71 | + DolUtils::dol_syslog(get_class($this).'::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING); |
|
72 | 72 | } |
73 | 73 | /* |
74 | 74 | if (!is_object($user)) { // Warning |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $i = 0; |
87 | 87 | |
88 | 88 | // $dirtriggers = array_merge(array('/core/triggers'), Globals::$conf->modules_parts['triggers']); |
89 | - $dirtriggers = array_merge(array(BASE_PATH . '/Helpers/triggers'), Globals::$conf->modules_parts['triggers']); |
|
89 | + $dirtriggers = array_merge(array(BASE_PATH.'/Helpers/triggers'), Globals::$conf->modules_parts['triggers']); |
|
90 | 90 | foreach ($dirtriggers as $reldir) { |
91 | 91 | //$dir = DolUtils::dol_buildpath($reldir, 0); |
92 | 92 | //$newdir = DolUtils::dol_osencode($dir); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $handle = opendir($newdir); |
100 | 100 | if (is_resource($handle)) { |
101 | 101 | while (($file = readdir($handle)) !== false) { |
102 | - if (is_readable($newdir . "/" . $file) && preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php$/i', $file, $reg)) { |
|
102 | + if (is_readable($newdir."/".$file) && preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php$/i', $file, $reg)) { |
|
103 | 103 | $part1 = $reg[1]; |
104 | 104 | $part2 = $reg[2]; |
105 | 105 | $part3 = $reg[3]; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $qualified = true; |
114 | 114 | if (strtolower($reg[2]) != 'all') { |
115 | 115 | $module = preg_replace('/^mod/i', '', $reg[2]); |
116 | - $constparam = 'MAIN_MODULE_' . strtoupper($module); |
|
116 | + $constparam = 'MAIN_MODULE_'.strtoupper($module); |
|
117 | 117 | if (empty(Globals::$conf->global->$constparam)) |
118 | 118 | $qualified = false; |
119 | 119 | } |
@@ -123,26 +123,26 @@ discard block |
||
123 | 123 | continue; |
124 | 124 | } |
125 | 125 | |
126 | - $modName = "Interface" . ucfirst($reg[3]); |
|
126 | + $modName = "Interface".ucfirst($reg[3]); |
|
127 | 127 | //print "file=$file - modName=$modName\n"; |
128 | 128 | if (in_array($modName, $modules)) { // $modules = list of modName already loaded |
129 | 129 | $langs->load("errors"); |
130 | - DolUtils::dol_syslog(get_class($this) . "::run_triggers action=" . $action . " " . $langs->trans("ErrorDuplicateTrigger", $newdir . "/" . $file, $fullpathfiles[$modName]), LOG_WARNING); |
|
130 | + DolUtils::dol_syslog(get_class($this)."::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger", $newdir."/".$file, $fullpathfiles[$modName]), LOG_WARNING); |
|
131 | 131 | continue; |
132 | 132 | } |
133 | 133 | |
134 | 134 | try { |
135 | 135 | //print 'Todo for '.$modName." : ".$newdir.'/'.$file."\n"; |
136 | - include_once $newdir . '/' . $file; |
|
136 | + include_once $newdir.'/'.$file; |
|
137 | 137 | //print 'Done for '.$modName."\n"; |
138 | 138 | } catch (Exception $e) { |
139 | - DolUtils::dol_syslog('ko for ' . $modName . " " . $e->getMessage() . "\n", LOG_ERR); |
|
139 | + DolUtils::dol_syslog('ko for '.$modName." ".$e->getMessage()."\n", LOG_ERR); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | $modules[$i] = $modName; |
143 | 143 | $files[$i] = $file; |
144 | - $fullpathfiles[$modName] = $newdir . '/' . $file; |
|
145 | - $orders[$i] = $part1 . '_' . $part2 . '_' . $part3; // Set sort criteria value |
|
144 | + $fullpathfiles[$modName] = $newdir.'/'.$file; |
|
145 | + $orders[$i] = $part1.'_'.$part2.'_'.$part3; // Set sort criteria value |
|
146 | 146 | |
147 | 147 | $i++; |
148 | 148 | } |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | //DolUtils::dol_syslog(get_class($this)."::run_triggers action=".$action." Launch runTrigger for file '".$files[$key]."'", LOG_DEBUG); |
167 | 167 | $result = $objMod->runTrigger($action, $object, $user, $langs, $conf); |
168 | 168 | } elseif (method_exists($objMod, 'run_trigger')) { // Deprecated method |
169 | - DolUtils::dol_syslog(get_class($this) . "::run_triggers action=" . $action . " Launch old method run_trigger (rename your trigger into runTrigger) for file '" . $files[$key] . "'", LOG_WARNING); |
|
169 | + DolUtils::dol_syslog(get_class($this)."::run_triggers action=".$action." Launch old method run_trigger (rename your trigger into runTrigger) for file '".$files[$key]."'", LOG_WARNING); |
|
170 | 170 | $result = $objMod->run_trigger($action, $object, $user, $langs, $conf); |
171 | 171 | } else { |
172 | - DolUtils::dol_syslog(get_class($this) . "::run_triggers action=" . $action . " A trigger was declared for class " . get_class($objMod) . " but method runTrigger was not found", LOG_ERR); |
|
172 | + DolUtils::dol_syslog(get_class($this)."::run_triggers action=".$action." A trigger was declared for class ".get_class($objMod)." but method runTrigger was not found", LOG_ERR); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | if ($result > 0) { |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | } |
195 | 195 | } |
196 | 196 | else { |
197 | - DolUtils::dol_syslog(get_class($this) . "::run_triggers action=" . $action . " Failed to instantiate trigger for file '" . $files[$key] . "'", LOG_ERR); |
|
197 | + DolUtils::dol_syslog(get_class($this)."::run_triggers action=".$action." Failed to instantiate trigger for file '".$files[$key]."'", LOG_ERR); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
201 | 201 | if ($nbko) { |
202 | - DolUtils::dol_syslog(get_class($this) . "::run_triggers action=" . $action . " Files found: " . $nbfile . ", Files launched: " . $nbtotal . ", Done: " . $nbok . ", Failed: " . $nbko . " - Nb of error string returned in this->errors = " . count($this->errors), LOG_ERR); |
|
202 | + DolUtils::dol_syslog(get_class($this)."::run_triggers action=".$action." Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko." - Nb of error string returned in this->errors = ".count($this->errors), LOG_ERR); |
|
203 | 203 | return -$nbko; |
204 | 204 | } else { |
205 | 205 | //DolUtils::dol_syslog(get_class($this)."::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_DEBUG); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $handle = opendir($newdir); |
246 | 246 | if (is_resource($handle)) { |
247 | 247 | while (($file = readdir($handle)) !== false) { |
248 | - if (is_readable($newdir . '/' . $file) && preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/', $file, $reg)) { |
|
248 | + if (is_readable($newdir.'/'.$file) && preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/', $file, $reg)) { |
|
249 | 249 | if (preg_match('/\.back$/', $file)) |
250 | 250 | continue; |
251 | 251 | |
@@ -253,21 +253,21 @@ discard block |
||
253 | 253 | $part2 = $reg[2]; |
254 | 254 | $part3 = $reg[3]; |
255 | 255 | |
256 | - $modName = 'Interface' . ucfirst($reg[3]); |
|
256 | + $modName = 'Interface'.ucfirst($reg[3]); |
|
257 | 257 | //print "file=$file"; print "modName=$modName"; exit; |
258 | 258 | if (in_array($modName, $modules)) { |
259 | 259 | $langs->load("errors"); |
260 | - print '<div class="error">' . $langs->trans("Error") . ' : ' . $langs->trans("ErrorDuplicateTrigger", $modName, "/htdocs/core/triggers/") . '</div>'; |
|
260 | + print '<div class="error">'.$langs->trans("Error").' : '.$langs->trans("ErrorDuplicateTrigger", $modName, "/htdocs/core/triggers/").'</div>'; |
|
261 | 261 | } else { |
262 | - include_once $newdir . '/' . $file; |
|
262 | + include_once $newdir.'/'.$file; |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | $files[$i] = $file; |
266 | - $fullpath[$i] = $dir . '/' . $file; |
|
267 | - $relpath[$i] = preg_replace('/^\//', '', $reldir) . '/' . $file; |
|
266 | + $fullpath[$i] = $dir.'/'.$file; |
|
267 | + $relpath[$i] = preg_replace('/^\//', '', $reldir).'/'.$file; |
|
268 | 268 | $iscoreorexternal[$i] = ($reldir == '/core/triggers/' ? 'internal' : 'external'); |
269 | 269 | $modules[$i] = $modName; |
270 | - $orders[$i] = $part1 . '_' . $part2 . '_' . $part3; // Set sort criteria value |
|
270 | + $orders[$i] = $part1.'_'.$part2.'_'.$part3; // Set sort criteria value |
|
271 | 271 | |
272 | 272 | $i++; |
273 | 273 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | continue; |
289 | 289 | |
290 | 290 | if (!class_exists($modName)) { |
291 | - print 'Error: A trigger file was found but its class "' . $modName . '" was not found.' . "<br>\n"; |
|
291 | + print 'Error: A trigger file was found but its class "'.$modName.'" was not found.'."<br>\n"; |
|
292 | 292 | continue; |
293 | 293 | } |
294 | 294 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // Check if trigger file is for a particular module |
306 | 306 | if (preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/i', $files[$key], $reg)) { |
307 | 307 | $module = preg_replace('/^mod/i', '', $reg[2]); |
308 | - $constparam = 'MAIN_MODULE_' . strtoupper($module); |
|
308 | + $constparam = 'MAIN_MODULE_'.strtoupper($module); |
|
309 | 309 | if (strtolower($module) == 'all') |
310 | 310 | $disabledbymodule = 0; |
311 | 311 | else if (empty(Globals::$conf->global->$constparam)) |
@@ -324,21 +324,21 @@ discard block |
||
324 | 324 | if ($disabledbyname > 0 || $disabledbymodule > 1) |
325 | 325 | $triggers[$j]['status'] = ''; |
326 | 326 | |
327 | - $text = '<b>' . $langs->trans("Description") . ':</b><br>'; |
|
328 | - $text .= $objMod->getDesc() . '<br>'; |
|
329 | - $text .= '<br><b>' . $langs->trans("Status") . ':</b><br>'; |
|
327 | + $text = '<b>'.$langs->trans("Description").':</b><br>'; |
|
328 | + $text .= $objMod->getDesc().'<br>'; |
|
329 | + $text .= '<br><b>'.$langs->trans("Status").':</b><br>'; |
|
330 | 330 | if ($disabledbyname == 1) { |
331 | - $text .= $langs->trans("TriggerDisabledByName") . '<br>'; |
|
331 | + $text .= $langs->trans("TriggerDisabledByName").'<br>'; |
|
332 | 332 | if ($disabledbymodule == 2) |
333 | - $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module) . '<br>'; |
|
333 | + $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'<br>'; |
|
334 | 334 | } |
335 | 335 | else { |
336 | 336 | if ($disabledbymodule == 0) |
337 | - $text .= $langs->trans("TriggerAlwaysActive") . '<br>'; |
|
337 | + $text .= $langs->trans("TriggerAlwaysActive").'<br>'; |
|
338 | 338 | if ($disabledbymodule == 1) |
339 | - $text .= $langs->trans("TriggerActiveAsModuleActive", $module) . '<br>'; |
|
339 | + $text .= $langs->trans("TriggerActiveAsModuleActive", $module).'<br>'; |
|
340 | 340 | if ($disabledbymodule == 2) |
341 | - $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module) . '<br>'; |
|
341 | + $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'<br>'; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | $triggers[$j]['info'] = $text; |
@@ -93,8 +93,9 @@ discard block |
||
93 | 93 | $newdir = DolUtils::dol_buildpath($reldir, 0); |
94 | 94 | //print "xx".$dir;exit; |
95 | 95 | // Check if directory exists (we do not use dol_is_dir to avoir loading files.lib.php at each call) |
96 | - if (!is_dir($newdir)) |
|
97 | - continue; |
|
96 | + if (!is_dir($newdir)) { |
|
97 | + continue; |
|
98 | + } |
|
98 | 99 | |
99 | 100 | $handle = opendir($newdir); |
100 | 101 | if (is_resource($handle)) { |
@@ -107,15 +108,17 @@ discard block |
||
107 | 108 | $nbfile++; |
108 | 109 | |
109 | 110 | // Check if trigger file is disabled by name |
110 | - if (preg_match('/NORUN$/i', $file)) |
|
111 | - continue; |
|
111 | + if (preg_match('/NORUN$/i', $file)) { |
|
112 | + continue; |
|
113 | + } |
|
112 | 114 | // Check if trigger file is for a particular module |
113 | 115 | $qualified = true; |
114 | 116 | if (strtolower($reg[2]) != 'all') { |
115 | 117 | $module = preg_replace('/^mod/i', '', $reg[2]); |
116 | 118 | $constparam = 'MAIN_MODULE_' . strtoupper($module); |
117 | - if (empty(Globals::$conf->global->$constparam)) |
|
118 | - $qualified = false; |
|
119 | + if (empty(Globals::$conf->global->$constparam)) { |
|
120 | + $qualified = false; |
|
121 | + } |
|
119 | 122 | } |
120 | 123 | |
121 | 124 | if (!$qualified) { |
@@ -155,8 +158,9 @@ discard block |
||
155 | 158 | // Loop on each trigger |
156 | 159 | foreach ($orders as $key => $value) { |
157 | 160 | $modName = $modules[$key]; |
158 | - if (empty($modName)) |
|
159 | - continue; |
|
161 | + if (empty($modName)) { |
|
162 | + continue; |
|
163 | + } |
|
160 | 164 | |
161 | 165 | $objMod = new $modName(); |
162 | 166 | if ($objMod) { |
@@ -186,14 +190,14 @@ discard block |
||
186 | 190 | //DolUtils::dol_syslog("Error in trigger ".$action." - Nb of error string returned = ".count($objMod->errors), LOG_ERR); |
187 | 191 | $nbtotal++; |
188 | 192 | $nbko++; |
189 | - if (!empty($objMod->errors)) |
|
190 | - $this->errors = array_merge($this->errors, $objMod->errors); |
|
191 | - else if (!empty($objMod->error)) |
|
192 | - $this->errors[] = $objMod->error; |
|
193 | + if (!empty($objMod->errors)) { |
|
194 | + $this->errors = array_merge($this->errors, $objMod->errors); |
|
195 | + } else if (!empty($objMod->error)) { |
|
196 | + $this->errors[] = $objMod->error; |
|
197 | + } |
|
193 | 198 | //DolUtils::dol_syslog("Error in trigger ".$action." - Nb of error string returned = ".count($this->errors), LOG_ERR); |
194 | 199 | } |
195 | - } |
|
196 | - else { |
|
200 | + } else { |
|
197 | 201 | DolUtils::dol_syslog(get_class($this) . "::run_triggers action=" . $action . " Failed to instantiate trigger for file '" . $files[$key] . "'", LOG_ERR); |
198 | 202 | } |
199 | 203 | } |
@@ -239,15 +243,17 @@ discard block |
||
239 | 243 | $newdir = DolUtils::dol_osencode($dir); |
240 | 244 | |
241 | 245 | // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php at each call) |
242 | - if (!is_dir($newdir)) |
|
243 | - continue; |
|
246 | + if (!is_dir($newdir)) { |
|
247 | + continue; |
|
248 | + } |
|
244 | 249 | |
245 | 250 | $handle = opendir($newdir); |
246 | 251 | if (is_resource($handle)) { |
247 | 252 | while (($file = readdir($handle)) !== false) { |
248 | 253 | if (is_readable($newdir . '/' . $file) && preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/', $file, $reg)) { |
249 | - if (preg_match('/\.back$/', $file)) |
|
250 | - continue; |
|
254 | + if (preg_match('/\.back$/', $file)) { |
|
255 | + continue; |
|
256 | + } |
|
251 | 257 | |
252 | 258 | $part1 = $reg[1]; |
253 | 259 | $part2 = $reg[2]; |
@@ -284,8 +290,9 @@ discard block |
||
284 | 290 | // Loop on each trigger |
285 | 291 | foreach ($orders as $key => $value) { |
286 | 292 | $modName = $modules[$key]; |
287 | - if (empty($modName)) |
|
288 | - continue; |
|
293 | + if (empty($modName)) { |
|
294 | + continue; |
|
295 | + } |
|
289 | 296 | |
290 | 297 | if (!class_exists($modName)) { |
291 | 298 | print 'Error: A trigger file was found but its class "' . $modName . '" was not found.' . "<br>\n"; |
@@ -300,16 +307,18 @@ discard block |
||
300 | 307 | $module = ''; |
301 | 308 | |
302 | 309 | // Check if trigger file is disabled by name |
303 | - if (preg_match('/NORUN$/i', $files[$key])) |
|
304 | - $disabledbyname = 1; |
|
310 | + if (preg_match('/NORUN$/i', $files[$key])) { |
|
311 | + $disabledbyname = 1; |
|
312 | + } |
|
305 | 313 | // Check if trigger file is for a particular module |
306 | 314 | if (preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/i', $files[$key], $reg)) { |
307 | 315 | $module = preg_replace('/^mod/i', '', $reg[2]); |
308 | 316 | $constparam = 'MAIN_MODULE_' . strtoupper($module); |
309 | - if (strtolower($module) == 'all') |
|
310 | - $disabledbymodule = 0; |
|
311 | - else if (empty(Globals::$conf->global->$constparam)) |
|
312 | - $disabledbymodule = 2; |
|
317 | + if (strtolower($module) == 'all') { |
|
318 | + $disabledbymodule = 0; |
|
319 | + } else if (empty(Globals::$conf->global->$constparam)) { |
|
320 | + $disabledbymodule = 2; |
|
321 | + } |
|
313 | 322 | $triggers[$j]['module'] = strtolower($module); |
314 | 323 | } |
315 | 324 | |
@@ -321,24 +330,28 @@ discard block |
||
321 | 330 | $triggers[$j]['iscoreorexternal'] = $iscoreorexternal[$key]; |
322 | 331 | $triggers[$j]['version'] = $objMod->getVersion(); |
323 | 332 | $triggers[$j]['status'] = img_picto($langs->trans("Active"), 'tick'); |
324 | - if ($disabledbyname > 0 || $disabledbymodule > 1) |
|
325 | - $triggers[$j]['status'] = ''; |
|
333 | + if ($disabledbyname > 0 || $disabledbymodule > 1) { |
|
334 | + $triggers[$j]['status'] = ''; |
|
335 | + } |
|
326 | 336 | |
327 | 337 | $text = '<b>' . $langs->trans("Description") . ':</b><br>'; |
328 | 338 | $text .= $objMod->getDesc() . '<br>'; |
329 | 339 | $text .= '<br><b>' . $langs->trans("Status") . ':</b><br>'; |
330 | 340 | if ($disabledbyname == 1) { |
331 | 341 | $text .= $langs->trans("TriggerDisabledByName") . '<br>'; |
332 | - if ($disabledbymodule == 2) |
|
333 | - $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module) . '<br>'; |
|
334 | - } |
|
335 | - else { |
|
336 | - if ($disabledbymodule == 0) |
|
337 | - $text .= $langs->trans("TriggerAlwaysActive") . '<br>'; |
|
338 | - if ($disabledbymodule == 1) |
|
339 | - $text .= $langs->trans("TriggerActiveAsModuleActive", $module) . '<br>'; |
|
340 | - if ($disabledbymodule == 2) |
|
341 | - $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module) . '<br>'; |
|
342 | + if ($disabledbymodule == 2) { |
|
343 | + $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module) . '<br>'; |
|
344 | + } |
|
345 | + } else { |
|
346 | + if ($disabledbymodule == 0) { |
|
347 | + $text .= $langs->trans("TriggerAlwaysActive") . '<br>'; |
|
348 | + } |
|
349 | + if ($disabledbymodule == 1) { |
|
350 | + $text .= $langs->trans("TriggerActiveAsModuleActive", $module) . '<br>'; |
|
351 | + } |
|
352 | + if ($disabledbymodule == 2) { |
|
353 | + $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module) . '<br>'; |
|
354 | + } |
|
342 | 355 | } |
343 | 356 | |
344 | 357 | $triggers[$j]['info'] = $text; |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | if (!empty(Globals::$conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;/', $typeofdata)) { |
113 | 113 | if (!empty($perm)) { |
114 | 114 | $tmp = explode(':', $typeofdata); |
115 | - $ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">'; |
|
115 | + $ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">'; |
|
116 | 116 | if ($fieldrequired) |
117 | 117 | $ret .= '<span class="fieldrequired">'; |
118 | 118 | $ret .= $langs->trans($text); |
119 | 119 | if ($fieldrequired) |
120 | 120 | $ret .= '</span>'; |
121 | - $ret .= '</div>' . "\n"; |
|
121 | + $ret .= '</div>'."\n"; |
|
122 | 122 | } |
123 | 123 | else { |
124 | 124 | if ($fieldrequired) |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | } |
131 | 131 | else { |
132 | - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { |
|
132 | + if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { |
|
133 | 133 | $ret .= '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">'; |
134 | 134 | } |
135 | 135 | if ($fieldrequired) { |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | if (!empty($notabletag)) { |
143 | 143 | $ret .= ' '; |
144 | 144 | } |
145 | - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { |
|
145 | + if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { |
|
146 | 146 | $ret .= '</td>'; |
147 | 147 | } |
148 | - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { |
|
148 | + if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { |
|
149 | 149 | $ret .= '<td align="right">'; |
150 | 150 | } |
151 | - if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { |
|
152 | - $ret .= '<a href="' . $_SERVER["PHP_SELF"] . '?action=edit' . $htmlname . '&' . $paramid . '=' . $object->id . $moreparam . '">' . img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)) . '</a>'; |
|
151 | + if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { |
|
152 | + $ret .= '<a href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&'.$paramid.'='.$object->id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).'</a>'; |
|
153 | 153 | } |
154 | 154 | if (!empty($notabletag) && $notabletag == 1) { |
155 | 155 | $ret .= ' : '; |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | if (!empty($notabletag) && $notabletag == 3) { |
158 | 158 | $ret .= ' '; |
159 | 159 | } |
160 | - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { |
|
160 | + if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { |
|
161 | 161 | $ret .= '</td>'; |
162 | 162 | } |
163 | - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { |
|
163 | + if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { |
|
164 | 164 | $ret .= '</tr></table>'; |
165 | 165 | } |
166 | 166 | } |
@@ -200,41 +200,41 @@ discard block |
||
200 | 200 | if (!empty(Globals::$conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker |
201 | 201 | $ret .= $this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg); |
202 | 202 | } else { |
203 | - if (GETPOST('action', 'aZ09') == 'edit' . $htmlname) { |
|
203 | + if (GETPOST('action', 'aZ09') == 'edit'.$htmlname) { |
|
204 | 204 | $ret .= "\n"; |
205 | - $ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">'; |
|
206 | - $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
|
207 | - $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
208 | - $ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">'; |
|
205 | + $ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">'; |
|
206 | + $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
207 | + $ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
208 | + $ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">'; |
|
209 | 209 | if (empty($notabletag)) |
210 | 210 | $ret .= '<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">'; |
211 | 211 | if (empty($notabletag)) |
212 | 212 | $ret .= '<tr><td>'; |
213 | 213 | if (preg_match('/^(string|email)/', $typeofdata)) { |
214 | 214 | $tmp = explode(':', $typeofdata); |
215 | - $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . ($tmp[1] ? ' size="' . $tmp[1] . '"' : '') . '>'; |
|
215 | + $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').'>'; |
|
216 | 216 | } else if (preg_match('/^(numeric|amount)/', $typeofdata)) { |
217 | 217 | $tmp = explode(':', $typeofdata); |
218 | 218 | $valuetoshow = price2num($editvalue ? $editvalue : $value); |
219 | - $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . ($tmp[1] ? ' size="' . $tmp[1] . '"' : '') . '>'; |
|
219 | + $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').'>'; |
|
220 | 220 | } else if (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { |
221 | 221 | $tmp = explode(':', $typeofdata); |
222 | 222 | $cols = $tmp[2]; |
223 | 223 | $morealt = ''; |
224 | 224 | if (preg_match('/%/', $cols)) { |
225 | - $morealt = ' style="width: ' . $cols . '"'; |
|
225 | + $morealt = ' style="width: '.$cols.'"'; |
|
226 | 226 | $cols = ''; |
227 | 227 | } |
228 | 228 | |
229 | 229 | $valuetoshow = ($editvalue ? $editvalue : $value); |
230 | 230 | |
231 | - $ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . ($tmp[1] ? $tmp[1] : '20') . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '">'; |
|
231 | + $ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1] ? $tmp[1] : '20').'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'">'; |
|
232 | 232 | $ret .= dol_string_neverthesehtmltags($valuetoshow, array('textarea')); |
233 | 233 | $ret .= '</textarea>'; |
234 | 234 | } else if ($typeofdata == 'day' || $typeofdata == 'datepicker') { |
235 | - $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, 0); |
|
235 | + $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, 0); |
|
236 | 236 | } else if ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { |
237 | - $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, 0); |
|
237 | + $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, 0); |
|
238 | 238 | } else if (preg_match('/^select;/', $typeofdata)) { |
239 | 239 | $arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); |
240 | 240 | foreach ($arraydata as $val) { |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | } |
244 | 244 | $ret .= $this->selectarray($htmlname, $arraylist, $value); |
245 | 245 | } else if (preg_match('/^ckeditor/', $typeofdata)) { |
246 | - $tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols |
|
247 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
246 | + $tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols |
|
247 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
248 | 248 | $doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), ($tmp[2] ? $tmp[2] : ''), ($tmp[3] ? $tmp[3] : '100'), ($tmp[1] ? $tmp[1] : 'dolibarr_notes'), 'In', ($tmp[5] ? $tmp[5] : 0), true, true, ($tmp[6] ? $tmp[6] : '20'), ($tmp[7] ? $tmp[7] : '100')); |
249 | 249 | $ret .= $doleditor->Create(1); |
250 | 250 | } |
@@ -254,16 +254,16 @@ discard block |
||
254 | 254 | if (empty($notabletag)) |
255 | 255 | $ret .= '<td align="left">'; |
256 | 256 | //else $ret.='<div class="clearboth"></div>'; |
257 | - $ret .= '<input type="submit" class="button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">'; |
|
257 | + $ret .= '<input type="submit" class="button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">'; |
|
258 | 258 | if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) |
259 | - $ret .= '<br>' . "\n"; |
|
260 | - $ret .= '<input type="submit" class="button' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
259 | + $ret .= '<br>'."\n"; |
|
260 | + $ret .= '<input type="submit" class="button'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">'; |
|
261 | 261 | if (empty($notabletag)) |
262 | 262 | $ret .= '</td>'; |
263 | 263 | |
264 | 264 | if (empty($notabletag)) |
265 | - $ret .= '</tr></table>' . "\n"; |
|
266 | - $ret .= '</form>' . "\n"; |
|
265 | + $ret .= '</tr></table>'."\n"; |
|
266 | + $ret .= '</form>'."\n"; |
|
267 | 267 | } |
268 | 268 | else { |
269 | 269 | if (preg_match('/^(email)/', $typeofdata)) |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | if (!empty(Globals::$conf->global->MAIN_DISABLE_NOTES_TAB)) { |
289 | 289 | $firstline = preg_replace('/<br>.*/', '', $tmpcontent); |
290 | 290 | $firstline = preg_replace('/[\n\r].*/', '', $firstline); |
291 | - $tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); |
|
291 | + $tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); |
|
292 | 292 | } |
293 | 293 | $ret .= $tmpcontent; |
294 | 294 | } else |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $inputOption = $tmp[1]; |
357 | 357 | if (!empty($tmp[2])) |
358 | 358 | $savemethod = $tmp[2]; |
359 | - $out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n"; |
|
359 | + $out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n"; |
|
360 | 360 | } |
361 | 361 | else if ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { |
362 | 362 | $tmp = explode(':', $inputType); |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | if (!empty($tmp[2])) |
367 | 367 | $savemethod = $tmp[2]; |
368 | 368 | |
369 | - $out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format |
|
369 | + $out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format |
|
370 | 370 | } |
371 | 371 | else if (preg_match('/^(select|autocomplete)/', $inputType)) { |
372 | 372 | $tmp = explode(':', $inputType); |
@@ -394,35 +394,35 @@ discard block |
||
394 | 394 | $savemethod = $tmp[4]; |
395 | 395 | |
396 | 396 | if (!empty(Globals::$conf->fckeditor->enabled)) { |
397 | - $out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n"; |
|
397 | + $out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n"; |
|
398 | 398 | } else { |
399 | 399 | $inputType = 'textarea'; |
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
403 | - $out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n"; |
|
404 | - $out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n"; |
|
405 | - $out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n"; |
|
406 | - $out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n"; |
|
403 | + $out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n"; |
|
404 | + $out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n"; |
|
405 | + $out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n"; |
|
406 | + $out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n"; |
|
407 | 407 | if (!empty($savemethod)) |
408 | - $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n"; |
|
408 | + $out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n"; |
|
409 | 409 | if (!empty($ext_element)) |
410 | - $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n"; |
|
410 | + $out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n"; |
|
411 | 411 | if (!empty($custommsg)) { |
412 | 412 | if (is_array($custommsg)) { |
413 | 413 | if (!empty($custommsg['success'])) |
414 | - $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n"; |
|
414 | + $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n"; |
|
415 | 415 | if (!empty($custommsg['error'])) |
416 | - $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n"; |
|
416 | + $out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n"; |
|
417 | 417 | } else |
418 | - $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n"; |
|
418 | + $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n"; |
|
419 | 419 | } |
420 | 420 | if ($inputType == 'textarea') { |
421 | - $out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n"; |
|
422 | - $out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n"; |
|
421 | + $out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n"; |
|
422 | + $out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n"; |
|
423 | 423 | } |
424 | - $out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n"; |
|
425 | - $out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n"; |
|
424 | + $out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n"; |
|
425 | + $out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n"; |
|
426 | 426 | } else { |
427 | 427 | $out = $value; |
428 | 428 | } |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | global $conf; |
455 | 455 | |
456 | 456 | if ($incbefore) { |
457 | - $text = $incbefore . $text; |
|
457 | + $text = $incbefore.$text; |
|
458 | 458 | } |
459 | 459 | if (!$htmltext) { |
460 | 460 | return $text; |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | |
475 | 475 | $extrastyle = ''; |
476 | 476 | if ($direction < 0) { |
477 | - $extracss = ($extracss ? $extracss . ' ' : '') . 'inline-block'; |
|
477 | + $extracss = ($extracss ? $extracss.' ' : '').'inline-block'; |
|
478 | 478 | $extrastyle = 'padding: 0px; padding-left: 3px !important;'; |
479 | 479 | } |
480 | 480 | if ($direction > 0) { |
481 | - $extracss = ($extracss ? $extracss . ' ' : '') . 'inline-block'; |
|
481 | + $extracss = ($extracss ? $extracss.' ' : '').'inline-block'; |
|
482 | 482 | $extrastyle = 'padding: 0px; padding-right: 3px !important;'; |
483 | 483 | } |
484 | 484 | |
@@ -491,53 +491,53 @@ discard block |
||
491 | 491 | $htmltext = str_replace('"', """, $htmltext); |
492 | 492 | } else { |
493 | 493 | $classfortooltip = 'classfortooltiponclick'; |
494 | - $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>'; |
|
494 | + $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>'; |
|
495 | 495 | } |
496 | 496 | if ($tooltipon == 2 || $tooltipon == 3) { |
497 | - $paramfortooltipimg = ' class="' . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"'; |
|
497 | + $paramfortooltipimg = ' class="'.$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"'; |
|
498 | 498 | if ($tooltiptrigger == '') { |
499 | - $paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : DolUtils::dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on img tag to store tooltip |
|
499 | + $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : DolUtils::dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on img tag to store tooltip |
|
500 | 500 | } else { |
501 | - $paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"'; |
|
501 | + $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"'; |
|
502 | 502 | } |
503 | 503 | } else { |
504 | - $paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag |
|
504 | + $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag |
|
505 | 505 | } |
506 | 506 | if ($tooltipon == 1 || $tooltipon == 3) { |
507 | - $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" '; |
|
507 | + $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" '; |
|
508 | 508 | if ($tooltiptrigger == '') { |
509 | - $paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : DolUtils::dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on td tag to store tooltip |
|
509 | + $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : DolUtils::dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on td tag to store tooltip |
|
510 | 510 | } else { |
511 | - $paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"'; |
|
511 | + $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"'; |
|
512 | 512 | } |
513 | 513 | } else { |
514 | - $paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag |
|
514 | + $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag |
|
515 | 515 | } |
516 | 516 | if (empty($notabs)) { |
517 | 517 | $s .= '<table class="nobordernopadding" summary=""><tr style="height: auto;">'; |
518 | 518 | } elseif ($notabs == 2) { |
519 | - $s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">'; |
|
519 | + $s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">'; |
|
520 | 520 | } |
521 | 521 | // Define value if value is before |
522 | 522 | if ($direction < 0) { |
523 | - $s .= '<' . $tag . $paramfortooltipimg; |
|
523 | + $s .= '<'.$tag.$paramfortooltipimg; |
|
524 | 524 | if ($tag == 'td') { |
525 | 525 | $s .= ' valign="top" width="14"'; |
526 | 526 | } |
527 | - $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
527 | + $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
|
528 | 528 | } |
529 | 529 | // Use another method to help avoid having a space in value in order to use this value with jquery |
530 | 530 | // Define label |
531 | 531 | if ((string) $text != '') { |
532 | - $s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>'; |
|
532 | + $s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>'; |
|
533 | 533 | } |
534 | 534 | // Define value if value is after |
535 | 535 | if ($direction > 0) { |
536 | - $s .= '<' . $tag . $paramfortooltipimg; |
|
536 | + $s .= '<'.$tag.$paramfortooltipimg; |
|
537 | 537 | if ($tag == 'td') { |
538 | 538 | $s .= ' valign="middle" width="14"'; |
539 | 539 | } |
540 | - $s .= '>' . $textfordialog . $img . '</' . $tag . '>'; |
|
540 | + $s .= '>'.$textfordialog.$img.'</'.$tag.'>'; |
|
541 | 541 | } |
542 | 542 | if (empty($notabs)) { |
543 | 543 | $s .= '</tr></table>'; |
@@ -630,15 +630,15 @@ discard block |
||
630 | 630 | |
631 | 631 | $disabled = 0; |
632 | 632 | $ret = '<div class="centpercent center">'; |
633 | - $ret .= '<select class="flat' . (empty(Globals::$conf->use_javascript_ajax) ? '' : ' hideobject') . ' massaction massactionselect" name="massaction"' . ($disabled ? ' disabled="disabled"' : '') . '>'; |
|
633 | + $ret .= '<select class="flat'.(empty(Globals::$conf->use_javascript_ajax) ? '' : ' hideobject').' massaction massactionselect" name="massaction"'.($disabled ? ' disabled="disabled"' : '').'>'; |
|
634 | 634 | |
635 | 635 | // Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks. |
636 | 636 | $parameters = array(); |
637 | - $reshook = $hookmanager->executeHooks('addMoreMassActions', $parameters); // Note that $action and $object may have been modified by hook |
|
637 | + $reshook = $hookmanager->executeHooks('addMoreMassActions', $parameters); // Note that $action and $object may have been modified by hook |
|
638 | 638 | if (empty($reshook)) { |
639 | - $ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>'; |
|
639 | + $ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>'; |
|
640 | 640 | foreach ($arrayofaction as $code => $label) { |
641 | - $ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . '>' . $label . '</option>'; |
|
641 | + $ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').'>'.$label.'</option>'; |
|
642 | 642 | } |
643 | 643 | } |
644 | 644 | $ret .= $hookmanager->resPrint; |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | $ret .= '</select>'; |
647 | 647 | // Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button |
648 | 648 | $ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER. |
649 | - $ret .= '<input type="submit" disabled name="confirmmassaction" class="button' . (empty(Globals::$conf->use_javascript_ajax) ? '' : ' hideobject') . ' massaction massactionconfirmed" value="' . DolUtils::dol_escape_htmltag($langs->trans("Confirm")) . '">'; |
|
649 | + $ret .= '<input type="submit" disabled name="confirmmassaction" class="button'.(empty(Globals::$conf->use_javascript_ajax) ? '' : ' hideobject').' massaction massactionconfirmed" value="'.DolUtils::dol_escape_htmltag($langs->trans("Confirm")).'">'; |
|
650 | 650 | $ret .= '</div>'; |
651 | 651 | |
652 | 652 | if (!empty(Globals::$conf->use_javascript_ajax)) { |
@@ -660,11 +660,11 @@ discard block |
||
660 | 660 | if ($(this).is(\':checked\')) atleastoneselected++; |
661 | 661 | }); |
662 | 662 | console.log("initCheckForSelect mode="+mode+" atleastoneselected="+atleastoneselected); |
663 | - if (atleastoneselected || ' . $alwaysvisible . ') |
|
663 | + if (atleastoneselected || ' . $alwaysvisible.') |
|
664 | 664 | { |
665 | 665 | jQuery(".massaction").show(); |
666 | - ' . ($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("' . $selected . '"); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '') . ' |
|
667 | - ' . ($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0"); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '') . ' |
|
666 | + ' . ($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("'.$selected.'"); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '').' |
|
667 | + ' . ($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0"); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '').' |
|
668 | 668 | } |
669 | 669 | else |
670 | 670 | { |
@@ -733,14 +733,14 @@ discard block |
||
733 | 733 | $atleastonefavorite = 0; |
734 | 734 | |
735 | 735 | $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite"; |
736 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_country"; |
|
736 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_country"; |
|
737 | 737 | $sql .= " WHERE active > 0"; |
738 | 738 | //$sql.= " ORDER BY code ASC"; |
739 | 739 | |
740 | - dol_syslog(get_class($this) . "::select_country", LOG_DEBUG); |
|
740 | + dol_syslog(get_class($this)."::select_country", LOG_DEBUG); |
|
741 | 741 | $resql = $this->db->query($sql); |
742 | 742 | if ($resql) { |
743 | - $out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
743 | + $out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>'; |
|
744 | 744 | $num = $this->db->num_rows($resql); |
745 | 745 | $i = 0; |
746 | 746 | if ($num) { |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | $countryArray[$i]['rowid'] = $obj->rowid; |
752 | 752 | $countryArray[$i]['code_iso'] = $obj->code_iso; |
753 | 753 | $countryArray[$i]['code_iso3'] = $obj->code_iso3; |
754 | - $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
|
754 | + $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
|
755 | 755 | $countryArray[$i]['favorite'] = $obj->favorite; |
756 | 756 | $favorite[$i] = $obj->favorite; |
757 | 757 | $label[$i] = dol_string_unaccent($countryArray[$i]['label']); |
@@ -764,16 +764,16 @@ discard block |
||
764 | 764 | $countryArray = dol_sort_array($countryArray, 'label'); |
765 | 765 | |
766 | 766 | if ($showempty) { |
767 | - $out .= '<option value=""> </option>' . "\n"; |
|
767 | + $out .= '<option value=""> </option>'."\n"; |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | if ($addspecialentries) { // Add dedicated entries for groups of countries |
771 | 771 | //if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; |
772 | - $out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
|
773 | - $out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; |
|
772 | + $out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
|
773 | + $out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; |
|
774 | 774 | if ($mysoc->isInEEC()) |
775 | - $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
|
776 | - $out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; |
|
775 | + $out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; |
|
776 | + $out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; |
|
777 | 777 | $out .= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; |
778 | 778 | } |
779 | 779 | |
@@ -791,16 +791,16 @@ discard block |
||
791 | 791 | } |
792 | 792 | if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { |
793 | 793 | $foundselected = true; |
794 | - $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected>'; |
|
794 | + $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" selected>'; |
|
795 | 795 | } else { |
796 | - $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '">'; |
|
796 | + $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'">'; |
|
797 | 797 | } |
798 | 798 | if ($row['label']) |
799 | 799 | $out .= dol_trunc($row['label'], $maxlength, 'middle'); |
800 | 800 | else |
801 | 801 | $out .= ' '; |
802 | 802 | if ($row['code_iso']) |
803 | - $out .= ' (' . $row['code_iso'] . ')'; |
|
803 | + $out .= ' ('.$row['code_iso'].')'; |
|
804 | 804 | $out .= '</option>'; |
805 | 805 | } |
806 | 806 | } |
@@ -811,8 +811,8 @@ discard block |
||
811 | 811 | } |
812 | 812 | |
813 | 813 | // Make select dynamic |
814 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
815 | - $out .= ajax_combobox('select' . $htmlname); |
|
814 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
815 | + $out .= ajax_combobox('select'.$htmlname); |
|
816 | 816 | |
817 | 817 | return $out; |
818 | 818 | } |
@@ -841,25 +841,25 @@ discard block |
||
841 | 841 | $incotermArray = array(); |
842 | 842 | |
843 | 843 | $sql = "SELECT rowid, code"; |
844 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_incoterms"; |
|
844 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_incoterms"; |
|
845 | 845 | $sql .= " WHERE active > 0"; |
846 | 846 | $sql .= " ORDER BY code ASC"; |
847 | 847 | |
848 | - dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG); |
|
848 | + dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG); |
|
849 | 849 | $resql = $this->db->query($sql); |
850 | 850 | if ($resql) { |
851 | 851 | if (Globals::$conf->use_javascript_ajax && !$forcecombo) { |
852 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
852 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
853 | 853 | $out .= ajax_combobox($htmlname, $events); |
854 | 854 | } |
855 | 855 | |
856 | 856 | if (!empty($page)) { |
857 | - $out .= '<form method="post" action="' . $page . '">'; |
|
857 | + $out .= '<form method="post" action="'.$page.'">'; |
|
858 | 858 | $out .= '<input type="hidden" name="action" value="set_incoterms">'; |
859 | - $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
859 | + $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
860 | 860 | } |
861 | 861 | |
862 | - $out .= '<select id="' . $htmlname . '" class="flat selectincoterm minwidth100imp noenlargeonsmartphone" name="' . $htmlname . '" ' . $htmloption . '>'; |
|
862 | + $out .= '<select id="'.$htmlname.'" class="flat selectincoterm minwidth100imp noenlargeonsmartphone" name="'.$htmlname.'" '.$htmloption.'>'; |
|
863 | 863 | $out .= '<option value="0"> </option>'; |
864 | 864 | $num = $this->db->num_rows($resql); |
865 | 865 | $i = 0; |
@@ -875,9 +875,9 @@ discard block |
||
875 | 875 | |
876 | 876 | foreach ($incotermArray as $row) { |
877 | 877 | if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { |
878 | - $out .= '<option value="' . $row['rowid'] . '" selected>'; |
|
878 | + $out .= '<option value="'.$row['rowid'].'" selected>'; |
|
879 | 879 | } else { |
880 | - $out .= '<option value="' . $row['rowid'] . '">'; |
|
880 | + $out .= '<option value="'.$row['rowid'].'">'; |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | if ($row['code']) |
@@ -888,10 +888,10 @@ discard block |
||
888 | 888 | } |
889 | 889 | $out .= '</select>'; |
890 | 890 | |
891 | - $out .= '<input id="location_incoterms" class="maxwidth100onsmartphone" name="location_incoterms" value="' . $location_incoterms . '">'; |
|
891 | + $out .= '<input id="location_incoterms" class="maxwidth100onsmartphone" name="location_incoterms" value="'.$location_incoterms.'">'; |
|
892 | 892 | |
893 | 893 | if (!empty($page)) { |
894 | - $out .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '"></form>'; |
|
894 | + $out .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'"></form>'; |
|
895 | 895 | } |
896 | 896 | } else { |
897 | 897 | DolUtils::dol_print_error($this->db); |
@@ -920,8 +920,8 @@ discard block |
||
920 | 920 | // If product & services are enabled or both disabled. |
921 | 921 | if ($forceall == 1 || (empty($forceall) && !empty(Globals::$conf->product->enabled) && !empty(Globals::$conf->service->enabled)) || (empty($forceall) && empty(Globals::$conf->product->enabled) && empty(Globals::$conf->service->enabled))) { |
922 | 922 | if (empty($hidetext)) |
923 | - print $langs->trans("Type") . ': '; |
|
924 | - print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
923 | + print $langs->trans("Type").': '; |
|
924 | + print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
|
925 | 925 | if ($showempty) { |
926 | 926 | print '<option value="-1"'; |
927 | 927 | if ($selected == -1) |
@@ -932,26 +932,26 @@ discard block |
||
932 | 932 | print '<option value="0"'; |
933 | 933 | if (0 == $selected) |
934 | 934 | print ' selected'; |
935 | - print '>' . $langs->trans("Product"); |
|
935 | + print '>'.$langs->trans("Product"); |
|
936 | 936 | |
937 | 937 | print '<option value="1"'; |
938 | 938 | if (1 == $selected) |
939 | 939 | print ' selected'; |
940 | - print '>' . $langs->trans("Service"); |
|
940 | + print '>'.$langs->trans("Service"); |
|
941 | 941 | |
942 | 942 | print '</select>'; |
943 | 943 | //if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); |
944 | 944 | } |
945 | 945 | if ((empty($forceall) && empty(Globals::$conf->product->enabled) && !empty(Globals::$conf->service->enabled)) || $forceall == 3) { |
946 | 946 | print $langs->trans("Service"); |
947 | - print '<input type="hidden" name="' . $htmlname . '" value="1">'; |
|
947 | + print '<input type="hidden" name="'.$htmlname.'" value="1">'; |
|
948 | 948 | } |
949 | 949 | if ((empty($forceall) && !empty(Globals::$conf->product->enabled) && empty(Globals::$conf->service->enabled)) || $forceall == 2) { |
950 | 950 | print $langs->trans("Product"); |
951 | - print '<input type="hidden" name="' . $htmlname . '" value="0">'; |
|
951 | + print '<input type="hidden" name="'.$htmlname.'" value="0">'; |
|
952 | 952 | } |
953 | 953 | if ($forceall < 0) { // This should happened only for contracts when both predefined product and service are disabled. |
954 | - print '<input type="hidden" name="' . $htmlname . '" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1 |
|
954 | + print '<input type="hidden" name="'.$htmlname.'" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1 |
|
955 | 955 | } |
956 | 956 | } |
957 | 957 | |
@@ -968,14 +968,14 @@ discard block |
||
968 | 968 | |
969 | 969 | $num = count($this->cache_types_fees); |
970 | 970 | if ($num > 0) |
971 | - return 0; // Cache already loaded |
|
971 | + return 0; // Cache already loaded |
|
972 | 972 | |
973 | 973 | dol_syslog(__METHOD__, LOG_DEBUG); |
974 | 974 | |
975 | 975 | $langs->load("trips"); |
976 | 976 | |
977 | 977 | $sql = "SELECT c.code, c.label"; |
978 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_type_fees as c"; |
|
978 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_type_fees as c"; |
|
979 | 979 | $sql .= " WHERE active > 0"; |
980 | 980 | |
981 | 981 | $resql = $this->db->query($sql); |
@@ -1015,11 +1015,11 @@ discard block |
||
1015 | 1015 | // phpcs:enable |
1016 | 1016 | global $user, $langs; |
1017 | 1017 | |
1018 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
1018 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
|
1019 | 1019 | |
1020 | 1020 | $this->load_cache_types_fees(); |
1021 | 1021 | |
1022 | - print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
1022 | + print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">'; |
|
1023 | 1023 | if ($showempty) { |
1024 | 1024 | print '<option value="-1"'; |
1025 | 1025 | if ($selected == -1) |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | foreach ($this->cache_types_fees as $key => $value) { |
1031 | - print '<option value="' . $key . '"'; |
|
1031 | + print '<option value="'.$key.'"'; |
|
1032 | 1032 | if ($key == $selected) |
1033 | 1033 | print ' selected'; |
1034 | 1034 | print '>'; |
@@ -1091,25 +1091,25 @@ discard block |
||
1091 | 1091 | // No immediate load of all database |
1092 | 1092 | $placeholder = ''; |
1093 | 1093 | if ($selected && empty($selected_input_value)) { |
1094 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
1094 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
1095 | 1095 | $societetmp = new Societe($this->db); |
1096 | 1096 | $societetmp->fetch($selected); |
1097 | 1097 | $selected_input_value = $societetmp->name; |
1098 | 1098 | unset($societetmp); |
1099 | 1099 | } |
1100 | 1100 | // mode 1 |
1101 | - $urloption = 'htmlname=' . $htmlname . '&outjson=1&filter=' . $filter . ($showtype ? '&showtype=' . $showtype : ''); |
|
1102 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, Globals::$conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
|
1101 | + $urloption = 'htmlname='.$htmlname.'&outjson=1&filter='.$filter.($showtype ? '&showtype='.$showtype : ''); |
|
1102 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, Globals::$conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
|
1103 | 1103 | $out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>'; |
1104 | 1104 | if (empty($hidelabel)) |
1105 | - print $langs->trans("RefOrLabel") . ' : '; |
|
1105 | + print $langs->trans("RefOrLabel").' : '; |
|
1106 | 1106 | else if ($hidelabel > 1) { |
1107 | - $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
1107 | + $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
|
1108 | 1108 | if ($hidelabel == 2) { |
1109 | 1109 | $out .= img_picto($langs->trans("Search"), 'search'); |
1110 | 1110 | } |
1111 | 1111 | } |
1112 | - $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty(Globals::$conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />'; |
|
1112 | + $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty(Globals::$conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />'; |
|
1113 | 1113 | if ($hidelabel == 3) { |
1114 | 1114 | $out .= img_picto($langs->trans("Search"), 'search'); |
1115 | 1115 | } |
@@ -1170,20 +1170,20 @@ discard block |
||
1170 | 1170 | $sql .= " , dictp.code as country_code"; |
1171 | 1171 | } |
1172 | 1172 | |
1173 | - $sql .= " FROM (" . MAIN_DB_PREFIX . "societe as s"; |
|
1173 | + $sql .= " FROM (".MAIN_DB_PREFIX."societe as s"; |
|
1174 | 1174 | if (!$user->rights->societe->client->voir && !$user->socid) |
1175 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
1175 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
1176 | 1176 | $sql .= " )"; |
1177 | 1177 | if (Globals::$conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) { |
1178 | - $sql .= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "c_country as dictp ON dictp.rowid=s.fk_pays"; |
|
1178 | + $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid=s.fk_pays"; |
|
1179 | 1179 | } |
1180 | - $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; |
|
1180 | + $sql .= " WHERE s.entity IN (".getEntity('societe').")"; |
|
1181 | 1181 | if (!empty($user->socid)) |
1182 | - $sql .= " AND s.rowid = " . $user->socid; |
|
1182 | + $sql .= " AND s.rowid = ".$user->socid; |
|
1183 | 1183 | if ($filter) |
1184 | - $sql .= " AND (" . $filter . ")"; |
|
1184 | + $sql .= " AND (".$filter.")"; |
|
1185 | 1185 | if (!$user->rights->societe->client->voir && !$user->socid) |
1186 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
1186 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
1187 | 1187 | if (!empty(Globals::$conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) |
1188 | 1188 | $sql .= " AND s.status <> 0"; |
1189 | 1189 | // Add criteria |
@@ -1198,31 +1198,31 @@ discard block |
||
1198 | 1198 | foreach ($scrit as $crit) { |
1199 | 1199 | if ($i > 0) |
1200 | 1200 | $sql .= " AND "; |
1201 | - $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
1201 | + $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')"; |
|
1202 | 1202 | $i++; |
1203 | 1203 | } |
1204 | 1204 | if (count($scrit) > 1) |
1205 | 1205 | $sql .= ")"; |
1206 | 1206 | if (!empty(Globals::$conf->barcode->enabled)) { |
1207 | - $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1207 | + $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
1208 | 1208 | } |
1209 | - $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
1209 | + $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
1210 | 1210 | $sql .= ")"; |
1211 | 1211 | } |
1212 | 1212 | $sql .= $this->db->order("nom", "ASC"); |
1213 | 1213 | $sql .= $this->db->plimit($limit, 0); |
1214 | 1214 | |
1215 | 1215 | // Build output string |
1216 | - dol_syslog(get_class($this) . "::select_thirdparty_list", LOG_DEBUG); |
|
1216 | + dol_syslog(get_class($this)."::select_thirdparty_list", LOG_DEBUG); |
|
1217 | 1217 | $resql = $this->db->query($sql); |
1218 | 1218 | if ($resql) { |
1219 | 1219 | if (!$forcecombo) { |
1220 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1220 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
1221 | 1221 | $out .= ajax_combobox($htmlname, $events, Globals::$conf->global->COMPANY_USE_SEARCH_TO_SELECT); |
1222 | 1222 | } |
1223 | 1223 | |
1224 | 1224 | // Construct $out and $outarray |
1225 | - $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n"; |
|
1225 | + $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n"; |
|
1226 | 1226 | |
1227 | 1227 | $textifempty = ''; |
1228 | 1228 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | $textifempty .= $langs->trans("All"); |
1235 | 1235 | } |
1236 | 1236 | if ($showempty) |
1237 | - $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
1237 | + $out .= '<option value="-1">'.$textifempty.'</option>'."\n"; |
|
1238 | 1238 | |
1239 | 1239 | $num = $this->db->num_rows($resql); |
1240 | 1240 | $i = 0; |
@@ -1244,18 +1244,18 @@ discard block |
||
1244 | 1244 | $label = ''; |
1245 | 1245 | if (Globals::$conf->global->SOCIETE_ADD_REF_IN_LIST) { |
1246 | 1246 | if (($obj->client) && (!empty($obj->code_client))) { |
1247 | - $label = $obj->code_client . ' - '; |
|
1247 | + $label = $obj->code_client.' - '; |
|
1248 | 1248 | } |
1249 | 1249 | if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { |
1250 | - $label .= $obj->code_fournisseur . ' - '; |
|
1250 | + $label .= $obj->code_fournisseur.' - '; |
|
1251 | 1251 | } |
1252 | - $label .= ' ' . $obj->name; |
|
1252 | + $label .= ' '.$obj->name; |
|
1253 | 1253 | } else { |
1254 | 1254 | $label = $obj->name; |
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | if (!empty($obj->name_alias)) { |
1258 | - $label .= ' (' . $obj->name_alias . ')'; |
|
1258 | + $label .= ' ('.$obj->name_alias.')'; |
|
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | if ($showtype) { |
@@ -1264,25 +1264,25 @@ discard block |
||
1264 | 1264 | if ($obj->client == 1 || $obj->client == 3) |
1265 | 1265 | $label .= $langs->trans("Customer"); |
1266 | 1266 | if ($obj->client == 2 || $obj->client == 3) |
1267 | - $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); |
|
1267 | + $label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); |
|
1268 | 1268 | if ($obj->fournisseur) |
1269 | - $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); |
|
1269 | + $label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); |
|
1270 | 1270 | if ($obj->client || $obj->fournisseur) |
1271 | 1271 | $label .= ')'; |
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | if (Globals::$conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) { |
1275 | - $label .= '-' . $obj->address . '-' . $obj->zip . ' ' . $obj->town; |
|
1275 | + $label .= '-'.$obj->address.'-'.$obj->zip.' '.$obj->town; |
|
1276 | 1276 | if (!empty($obj->country_code)) { |
1277 | - $label .= ' ' . $langs->trans('Country' . $obj->country_code); |
|
1277 | + $label .= ' '.$langs->trans('Country'.$obj->country_code); |
|
1278 | 1278 | } |
1279 | 1279 | } |
1280 | 1280 | |
1281 | 1281 | if (empty($outputmode)) { |
1282 | 1282 | if (in_array($obj->rowid, $selected)) { |
1283 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $label . '</option>'; |
|
1283 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$label.'</option>'; |
|
1284 | 1284 | } else { |
1285 | - $out .= '<option value="' . $obj->rowid . '">' . $label . '</option>'; |
|
1285 | + $out .= '<option value="'.$obj->rowid.'">'.$label.'</option>'; |
|
1286 | 1286 | } |
1287 | 1287 | } else { |
1288 | 1288 | array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | $out .= "\n"; |
1294 | 1294 | } |
1295 | 1295 | } |
1296 | - $out .= '</select>' . "\n"; |
|
1296 | + $out .= '</select>'."\n"; |
|
1297 | 1297 | } |
1298 | 1298 | else { |
1299 | 1299 | DolUtils::dol_print_error($this->db); |
@@ -1325,17 +1325,17 @@ discard block |
||
1325 | 1325 | // On recherche les remises |
1326 | 1326 | $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; |
1327 | 1327 | $sql .= " re.description, re.fk_facture_source"; |
1328 | - $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re"; |
|
1329 | - $sql .= " WHERE re.fk_soc = " . (int) $socid; |
|
1330 | - $sql .= " AND re.entity = " . Globals::$conf->entity; |
|
1328 | + $sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re"; |
|
1329 | + $sql .= " WHERE re.fk_soc = ".(int) $socid; |
|
1330 | + $sql .= " AND re.entity = ".Globals::$conf->entity; |
|
1331 | 1331 | if ($filter) |
1332 | - $sql .= " AND " . $filter; |
|
1332 | + $sql .= " AND ".$filter; |
|
1333 | 1333 | $sql .= " ORDER BY re.description ASC"; |
1334 | 1334 | |
1335 | - dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG); |
|
1335 | + dol_syslog(get_class($this)."::select_remises", LOG_DEBUG); |
|
1336 | 1336 | $resql = $this->db->query($sql); |
1337 | 1337 | if ($resql) { |
1338 | - print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">'; |
|
1338 | + print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">'; |
|
1339 | 1339 | $num = $this->db->num_rows($resql); |
1340 | 1340 | |
1341 | 1341 | $qualifiedlines = $num; |
@@ -1368,10 +1368,10 @@ discard block |
||
1368 | 1368 | if (!empty(Globals::$conf->global->MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST) && !empty($obj->fk_facture_source)) { |
1369 | 1369 | $tmpfac = new Facture($this->db); |
1370 | 1370 | if ($tmpfac->fetch($obj->fk_facture_source) > 0) |
1371 | - $desc = $desc . ' - ' . $tmpfac->ref; |
|
1371 | + $desc = $desc.' - '.$tmpfac->ref; |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | - print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; |
|
1374 | + print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; |
|
1375 | 1375 | $i++; |
1376 | 1376 | } |
1377 | 1377 | } |
@@ -1451,7 +1451,7 @@ discard block |
||
1451 | 1451 | $out = ''; |
1452 | 1452 | |
1453 | 1453 | if (!is_object($hookmanager)) { |
1454 | - include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; |
|
1454 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
1455 | 1455 | $hookmanager = new HookManager($this->db); |
1456 | 1456 | } |
1457 | 1457 | |
@@ -1459,36 +1459,36 @@ discard block |
||
1459 | 1459 | $sql = "SELECT sp.rowid, sp.lastname, sp.statut, sp.firstname, sp.poste"; |
1460 | 1460 | if ($showsoc > 0) |
1461 | 1461 | $sql .= " , s.nom as company"; |
1462 | - $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as sp"; |
|
1462 | + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; |
|
1463 | 1463 | if ($showsoc > 0) |
1464 | - $sql .= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid=sp.fk_soc"; |
|
1465 | - $sql .= " WHERE sp.entity IN (" . getEntity('socpeople') . ")"; |
|
1464 | + $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=sp.fk_soc"; |
|
1465 | + $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; |
|
1466 | 1466 | if ($socid > 0 || $socid == -1) |
1467 | - $sql .= " AND sp.fk_soc=" . $socid; |
|
1467 | + $sql .= " AND sp.fk_soc=".$socid; |
|
1468 | 1468 | if (!empty(Globals::$conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) |
1469 | 1469 | $sql .= " AND sp.statut <> 0"; |
1470 | 1470 | $sql .= " ORDER BY sp.lastname ASC"; |
1471 | 1471 | |
1472 | - dol_syslog(get_class($this) . "::select_contacts", LOG_DEBUG); |
|
1472 | + dol_syslog(get_class($this)."::select_contacts", LOG_DEBUG); |
|
1473 | 1473 | $resql = $this->db->query($sql); |
1474 | 1474 | if ($resql) { |
1475 | 1475 | $num = $this->db->num_rows($resql); |
1476 | 1476 | |
1477 | 1477 | if (Globals::$conf->use_javascript_ajax && !$forcecombo && !$options_only) { |
1478 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1478 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
1479 | 1479 | $out .= ajax_combobox($htmlid, $events, Globals::$conf->global->CONTACT_USE_SEARCH_TO_SELECT); |
1480 | 1480 | } |
1481 | 1481 | |
1482 | 1482 | if ($htmlname != 'none' || $options_only) |
1483 | - $out .= '<select class="flat' . ($moreclass ? ' ' . $moreclass : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; |
|
1483 | + $out .= '<select class="flat'.($moreclass ? ' '.$moreclass : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>'; |
|
1484 | 1484 | if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) |
1485 | - $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; |
|
1485 | + $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>'; |
|
1486 | 1486 | if ($showempty == 2) |
1487 | - $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>' . $langs->trans("Internal") . '</option>'; |
|
1487 | + $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>'.$langs->trans("Internal").'</option>'; |
|
1488 | 1488 | $num = $this->db->num_rows($resql); |
1489 | 1489 | $i = 0; |
1490 | 1490 | if ($num) { |
1491 | - include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
1491 | + include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
1492 | 1492 | $contactstatic = new Contact($this->db); |
1493 | 1493 | |
1494 | 1494 | while ($i < $num) { |
@@ -1505,27 +1505,27 @@ discard block |
||
1505 | 1505 | if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) |
1506 | 1506 | $disabled = 1; |
1507 | 1507 | if (!empty($selected) && in_array($obj->rowid, $selected)) { |
1508 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
1508 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
1509 | 1509 | if ($disabled) |
1510 | 1510 | $out .= ' disabled'; |
1511 | 1511 | $out .= ' selected>'; |
1512 | 1512 | $out .= $contactstatic->getFullName($langs); |
1513 | 1513 | if ($showfunction && $obj->poste) |
1514 | - $out .= ' (' . $obj->poste . ')'; |
|
1514 | + $out .= ' ('.$obj->poste.')'; |
|
1515 | 1515 | if (($showsoc > 0) && $obj->company) |
1516 | - $out .= ' - (' . $obj->company . ')'; |
|
1516 | + $out .= ' - ('.$obj->company.')'; |
|
1517 | 1517 | $out .= '</option>'; |
1518 | 1518 | } |
1519 | 1519 | else { |
1520 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
1520 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
1521 | 1521 | if ($disabled) |
1522 | 1522 | $out .= ' disabled'; |
1523 | 1523 | $out .= '>'; |
1524 | 1524 | $out .= $contactstatic->getFullName($langs); |
1525 | 1525 | if ($showfunction && $obj->poste) |
1526 | - $out .= ' (' . $obj->poste . ')'; |
|
1526 | + $out .= ' ('.$obj->poste.')'; |
|
1527 | 1527 | if (($showsoc > 0) && $obj->company) |
1528 | - $out .= ' - (' . $obj->company . ')'; |
|
1528 | + $out .= ' - ('.$obj->company.')'; |
|
1529 | 1529 | $out .= '</option>'; |
1530 | 1530 | } |
1531 | 1531 | } |
@@ -1533,9 +1533,9 @@ discard block |
||
1533 | 1533 | if (in_array($obj->rowid, $selected)) { |
1534 | 1534 | $out .= $contactstatic->getFullName($langs); |
1535 | 1535 | if ($showfunction && $obj->poste) |
1536 | - $out .= ' (' . $obj->poste . ')'; |
|
1536 | + $out .= ' ('.$obj->poste.')'; |
|
1537 | 1537 | if (($showsoc > 0) && $obj->company) |
1538 | - $out .= ' - (' . $obj->company . ')'; |
|
1538 | + $out .= ' - ('.$obj->company.')'; |
|
1539 | 1539 | } |
1540 | 1540 | } |
1541 | 1541 | } |
@@ -1543,7 +1543,7 @@ discard block |
||
1543 | 1543 | } |
1544 | 1544 | } |
1545 | 1545 | else { |
1546 | - $out .= '<option value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled>'; |
|
1546 | + $out .= '<option value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled>'; |
|
1547 | 1547 | $out .= ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); |
1548 | 1548 | $out .= '</option>'; |
1549 | 1549 | } |
@@ -1557,7 +1557,7 @@ discard block |
||
1557 | 1557 | 'showsoc' => $showsoc, |
1558 | 1558 | ); |
1559 | 1559 | |
1560 | - $reshook = $hookmanager->executeHooks('afterSelectContactOptions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
1560 | + $reshook = $hookmanager->executeHooks('afterSelectContactOptions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
1561 | 1561 | |
1562 | 1562 | if ($htmlname != 'none' || $options_only) { |
1563 | 1563 | $out .= '</select>'; |
@@ -1656,33 +1656,33 @@ discard block |
||
1656 | 1656 | if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) { |
1657 | 1657 | $sql .= ", e.label"; |
1658 | 1658 | } |
1659 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
1659 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
1660 | 1660 | if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) { |
1661 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entity as e ON e.rowid=u.entity"; |
|
1661 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e ON e.rowid=u.entity"; |
|
1662 | 1662 | if ($force_entity) |
1663 | - $sql .= " WHERE u.entity IN (0," . $force_entity . ")"; |
|
1663 | + $sql .= " WHERE u.entity IN (0,".$force_entity.")"; |
|
1664 | 1664 | else |
1665 | 1665 | $sql .= " WHERE u.entity IS NOT NULL"; |
1666 | 1666 | } |
1667 | 1667 | else { |
1668 | 1668 | if (!empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
1669 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ug"; |
|
1669 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug"; |
|
1670 | 1670 | $sql .= " ON ug.fk_user = u.rowid"; |
1671 | - $sql .= " WHERE ug.entity = " . Globals::$conf->entity; |
|
1671 | + $sql .= " WHERE ug.entity = ".Globals::$conf->entity; |
|
1672 | 1672 | } else { |
1673 | - $sql .= " WHERE u.entity IN (0," . Globals::$conf->entity . ")"; |
|
1673 | + $sql .= " WHERE u.entity IN (0,".Globals::$conf->entity.")"; |
|
1674 | 1674 | } |
1675 | 1675 | } |
1676 | 1676 | if (!empty($user->societe_id)) |
1677 | - $sql .= " AND u.fk_soc = " . $user->societe_id; |
|
1677 | + $sql .= " AND u.fk_soc = ".$user->societe_id; |
|
1678 | 1678 | if (is_array($exclude) && $excludeUsers) |
1679 | - $sql .= " AND u.rowid NOT IN (" . $excludeUsers . ")"; |
|
1679 | + $sql .= " AND u.rowid NOT IN (".$excludeUsers.")"; |
|
1680 | 1680 | if ($includeUsers) |
1681 | - $sql .= " AND u.rowid IN (" . $includeUsers . ")"; |
|
1681 | + $sql .= " AND u.rowid IN (".$includeUsers.")"; |
|
1682 | 1682 | if (!empty(Globals::$conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) |
1683 | 1683 | $sql .= " AND u.statut <> 0"; |
1684 | 1684 | if (!empty($morefilter)) |
1685 | - $sql .= " " . $morefilter; |
|
1685 | + $sql .= " ".$morefilter; |
|
1686 | 1686 | |
1687 | 1687 | if (empty(Globals::$conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname |
1688 | 1688 | $sql .= " ORDER BY u.firstname ASC"; |
@@ -1690,22 +1690,22 @@ discard block |
||
1690 | 1690 | $sql .= " ORDER BY u.lastname ASC"; |
1691 | 1691 | } |
1692 | 1692 | |
1693 | - dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG); |
|
1693 | + dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); |
|
1694 | 1694 | $resql = $this->db->query($sql); |
1695 | 1695 | if ($resql) { |
1696 | 1696 | $num = $this->db->num_rows($resql); |
1697 | 1697 | $i = 0; |
1698 | 1698 | if ($num) { |
1699 | 1699 | // Enhance with select2 |
1700 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1700 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
1701 | 1701 | $out .= ajax_combobox($htmlname); |
1702 | 1702 | |
1703 | 1703 | // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined |
1704 | - $out .= '<select class="flat' . ($morecss ? ' minwidth100 ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
1704 | + $out .= '<select class="flat'.($morecss ? ' minwidth100 '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
|
1705 | 1705 | if ($show_empty && !$multiple) |
1706 | - $out .= '<option value="-1"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '> </option>' . "\n"; |
|
1706 | + $out .= '<option value="-1"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'> </option>'."\n"; |
|
1707 | 1707 | if ($show_every) |
1708 | - $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; |
|
1708 | + $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; |
|
1709 | 1709 | |
1710 | 1710 | $userstatic = new User($this->db); |
1711 | 1711 | |
@@ -1720,14 +1720,14 @@ discard block |
||
1720 | 1720 | if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly)) |
1721 | 1721 | $disableline = ($enableonlytext ? $enableonlytext : '1'); |
1722 | 1722 | |
1723 | - if ((is_object($selected) && $selected->id == $obj->rowid) || (!is_object($selected) && in_array($obj->rowid, $selected) )) { |
|
1724 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
1723 | + if ((is_object($selected) && $selected->id == $obj->rowid) || (!is_object($selected) && in_array($obj->rowid, $selected))) { |
|
1724 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
1725 | 1725 | if ($disableline) |
1726 | 1726 | $out .= ' disabled'; |
1727 | 1727 | $out .= ' selected>'; |
1728 | 1728 | } |
1729 | 1729 | else { |
1730 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
1730 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
1731 | 1731 | if ($disableline) |
1732 | 1732 | $out .= ' disabled'; |
1733 | 1733 | $out .= '>'; |
@@ -1743,31 +1743,31 @@ discard block |
||
1743 | 1743 | // Complete name with more info |
1744 | 1744 | $moreinfo = 0; |
1745 | 1745 | if (!empty(Globals::$conf->global->MAIN_SHOW_LOGIN)) { |
1746 | - $out .= ($moreinfo ? ' - ' : ' (') . $obj->login; |
|
1746 | + $out .= ($moreinfo ? ' - ' : ' (').$obj->login; |
|
1747 | 1747 | $moreinfo++; |
1748 | 1748 | } |
1749 | 1749 | if ($showstatus >= 0) { |
1750 | 1750 | if ($obj->statut == 1 && $showstatus == 1) { |
1751 | - $out .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); |
|
1751 | + $out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); |
|
1752 | 1752 | $moreinfo++; |
1753 | 1753 | } |
1754 | 1754 | if ($obj->statut == 0) { |
1755 | - $out .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); |
|
1755 | + $out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); |
|
1756 | 1756 | $moreinfo++; |
1757 | 1757 | } |
1758 | 1758 | } |
1759 | 1759 | if (!empty(Globals::$conf->multicompany->enabled) && empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) { |
1760 | 1760 | if (!$obj->entity) { |
1761 | - $out .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); |
|
1761 | + $out .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); |
|
1762 | 1762 | $moreinfo++; |
1763 | 1763 | } else { |
1764 | - $out .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
1764 | + $out .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); |
|
1765 | 1765 | $moreinfo++; |
1766 | 1766 | } |
1767 | 1767 | } |
1768 | 1768 | $out .= ($moreinfo ? ')' : ''); |
1769 | 1769 | if ($disableline && $disableline != '1') { |
1770 | - $out .= ' - ' . $disableline; // This is text from $enableonlytext parameter |
|
1770 | + $out .= ' - '.$disableline; // This is text from $enableonlytext parameter |
|
1771 | 1771 | } |
1772 | 1772 | $out .= '</option>'; |
1773 | 1773 | $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength); |
@@ -1775,8 +1775,8 @@ discard block |
||
1775 | 1775 | $i++; |
1776 | 1776 | } |
1777 | 1777 | } else { |
1778 | - $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>'; |
|
1779 | - $out .= '<option value="">' . $langs->trans("None") . '</option>'; |
|
1778 | + $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>'; |
|
1779 | + $out .= '<option value="">'.$langs->trans("None").'</option>'; |
|
1780 | 1780 | } |
1781 | 1781 | $out .= '</select>'; |
1782 | 1782 | } else { |
@@ -1827,7 +1827,7 @@ discard block |
||
1827 | 1827 | $out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">'; |
1828 | 1828 | $out .= '<script type="text/javascript" language="javascript">jQuery(document).ready(function () { jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });})</script>'; |
1829 | 1829 | $out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); |
1830 | - $out .= ' <input type="submit" class="button valignmiddle" name="' . $action . 'assignedtouser" value="' . DolUtils::dol_escape_htmltag($langs->trans("Add")) . '">'; |
|
1830 | + $out .= ' <input type="submit" class="button valignmiddle" name="'.$action.'assignedtouser" value="'.DolUtils::dol_escape_htmltag($langs->trans("Add")).'">'; |
|
1831 | 1831 | $out .= '<br>'; |
1832 | 1832 | } |
1833 | 1833 | $assignedtouser = array(); |
@@ -1851,16 +1851,16 @@ discard block |
||
1851 | 1851 | $out .= $userstatic->getNomUrl(-1); |
1852 | 1852 | if ($i == 0) { |
1853 | 1853 | $ownerid = $value['id']; |
1854 | - $out .= ' (' . $langs->trans("Owner") . ')'; |
|
1854 | + $out .= ' ('.$langs->trans("Owner").')'; |
|
1855 | 1855 | } |
1856 | 1856 | if ($nbassignetouser > 1 && $action != 'view') { |
1857 | - $out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $userstatic->id . '" class="removedassigned" id="removedassigned_' . $userstatic->id . '" name="removedassigned_' . $userstatic->id . '">'; |
|
1857 | + $out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">'; |
|
1858 | 1858 | } |
1859 | 1859 | // Show my availability |
1860 | 1860 | if ($showproperties) { |
1861 | 1861 | if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { |
1862 | 1862 | $out .= '<div class="myavailability inline-block">'; |
1863 | - $out .= ' - <span class="opacitymedium">' . $langs->trans("Availability") . ':</span> <input id="transparency" class="marginleftonly marginrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofuserid[$ownerid]['transparency'] ? ' checked' : '') . '>' . $langs->trans("Busy"); |
|
1863 | + $out .= ' - <span class="opacitymedium">'.$langs->trans("Availability").':</span> <input id="transparency" class="marginleftonly marginrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofuserid[$ownerid]['transparency'] ? ' checked' : '').'>'.$langs->trans("Busy"); |
|
1864 | 1864 | $out .= '</div>'; |
1865 | 1865 | } |
1866 | 1866 | } |
@@ -1914,19 +1914,19 @@ discard block |
||
1914 | 1914 | $placeholder = ''; |
1915 | 1915 | |
1916 | 1916 | if ($selected && empty($selected_input_value)) { |
1917 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
1917 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
1918 | 1918 | $producttmpselect = new Product($this->db); |
1919 | 1919 | $producttmpselect->fetch($selected); |
1920 | 1920 | $selected_input_value = $producttmpselect->ref; |
1921 | 1921 | unset($producttmpselect); |
1922 | 1922 | } |
1923 | 1923 | // mode=1 means customers products |
1924 | - $urloption = 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=1&status=' . $status . '&finished=' . $finished . '&hidepriceinlabel=' . $hidepriceinlabel . '&warehousestatus=' . $warehouseStatus; |
|
1924 | + $urloption = 'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus; |
|
1925 | 1925 | //Price by customer |
1926 | 1926 | if (!empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { |
1927 | - $urloption .= '&socid=' . $socid; |
|
1927 | + $urloption .= '&socid='.$socid; |
|
1928 | 1928 | } |
1929 | - print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
|
1929 | + print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
|
1930 | 1930 | |
1931 | 1931 | if (!empty(Globals::$conf->variants->enabled)) { |
1932 | 1932 | |
@@ -2003,14 +2003,14 @@ discard block |
||
2003 | 2003 | <?php |
2004 | 2004 | } |
2005 | 2005 | if (empty($hidelabel)) |
2006 | - print $langs->trans("RefOrLabel") . ' : '; |
|
2006 | + print $langs->trans("RefOrLabel").' : '; |
|
2007 | 2007 | else if ($hidelabel > 1) { |
2008 | - $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
|
2008 | + $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; |
|
2009 | 2009 | if ($hidelabel == 2) { |
2010 | 2010 | print img_picto($langs->trans("Search"), 'search'); |
2011 | 2011 | } |
2012 | 2012 | } |
2013 | - print '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty(Globals::$conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />'; |
|
2013 | + print '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty(Globals::$conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />'; |
|
2014 | 2014 | if ($hidelabel == 3) { |
2015 | 2015 | print img_picto($langs->trans("Search"), 'search'); |
2016 | 2016 | } |
@@ -2053,7 +2053,7 @@ discard block |
||
2053 | 2053 | |
2054 | 2054 | $warehouseStatusArray = array(); |
2055 | 2055 | if (!empty($warehouseStatus)) { |
2056 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
2056 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
2057 | 2057 | if (preg_match('/warehouseclosed/', $warehouseStatus)) { |
2058 | 2058 | $warehouseStatusArray[] = Entrepot::STATUS_CLOSED; |
2059 | 2059 | } |
@@ -2069,13 +2069,13 @@ discard block |
||
2069 | 2069 | (count($warehouseStatusArray)) ? $selectFieldsGrouped = ", sum(ps.reel) as stock" : $selectFieldsGrouped = ", p.stock"; |
2070 | 2070 | |
2071 | 2071 | $sql = "SELECT "; |
2072 | - $sql .= $selectFields . $selectFieldsGrouped; |
|
2072 | + $sql .= $selectFields.$selectFieldsGrouped; |
|
2073 | 2073 | |
2074 | 2074 | if (!empty(Globals::$conf->global->PRODUCT_SORT_BY_CATEGORY)) { |
2075 | 2075 | //Product category |
2076 | - $sql .= ", (SELECT " . MAIN_DB_PREFIX . "categorie_product.fk_categorie |
|
2077 | - FROM " . MAIN_DB_PREFIX . "categorie_product |
|
2078 | - WHERE " . MAIN_DB_PREFIX . "categorie_product.fk_product=p.rowid |
|
2076 | + $sql .= ", (SELECT ".MAIN_DB_PREFIX."categorie_product.fk_categorie |
|
2077 | + FROM " . MAIN_DB_PREFIX."categorie_product |
|
2078 | + WHERE " . MAIN_DB_PREFIX."categorie_product.fk_product=p.rowid |
|
2079 | 2079 | LIMIT 1 |
2080 | 2080 | ) AS categorie_product_id "; |
2081 | 2081 | } |
@@ -2094,45 +2094,45 @@ discard block |
||
2094 | 2094 | } |
2095 | 2095 | // Price by quantity |
2096 | 2096 | if (!empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { |
2097 | - $sql .= ", (SELECT pp.rowid FROM " . MAIN_DB_PREFIX . "product_price as pp WHERE pp.fk_product = p.rowid"; |
|
2097 | + $sql .= ", (SELECT pp.rowid FROM ".MAIN_DB_PREFIX."product_price as pp WHERE pp.fk_product = p.rowid"; |
|
2098 | 2098 | if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) |
2099 | - $sql .= " AND price_level=" . $price_level; |
|
2099 | + $sql .= " AND price_level=".$price_level; |
|
2100 | 2100 | $sql .= " ORDER BY date_price"; |
2101 | 2101 | $sql .= " DESC LIMIT 1) as price_rowid"; |
2102 | - $sql .= ", (SELECT pp.price_by_qty FROM " . MAIN_DB_PREFIX . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable |
|
2102 | + $sql .= ", (SELECT pp.price_by_qty FROM ".MAIN_DB_PREFIX."product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable |
|
2103 | 2103 | if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) |
2104 | - $sql .= " AND price_level=" . $price_level; |
|
2104 | + $sql .= " AND price_level=".$price_level; |
|
2105 | 2105 | $sql .= " ORDER BY date_price"; |
2106 | 2106 | $sql .= " DESC LIMIT 1) as price_by_qty"; |
2107 | 2107 | $selectFields .= ", price_rowid, price_by_qty"; |
2108 | 2108 | } |
2109 | - $sql .= " FROM " . MAIN_DB_PREFIX . "product as p"; |
|
2109 | + $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; |
|
2110 | 2110 | if (count($warehouseStatusArray)) { |
2111 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_stock as ps on ps.fk_product = p.rowid"; |
|
2112 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e on ps.fk_entrepot = e.rowid"; |
|
2111 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid"; |
|
2112 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid"; |
|
2113 | 2113 | } |
2114 | 2114 | |
2115 | 2115 | // include search in supplier ref |
2116 | 2116 | if (!empty(Globals::$conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) { |
2117 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
2117 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
2118 | 2118 | } |
2119 | 2119 | |
2120 | 2120 | //Price by customer |
2121 | 2121 | if (!empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { |
2122 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_customer_price as pcp ON pcp.fk_soc=" . $socid . " AND pcp.fk_product=p.rowid"; |
|
2122 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_customer_price as pcp ON pcp.fk_soc=".$socid." AND pcp.fk_product=p.rowid"; |
|
2123 | 2123 | } |
2124 | 2124 | // Multilang : we add translation |
2125 | 2125 | if (!empty(Globals::$conf->global->MAIN_MULTILANGS)) { |
2126 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_lang as pl ON pl.fk_product = p.rowid AND pl.lang='" . $langs->getDefaultLang() . "'"; |
|
2126 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang='".$langs->getDefaultLang()."'"; |
|
2127 | 2127 | } |
2128 | 2128 | |
2129 | 2129 | if (!empty(Globals::$conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { |
2130 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
|
2130 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; |
|
2131 | 2131 | } |
2132 | 2132 | |
2133 | - $sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; |
|
2133 | + $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; |
|
2134 | 2134 | if (count($warehouseStatusArray)) { |
2135 | - $sql .= ' AND (p.fk_product_type = 1 OR e.statut IN (' . $this->db->escape(implode(',', $warehouseStatusArray)) . '))'; |
|
2135 | + $sql .= ' AND (p.fk_product_type = 1 OR e.statut IN ('.$this->db->escape(implode(',', $warehouseStatusArray)).'))'; |
|
2136 | 2136 | } |
2137 | 2137 | |
2138 | 2138 | if (!empty(Globals::$conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { |
@@ -2140,17 +2140,17 @@ discard block |
||
2140 | 2140 | } |
2141 | 2141 | |
2142 | 2142 | if ($finished == 0) { |
2143 | - $sql .= " AND p.finished = " . $finished; |
|
2143 | + $sql .= " AND p.finished = ".$finished; |
|
2144 | 2144 | } elseif ($finished == 1) { |
2145 | - $sql .= " AND p.finished = " . $finished; |
|
2145 | + $sql .= " AND p.finished = ".$finished; |
|
2146 | 2146 | if ($status >= 0) |
2147 | - $sql .= " AND p.tosell = " . $status; |
|
2147 | + $sql .= " AND p.tosell = ".$status; |
|
2148 | 2148 | } |
2149 | 2149 | elseif ($status >= 0) { |
2150 | - $sql .= " AND p.tosell = " . $status; |
|
2150 | + $sql .= " AND p.tosell = ".$status; |
|
2151 | 2151 | } |
2152 | 2152 | if (strval($filtertype) != '') |
2153 | - $sql .= " AND p.fk_product_type=" . $filtertype; |
|
2153 | + $sql .= " AND p.fk_product_type=".$filtertype; |
|
2154 | 2154 | // Add criteria on ref/label |
2155 | 2155 | if ($filterkey != '') { |
2156 | 2156 | $sql .= ' AND ('; |
@@ -2163,27 +2163,27 @@ discard block |
||
2163 | 2163 | foreach ($scrit as $crit) { |
2164 | 2164 | if ($i > 0) |
2165 | 2165 | $sql .= " AND "; |
2166 | - $sql .= "(p.ref LIKE '" . $db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $db->escape($prefix . $crit) . "%'"; |
|
2166 | + $sql .= "(p.ref LIKE '".$db->escape($prefix.$crit)."%' OR p.label LIKE '".$db->escape($prefix.$crit)."%'"; |
|
2167 | 2167 | if (!empty(Globals::$conf->global->MAIN_MULTILANGS)) |
2168 | - $sql .= " OR pl.label LIKE '" . $db->escape($prefix . $crit) . "%'"; |
|
2168 | + $sql .= " OR pl.label LIKE '".$db->escape($prefix.$crit)."%'"; |
|
2169 | 2169 | if (!empty(Globals::$conf->global->PRODUCT_AJAX_SEARCH_ON_DESCRIPTION)) { |
2170 | - $sql .= " OR p.description LIKE '" . $db->escape($prefix . $crit) . "%'"; |
|
2170 | + $sql .= " OR p.description LIKE '".$db->escape($prefix.$crit)."%'"; |
|
2171 | 2171 | if (!empty(Globals::$conf->global->MAIN_MULTILANGS)) |
2172 | - $sql .= " OR pl.description LIKE '" . $db->escape($prefix . $crit) . "%'"; |
|
2172 | + $sql .= " OR pl.description LIKE '".$db->escape($prefix.$crit)."%'"; |
|
2173 | 2173 | } |
2174 | 2174 | if (!empty(Globals::$conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) |
2175 | - $sql .= " OR pfp.ref_fourn LIKE '" . $db->escape($prefix . $crit) . "%'"; |
|
2175 | + $sql .= " OR pfp.ref_fourn LIKE '".$db->escape($prefix.$crit)."%'"; |
|
2176 | 2176 | $sql .= ")"; |
2177 | 2177 | $i++; |
2178 | 2178 | } |
2179 | 2179 | if (count($scrit) > 1) |
2180 | 2180 | $sql .= ")"; |
2181 | 2181 | if (!empty(Globals::$conf->barcode->enabled)) |
2182 | - $sql .= " OR p.barcode LIKE '" . $db->escape($prefix . $filterkey) . "%'"; |
|
2182 | + $sql .= " OR p.barcode LIKE '".$db->escape($prefix.$filterkey)."%'"; |
|
2183 | 2183 | $sql .= ')'; |
2184 | 2184 | } |
2185 | 2185 | if (count($warehouseStatusArray)) { |
2186 | - $sql .= ' GROUP BY' . $selectFields; |
|
2186 | + $sql .= ' GROUP BY'.$selectFields; |
|
2187 | 2187 | } |
2188 | 2188 | |
2189 | 2189 | //Sort by category |
@@ -2198,21 +2198,21 @@ discard block |
||
2198 | 2198 | $sql .= $db->plimit($limit, 0); |
2199 | 2199 | |
2200 | 2200 | // Build output string |
2201 | - dol_syslog(get_class($this) . "::select_produits_list search product", LOG_DEBUG); |
|
2201 | + dol_syslog(get_class($this)."::select_produits_list search product", LOG_DEBUG); |
|
2202 | 2202 | $result = $this->db->query($sql); |
2203 | 2203 | if ($result) { |
2204 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2205 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
2204 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
2205 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
2206 | 2206 | $num = $this->db->num_rows($result); |
2207 | 2207 | |
2208 | 2208 | $events = null; |
2209 | 2209 | |
2210 | 2210 | if (!$forcecombo) { |
2211 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2211 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
2212 | 2212 | $out .= ajax_combobox($htmlname, $events, Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT); |
2213 | 2213 | } |
2214 | 2214 | |
2215 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
2215 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
2216 | 2216 | |
2217 | 2217 | $textifempty = ''; |
2218 | 2218 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
@@ -2224,7 +2224,7 @@ discard block |
||
2224 | 2224 | $textifempty .= $langs->trans("All"); |
2225 | 2225 | } |
2226 | 2226 | if ($showempty) |
2227 | - $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
2227 | + $out .= '<option value="0" selected>'.$textifempty.'</option>'; |
|
2228 | 2228 | |
2229 | 2229 | $i = 0; |
2230 | 2230 | while ($num && $i < $num) { |
@@ -2234,11 +2234,11 @@ discard block |
||
2234 | 2234 | |
2235 | 2235 | if ((!empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product |
2236 | 2236 | $sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type"; |
2237 | - $sql .= " FROM " . MAIN_DB_PREFIX . "product_price_by_qty"; |
|
2238 | - $sql .= " WHERE fk_product_price=" . $objp->price_rowid; |
|
2237 | + $sql .= " FROM ".MAIN_DB_PREFIX."product_price_by_qty"; |
|
2238 | + $sql .= " WHERE fk_product_price=".$objp->price_rowid; |
|
2239 | 2239 | $sql .= " ORDER BY quantity ASC"; |
2240 | 2240 | |
2241 | - dol_syslog(get_class($this) . "::select_produits_list search price by qty", LOG_DEBUG); |
|
2241 | + dol_syslog(get_class($this)."::select_produits_list search price by qty", LOG_DEBUG); |
|
2242 | 2242 | $result2 = $this->db->query($sql); |
2243 | 2243 | if ($result2) { |
2244 | 2244 | $nb_prices = $this->db->num_rows($result2); |
@@ -2342,7 +2342,7 @@ discard block |
||
2342 | 2342 | if (!empty($objp->label_translated)) |
2343 | 2343 | $label = $objp->label_translated; |
2344 | 2344 | if (!empty($filterkey) && $filterkey != '') |
2345 | - $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1); |
|
2345 | + $label = preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $label, 1); |
|
2346 | 2346 | |
2347 | 2347 | $outkey = $objp->rowid; |
2348 | 2348 | $outref = $objp->ref; |
@@ -2354,10 +2354,10 @@ discard block |
||
2354 | 2354 | $outdurationvalue = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : ''; |
2355 | 2355 | $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; |
2356 | 2356 | |
2357 | - $opt = '<option value="' . $objp->rowid . '"'; |
|
2357 | + $opt = '<option value="'.$objp->rowid.'"'; |
|
2358 | 2358 | $opt .= ($objp->rowid == $selected) ? ' selected' : ''; |
2359 | 2359 | if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { |
2360 | - $opt .= ' pbq="' . $objp->price_by_qty_rowid . '" data-pbq="' . $objp->price_by_qty_rowid . '" data-pbqqty="' . $objp->price_by_qty_quantity . '" data-pbqpercent="' . $objp->price_by_qty_remise_percent . '"'; |
|
2360 | + $opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; |
|
2361 | 2361 | } |
2362 | 2362 | if (!empty(Globals::$conf->stock->enabled) && $objp->fk_product_type == 0 && isset($objp->stock)) { |
2363 | 2363 | if ($objp->stock > 0) |
@@ -2368,16 +2368,16 @@ discard block |
||
2368 | 2368 | $opt .= '>'; |
2369 | 2369 | $opt .= $objp->ref; |
2370 | 2370 | if ($outbarcode) |
2371 | - $opt .= ' (' . $outbarcode . ')'; |
|
2372 | - $opt .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
2371 | + $opt .= ' ('.$outbarcode.')'; |
|
2372 | + $opt .= ' - '.dol_trunc($label, $maxlengtharticle); |
|
2373 | 2373 | |
2374 | 2374 | $objRef = $objp->ref; |
2375 | 2375 | if (!empty($filterkey) && $filterkey != '') |
2376 | - $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
2376 | + $objRef = preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $objRef, 1); |
|
2377 | 2377 | $outval .= $objRef; |
2378 | 2378 | if ($outbarcode) |
2379 | - $outval .= ' (' . $outbarcode . ')'; |
|
2380 | - $outval .= ' - ' . dol_trunc($label, $maxlengtharticle); |
|
2379 | + $outval .= ' ('.$outbarcode.')'; |
|
2380 | + $outval .= ' - '.dol_trunc($label, $maxlengtharticle); |
|
2381 | 2381 | |
2382 | 2382 | $found = 0; |
2383 | 2383 | |
@@ -2385,25 +2385,25 @@ discard block |
||
2385 | 2385 | // If we need a particular price level (from 1 to 6) |
2386 | 2386 | if (empty($hidepriceinlabel) && $price_level >= 1 && (!empty(Globals::$conf->global->PRODUIT_MULTIPRICES) || !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) { |
2387 | 2387 | $sql = "SELECT price, price_ttc, price_base_type, tva_tx"; |
2388 | - $sql .= " FROM " . MAIN_DB_PREFIX . "product_price"; |
|
2389 | - $sql .= " WHERE fk_product='" . $objp->rowid . "'"; |
|
2390 | - $sql .= " AND entity IN (" . getEntity('productprice') . ")"; |
|
2391 | - $sql .= " AND price_level=" . $price_level; |
|
2388 | + $sql .= " FROM ".MAIN_DB_PREFIX."product_price"; |
|
2389 | + $sql .= " WHERE fk_product='".$objp->rowid."'"; |
|
2390 | + $sql .= " AND entity IN (".getEntity('productprice').")"; |
|
2391 | + $sql .= " AND price_level=".$price_level; |
|
2392 | 2392 | $sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. |
2393 | 2393 | $sql .= " LIMIT 1"; |
2394 | 2394 | |
2395 | - dol_syslog(get_class($this) . '::constructProductListOption search price for level ' . $price_level . '', LOG_DEBUG); |
|
2395 | + dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG); |
|
2396 | 2396 | $result2 = $this->db->query($sql); |
2397 | 2397 | if ($result2) { |
2398 | 2398 | $objp2 = $this->db->fetch_object($result2); |
2399 | 2399 | if ($objp2) { |
2400 | 2400 | $found = 1; |
2401 | 2401 | if ($objp2->price_base_type == 'HT') { |
2402 | - $opt .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("HT"); |
|
2403 | - $outval .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
2402 | + $opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("HT"); |
|
2403 | + $outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("HT"); |
|
2404 | 2404 | } else { |
2405 | - $opt .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("TTC"); |
|
2406 | - $outval .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
2405 | + $opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("TTC"); |
|
2406 | + $outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("TTC"); |
|
2407 | 2407 | } |
2408 | 2408 | $outprice_ht = price($objp2->price); |
2409 | 2409 | $outprice_ttc = price($objp2->price_ttc); |
@@ -2421,13 +2421,13 @@ discard block |
||
2421 | 2421 | $outqty = $objp->quantity; |
2422 | 2422 | $outdiscount = $objp->remise_percent; |
2423 | 2423 | if ($objp->quantity == 1) { |
2424 | - $opt .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/"; |
|
2425 | - $outval .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/"; |
|
2424 | + $opt .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/"; |
|
2425 | + $outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/"; |
|
2426 | 2426 | $opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
2427 | 2427 | $outval .= $langs->transnoentities("Unit"); |
2428 | 2428 | } else { |
2429 | - $opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $objp->quantity; |
|
2430 | - $outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $objp->quantity; |
|
2429 | + $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/".$objp->quantity; |
|
2430 | + $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/".$objp->quantity; |
|
2431 | 2431 | $opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
2432 | 2432 | $outval .= $langs->transnoentities("Units"); |
2433 | 2433 | } |
@@ -2438,12 +2438,12 @@ discard block |
||
2438 | 2438 | $outtva_tx = $objp->tva_tx; |
2439 | 2439 | } |
2440 | 2440 | if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { |
2441 | - $opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
2442 | - $outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
2441 | + $opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
2442 | + $outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
2443 | 2443 | } |
2444 | 2444 | if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { |
2445 | - $opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
2446 | - $outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
2445 | + $opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
2446 | + $outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
2447 | 2447 | } |
2448 | 2448 | |
2449 | 2449 | // Price by customer |
@@ -2452,11 +2452,11 @@ discard block |
||
2452 | 2452 | $found = 1; |
2453 | 2453 | |
2454 | 2454 | if ($objp->custprice_base_type == 'HT') { |
2455 | - $opt .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("HT"); |
|
2456 | - $outval .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
2455 | + $opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("HT"); |
|
2456 | + $outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("HT"); |
|
2457 | 2457 | } else { |
2458 | - $opt .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("TTC"); |
|
2459 | - $outval .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
2458 | + $opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("TTC"); |
|
2459 | + $outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("TTC"); |
|
2460 | 2460 | } |
2461 | 2461 | |
2462 | 2462 | $outprice_ht = price($objp->custprice); |
@@ -2469,11 +2469,11 @@ discard block |
||
2469 | 2469 | // If level no defined or multiprice not found, we used the default price |
2470 | 2470 | if (empty($hidepriceinlabel) && !$found) { |
2471 | 2471 | if ($objp->price_base_type == 'HT') { |
2472 | - $opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("HT"); |
|
2473 | - $outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("HT"); |
|
2472 | + $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("HT"); |
|
2473 | + $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("HT"); |
|
2474 | 2474 | } else { |
2475 | - $opt .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("TTC"); |
|
2476 | - $outval .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("TTC"); |
|
2475 | + $opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("TTC"); |
|
2476 | + $outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("TTC"); |
|
2477 | 2477 | } |
2478 | 2478 | $outprice_ht = price($objp->price); |
2479 | 2479 | $outprice_ttc = price($objp->price_ttc); |
@@ -2482,21 +2482,21 @@ discard block |
||
2482 | 2482 | } |
2483 | 2483 | |
2484 | 2484 | if (!empty(Globals::$conf->stock->enabled) && isset($objp->stock) && $objp->fk_product_type == 0) { |
2485 | - $opt .= ' - ' . $langs->trans("Stock") . ':' . $objp->stock; |
|
2485 | + $opt .= ' - '.$langs->trans("Stock").':'.$objp->stock; |
|
2486 | 2486 | |
2487 | 2487 | if ($objp->stock > 0) { |
2488 | - $outval .= ' - <span class="product_line_stock_ok">' . $langs->transnoentities("Stock") . ':' . $objp->stock . '</span>'; |
|
2488 | + $outval .= ' - <span class="product_line_stock_ok">'.$langs->transnoentities("Stock").':'.$objp->stock.'</span>'; |
|
2489 | 2489 | } elseif ($objp->stock <= 0) { |
2490 | - $outval .= ' - <span class="product_line_stock_too_low">' . $langs->transnoentities("Stock") . ':' . $objp->stock . '</span>'; |
|
2490 | + $outval .= ' - <span class="product_line_stock_too_low">'.$langs->transnoentities("Stock").':'.$objp->stock.'</span>'; |
|
2491 | 2491 | } |
2492 | 2492 | } |
2493 | 2493 | |
2494 | 2494 | if ($outdurationvalue && $outdurationunit) { |
2495 | 2495 | $da = array("h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); |
2496 | 2496 | if (isset($da[$outdurationunit])) { |
2497 | - $key = $da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''); |
|
2498 | - $opt .= ' - ' . $outdurationvalue . ' ' . $langs->trans($key); |
|
2499 | - $outval .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($key); |
|
2497 | + $key = $da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''); |
|
2498 | + $opt .= ' - '.$outdurationvalue.' '.$langs->trans($key); |
|
2499 | + $outval .= ' - '.$outdurationvalue.' '.$langs->transnoentities($key); |
|
2500 | 2500 | } |
2501 | 2501 | } |
2502 | 2502 | |
@@ -2527,7 +2527,7 @@ discard block |
||
2527 | 2527 | $selected_input_value = ''; |
2528 | 2528 | if (!empty(Globals::$conf->use_javascript_ajax) && !empty(Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { |
2529 | 2529 | if ($selected > 0) { |
2530 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
2530 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
2531 | 2531 | $producttmpselect = new Product($this->db); |
2532 | 2532 | $producttmpselect->fetch($selected); |
2533 | 2533 | $selected_input_value = $producttmpselect->ref; |
@@ -2535,9 +2535,9 @@ discard block |
||
2535 | 2535 | } |
2536 | 2536 | |
2537 | 2537 | // mode=2 means suppliers products |
2538 | - $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice; |
|
2539 | - print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
|
2540 | - print ($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" size="20" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '">'; |
|
2538 | + $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; |
|
2539 | + print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
|
2540 | + print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'">'; |
|
2541 | 2541 | } else { |
2542 | 2542 | print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', -1, 0, 0, $alsoproductwithnosupplierprice); |
2543 | 2543 | } |
@@ -2573,17 +2573,17 @@ discard block |
||
2573 | 2573 | $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,"; |
2574 | 2574 | $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,"; |
2575 | 2575 | $sql .= " pfp.supplier_reputation"; |
2576 | - $sql .= " FROM " . MAIN_DB_PREFIX . "product as p"; |
|
2577 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
2576 | + $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; |
|
2577 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
2578 | 2578 | if ($socid) |
2579 | - $sql .= " AND pfp.fk_soc = " . $socid; |
|
2580 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON pfp.fk_soc = s.rowid"; |
|
2581 | - $sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; |
|
2579 | + $sql .= " AND pfp.fk_soc = ".$socid; |
|
2580 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid"; |
|
2581 | + $sql .= " WHERE p.entity IN (".getEntity('product').")"; |
|
2582 | 2582 | $sql .= " AND p.tobuy = 1"; |
2583 | 2583 | if (strval($filtertype) != '') |
2584 | - $sql .= " AND p.fk_product_type=" . $this->db->escape($filtertype); |
|
2584 | + $sql .= " AND p.fk_product_type=".$this->db->escape($filtertype); |
|
2585 | 2585 | if (!empty($filtre)) |
2586 | - $sql .= " " . $filtre; |
|
2586 | + $sql .= " ".$filtre; |
|
2587 | 2587 | // Add criteria on ref/label |
2588 | 2588 | if ($filterkey != '') { |
2589 | 2589 | $sql .= ' AND ('; |
@@ -2596,13 +2596,13 @@ discard block |
||
2596 | 2596 | foreach ($scrit as $crit) { |
2597 | 2597 | if ($i > 0) |
2598 | 2598 | $sql .= " AND "; |
2599 | - $sql .= "(pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
|
2599 | + $sql .= "(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%')"; |
|
2600 | 2600 | $i++; |
2601 | 2601 | } |
2602 | 2602 | if (count($scrit) > 1) |
2603 | 2603 | $sql .= ")"; |
2604 | 2604 | if (!empty(Globals::$conf->barcode->enabled)) |
2605 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
2605 | + $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'"; |
|
2606 | 2606 | $sql .= ')'; |
2607 | 2607 | } |
2608 | 2608 | $sql .= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC"; |
@@ -2610,15 +2610,15 @@ discard block |
||
2610 | 2610 | |
2611 | 2611 | // Build output string |
2612 | 2612 | |
2613 | - dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG); |
|
2613 | + dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG); |
|
2614 | 2614 | $result = $this->db->query($sql); |
2615 | 2615 | if ($result) { |
2616 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
2616 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
2617 | 2617 | |
2618 | 2618 | $num = $this->db->num_rows($result); |
2619 | 2619 | |
2620 | 2620 | //$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax |
2621 | - $out .= '<select class="flat maxwidthonsmartphone" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
2621 | + $out .= '<select class="flat maxwidthonsmartphone" id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
2622 | 2622 | if (!$selected) |
2623 | 2623 | $out .= '<option value="0" selected> </option>'; |
2624 | 2624 | else |
@@ -2628,9 +2628,9 @@ discard block |
||
2628 | 2628 | while ($i < $num) { |
2629 | 2629 | $objp = $this->db->fetch_object($result); |
2630 | 2630 | |
2631 | - $outkey = $objp->idprodfournprice; // id in table of price |
|
2631 | + $outkey = $objp->idprodfournprice; // id in table of price |
|
2632 | 2632 | if (!$outkey && $alsoproductwithnosupplierprice) |
2633 | - $outkey = 'idprod_' . $objp->rowid; // id of product |
|
2633 | + $outkey = 'idprod_'.$objp->rowid; // id of product |
|
2634 | 2634 | |
2635 | 2635 | $outref = $objp->ref; |
2636 | 2636 | $outval = ''; |
@@ -2640,36 +2640,36 @@ discard block |
||
2640 | 2640 | $outdurationvalue = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : ''; |
2641 | 2641 | $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; |
2642 | 2642 | |
2643 | - $opt = '<option value="' . $outkey . '"'; |
|
2643 | + $opt = '<option value="'.$outkey.'"'; |
|
2644 | 2644 | if ($selected && $selected == $objp->idprodfournprice) |
2645 | 2645 | $opt .= ' selected'; |
2646 | 2646 | if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) |
2647 | 2647 | $opt .= ' disabled'; |
2648 | 2648 | if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { |
2649 | - $opt .= ' pbq="' . $objp->idprodfournprice . '" data-pbq="' . $objp->idprodfournprice . '" data-pbqqty="' . $objp->quantity . '" data-pbqpercent="' . $objp->remise_percent . '"'; |
|
2649 | + $opt .= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqpercent="'.$objp->remise_percent.'"'; |
|
2650 | 2650 | } |
2651 | 2651 | $opt .= '>'; |
2652 | 2652 | |
2653 | 2653 | $objRef = $objp->ref; |
2654 | 2654 | if ($filterkey && $filterkey != '') |
2655 | - $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
2655 | + $objRef = preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $objRef, 1); |
|
2656 | 2656 | $objRefFourn = $objp->ref_fourn; |
2657 | 2657 | if ($filterkey && $filterkey != '') |
2658 | - $objRefFourn = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
2658 | + $objRefFourn = preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
2659 | 2659 | $label = $objp->label; |
2660 | 2660 | if ($filterkey && $filterkey != '') |
2661 | - $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1); |
|
2661 | + $label = preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $label, 1); |
|
2662 | 2662 | |
2663 | 2663 | $opt .= $objp->ref; |
2664 | 2664 | if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) |
2665 | - $opt .= ' (' . $objp->ref_fourn . ')'; |
|
2665 | + $opt .= ' ('.$objp->ref_fourn.')'; |
|
2666 | 2666 | $opt .= ' - '; |
2667 | 2667 | $outval .= $objRef; |
2668 | 2668 | if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) |
2669 | - $outval .= ' (' . $objRefFourn . ')'; |
|
2669 | + $outval .= ' ('.$objRefFourn.')'; |
|
2670 | 2670 | $outval .= ' - '; |
2671 | - $opt .= dol_trunc($label, 72) . ' - '; |
|
2672 | - $outval .= dol_trunc($label, 72) . ' - '; |
|
2671 | + $opt .= dol_trunc($label, 72).' - '; |
|
2672 | + $outval .= dol_trunc($label, 72).' - '; |
|
2673 | 2673 | |
2674 | 2674 | if (!empty($objp->idprodfournprice)) { |
2675 | 2675 | $outqty = $objp->quantity; |
@@ -2691,39 +2691,39 @@ discard block |
||
2691 | 2691 | } |
2692 | 2692 | } |
2693 | 2693 | if ($objp->quantity == 1) { |
2694 | - $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/"; |
|
2695 | - $outval .= price($objp->fprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/"; |
|
2694 | + $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/"; |
|
2695 | + $outval .= price($objp->fprice, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/"; |
|
2696 | 2696 | $opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding |
2697 | 2697 | $outval .= $langs->transnoentities("Unit"); |
2698 | 2698 | } else { |
2699 | - $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $objp->quantity; |
|
2700 | - $outval .= price($objp->fprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $objp->quantity; |
|
2701 | - $opt .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
|
2702 | - $outval .= ' ' . $langs->transnoentities("Units"); |
|
2699 | + $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/".$objp->quantity; |
|
2700 | + $outval .= price($objp->fprice, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/".$objp->quantity; |
|
2701 | + $opt .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding |
|
2702 | + $outval .= ' '.$langs->transnoentities("Units"); |
|
2703 | 2703 | } |
2704 | 2704 | |
2705 | 2705 | if ($objp->quantity >= 1) { |
2706 | - $opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
2707 | - $outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding |
|
2706 | + $opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
2707 | + $outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding |
|
2708 | 2708 | } |
2709 | 2709 | if ($objp->remise_percent >= 1) { |
2710 | - $opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
2711 | - $outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; |
|
2710 | + $opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
2711 | + $outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; |
|
2712 | 2712 | } |
2713 | 2713 | if ($objp->duration) { |
2714 | - $opt .= " - " . $objp->duration; |
|
2715 | - $outval .= " - " . $objp->duration; |
|
2714 | + $opt .= " - ".$objp->duration; |
|
2715 | + $outval .= " - ".$objp->duration; |
|
2716 | 2716 | } |
2717 | 2717 | if (!$socid) { |
2718 | - $opt .= " - " . dol_trunc($objp->name, 8); |
|
2719 | - $outval .= " - " . dol_trunc($objp->name, 8); |
|
2718 | + $opt .= " - ".dol_trunc($objp->name, 8); |
|
2719 | + $outval .= " - ".dol_trunc($objp->name, 8); |
|
2720 | 2720 | } |
2721 | 2721 | if ($objp->supplier_reputation) { |
2722 | 2722 | //TODO dictionary |
2723 | 2723 | $reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); |
2724 | 2724 | |
2725 | - $opt .= " - " . $reputations[$objp->supplier_reputation]; |
|
2726 | - $outval .= " - " . $reputations[$objp->supplier_reputation]; |
|
2725 | + $opt .= " - ".$reputations[$objp->supplier_reputation]; |
|
2726 | + $outval .= " - ".$reputations[$objp->supplier_reputation]; |
|
2727 | 2727 | } |
2728 | 2728 | } else { |
2729 | 2729 | if (empty($alsoproductwithnosupplierprice)) { // No supplier price defined for couple product/supplier |
@@ -2757,7 +2757,7 @@ discard block |
||
2757 | 2757 | |
2758 | 2758 | $this->db->free($result); |
2759 | 2759 | |
2760 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
2760 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
2761 | 2761 | $out .= ajax_combobox($htmlname); |
2762 | 2762 | |
2763 | 2763 | if (empty($outputmode)) |
@@ -2788,39 +2788,39 @@ discard block |
||
2788 | 2788 | $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, pfp.fk_soc,"; |
2789 | 2789 | $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,"; |
2790 | 2790 | $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; |
2791 | - $sql .= " FROM " . MAIN_DB_PREFIX . "product as p"; |
|
2792 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
2793 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON pfp.fk_soc = s.rowid"; |
|
2794 | - $sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; |
|
2791 | + $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; |
|
2792 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
|
2793 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid"; |
|
2794 | + $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; |
|
2795 | 2795 | $sql .= " AND p.tobuy = 1"; |
2796 | 2796 | $sql .= " AND s.fournisseur = 1"; |
2797 | - $sql .= " AND p.rowid = " . $productid; |
|
2797 | + $sql .= " AND p.rowid = ".$productid; |
|
2798 | 2798 | $sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; |
2799 | 2799 | |
2800 | - dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG); |
|
2800 | + dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); |
|
2801 | 2801 | $result = $this->db->query($sql); |
2802 | 2802 | |
2803 | 2803 | if ($result) { |
2804 | 2804 | $num = $this->db->num_rows($result); |
2805 | 2805 | |
2806 | - $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
2806 | + $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
|
2807 | 2807 | |
2808 | 2808 | if (!$num) { |
2809 | - $form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; |
|
2809 | + $form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; |
|
2810 | 2810 | } else { |
2811 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php'; |
|
2811 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; |
|
2812 | 2812 | $form .= '<option value="0"> </option>'; |
2813 | 2813 | |
2814 | 2814 | $i = 0; |
2815 | 2815 | while ($i < $num) { |
2816 | 2816 | $objp = $this->db->fetch_object($result); |
2817 | 2817 | |
2818 | - $opt = '<option value="' . $objp->idprodfournprice . '"'; |
|
2818 | + $opt = '<option value="'.$objp->idprodfournprice.'"'; |
|
2819 | 2819 | //if there is only one supplier, preselect it |
2820 | 2820 | if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier)) { |
2821 | 2821 | $opt .= ' selected'; |
2822 | 2822 | } |
2823 | - $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - '; |
|
2823 | + $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - '; |
|
2824 | 2824 | |
2825 | 2825 | if (!empty(Globals::$conf->dynamicprices->enabled) && !empty($objp->fk_supplier_price_expression)) { |
2826 | 2826 | $prod_supplier = new ProductFournisseur($this->db); |
@@ -2839,10 +2839,10 @@ discard block |
||
2839 | 2839 | } |
2840 | 2840 | } |
2841 | 2841 | if ($objp->quantity == 1) { |
2842 | - $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/"; |
|
2842 | + $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/"; |
|
2843 | 2843 | } |
2844 | 2844 | |
2845 | - $opt .= $objp->quantity . ' '; |
|
2845 | + $opt .= $objp->quantity.' '; |
|
2846 | 2846 | |
2847 | 2847 | if ($objp->quantity == 1) { |
2848 | 2848 | $opt .= $langs->trans("Unit"); |
@@ -2851,10 +2851,10 @@ discard block |
||
2851 | 2851 | } |
2852 | 2852 | if ($objp->quantity > 1) { |
2853 | 2853 | $opt .= " - "; |
2854 | - $opt .= price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->trans("Unit"); |
|
2854 | + $opt .= price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/".$langs->trans("Unit"); |
|
2855 | 2855 | } |
2856 | 2856 | if ($objp->duration) |
2857 | - $opt .= " - " . $objp->duration; |
|
2857 | + $opt .= " - ".$objp->duration; |
|
2858 | 2858 | $opt .= "</option>\n"; |
2859 | 2859 | |
2860 | 2860 | $form .= $opt; |
@@ -2886,14 +2886,14 @@ discard block |
||
2886 | 2886 | // phpcs:enable |
2887 | 2887 | // looking for users |
2888 | 2888 | $sql = "SELECT a.rowid, a.label"; |
2889 | - $sql .= " FROM " . MAIN_DB_PREFIX . "societe_address as a"; |
|
2890 | - $sql .= " WHERE a.fk_soc = " . $socid; |
|
2889 | + $sql .= " FROM ".MAIN_DB_PREFIX."societe_address as a"; |
|
2890 | + $sql .= " WHERE a.fk_soc = ".$socid; |
|
2891 | 2891 | $sql .= " ORDER BY a.label ASC"; |
2892 | 2892 | |
2893 | - dol_syslog(get_class($this) . "::select_address", LOG_DEBUG); |
|
2893 | + dol_syslog(get_class($this)."::select_address", LOG_DEBUG); |
|
2894 | 2894 | $resql = $this->db->query($sql); |
2895 | 2895 | if ($resql) { |
2896 | - print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
2896 | + print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
|
2897 | 2897 | if ($showempty) |
2898 | 2898 | print '<option value="0"> </option>'; |
2899 | 2899 | $num = $this->db->num_rows($resql); |
@@ -2903,9 +2903,9 @@ discard block |
||
2903 | 2903 | $obj = $this->db->fetch_object($resql); |
2904 | 2904 | |
2905 | 2905 | if ($selected && $selected == $obj->rowid) { |
2906 | - print '<option value="' . $obj->rowid . '" selected>' . $obj->label . '</option>'; |
|
2906 | + print '<option value="'.$obj->rowid.'" selected>'.$obj->label.'</option>'; |
|
2907 | 2907 | } else { |
2908 | - print '<option value="' . $obj->rowid . '">' . $obj->label . '</option>'; |
|
2908 | + print '<option value="'.$obj->rowid.'">'.$obj->label.'</option>'; |
|
2909 | 2909 | } |
2910 | 2910 | $i++; |
2911 | 2911 | } |
@@ -2930,13 +2930,13 @@ discard block |
||
2930 | 2930 | |
2931 | 2931 | $num = count($this->cache_conditions_paiements); |
2932 | 2932 | if ($num > 0) |
2933 | - return 0; // Cache already loaded |
|
2933 | + return 0; // Cache already loaded |
|
2934 | 2934 | |
2935 | 2935 | dol_syslog(__METHOD__, LOG_DEBUG); |
2936 | 2936 | |
2937 | 2937 | $sql = "SELECT rowid, code, libelle as label"; |
2938 | - $sql .= " FROM " . MAIN_DB_PREFIX . 'c_payment_term'; |
|
2939 | - $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; |
|
2938 | + $sql .= " FROM ".MAIN_DB_PREFIX.'c_payment_term'; |
|
2939 | + $sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; |
|
2940 | 2940 | $sql .= " AND active > 0"; |
2941 | 2941 | $sql .= " ORDER BY sortorder"; |
2942 | 2942 | |
@@ -2948,7 +2948,7 @@ discard block |
||
2948 | 2948 | $obj = $this->db->fetch_object($resql); |
2949 | 2949 | |
2950 | 2950 | // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
2951 | - $label = ($langs->trans("PaymentConditionShort" . $obj->code) != ("PaymentConditionShort" . $obj->code) ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
2951 | + $label = ($langs->trans("PaymentConditionShort".$obj->code) != ("PaymentConditionShort".$obj->code) ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
2952 | 2952 | $this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code; |
2953 | 2953 | $this->cache_conditions_paiements[$obj->rowid]['label'] = $label; |
2954 | 2954 | $i++; |
@@ -2976,14 +2976,14 @@ discard block |
||
2976 | 2976 | |
2977 | 2977 | $num = count($this->cache_availability); |
2978 | 2978 | if ($num > 0) |
2979 | - return 0; // Cache already loaded |
|
2979 | + return 0; // Cache already loaded |
|
2980 | 2980 | |
2981 | 2981 | dol_syslog(__METHOD__, LOG_DEBUG); |
2982 | 2982 | |
2983 | 2983 | $langs->load('propal'); |
2984 | 2984 | |
2985 | 2985 | $sql = "SELECT rowid, code, label"; |
2986 | - $sql .= " FROM " . MAIN_DB_PREFIX . 'c_availability'; |
|
2986 | + $sql .= " FROM ".MAIN_DB_PREFIX.'c_availability'; |
|
2987 | 2987 | $sql .= " WHERE active > 0"; |
2988 | 2988 | |
2989 | 2989 | $resql = $this->db->query($sql); |
@@ -2994,7 +2994,7 @@ discard block |
||
2994 | 2994 | $obj = $this->db->fetch_object($resql); |
2995 | 2995 | |
2996 | 2996 | // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
2997 | - $label = ($langs->trans("AvailabilityType" . $obj->code) != ("AvailabilityType" . $obj->code) ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
2997 | + $label = ($langs->trans("AvailabilityType".$obj->code) != ("AvailabilityType".$obj->code) ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
2998 | 2998 | $this->cache_availability[$obj->rowid]['code'] = $obj->code; |
2999 | 2999 | $this->cache_availability[$obj->rowid]['label'] = $label; |
3000 | 3000 | $i++; |
@@ -3024,16 +3024,16 @@ discard block |
||
3024 | 3024 | |
3025 | 3025 | $this->load_cache_availability(); |
3026 | 3026 | |
3027 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
3027 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
|
3028 | 3028 | |
3029 | - print '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
|
3029 | + print '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">'; |
|
3030 | 3030 | if ($addempty) |
3031 | 3031 | print '<option value="0"> </option>'; |
3032 | 3032 | foreach ($this->cache_availability as $id => $arrayavailability) { |
3033 | 3033 | if ($selected == $id) { |
3034 | - print '<option value="' . $id . '" selected>'; |
|
3034 | + print '<option value="'.$id.'" selected>'; |
|
3035 | 3035 | } else { |
3036 | - print '<option value="' . $id . '">'; |
|
3036 | + print '<option value="'.$id.'">'; |
|
3037 | 3037 | } |
3038 | 3038 | print $arrayavailability['label']; |
3039 | 3039 | print '</option>'; |
@@ -3054,10 +3054,10 @@ discard block |
||
3054 | 3054 | |
3055 | 3055 | $num = count($this->cache_demand_reason); |
3056 | 3056 | if ($num > 0) |
3057 | - return 0; // Cache already loaded |
|
3057 | + return 0; // Cache already loaded |
|
3058 | 3058 | |
3059 | 3059 | $sql = "SELECT rowid, code, label"; |
3060 | - $sql .= " FROM " . MAIN_DB_PREFIX . 'c_input_reason'; |
|
3060 | + $sql .= " FROM ".MAIN_DB_PREFIX.'c_input_reason'; |
|
3061 | 3061 | $sql .= " WHERE active > 0"; |
3062 | 3062 | |
3063 | 3063 | $resql = $this->db->query($sql); |
@@ -3070,10 +3070,10 @@ discard block |
||
3070 | 3070 | |
3071 | 3071 | // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
3072 | 3072 | $label = ($obj->label != '-' ? $obj->label : ''); |
3073 | - if ($langs->trans("DemandReasonType" . $obj->code) != ("DemandReasonType" . $obj->code)) |
|
3074 | - $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
3073 | + if ($langs->trans("DemandReasonType".$obj->code) != ("DemandReasonType".$obj->code)) |
|
3074 | + $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
3075 | 3075 | if ($langs->trans($obj->code) != $obj->code) |
3076 | - $label = $langs->trans($obj->code); // So translation key SRC_XXX will work |
|
3076 | + $label = $langs->trans($obj->code); // So translation key SRC_XXX will work |
|
3077 | 3077 | |
3078 | 3078 | $tmparray[$obj->rowid]['id'] = $obj->rowid; |
3079 | 3079 | $tmparray[$obj->rowid]['code'] = $obj->code; |
@@ -3108,17 +3108,17 @@ discard block |
||
3108 | 3108 | |
3109 | 3109 | $this->loadCacheInputReason(); |
3110 | 3110 | |
3111 | - print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
3111 | + print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
|
3112 | 3112 | if ($addempty) |
3113 | - print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; |
|
3113 | + print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>'; |
|
3114 | 3114 | foreach ($this->cache_demand_reason as $id => $arraydemandreason) { |
3115 | 3115 | if ($arraydemandreason['code'] == $exclude) |
3116 | 3116 | continue; |
3117 | 3117 | |
3118 | 3118 | if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { |
3119 | - print '<option value="' . $arraydemandreason['id'] . '" selected>'; |
|
3119 | + print '<option value="'.$arraydemandreason['id'].'" selected>'; |
|
3120 | 3120 | } else { |
3121 | - print '<option value="' . $arraydemandreason['id'] . '">'; |
|
3121 | + print '<option value="'.$arraydemandreason['id'].'">'; |
|
3122 | 3122 | } |
3123 | 3123 | $label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason |
3124 | 3124 | print $langs->trans($label); |
@@ -3142,15 +3142,15 @@ discard block |
||
3142 | 3142 | |
3143 | 3143 | $num = count($this->cache_types_paiements); |
3144 | 3144 | if ($num > 0) |
3145 | - return $num; // Cache already loaded |
|
3145 | + return $num; // Cache already loaded |
|
3146 | 3146 | |
3147 | 3147 | dol_syslog(__METHOD__, LOG_DEBUG); |
3148 | 3148 | |
3149 | 3149 | $this->cache_types_paiements = array(); |
3150 | 3150 | |
3151 | 3151 | $sql = "SELECT id, code, libelle as label, type, active"; |
3152 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_paiement"; |
|
3153 | - $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; |
|
3152 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_paiement"; |
|
3153 | + $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; |
|
3154 | 3154 | //if ($active >= 0) $sql.= " AND active = ".$active; |
3155 | 3155 | |
3156 | 3156 | $resql = $this->db->query($sql); |
@@ -3161,7 +3161,7 @@ discard block |
||
3161 | 3161 | $obj = $this->db->fetch_object($resql); |
3162 | 3162 | |
3163 | 3163 | // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
3164 | - $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != ("PaymentTypeShort" . $obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
3164 | + $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != ("PaymentTypeShort".$obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
3165 | 3165 | $this->cache_types_paiements[$obj->id]['id'] = $obj->id; |
3166 | 3166 | $this->cache_types_paiements[$obj->id]['code'] = $obj->code; |
3167 | 3167 | $this->cache_types_paiements[$obj->id]['label'] = $label; |
@@ -3198,7 +3198,7 @@ discard block |
||
3198 | 3198 | // phpcs:enable |
3199 | 3199 | global $langs, $user, $conf; |
3200 | 3200 | |
3201 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
|
3201 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); |
|
3202 | 3202 | |
3203 | 3203 | $this->load_cache_conditions_paiements(); |
3204 | 3204 | |
@@ -3206,14 +3206,14 @@ discard block |
||
3206 | 3206 | if (empty($selected) && !empty(Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID)) |
3207 | 3207 | $selected = Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID; |
3208 | 3208 | |
3209 | - print '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
3209 | + print '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
|
3210 | 3210 | if ($addempty) |
3211 | 3211 | print '<option value="0"> </option>'; |
3212 | 3212 | foreach ($this->cache_conditions_paiements as $id => $arrayconditions) { |
3213 | 3213 | if ($selected == $id) { |
3214 | - print '<option value="' . $id . '" selected>'; |
|
3214 | + print '<option value="'.$id.'" selected>'; |
|
3215 | 3215 | } else { |
3216 | - print '<option value="' . $id . '">'; |
|
3216 | + print '<option value="'.$id.'">'; |
|
3217 | 3217 | } |
3218 | 3218 | print $arrayconditions['label']; |
3219 | 3219 | print '</option>'; |
@@ -3243,7 +3243,7 @@ discard block |
||
3243 | 3243 | // phpcs:enable |
3244 | 3244 | global $langs, $user; |
3245 | 3245 | |
3246 | - dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG); |
|
3246 | + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); |
|
3247 | 3247 | |
3248 | 3248 | $filterarray = array(); |
3249 | 3249 | if ($filtertype == 'CRDT') |
@@ -3255,7 +3255,7 @@ discard block |
||
3255 | 3255 | |
3256 | 3256 | $this->load_cache_types_paiements(); |
3257 | 3257 | |
3258 | - print '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
3258 | + print '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
|
3259 | 3259 | if ($empty) |
3260 | 3260 | print '<option value=""> </option>'; |
3261 | 3261 | foreach ($this->cache_types_paiements as $id => $arraytypes) { |
@@ -3272,13 +3272,13 @@ discard block |
||
3272 | 3272 | continue; |
3273 | 3273 | |
3274 | 3274 | if ($format == 0) |
3275 | - print '<option value="' . $id . '"'; |
|
3275 | + print '<option value="'.$id.'"'; |
|
3276 | 3276 | elseif ($format == 1) |
3277 | - print '<option value="' . $arraytypes['code'] . '"'; |
|
3277 | + print '<option value="'.$arraytypes['code'].'"'; |
|
3278 | 3278 | elseif ($format == 2) |
3279 | - print '<option value="' . $arraytypes['code'] . '"'; |
|
3279 | + print '<option value="'.$arraytypes['code'].'"'; |
|
3280 | 3280 | elseif ($format == 3) |
3281 | - print '<option value="' . $id . '"'; |
|
3281 | + print '<option value="'.$id.'"'; |
|
3282 | 3282 | // Si selected est text, on compare avec code, sinon avec id |
3283 | 3283 | if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) |
3284 | 3284 | print ' selected'; |
@@ -3314,16 +3314,16 @@ discard block |
||
3314 | 3314 | |
3315 | 3315 | $return = ''; |
3316 | 3316 | |
3317 | - $return .= '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
3317 | + $return .= '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
|
3318 | 3318 | $options = array( |
3319 | 3319 | 'HT' => $langs->trans("HT"), |
3320 | 3320 | 'TTC' => $langs->trans("TTC") |
3321 | 3321 | ); |
3322 | 3322 | foreach ($options as $id => $value) { |
3323 | 3323 | if ($selected == $id) { |
3324 | - $return .= '<option value="' . $id . '" selected>' . $value; |
|
3324 | + $return .= '<option value="'.$id.'" selected>'.$value; |
|
3325 | 3325 | } else { |
3326 | - $return .= '<option value="' . $id . '">' . $value; |
|
3326 | + $return .= '<option value="'.$id.'">'.$value; |
|
3327 | 3327 | } |
3328 | 3328 | $return .= '</option>'; |
3329 | 3329 | } |
@@ -3350,30 +3350,30 @@ discard block |
||
3350 | 3350 | $langs->load("deliveries"); |
3351 | 3351 | |
3352 | 3352 | $sql = "SELECT rowid, code, libelle as label"; |
3353 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_shipment_mode"; |
|
3353 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode"; |
|
3354 | 3354 | $sql .= " WHERE active > 0"; |
3355 | 3355 | if ($filtre) |
3356 | - $sql .= " AND " . $filtre; |
|
3356 | + $sql .= " AND ".$filtre; |
|
3357 | 3357 | $sql .= " ORDER BY libelle ASC"; |
3358 | 3358 | |
3359 | - dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG); |
|
3359 | + dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG); |
|
3360 | 3360 | $result = $this->db->query($sql); |
3361 | 3361 | if ($result) { |
3362 | 3362 | $num = $this->db->num_rows($result); |
3363 | 3363 | $i = 0; |
3364 | 3364 | if ($num) { |
3365 | - print '<select id="select' . $htmlname . '" class="flat selectshippingmethod" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
3365 | + print '<select id="select'.$htmlname.'" class="flat selectshippingmethod" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
|
3366 | 3366 | if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
3367 | 3367 | print '<option value="-1"> </option>'; |
3368 | 3368 | } |
3369 | 3369 | while ($i < $num) { |
3370 | 3370 | $obj = $this->db->fetch_object($result); |
3371 | 3371 | if ($selected == $obj->rowid) { |
3372 | - print '<option value="' . $obj->rowid . '" selected>'; |
|
3372 | + print '<option value="'.$obj->rowid.'" selected>'; |
|
3373 | 3373 | } else { |
3374 | - print '<option value="' . $obj->rowid . '">'; |
|
3374 | + print '<option value="'.$obj->rowid.'">'; |
|
3375 | 3375 | } |
3376 | - print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; |
|
3376 | + print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; |
|
3377 | 3377 | print '</option>'; |
3378 | 3378 | $i++; |
3379 | 3379 | } |
@@ -3404,16 +3404,16 @@ discard block |
||
3404 | 3404 | $langs->load("deliveries"); |
3405 | 3405 | |
3406 | 3406 | if ($htmlname != "none") { |
3407 | - print '<form method="POST" action="' . $page . '">'; |
|
3407 | + print '<form method="POST" action="'.$page.'">'; |
|
3408 | 3408 | print '<input type="hidden" name="action" value="setshippingmethod">'; |
3409 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
3409 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
3410 | 3410 | $this->selectShippingMethod($selected, $htmlname, '', $addempty); |
3411 | - print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
3411 | + print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
3412 | 3412 | print '</form>'; |
3413 | 3413 | } else { |
3414 | 3414 | if ($selected) { |
3415 | 3415 | $code = $langs->getLabelFromKey($db, $selected, 'c_shipment_mode', 'rowid', 'code'); |
3416 | - print $langs->trans("SendingMethod" . strtoupper($code)); |
|
3416 | + print $langs->trans("SendingMethod".strtoupper($code)); |
|
3417 | 3417 | } else { |
3418 | 3418 | print " "; |
3419 | 3419 | } |
@@ -3435,7 +3435,7 @@ discard block |
||
3435 | 3435 | $langs->load('bills'); |
3436 | 3436 | |
3437 | 3437 | $opt = '<option value ="" selected></option>'; |
3438 | - $sql = 'SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_counter>=1'; |
|
3438 | + $sql = 'SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc FROM '.MAIN_DB_PREFIX.'facture WHERE situation_counter>=1'; |
|
3439 | 3439 | $sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; |
3440 | 3440 | $resql = $this->db->query($sql); |
3441 | 3441 | if ($resql && $this->db->num_rows($resql) > 0) { |
@@ -3453,9 +3453,9 @@ discard block |
||
3453 | 3453 | //Not prov? |
3454 | 3454 | if (substr($obj->ref, 1, 4) != 'PROV') { |
3455 | 3455 | if ($selected == $obj->rowid) { |
3456 | - $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>'; |
|
3456 | + $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>'; |
|
3457 | 3457 | } else { |
3458 | - $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>'; |
|
3458 | + $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>'; |
|
3459 | 3459 | } |
3460 | 3460 | } |
3461 | 3461 | } |
@@ -3463,10 +3463,10 @@ discard block |
||
3463 | 3463 | } |
3464 | 3464 | } |
3465 | 3465 | } else { |
3466 | - dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); |
|
3466 | + dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); |
|
3467 | 3467 | } |
3468 | 3468 | if ($opt == '<option value ="" selected></option>') { |
3469 | - $opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; |
|
3469 | + $opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; |
|
3470 | 3470 | } |
3471 | 3471 | return $opt; |
3472 | 3472 | } |
@@ -3485,9 +3485,9 @@ discard block |
||
3485 | 3485 | |
3486 | 3486 | $langs->load('products'); |
3487 | 3487 | |
3488 | - $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
3488 | + $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
3489 | 3489 | |
3490 | - $sql = 'SELECT rowid, label, code from ' . MAIN_DB_PREFIX . 'c_units'; |
|
3490 | + $sql = 'SELECT rowid, label, code from '.MAIN_DB_PREFIX.'c_units'; |
|
3491 | 3491 | $sql .= ' WHERE active > 0'; |
3492 | 3492 | |
3493 | 3493 | $resql = $this->db->query($sql); |
@@ -3497,14 +3497,14 @@ discard block |
||
3497 | 3497 | |
3498 | 3498 | while ($res = $this->db->fetch_object($resql)) { |
3499 | 3499 | $unitLabel = $res->label; |
3500 | - if (!empty($langs->tab_translate['unit' . $res->code])) { // check if Translation is available before |
|
3501 | - $unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; |
|
3500 | + if (!empty($langs->tab_translate['unit'.$res->code])) { // check if Translation is available before |
|
3501 | + $unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; |
|
3502 | 3502 | } |
3503 | 3503 | |
3504 | 3504 | if ($selected == $res->rowid) { |
3505 | - $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>'; |
|
3505 | + $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>'; |
|
3506 | 3506 | } else { |
3507 | - $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>'; |
|
3507 | + $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>'; |
|
3508 | 3508 | } |
3509 | 3509 | } |
3510 | 3510 | $return .= '</select>'; |
@@ -3534,21 +3534,21 @@ discard block |
||
3534 | 3534 | $num = 0; |
3535 | 3535 | |
3536 | 3536 | $sql = "SELECT rowid, label, bank, clos as status, currency_code"; |
3537 | - $sql .= " FROM " . MAIN_DB_PREFIX . "bank_account"; |
|
3538 | - $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; |
|
3537 | + $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; |
|
3538 | + $sql .= " WHERE entity IN (".getEntity('bank_account').")"; |
|
3539 | 3539 | if ($statut != 2) |
3540 | - $sql .= " AND clos = '" . $statut . "'"; |
|
3540 | + $sql .= " AND clos = '".$statut."'"; |
|
3541 | 3541 | if ($filtre) |
3542 | - $sql .= " AND " . $filtre; |
|
3542 | + $sql .= " AND ".$filtre; |
|
3543 | 3543 | $sql .= " ORDER BY label"; |
3544 | 3544 | |
3545 | - dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); |
|
3545 | + dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG); |
|
3546 | 3546 | $result = $this->db->query($sql); |
3547 | 3547 | if ($result) { |
3548 | 3548 | $num = $this->db->num_rows($result); |
3549 | 3549 | $i = 0; |
3550 | 3550 | if ($num) { |
3551 | - print '<select id="select' . $htmlname . '" class="flat selectbankaccount" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>'; |
|
3551 | + print '<select id="select'.$htmlname.'" class="flat selectbankaccount" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
|
3552 | 3552 | if ($useempty == 1 || ($useempty == 2 && $num > 1)) { |
3553 | 3553 | print '<option value="-1"> </option>'; |
3554 | 3554 | } |
@@ -3556,15 +3556,15 @@ discard block |
||
3556 | 3556 | while ($i < $num) { |
3557 | 3557 | $obj = $this->db->fetch_object($result); |
3558 | 3558 | if ($selected == $obj->rowid) { |
3559 | - print '<option value="' . $obj->rowid . '" selected>'; |
|
3559 | + print '<option value="'.$obj->rowid.'" selected>'; |
|
3560 | 3560 | } else { |
3561 | - print '<option value="' . $obj->rowid . '">'; |
|
3561 | + print '<option value="'.$obj->rowid.'">'; |
|
3562 | 3562 | } |
3563 | 3563 | print trim($obj->label); |
3564 | 3564 | if ($showcurrency) |
3565 | - print ' (' . $obj->currency_code . ')'; |
|
3565 | + print ' ('.$obj->currency_code.')'; |
|
3566 | 3566 | if ($statut == 2 && $obj->status == 1) |
3567 | - print ' (' . $langs->trans("Closed") . ')'; |
|
3567 | + print ' ('.$langs->trans("Closed").')'; |
|
3568 | 3568 | print '</option>'; |
3569 | 3569 | $i++; |
3570 | 3570 | } |
@@ -3572,9 +3572,9 @@ discard block |
||
3572 | 3572 | } |
3573 | 3573 | else { |
3574 | 3574 | if ($statut == 0) |
3575 | - print '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; |
|
3575 | + print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; |
|
3576 | 3576 | else |
3577 | - print '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; |
|
3577 | + print '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; |
|
3578 | 3578 | } |
3579 | 3579 | } |
3580 | 3580 | else { |
@@ -3597,19 +3597,19 @@ discard block |
||
3597 | 3597 | { |
3598 | 3598 | global $langs; |
3599 | 3599 | if ($htmlname != "none") { |
3600 | - print '<form method="POST" action="' . $page . '">'; |
|
3600 | + print '<form method="POST" action="'.$page.'">'; |
|
3601 | 3601 | print '<input type="hidden" name="action" value="setbankaccount">'; |
3602 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
3602 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
3603 | 3603 | $nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); |
3604 | 3604 | if ($nbaccountfound > 0) |
3605 | - print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
3605 | + print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
3606 | 3606 | print '</form>'; |
3607 | 3607 | } else { |
3608 | 3608 | |
3609 | 3609 | $langs->load('banks'); |
3610 | 3610 | |
3611 | 3611 | if ($selected) { |
3612 | - require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
3612 | + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
|
3613 | 3613 | $bankstatic = new Account($this->db); |
3614 | 3614 | $result = $bankstatic->fetch($selected); |
3615 | 3615 | if ($result) |
@@ -3639,19 +3639,19 @@ discard block |
||
3639 | 3639 | global $conf, $langs; |
3640 | 3640 | $langs->load("categories"); |
3641 | 3641 | |
3642 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
3642 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
3643 | 3643 | |
3644 | 3644 | // For backward compatibility |
3645 | 3645 | if (is_numeric($type)) { |
3646 | - dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
3646 | + dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
3647 | 3647 | } |
3648 | 3648 | |
3649 | 3649 | if ($type === Categorie::TYPE_BANK_LINE) { |
3650 | 3650 | // TODO Move this into common category feature |
3651 | 3651 | $categids = array(); |
3652 | 3652 | $sql = "SELECT c.label, c.rowid"; |
3653 | - $sql .= " FROM " . MAIN_DB_PREFIX . "bank_categ as c"; |
|
3654 | - $sql .= " WHERE entity = " . Globals::$conf->entity; |
|
3653 | + $sql .= " FROM ".MAIN_DB_PREFIX."bank_categ as c"; |
|
3654 | + $sql .= " WHERE entity = ".Globals::$conf->entity; |
|
3655 | 3655 | $sql .= " ORDER BY c.label"; |
3656 | 3656 | $result = $this->db->query($sql); |
3657 | 3657 | if ($result) { |
@@ -3672,11 +3672,11 @@ discard block |
||
3672 | 3672 | $cate_arbo = $cat->get_full_arbo($type, $excludeafterid); |
3673 | 3673 | } |
3674 | 3674 | |
3675 | - $output = '<select class="flat" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
3675 | + $output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
3676 | 3676 | $outarray = array(); |
3677 | 3677 | if (is_array($cate_arbo)) { |
3678 | 3678 | if (!count($cate_arbo)) |
3679 | - $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; |
|
3679 | + $output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; |
|
3680 | 3680 | else { |
3681 | 3681 | $output .= '<option value="-1"> </option>'; |
3682 | 3682 | foreach ($cate_arbo as $key => $value) { |
@@ -3685,7 +3685,7 @@ discard block |
||
3685 | 3685 | } else { |
3686 | 3686 | $add = ''; |
3687 | 3687 | } |
3688 | - $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '">' . dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle') . '</option>'; |
|
3688 | + $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'">'.dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle').'</option>'; |
|
3689 | 3689 | |
3690 | 3690 | $outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel']; |
3691 | 3691 | } |
@@ -3719,7 +3719,7 @@ discard block |
||
3719 | 3719 | function form_confirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) |
3720 | 3720 | { |
3721 | 3721 | // phpcs:enable |
3722 | - dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
|
3722 | + dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); |
|
3723 | 3723 | print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); |
3724 | 3724 | } |
3725 | 3725 | |
@@ -3767,36 +3767,36 @@ discard block |
||
3767 | 3767 | foreach ($formquestion as $key => $input) { |
3768 | 3768 | if (is_array($input) && !empty($input)) { |
3769 | 3769 | if ($input['type'] == 'hidden') { |
3770 | - $more .= '<input type="hidden" id="' . $input['name'] . '" name="' . $input['name'] . '" value="' . DolUtils::dol_escape_htmltag($input['value']) . '">' . "\n"; |
|
3770 | + $more .= '<input type="hidden" id="'.$input['name'].'" name="'.$input['name'].'" value="'.DolUtils::dol_escape_htmltag($input['value']).'">'."\n"; |
|
3771 | 3771 | } |
3772 | 3772 | } |
3773 | 3773 | } |
3774 | 3774 | |
3775 | 3775 | // Now add questions |
3776 | - $more .= '<table class="paddingtopbottomonly" width="100%">' . "\n"; |
|
3776 | + $more .= '<table class="paddingtopbottomonly" width="100%">'."\n"; |
|
3777 | 3777 | if (!empty($formquestion['text'])) |
3778 | - $more .= '<tr><td colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; |
|
3778 | + $more .= '<tr><td colspan="2">'.$formquestion['text'].'</td></tr>'."\n"; |
|
3779 | 3779 | foreach ($formquestion as $key => $input) { |
3780 | 3780 | if (is_array($input) && !empty($input)) { |
3781 | - $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); |
|
3782 | - $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : ''); |
|
3783 | - $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : ''); |
|
3781 | + $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); |
|
3782 | + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); |
|
3783 | + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); |
|
3784 | 3784 | |
3785 | 3785 | if ($input['type'] == 'text') { |
3786 | - $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td><td align="left"><input type="text" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $size . ' value="' . $input['value'] . '"' . $moreattr . ' /></td></tr>' . "\n"; |
|
3786 | + $more .= '<tr><td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td><td align="left"><input type="text" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n"; |
|
3787 | 3787 | } elseif ($input['type'] == 'password') { |
3788 | - $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td><td align="left"><input type="password" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $size . ' value="' . $input['value'] . '"' . $moreattr . ' /></td></tr>' . "\n"; |
|
3788 | + $more .= '<tr><td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td><td align="left"><input type="password" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n"; |
|
3789 | 3789 | } elseif ($input['type'] == 'select') { |
3790 | - $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>'; |
|
3790 | + $more .= '<tr><td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>'; |
|
3791 | 3791 | if (!empty($input['label'])) |
3792 | - $more .= $input['label'] . '</td><td class="tdtop" align="left">'; |
|
3792 | + $more .= $input['label'].'</td><td class="tdtop" align="left">'; |
|
3793 | 3793 | $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss); |
3794 | - $more .= '</td></tr>' . "\n"; |
|
3794 | + $more .= '</td></tr>'."\n"; |
|
3795 | 3795 | } |
3796 | 3796 | elseif ($input['type'] == 'checkbox') { |
3797 | 3797 | $more .= '<tr>'; |
3798 | - $more .= '<td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . ' </td><td align="left">'; |
|
3799 | - $more .= '<input type="checkbox" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $moreattr; |
|
3798 | + $more .= '<td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>'.$input['label'].' </td><td align="left">'; |
|
3799 | + $more .= '<input type="checkbox" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$moreattr; |
|
3800 | 3800 | if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0') |
3801 | 3801 | $more .= ' checked'; |
3802 | 3802 | if (is_bool($input['value']) && $input['value']) |
@@ -3804,51 +3804,51 @@ discard block |
||
3804 | 3804 | if (isset($input['disabled'])) |
3805 | 3805 | $more .= ' disabled'; |
3806 | 3806 | $more .= ' /></td>'; |
3807 | - $more .= '</tr>' . "\n"; |
|
3807 | + $more .= '</tr>'."\n"; |
|
3808 | 3808 | } |
3809 | 3809 | elseif ($input['type'] == 'radio') { |
3810 | 3810 | $i = 0; |
3811 | 3811 | foreach ($input['values'] as $selkey => $selval) { |
3812 | 3812 | $more .= '<tr>'; |
3813 | 3813 | if ($i == 0) |
3814 | - $more .= '<td' . (empty($input['tdclass']) ? ' class="tdtop"' : (' class="tdtop ' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td>'; |
|
3814 | + $more .= '<td'.(empty($input['tdclass']) ? ' class="tdtop"' : (' class="tdtop '.$input['tdclass'].'"')).'>'.$input['label'].'</td>'; |
|
3815 | 3815 | else |
3816 | - $more .= '<td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '> </td>'; |
|
3817 | - $more .= '<td><input type="radio" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '" value="' . $selkey . '"' . $moreattr; |
|
3816 | + $more .= '<td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'> </td>'; |
|
3817 | + $more .= '<td><input type="radio" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"'.$moreattr; |
|
3818 | 3818 | if ($input['disabled']) |
3819 | 3819 | $more .= ' disabled'; |
3820 | 3820 | $more .= ' /> '; |
3821 | 3821 | $more .= $selval; |
3822 | - $more .= '</td></tr>' . "\n"; |
|
3822 | + $more .= '</td></tr>'."\n"; |
|
3823 | 3823 | $i++; |
3824 | 3824 | } |
3825 | 3825 | } |
3826 | 3826 | elseif ($input['type'] == 'date') { |
3827 | - $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td>'; |
|
3827 | + $more .= '<tr><td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td>'; |
|
3828 | 3828 | $more .= '<td align="left">'; |
3829 | 3829 | $more .= $this->selectDate($input['value'], $input['name'], 0, 0, 0, '', 1, 0); |
3830 | - $more .= '</td></tr>' . "\n"; |
|
3831 | - $formquestion[] = array('name' => $input['name'] . 'day'); |
|
3832 | - $formquestion[] = array('name' => $input['name'] . 'month'); |
|
3833 | - $formquestion[] = array('name' => $input['name'] . 'year'); |
|
3834 | - $formquestion[] = array('name' => $input['name'] . 'hour'); |
|
3835 | - $formquestion[] = array('name' => $input['name'] . 'min'); |
|
3830 | + $more .= '</td></tr>'."\n"; |
|
3831 | + $formquestion[] = array('name' => $input['name'].'day'); |
|
3832 | + $formquestion[] = array('name' => $input['name'].'month'); |
|
3833 | + $formquestion[] = array('name' => $input['name'].'year'); |
|
3834 | + $formquestion[] = array('name' => $input['name'].'hour'); |
|
3835 | + $formquestion[] = array('name' => $input['name'].'min'); |
|
3836 | 3836 | } elseif ($input['type'] == 'other') { |
3837 | - $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>'; |
|
3837 | + $more .= '<tr><td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>'; |
|
3838 | 3838 | if (!empty($input['label'])) |
3839 | - $more .= $input['label'] . '</td><td align="left">'; |
|
3839 | + $more .= $input['label'].'</td><td align="left">'; |
|
3840 | 3840 | $more .= $input['value']; |
3841 | - $more .= '</td></tr>' . "\n"; |
|
3841 | + $more .= '</td></tr>'."\n"; |
|
3842 | 3842 | } |
3843 | 3843 | |
3844 | 3844 | elseif ($input['type'] == 'onecolumn') { |
3845 | 3845 | $more .= '<tr><td colspan="2" align="left">'; |
3846 | 3846 | $more .= $input['value']; |
3847 | - $more .= '</td></tr>' . "\n"; |
|
3847 | + $more .= '</td></tr>'."\n"; |
|
3848 | 3848 | } |
3849 | 3849 | } |
3850 | 3850 | } |
3851 | - $more .= '</table>' . "\n"; |
|
3851 | + $more .= '</table>'."\n"; |
|
3852 | 3852 | } |
3853 | 3853 | |
3854 | 3854 | // JQUI method dialog is broken with jmobile, we use standard HTML. |
@@ -3867,10 +3867,10 @@ discard block |
||
3867 | 3867 | $button = $useajax; |
3868 | 3868 | $useajax = 1; |
3869 | 3869 | $autoOpen = false; |
3870 | - $dialogconfirm .= '-' . $button; |
|
3870 | + $dialogconfirm .= '-'.$button; |
|
3871 | 3871 | } |
3872 | - $pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . $action . '&confirm=yes'; |
|
3873 | - $pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'confirm=no' : ''); |
|
3872 | + $pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.$action.'&confirm=yes'; |
|
3873 | + $pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'confirm=no' : ''); |
|
3874 | 3874 | // Add input fields into list of fields to read during submit (inputok and inputko) |
3875 | 3875 | if (is_array($formquestion)) { |
3876 | 3876 | foreach ($formquestion as $key => $input) { |
@@ -3882,20 +3882,20 @@ discard block |
||
3882 | 3882 | } |
3883 | 3883 | } |
3884 | 3884 | // Show JQuery confirm box. Note that global var $useglobalvars is used inside this template |
3885 | - $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . DolUtils::dol_escape_htmltag($title) . '" style="display: none;">'; |
|
3885 | + $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.DolUtils::dol_escape_htmltag($title).'" style="display: none;">'; |
|
3886 | 3886 | if (!empty($more)) { |
3887 | - $formconfirm .= '<div class="confirmquestions">' . $more . '</div>'; |
|
3887 | + $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'; |
|
3888 | 3888 | } |
3889 | - $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help('', '') . ' ' . $question . '</div>' : ''); |
|
3890 | - $formconfirm .= '</div>' . "\n"; |
|
3889 | + $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help('', '').' '.$question.'</div>' : ''); |
|
3890 | + $formconfirm .= '</div>'."\n"; |
|
3891 | 3891 | |
3892 | - $formconfirm .= "\n<!-- begin ajax formconfirm page=" . $page . " -->\n"; |
|
3893 | - $formconfirm .= '<script type="text/javascript">' . "\n"; |
|
3892 | + $formconfirm .= "\n<!-- begin ajax formconfirm page=".$page." -->\n"; |
|
3893 | + $formconfirm .= '<script type="text/javascript">'."\n"; |
|
3894 | 3894 | $formconfirm .= 'jQuery(document).ready(function() { |
3895 | 3895 | $(function() { |
3896 | - $( "#' . $dialogconfirm . '" ).dialog( |
|
3896 | + $( "#' . $dialogconfirm.'" ).dialog( |
|
3897 | 3897 | { |
3898 | - autoOpen: ' . ($autoOpen ? "true" : "false") . ','; |
|
3898 | + autoOpen: ' . ($autoOpen ? "true" : "false").','; |
|
3899 | 3899 | if ($newselectedchoice == 'no') { |
3900 | 3900 | $formconfirm .= ' |
3901 | 3901 | open: function() { |
@@ -3904,15 +3904,15 @@ discard block |
||
3904 | 3904 | } |
3905 | 3905 | $formconfirm .= ' |
3906 | 3906 | resizable: false, |
3907 | - height: "' . $height . '", |
|
3908 | - width: "' . $width . '", |
|
3907 | + height: "' . $height.'", |
|
3908 | + width: "' . $width.'", |
|
3909 | 3909 | modal: true, |
3910 | 3910 | closeOnEscape: false, |
3911 | 3911 | buttons: { |
3912 | - "' . dol_escape_js($langs->transnoentities("Yes")) . '": function() { |
|
3912 | + "' . dol_escape_js($langs->transnoentities("Yes")).'": function() { |
|
3913 | 3913 | var options=""; |
3914 | - var inputok = ' . json_encode($inputok) . '; |
|
3915 | - var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '"; |
|
3914 | + var inputok = ' . json_encode($inputok).'; |
|
3915 | + var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; |
|
3916 | 3916 | if (inputok.length>0) { |
3917 | 3917 | $.each(inputok, function(i, inputname) { |
3918 | 3918 | var more = ""; |
@@ -3928,10 +3928,10 @@ discard block |
||
3928 | 3928 | if (pageyes.length > 0) { location.href = urljump; } |
3929 | 3929 | $(this).dialog("close"); |
3930 | 3930 | }, |
3931 | - "' . dol_escape_js($langs->transnoentities("No")) . '": function() { |
|
3931 | + "' . dol_escape_js($langs->transnoentities("No")).'": function() { |
|
3932 | 3932 | var options = ""; |
3933 | - var inputko = ' . json_encode($inputko) . '; |
|
3934 | - var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '"; |
|
3933 | + var inputko = ' . json_encode($inputko).'; |
|
3934 | + var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'"; |
|
3935 | 3935 | if (inputko.length>0) { |
3936 | 3936 | $.each(inputko, function(i, inputname) { |
3937 | 3937 | var more = ""; |
@@ -3950,10 +3950,10 @@ discard block |
||
3950 | 3950 | } |
3951 | 3951 | ); |
3952 | 3952 | |
3953 | - var button = "' . $button . '"; |
|
3953 | + var button = "' . $button.'"; |
|
3954 | 3954 | if (button.length > 0) { |
3955 | 3955 | $( "#" + button ).click(function() { |
3956 | - $("#' . $dialogconfirm . '").dialog("open"); |
|
3956 | + $("#' . $dialogconfirm.'").dialog("open"); |
|
3957 | 3957 | }); |
3958 | 3958 | } |
3959 | 3959 | }); |
@@ -3961,37 +3961,37 @@ discard block |
||
3961 | 3961 | </script>'; |
3962 | 3962 | $formconfirm .= "<!-- end ajax formconfirm -->\n"; |
3963 | 3963 | } else { |
3964 | - $formconfirm .= "\n<!-- begin formconfirm page=" . $page . " -->\n"; |
|
3964 | + $formconfirm .= "\n<!-- begin formconfirm page=".$page." -->\n"; |
|
3965 | 3965 | |
3966 | 3966 | if (empty($disableformtag)) |
3967 | - $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n"; |
|
3967 | + $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n"; |
|
3968 | 3968 | |
3969 | - $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
|
3969 | + $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n"; |
|
3970 | 3970 | if (empty($disableformtag)) |
3971 | - $formconfirm .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n"; |
|
3971 | + $formconfirm .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n"; |
|
3972 | 3972 | |
3973 | - $formconfirm .= '<table width="100%" class="valid">' . "\n"; |
|
3973 | + $formconfirm .= '<table width="100%" class="valid">'."\n"; |
|
3974 | 3974 | |
3975 | 3975 | // Line title |
3976 | - $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="3">' . img_picto('', 'recent') . ' ' . $title . '</td></tr>' . "\n"; |
|
3976 | + $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('', 'recent').' '.$title.'</td></tr>'."\n"; |
|
3977 | 3977 | |
3978 | 3978 | // Line form fields |
3979 | 3979 | if ($more) { |
3980 | - $formconfirm .= '<tr class="valid"><td class="valid" colspan="3">' . "\n"; |
|
3980 | + $formconfirm .= '<tr class="valid"><td class="valid" colspan="3">'."\n"; |
|
3981 | 3981 | $formconfirm .= $more; |
3982 | - $formconfirm .= '</td></tr>' . "\n"; |
|
3982 | + $formconfirm .= '</td></tr>'."\n"; |
|
3983 | 3983 | } |
3984 | 3984 | |
3985 | 3985 | // Line with question |
3986 | 3986 | $formconfirm .= '<tr class="valid">'; |
3987 | - $formconfirm .= '<td class="valid">' . $question . '</td>'; |
|
3987 | + $formconfirm .= '<td class="valid">'.$question.'</td>'; |
|
3988 | 3988 | $formconfirm .= '<td class="valid">'; |
3989 | 3989 | $formconfirm .= $this->selectyesno("confirm", $newselectedchoice); |
3990 | 3990 | $formconfirm .= '</td>'; |
3991 | - $formconfirm .= '<td class="valid" align="center"><input class="button valignmiddle" type="submit" value="' . $langs->trans("Validate") . '"></td>'; |
|
3992 | - $formconfirm .= '</tr>' . "\n"; |
|
3991 | + $formconfirm .= '<td class="valid" align="center"><input class="button valignmiddle" type="submit" value="'.$langs->trans("Validate").'"></td>'; |
|
3992 | + $formconfirm .= '</tr>'."\n"; |
|
3993 | 3993 | |
3994 | - $formconfirm .= '</table>' . "\n"; |
|
3994 | + $formconfirm .= '</table>'."\n"; |
|
3995 | 3995 | |
3996 | 3996 | if (empty($disableformtag)) |
3997 | 3997 | $formconfirm .= "</form>\n"; |
@@ -4022,8 +4022,8 @@ discard block |
||
4022 | 4022 | // phpcs:enable |
4023 | 4023 | global $langs; |
4024 | 4024 | |
4025 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; |
|
4026 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
4025 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; |
|
4026 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
4027 | 4027 | |
4028 | 4028 | $out = ''; |
4029 | 4029 | |
@@ -4032,11 +4032,11 @@ discard block |
||
4032 | 4032 | $langs->load("project"); |
4033 | 4033 | if ($htmlname != "none") { |
4034 | 4034 | $out .= "\n"; |
4035 | - $out .= '<form method="post" action="' . $page . '">'; |
|
4035 | + $out .= '<form method="post" action="'.$page.'">'; |
|
4036 | 4036 | $out .= '<input type="hidden" name="action" value="classin">'; |
4037 | - $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4037 | + $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4038 | 4038 | $out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1); |
4039 | - $out .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">'; |
|
4039 | + $out .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; |
|
4040 | 4040 | $out .= '</form>'; |
4041 | 4041 | } else { |
4042 | 4042 | if ($selected) { |
@@ -4071,11 +4071,11 @@ discard block |
||
4071 | 4071 | // phpcs:enable |
4072 | 4072 | global $langs; |
4073 | 4073 | if ($htmlname != "none") { |
4074 | - print '<form method="post" action="' . $page . '">'; |
|
4074 | + print '<form method="post" action="'.$page.'">'; |
|
4075 | 4075 | print '<input type="hidden" name="action" value="setconditions">'; |
4076 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4076 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4077 | 4077 | $this->select_conditions_paiements($selected, $htmlname, -1, $addempty); |
4078 | - print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4078 | + print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
4079 | 4079 | print '</form>'; |
4080 | 4080 | } else { |
4081 | 4081 | if ($selected) { |
@@ -4102,11 +4102,11 @@ discard block |
||
4102 | 4102 | // phpcs:enable |
4103 | 4103 | global $langs; |
4104 | 4104 | if ($htmlname != "none") { |
4105 | - print '<form method="post" action="' . $page . '">'; |
|
4105 | + print '<form method="post" action="'.$page.'">'; |
|
4106 | 4106 | print '<input type="hidden" name="action" value="setavailability">'; |
4107 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4107 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4108 | 4108 | $this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty); |
4109 | - print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">'; |
|
4109 | + print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; |
|
4110 | 4110 | print '</form>'; |
4111 | 4111 | } else { |
4112 | 4112 | if ($selected) { |
@@ -4132,11 +4132,11 @@ discard block |
||
4132 | 4132 | { |
4133 | 4133 | global $langs; |
4134 | 4134 | if ($htmlname != "none") { |
4135 | - print '<form method="post" action="' . $page . '">'; |
|
4135 | + print '<form method="post" action="'.$page.'">'; |
|
4136 | 4136 | print '<input type="hidden" name="action" value="setdemandreason">'; |
4137 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4137 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4138 | 4138 | $this->selectInputReason($selected, $htmlname, -1, $addempty); |
4139 | - print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">'; |
|
4139 | + print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; |
|
4140 | 4140 | print '</form>'; |
4141 | 4141 | } else { |
4142 | 4142 | if ($selected) { |
@@ -4174,14 +4174,14 @@ discard block |
||
4174 | 4174 | $ret = ''; |
4175 | 4175 | |
4176 | 4176 | if ($htmlname != "none") { |
4177 | - $ret .= '<form method="post" action="' . $page . '" name="form' . $htmlname . '">'; |
|
4178 | - $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
|
4179 | - $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4177 | + $ret .= '<form method="post" action="'.$page.'" name="form'.$htmlname.'">'; |
|
4178 | + $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
4179 | + $ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4180 | 4180 | $ret .= '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; |
4181 | 4181 | $ret .= '<tr><td>'; |
4182 | - $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0); |
|
4182 | + $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0); |
|
4183 | 4183 | $ret .= '</td>'; |
4184 | - $ret .= '<td align="left"><input type="submit" class="button" value="' . $langs->trans("Modify") . '"></td>'; |
|
4184 | + $ret .= '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; |
|
4185 | 4185 | $ret .= '</tr></table></form>'; |
4186 | 4186 | } else { |
4187 | 4187 | if ($displayhour) |
@@ -4212,15 +4212,15 @@ discard block |
||
4212 | 4212 | global $langs; |
4213 | 4213 | |
4214 | 4214 | if ($htmlname != "none") { |
4215 | - print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">'; |
|
4216 | - print '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
|
4217 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4215 | + print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">'; |
|
4216 | + print '<input type="hidden" name="action" value="set'.$htmlname.'">'; |
|
4217 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4218 | 4218 | print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); |
4219 | - print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4219 | + print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
4220 | 4220 | print '</form>'; |
4221 | 4221 | } else { |
4222 | 4222 | if ($selected) { |
4223 | - require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
4223 | + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
|
4224 | 4224 | $theuser = new User($this->db); |
4225 | 4225 | $theuser->fetch($selected); |
4226 | 4226 | print $theuser->getNomUrl(1); |
@@ -4246,11 +4246,11 @@ discard block |
||
4246 | 4246 | // phpcs:enable |
4247 | 4247 | global $langs; |
4248 | 4248 | if ($htmlname != "none") { |
4249 | - print '<form method="POST" action="' . $page . '">'; |
|
4249 | + print '<form method="POST" action="'.$page.'">'; |
|
4250 | 4250 | print '<input type="hidden" name="action" value="setmode">'; |
4251 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4251 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4252 | 4252 | $this->select_types_paiements($selected, $htmlname, $filtertype, 0, 0, 0, 0, $active); |
4253 | - print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4253 | + print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
4254 | 4254 | print '</form>'; |
4255 | 4255 | } else { |
4256 | 4256 | if ($selected) { |
@@ -4276,11 +4276,11 @@ discard block |
||
4276 | 4276 | // phpcs:enable |
4277 | 4277 | global $langs; |
4278 | 4278 | if ($htmlname != "none") { |
4279 | - print '<form method="POST" action="' . $page . '">'; |
|
4279 | + print '<form method="POST" action="'.$page.'">'; |
|
4280 | 4280 | print '<input type="hidden" name="action" value="setmulticurrencycode">'; |
4281 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4281 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4282 | 4282 | print $this->selectMultiCurrency($selected, $htmlname, 0); |
4283 | - print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4283 | + print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
4284 | 4284 | print '</form>'; |
4285 | 4285 | } else { |
4286 | 4286 | dol_include_once('/core/lib/company.lib.php'); |
@@ -4304,21 +4304,21 @@ discard block |
||
4304 | 4304 | global $langs, $mysoc, $conf; |
4305 | 4305 | |
4306 | 4306 | if ($htmlname != "none") { |
4307 | - print '<form method="POST" action="' . $page . '">'; |
|
4307 | + print '<form method="POST" action="'.$page.'">'; |
|
4308 | 4308 | print '<input type="hidden" name="action" value="setmulticurrencyrate">'; |
4309 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4310 | - print '<input type="text" name="' . $htmlname . '" value="' . (!empty($rate) ? price($rate) : 1) . '" size="10" /> '; |
|
4309 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4310 | + print '<input type="text" name="'.$htmlname.'" value="'.(!empty($rate) ? price($rate) : 1).'" size="10" /> '; |
|
4311 | 4311 | print '<select name="calculation_mode">'; |
4312 | - print '<option value="1">' . $currency . ' > ' . Globals::$conf->currency . '</option>'; |
|
4313 | - print '<option value="2">' . Globals::$conf->currency . ' > ' . $currency . '</option>'; |
|
4312 | + print '<option value="1">'.$currency.' > '.Globals::$conf->currency.'</option>'; |
|
4313 | + print '<option value="2">'.Globals::$conf->currency.' > '.$currency.'</option>'; |
|
4314 | 4314 | print '</select> '; |
4315 | - print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4315 | + print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
4316 | 4316 | print '</form>'; |
4317 | 4317 | } else { |
4318 | 4318 | if (!empty($rate)) { |
4319 | 4319 | print price($rate, 1, $langs, 1, 0); |
4320 | 4320 | if ($currency && $rate != 1) |
4321 | - print ' (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . Globals::$conf->currency . ')'; |
|
4321 | + print ' ('.price($rate, 1, $langs, 1, 0).' '.$currency.' = 1 '.Globals::$conf->currency.')'; |
|
4322 | 4322 | } |
4323 | 4323 | else { |
4324 | 4324 | print 1; |
@@ -4347,14 +4347,14 @@ discard block |
||
4347 | 4347 | // phpcs:enable |
4348 | 4348 | global $conf, $langs; |
4349 | 4349 | if ($htmlname != "none") { |
4350 | - print '<form method="post" action="' . $page . '">'; |
|
4350 | + print '<form method="post" action="'.$page.'">'; |
|
4351 | 4351 | print '<input type="hidden" name="action" value="setabsolutediscount">'; |
4352 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4352 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4353 | 4353 | print '<div class="inline-block">'; |
4354 | 4354 | if (!empty($discount_type)) { |
4355 | 4355 | if (!empty(Globals::$conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { |
4356 | 4356 | if (!$filter || $filter == "fk_invoice_supplier_source IS NULL") |
4357 | - $translationKey = 'HasAbsoluteDiscountFromSupplier'; // If we want deposit to be substracted to payments only and not to total of final invoice |
|
4357 | + $translationKey = 'HasAbsoluteDiscountFromSupplier'; // If we want deposit to be substracted to payments only and not to total of final invoice |
|
4358 | 4358 | else |
4359 | 4359 | $translationKey = 'HasCreditNoteFromSupplier'; |
4360 | 4360 | } |
@@ -4367,7 +4367,7 @@ discard block |
||
4367 | 4367 | } else { |
4368 | 4368 | if (!empty(Globals::$conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { |
4369 | 4369 | if (!$filter || $filter == "fk_facture_source IS NULL") |
4370 | - $translationKey = 'CompanyHasAbsoluteDiscount'; // If we want deposit to be substracted to payments only and not to total of final invoice |
|
4370 | + $translationKey = 'CompanyHasAbsoluteDiscount'; // If we want deposit to be substracted to payments only and not to total of final invoice |
|
4371 | 4371 | else |
4372 | 4372 | $translationKey = 'CompanyHasCreditNote'; |
4373 | 4373 | } |
@@ -4384,21 +4384,21 @@ discard block |
||
4384 | 4384 | print '</div>'; |
4385 | 4385 | if (empty($hidelist)) { |
4386 | 4386 | print '<div class="inline-block" style="padding-right: 10px">'; |
4387 | - $newfilter = 'discount_type=' . intval($discount_type); |
|
4387 | + $newfilter = 'discount_type='.intval($discount_type); |
|
4388 | 4388 | if (!empty($discount_type)) { |
4389 | 4389 | $newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available |
4390 | 4390 | } else { |
4391 | 4391 | $newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available |
4392 | 4392 | } |
4393 | 4393 | if ($filter) |
4394 | - $newfilter .= ' AND (' . $filter . ')'; |
|
4394 | + $newfilter .= ' AND ('.$filter.')'; |
|
4395 | 4395 | $nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue); |
4396 | 4396 | if ($nbqualifiedlines > 0) { |
4397 | - print ' <input type="submit" class="button" value="' . DolUtils::dol_escape_htmltag($langs->trans("UseLine")) . '"'; |
|
4397 | + print ' <input type="submit" class="button" value="'.DolUtils::dol_escape_htmltag($langs->trans("UseLine")).'"'; |
|
4398 | 4398 | if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") |
4399 | - print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
4399 | + print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
|
4400 | 4400 | if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") |
4401 | - print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
4401 | + print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; |
|
4402 | 4402 | |
4403 | 4403 | print '>'; |
4404 | 4404 | } |
@@ -4435,22 +4435,22 @@ discard block |
||
4435 | 4435 | global $langs, $conf; |
4436 | 4436 | |
4437 | 4437 | if ($htmlname != "none") { |
4438 | - print '<form method="post" action="' . $page . '">'; |
|
4438 | + print '<form method="post" action="'.$page.'">'; |
|
4439 | 4439 | print '<input type="hidden" name="action" value="set_contact">'; |
4440 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4440 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4441 | 4441 | print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; |
4442 | 4442 | print '<tr><td>'; |
4443 | 4443 | $num = $this->select_contacts($societe->id, $selected, $htmlname); |
4444 | 4444 | if ($num == 0) { |
4445 | 4445 | $addcontact = (!empty(Globals::$conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); |
4446 | - print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>'; |
|
4446 | + print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>'; |
|
4447 | 4447 | } |
4448 | 4448 | print '</td>'; |
4449 | - print '<td align="left"><input type="submit" class="button" value="' . $langs->trans("Modify") . '"></td>'; |
|
4449 | + print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; |
|
4450 | 4450 | print '</tr></table></form>'; |
4451 | 4451 | } else { |
4452 | 4452 | if ($selected) { |
4453 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
4453 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
4454 | 4454 | $contact = new Contact($this->db); |
4455 | 4455 | $contact->fetch($selected); |
4456 | 4456 | print $contact->getFullName($langs); |
@@ -4482,15 +4482,15 @@ discard block |
||
4482 | 4482 | |
4483 | 4483 | $out = ''; |
4484 | 4484 | if ($htmlname != "none") { |
4485 | - $out .= '<form method="post" action="' . $page . '">'; |
|
4485 | + $out .= '<form method="post" action="'.$page.'">'; |
|
4486 | 4486 | $out .= '<input type="hidden" name="action" value="set_thirdparty">'; |
4487 | - $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
4487 | + $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
4488 | 4488 | $out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events); |
4489 | - $out .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
4489 | + $out .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
4490 | 4490 | $out .= '</form>'; |
4491 | 4491 | } else { |
4492 | 4492 | if ($selected) { |
4493 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
4493 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
4494 | 4494 | $soc = new Societe($this->db); |
4495 | 4495 | $soc->fetch($selected); |
4496 | 4496 | $out .= $soc->getNomUrl($langs); |
@@ -4536,17 +4536,17 @@ discard block |
||
4536 | 4536 | $out = ''; |
4537 | 4537 | |
4538 | 4538 | if ($selected == 'euro' || $selected == 'euros') |
4539 | - $selected = 'EUR'; // Pour compatibilite |
|
4539 | + $selected = 'EUR'; // Pour compatibilite |
|
4540 | 4540 | |
4541 | - $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
4541 | + $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
4542 | 4542 | foreach ($langs->cache_currencies as $code_iso => $currency) { |
4543 | 4543 | if ($selected && $selected == $code_iso) { |
4544 | - $out .= '<option value="' . $code_iso . '" selected>'; |
|
4544 | + $out .= '<option value="'.$code_iso.'" selected>'; |
|
4545 | 4545 | } else { |
4546 | - $out .= '<option value="' . $code_iso . '">'; |
|
4546 | + $out .= '<option value="'.$code_iso.'">'; |
|
4547 | 4547 | } |
4548 | 4548 | $out .= $currency['label']; |
4549 | - $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; |
|
4549 | + $out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; |
|
4550 | 4550 | $out .= '</option>'; |
4551 | 4551 | } |
4552 | 4552 | $out .= '</select>'; |
@@ -4554,7 +4554,7 @@ discard block |
||
4554 | 4554 | $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
4555 | 4555 | |
4556 | 4556 | // Make select dynamic |
4557 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
4557 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
4558 | 4558 | $out .= ajax_combobox($htmlname); |
4559 | 4559 | |
4560 | 4560 | return $out; |
@@ -4572,12 +4572,12 @@ discard block |
||
4572 | 4572 | { |
4573 | 4573 | global $db, $conf, $langs, $user; |
4574 | 4574 | |
4575 | - $langs->loadCacheCurrencies(''); // Load ->cache_currencies |
|
4575 | + $langs->loadCacheCurrencies(''); // Load ->cache_currencies |
|
4576 | 4576 | |
4577 | 4577 | $TCurrency = array(); |
4578 | 4578 | |
4579 | - $sql = 'SELECT code FROM ' . MAIN_DB_PREFIX . 'multicurrency'; |
|
4580 | - $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; |
|
4579 | + $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency'; |
|
4580 | + $sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; |
|
4581 | 4581 | $resql = $db->query($sql); |
4582 | 4582 | if ($resql) { |
4583 | 4583 | while ($obj = $db->fetch_object($resql)) |
@@ -4585,7 +4585,7 @@ discard block |
||
4585 | 4585 | } |
4586 | 4586 | |
4587 | 4587 | $out = ''; |
4588 | - $out .= '<select class="flat" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
4588 | + $out .= '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
4589 | 4589 | if ($useempty) |
4590 | 4590 | $out .= '<option value=""></option>'; |
4591 | 4591 | // If company current currency not in table, we add it into list. Should always be available. |
@@ -4596,12 +4596,12 @@ discard block |
||
4596 | 4596 | foreach ($langs->cache_currencies as $code_iso => $currency) { |
4597 | 4597 | if (isset($TCurrency[$code_iso])) { |
4598 | 4598 | if (!empty($selected) && $selected == $code_iso) |
4599 | - $out .= '<option value="' . $code_iso . '" selected="selected">'; |
|
4599 | + $out .= '<option value="'.$code_iso.'" selected="selected">'; |
|
4600 | 4600 | else |
4601 | - $out .= '<option value="' . $code_iso . '">'; |
|
4601 | + $out .= '<option value="'.$code_iso.'">'; |
|
4602 | 4602 | |
4603 | 4603 | $out .= $currency['label']; |
4604 | - $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; |
|
4604 | + $out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; |
|
4605 | 4605 | $out .= '</option>'; |
4606 | 4606 | } |
4607 | 4607 | } |
@@ -4609,7 +4609,7 @@ discard block |
||
4609 | 4609 | |
4610 | 4610 | $out .= '</select>'; |
4611 | 4611 | // Make select dynamic |
4612 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
4612 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
4613 | 4613 | $out .= ajax_combobox($htmlname); |
4614 | 4614 | |
4615 | 4615 | return $out; |
@@ -4629,15 +4629,15 @@ discard block |
||
4629 | 4629 | |
4630 | 4630 | $num = count($this->cache_vatrates); |
4631 | 4631 | if ($num > 0) |
4632 | - return $num; // Cache already loaded |
|
4632 | + return $num; // Cache already loaded |
|
4633 | 4633 | |
4634 | 4634 | dol_syslog(__METHOD__, LOG_DEBUG); |
4635 | 4635 | |
4636 | 4636 | $sql = "SELECT DISTINCT t.rowid, t.code, t.taux, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.recuperableonly"; |
4637 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
|
4637 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; |
|
4638 | 4638 | $sql .= " WHERE t.fk_pays = c.rowid"; |
4639 | 4639 | $sql .= " AND t.active > 0"; |
4640 | - $sql .= " AND c.code IN (" . $country_code . ")"; |
|
4640 | + $sql .= " AND c.code IN (".$country_code.")"; |
|
4641 | 4641 | $sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC"; |
4642 | 4642 | |
4643 | 4643 | $resql = $this->db->query($sql); |
@@ -4655,28 +4655,28 @@ discard block |
||
4655 | 4655 | $this->cache_vatrates[$i]['localtax2'] = $obj->localtax2; |
4656 | 4656 | $this->cache_vatrates[$i]['localtax2_type'] = $obj->localtax1_type; |
4657 | 4657 | |
4658 | - $this->cache_vatrates[$i]['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * |
|
4659 | - $this->cache_vatrates[$i]['labelallrates'] = $obj->taux . '/' . ($obj->localtax1 ? $obj->localtax1 : '0') . '/' . ($obj->localtax2 ? $obj->localtax2 : '0') . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
4658 | + $this->cache_vatrates[$i]['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * |
|
4659 | + $this->cache_vatrates[$i]['labelallrates'] = $obj->taux.'/'.($obj->localtax1 ? $obj->localtax1 : '0').'/'.($obj->localtax2 ? $obj->localtax2 : '0').($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
|
4660 | 4660 | $positiverates = ''; |
4661 | 4661 | if ($obj->taux) |
4662 | - $positiverates .= ($positiverates ? '/' : '') . $obj->taux; |
|
4662 | + $positiverates .= ($positiverates ? '/' : '').$obj->taux; |
|
4663 | 4663 | if ($obj->localtax1) |
4664 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; |
|
4664 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax1; |
|
4665 | 4665 | if ($obj->localtax2) |
4666 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; |
|
4666 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax2; |
|
4667 | 4667 | if (empty($positiverates)) |
4668 | 4668 | $positiverates = '0'; |
4669 | - $this->cache_vatrates[$i]['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
|
4669 | + $this->cache_vatrates[$i]['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label |
|
4670 | 4670 | } |
4671 | 4671 | |
4672 | 4672 | return $num; |
4673 | 4673 | } |
4674 | 4674 | else { |
4675 | - $this->error = '<font class="error">' . $langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code) . '</font>'; |
|
4675 | + $this->error = '<font class="error">'.$langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code).'</font>'; |
|
4676 | 4676 | return -1; |
4677 | 4677 | } |
4678 | 4678 | } else { |
4679 | - $this->error = '<font class="error">' . $this->db->error() . '</font>'; |
|
4679 | + $this->error = '<font class="error">'.$this->db->error().'</font>'; |
|
4680 | 4680 | return -2; |
4681 | 4681 | } |
4682 | 4682 | } |
@@ -4725,9 +4725,9 @@ discard block |
||
4725 | 4725 | // Check parameters |
4726 | 4726 | if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { |
4727 | 4727 | if ($societe_vendeuse->id == $mysoc->id) { |
4728 | - $return .= '<font class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</div>'; |
|
4728 | + $return .= '<font class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</div>'; |
|
4729 | 4729 | } else { |
4730 | - $return .= '<font class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</div>'; |
|
4730 | + $return .= '<font class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</div>'; |
|
4731 | 4731 | } |
4732 | 4732 | return $return; |
4733 | 4733 | } |
@@ -4738,32 +4738,32 @@ discard block |
||
4738 | 4738 | // Define list of countries to use to search VAT rates to show |
4739 | 4739 | // First we defined code_country to use to find list |
4740 | 4740 | if (is_object($societe_vendeuse)) { |
4741 | - $code_country = "'" . $societe_vendeuse->country_code . "'"; |
|
4741 | + $code_country = "'".$societe_vendeuse->country_code."'"; |
|
4742 | 4742 | } else { |
4743 | - $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente |
|
4743 | + $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente |
|
4744 | 4744 | } |
4745 | 4745 | if (!empty(Globals::$conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { // If option to have vat for end customer for services is on |
4746 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
4746 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
4747 | 4747 | if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { |
4748 | 4748 | // We also add the buyer |
4749 | 4749 | if (is_numeric($type)) { |
4750 | 4750 | if ($type == 1) { // We know product is a service |
4751 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
4751 | + $code_country .= ",'".$societe_acheteuse->country_code."'"; |
|
4752 | 4752 | } |
4753 | 4753 | } else if (!$idprod) { // We don't know type of product |
4754 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
4754 | + $code_country .= ",'".$societe_acheteuse->country_code."'"; |
|
4755 | 4755 | } else { |
4756 | 4756 | $prodstatic = new Product($this->db); |
4757 | 4757 | $prodstatic->fetch($idprod); |
4758 | 4758 | if ($prodstatic->type == Product::TYPE_SERVICE) { // We know product is a service |
4759 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'"; |
|
4759 | + $code_country .= ",'".$societe_acheteuse->country_code."'"; |
|
4760 | 4760 | } |
4761 | 4761 | } |
4762 | 4762 | } |
4763 | 4763 | } |
4764 | 4764 | |
4765 | 4765 | // Now we get list |
4766 | - $num = $this->load_cache_vatrates($code_country); // If no vat defined, return -1 with message into this->error |
|
4766 | + $num = $this->load_cache_vatrates($code_country); // If no vat defined, return -1 with message into this->error |
|
4767 | 4767 | |
4768 | 4768 | if ($num > 0) { |
4769 | 4769 | // Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '') |
@@ -4796,13 +4796,13 @@ discard block |
||
4796 | 4796 | if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0") { |
4797 | 4797 | // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses |
4798 | 4798 | if (empty(Globals::$conf->global->OVERRIDE_VAT_FOR_EXPENSE_REPORT)) { |
4799 | - $title = ' title="' . $langs->trans('VATIsNotUsed') . '"'; |
|
4799 | + $title = ' title="'.$langs->trans('VATIsNotUsed').'"'; |
|
4800 | 4800 | $disabled = true; |
4801 | 4801 | } |
4802 | 4802 | } |
4803 | 4803 | |
4804 | 4804 | if (!$options_only) { |
4805 | - $return .= '<select class="flat minwidth75imp" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>'; |
|
4805 | + $return .= '<select class="flat minwidth75imp" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>'; |
|
4806 | 4806 | } |
4807 | 4807 | |
4808 | 4808 | $selectedfound = false; |
@@ -4815,11 +4815,11 @@ discard block |
||
4815 | 4815 | $key = $rate['txtva']; |
4816 | 4816 | $key .= $rate['nprtva'] ? '*' : ''; |
4817 | 4817 | if ($mode > 0 && $rate['code']) |
4818 | - $key .= ' (' . $rate['code'] . ')'; |
|
4818 | + $key .= ' ('.$rate['code'].')'; |
|
4819 | 4819 | if ($mode < 0) |
4820 | 4820 | $key = $rate['rowid']; |
4821 | 4821 | |
4822 | - $return .= '<option value="' . $key . '"'; |
|
4822 | + $return .= '<option value="'.$key.'"'; |
|
4823 | 4823 | if (!$selectedfound) { |
4824 | 4824 | if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag |
4825 | 4825 | if ($defaultcode == $rate['code']) { |
@@ -4839,7 +4839,7 @@ discard block |
||
4839 | 4839 | $return .= vatrate($rate['label']); |
4840 | 4840 | } |
4841 | 4841 | //$return.=($rate['code']?' '.$rate['code']:''); |
4842 | - $return .= (empty($rate['code']) && $rate['nprtva']) ? ' *' : ''; // We show the * (old behaviour only if new vat code is not used) |
|
4842 | + $return .= (empty($rate['code']) && $rate['nprtva']) ? ' *' : ''; // We show the * (old behaviour only if new vat code is not used) |
|
4843 | 4843 | |
4844 | 4844 | $return .= '</option>'; |
4845 | 4845 | } |
@@ -4938,7 +4938,7 @@ discard block |
||
4938 | 4938 | $orig_set_time = $set_time; |
4939 | 4939 | |
4940 | 4940 | if ($set_time === '' && $emptydate == 0) { |
4941 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
4941 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
4942 | 4942 | $set_time = dol_now('tzuser') - (getServerTimeZoneInt('now') * 3600); // set_time must be relative to PHP server timezone |
4943 | 4943 | } |
4944 | 4944 | |
@@ -4991,36 +4991,36 @@ discard block |
||
4991 | 4991 | //print "e".$set_time." t ".Globals::$conf->format_date_short; |
4992 | 4992 | if (strval($set_time) != '' && $set_time != -1) { |
4993 | 4993 | //$formated_date=DolUtils::dol_print_date($set_time,Globals::$conf->format_date_short); |
4994 | - $formated_date = DolUtils::dol_print_date($set_time, $langs->trans("FormatDateShortInput")); // FormatDateShortInput for DolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
4994 | + $formated_date = DolUtils::dol_print_date($set_time, $langs->trans("FormatDateShortInput")); // FormatDateShortInput for DolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
4995 | 4995 | } |
4996 | 4996 | |
4997 | 4997 | // Calendrier popup version eldy |
4998 | 4998 | if ($usecalendar == "eldy") { |
4999 | 4999 | // Zone de saisie manuelle de la date |
5000 | - $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidth75" maxlength="11" value="' . $formated_date . '"'; |
|
5000 | + $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidth75" maxlength="11" value="'.$formated_date.'"'; |
|
5001 | 5001 | $retstring .= ($disabled ? ' disabled' : ''); |
5002 | - $retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for DolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
5002 | + $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for DolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
5003 | 5003 | $retstring .= '>'; |
5004 | 5004 | |
5005 | 5005 | // Icone calendrier |
5006 | 5006 | if (!$disabled) { |
5007 | - $retstring .= '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"'; |
|
5008 | - $base = DOL_URL_ROOT . '/core/'; |
|
5009 | - $retstring .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; |
|
5010 | - $retstring .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
5007 | + $retstring .= '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; |
|
5008 | + $base = DOL_URL_ROOT.'/core/'; |
|
5009 | + $retstring .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; |
|
5010 | + $retstring .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; |
|
5011 | 5011 | } else |
5012 | - $retstring .= '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
5012 | + $retstring .= '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
|
5013 | 5013 | |
5014 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
|
5015 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
|
5016 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
5014 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
5015 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
5016 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
|
5017 | 5017 | } |
5018 | 5018 | elseif ($usecalendar == 'jquery') { |
5019 | 5019 | if (!$disabled) { |
5020 | 5020 | // Output javascript for datepicker |
5021 | 5021 | $retstring .= "<script type='text/javascript'>"; |
5022 | - $retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ |
|
5023 | - dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', |
|
5022 | + $retstring .= "$(function(){ $('#".$prefix."').datepicker({ |
|
5023 | + dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', |
|
5024 | 5024 | autoclose: true, |
5025 | 5025 | todayHighlight: true,"; |
5026 | 5026 | if (!empty(Globals::$conf->dol_use_jmobile)) { |
@@ -5043,7 +5043,7 @@ discard block |
||
5043 | 5043 | */ |
5044 | 5044 | $retstring .= " |
5045 | 5045 | showOn: 'button', |
5046 | - buttonImage: '" . DOL_BASE_URI . "/theme/" . Globals::$conf->theme . "/img/object_calendarday.png', |
|
5046 | + buttonImage: '" . DOL_BASE_URI."/theme/".Globals::$conf->theme."/img/object_calendarday.png', |
|
5047 | 5047 | buttonImageOnly: true"; |
5048 | 5048 | } |
5049 | 5049 | $retstring .= " |
@@ -5053,9 +5053,9 @@ discard block |
||
5053 | 5053 | |
5054 | 5054 | // Zone de saisie manuelle de la date |
5055 | 5055 | $retstring .= '<div class="nowrap inline-block">'; |
5056 | - $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidth75" maxlength="11" value="' . $formated_date . '"'; |
|
5056 | + $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidth75" maxlength="11" value="'.$formated_date.'"'; |
|
5057 | 5057 | $retstring .= ($disabled ? ' disabled' : ''); |
5058 | - $retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for DolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
5058 | + $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for DolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript |
|
5059 | 5059 | $retstring .= '>'; |
5060 | 5060 | |
5061 | 5061 | // Icone calendrier |
@@ -5070,13 +5070,13 @@ discard block |
||
5070 | 5070 | $retstring.='});'; |
5071 | 5071 | $retstring.="</script>"; */ |
5072 | 5072 | } else { |
5073 | - $retstring .= '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
5073 | + $retstring .= '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; |
|
5074 | 5074 | } |
5075 | 5075 | |
5076 | 5076 | $retstring .= '</div>'; |
5077 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
|
5078 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
|
5079 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
|
5077 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n"; |
|
5078 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n"; |
|
5079 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; |
|
5080 | 5080 | } else { |
5081 | 5081 | $retstring .= "Bad value of MAIN_POPUP_CALENDAR"; |
5082 | 5082 | } |
@@ -5085,26 +5085,26 @@ discard block |
||
5085 | 5085 | else { |
5086 | 5086 | //$retstring.='<div class="inline-block">'; |
5087 | 5087 | // Day |
5088 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">'; |
|
5088 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">'; |
|
5089 | 5089 | |
5090 | 5090 | if ($emptydate || $set_time == -1) { |
5091 | 5091 | $retstring .= '<option value="0" selected> </option>'; |
5092 | 5092 | } |
5093 | 5093 | |
5094 | 5094 | for ($day = 1; $day <= 31; $day++) { |
5095 | - $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>'; |
|
5095 | + $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>'; |
|
5096 | 5096 | } |
5097 | 5097 | |
5098 | 5098 | $retstring .= "</select>"; |
5099 | 5099 | |
5100 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">'; |
|
5100 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">'; |
|
5101 | 5101 | if ($emptydate || $set_time == -1) { |
5102 | 5102 | $retstring .= '<option value="0" selected> </option>'; |
5103 | 5103 | } |
5104 | 5104 | |
5105 | 5105 | // Month |
5106 | 5106 | for ($month = 1; $month <= 12; $month++) { |
5107 | - $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>'; |
|
5107 | + $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>'; |
|
5108 | 5108 | $retstring .= DolUtils::dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b"); |
5109 | 5109 | $retstring .= "</option>"; |
5110 | 5110 | } |
@@ -5112,12 +5112,12 @@ discard block |
||
5112 | 5112 | |
5113 | 5113 | // Year |
5114 | 5114 | if ($emptydate || $set_time == -1) { |
5115 | - $retstring .= '<input' . ($disabled ? ' disabled' : '') . ' placeholder="' . DolUtils::dol_escape_htmltag($langs->trans("Year")) . '" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">'; |
|
5115 | + $retstring .= '<input'.($disabled ? ' disabled' : '').' placeholder="'.DolUtils::dol_escape_htmltag($langs->trans("Year")).'" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'; |
|
5116 | 5116 | } else { |
5117 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">'; |
|
5117 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">'; |
|
5118 | 5118 | |
5119 | 5119 | for ($year = $syear - 10; $year < $syear + 10; $year++) { |
5120 | - $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>'; |
|
5120 | + $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>'; |
|
5121 | 5121 | } |
5122 | 5122 | $retstring .= "</select>\n"; |
5123 | 5123 | } |
@@ -5130,13 +5130,13 @@ discard block |
||
5130 | 5130 | |
5131 | 5131 | if ($h) { |
5132 | 5132 | // Show hour |
5133 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">'; |
|
5133 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">'; |
|
5134 | 5134 | if ($emptyhours) |
5135 | 5135 | $retstring .= '<option value="-1"> </option>'; |
5136 | 5136 | for ($hour = 0; $hour < 24; $hour++) { |
5137 | 5137 | if (strlen($hour) < 2) |
5138 | - $hour = "0" . $hour; |
|
5139 | - $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour . (empty(Globals::$conf->dol_optimize_smallscreen) ? '' : 'H') . '</option>'; |
|
5138 | + $hour = "0".$hour; |
|
5139 | + $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour.(empty(Globals::$conf->dol_optimize_smallscreen) ? '' : 'H').'</option>'; |
|
5140 | 5140 | } |
5141 | 5141 | $retstring .= '</select>'; |
5142 | 5142 | if ($m && empty(Globals::$conf->dol_optimize_smallscreen)) |
@@ -5145,17 +5145,17 @@ discard block |
||
5145 | 5145 | |
5146 | 5146 | if ($m) { |
5147 | 5147 | // Show minutes |
5148 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">'; |
|
5148 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">'; |
|
5149 | 5149 | if ($emptyhours) |
5150 | 5150 | $retstring .= '<option value="-1"> </option>'; |
5151 | 5151 | for ($min = 0; $min < 60; $min++) { |
5152 | 5152 | if (strlen($min) < 2) |
5153 | - $min = "0" . $min; |
|
5154 | - $retstring .= '<option value="' . $min . '"' . (($min == $smin) ? ' selected' : '') . '>' . $min . (empty(Globals::$conf->dol_optimize_smallscreen) ? '' : '') . '</option>'; |
|
5153 | + $min = "0".$min; |
|
5154 | + $retstring .= '<option value="'.$min.'"'.(($min == $smin) ? ' selected' : '').'>'.$min.(empty(Globals::$conf->dol_optimize_smallscreen) ? '' : '').'</option>'; |
|
5155 | 5155 | } |
5156 | 5156 | $retstring .= '</select>'; |
5157 | 5157 | |
5158 | - $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">'; |
|
5158 | + $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">'; |
|
5159 | 5159 | } |
5160 | 5160 | |
5161 | 5161 | // Add a "Now" link |
@@ -5164,10 +5164,10 @@ discard block |
||
5164 | 5164 | $reset_scripts = ""; |
5165 | 5165 | |
5166 | 5166 | // Generate the date part, depending on the use or not of the javascript calendar |
5167 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . DolUtils::dol_print_date(dol_now(), 'day') . '\');'; |
|
5168 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . DolUtils::dol_print_date(dol_now(), '%d') . '\');'; |
|
5169 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . DolUtils::dol_print_date(dol_now(), '%m') . '\');'; |
|
5170 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . DolUtils::dol_print_date(dol_now(), '%Y') . '\');'; |
|
5167 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.DolUtils::dol_print_date(dol_now(), 'day').'\');'; |
|
5168 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.DolUtils::dol_print_date(dol_now(), '%d').'\');'; |
|
5169 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.DolUtils::dol_print_date(dol_now(), '%m').'\');'; |
|
5170 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.DolUtils::dol_print_date(dol_now(), '%Y').'\');'; |
|
5171 | 5171 | /* if ($usecalendar == "eldy") |
5172 | 5172 | { |
5173 | 5173 | $base=DOL_URL_ROOT.'/core/'; |
@@ -5184,7 +5184,7 @@ discard block |
||
5184 | 5184 | if ($fullday) |
5185 | 5185 | $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
5186 | 5186 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; |
5187 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . DolUtils::dol_print_date(dol_now(), '%H') . '\');'; |
|
5187 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.DolUtils::dol_print_date(dol_now(), '%H').'\');'; |
|
5188 | 5188 | if ($fullday) |
5189 | 5189 | $reset_scripts .= ' } '; |
5190 | 5190 | } |
@@ -5193,13 +5193,13 @@ discard block |
||
5193 | 5193 | if ($fullday) |
5194 | 5194 | $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
5195 | 5195 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; |
5196 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . DolUtils::dol_print_date(dol_now(), '%M') . '\');'; |
|
5196 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.DolUtils::dol_print_date(dol_now(), '%M').'\');'; |
|
5197 | 5197 | if ($fullday) |
5198 | 5198 | $reset_scripts .= ' } '; |
5199 | 5199 | } |
5200 | 5200 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
5201 | 5201 | if ($reset_scripts && empty(Globals::$conf->dol_optimize_smallscreen)) { |
5202 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">'; |
|
5202 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">'; |
|
5203 | 5203 | $retstring .= $langs->trans("Now"); |
5204 | 5204 | $retstring .= '</button> '; |
5205 | 5205 | } |
@@ -5211,15 +5211,15 @@ discard block |
||
5211 | 5211 | $reset_scripts = ""; |
5212 | 5212 | |
5213 | 5213 | // Generate the date part, depending on the use or not of the javascript calendar |
5214 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . DolUtils::dol_print_date(dol_now(), 'day') . '\');'; |
|
5215 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . DolUtils::dol_print_date(dol_now(), '%d') . '\');'; |
|
5216 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . DolUtils::dol_print_date(dol_now(), '%m') . '\');'; |
|
5217 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . DolUtils::dol_print_date(dol_now(), '%Y') . '\');'; |
|
5214 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.DolUtils::dol_print_date(dol_now(), 'day').'\');'; |
|
5215 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.DolUtils::dol_print_date(dol_now(), '%d').'\');'; |
|
5216 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.DolUtils::dol_print_date(dol_now(), '%m').'\');'; |
|
5217 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.DolUtils::dol_print_date(dol_now(), '%Y').'\');'; |
|
5218 | 5218 | // Update the hour part |
5219 | 5219 | if ($h) { |
5220 | 5220 | if ($fullday) |
5221 | 5221 | $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
5222 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . DolUtils::dol_print_date(dol_now(), '%H') . '\');'; |
|
5222 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.DolUtils::dol_print_date(dol_now(), '%H').'\');'; |
|
5223 | 5223 | if ($fullday) |
5224 | 5224 | $reset_scripts .= ' } '; |
5225 | 5225 | } |
@@ -5227,13 +5227,13 @@ discard block |
||
5227 | 5227 | if ($m) { |
5228 | 5228 | if ($fullday) |
5229 | 5229 | $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
5230 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . DolUtils::dol_print_date(dol_now(), '%M') . '\');'; |
|
5230 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.DolUtils::dol_print_date(dol_now(), '%M').'\');'; |
|
5231 | 5231 | if ($fullday) |
5232 | 5232 | $reset_scripts .= ' } '; |
5233 | 5233 | } |
5234 | 5234 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
5235 | 5235 | if ($reset_scripts && empty(Globals::$conf->dol_optimize_smallscreen)) { |
5236 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">'; |
|
5236 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">'; |
|
5237 | 5237 | $retstring .= $langs->trans("DateStartPlusOne"); |
5238 | 5238 | $retstring .= '</button> '; |
5239 | 5239 | } |
@@ -5242,7 +5242,7 @@ discard block |
||
5242 | 5242 | // Add a "Plus one hour" link |
5243 | 5243 | if (Globals::$conf->use_javascript_ajax && $adddateof) { |
5244 | 5244 | $tmparray = dol_getdate($adddateof); |
5245 | - $retstring .= ' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\'' . DolUtils::dol_print_date($adddateof, 'day') . '\');jQuery(\'#reday\').val(\'' . $tmparray['mday'] . '\');jQuery(\'#remonth\').val(\'' . $tmparray['mon'] . '\');jQuery(\'#reyear\').val(\'' . $tmparray['year'] . '\');">' . $langs->trans("DateInvoice") . '</a>'; |
|
5245 | + $retstring .= ' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\''.DolUtils::dol_print_date($adddateof, 'day').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$langs->trans("DateInvoice").'</a>'; |
|
5246 | 5246 | } |
5247 | 5247 | |
5248 | 5248 | return $retstring; |
@@ -5274,29 +5274,29 @@ discard block |
||
5274 | 5274 | |
5275 | 5275 | // Hours |
5276 | 5276 | if ($iSecond != '') { |
5277 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
5277 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
5278 | 5278 | |
5279 | 5279 | $hourSelected = convertSecondToTime($iSecond, 'allhour'); |
5280 | 5280 | $minSelected = convertSecondToTime($iSecond, 'min'); |
5281 | 5281 | } |
5282 | 5282 | |
5283 | 5283 | if ($typehour == 'select') { |
5284 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>'; |
|
5284 | + $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>'; |
|
5285 | 5285 | for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours |
5286 | - $retstring .= '<option value="' . $hour . '"'; |
|
5286 | + $retstring .= '<option value="'.$hour.'"'; |
|
5287 | 5287 | if ($hourSelected == $hour) { |
5288 | 5288 | $retstring .= " selected"; |
5289 | 5289 | } |
5290 | - $retstring .= ">" . $hour . "</option>"; |
|
5290 | + $retstring .= ">".$hour."</option>"; |
|
5291 | 5291 | } |
5292 | 5292 | $retstring .= "</select>"; |
5293 | 5293 | } elseif ($typehour == 'text' || $typehour == 'textselect') { |
5294 | - $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" size="1" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; |
|
5294 | + $retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" size="1" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; |
|
5295 | 5295 | } else |
5296 | 5296 | return 'BadValueForParameterTypeHour'; |
5297 | 5297 | |
5298 | 5298 | if ($typehour != 'text') |
5299 | - $retstring .= ' ' . $langs->trans('HourShort'); |
|
5299 | + $retstring .= ' '.$langs->trans('HourShort'); |
|
5300 | 5300 | else |
5301 | 5301 | $retstring .= '<span class="hideonsmartphone">:</span>'; |
5302 | 5302 | |
@@ -5307,21 +5307,21 @@ discard block |
||
5307 | 5307 | $retstring .= '<span class="hideonsmartphone"> </span>'; |
5308 | 5308 | |
5309 | 5309 | if ($typehour == 'select' || $typehour == 'textselect') { |
5310 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>'; |
|
5310 | + $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>'; |
|
5311 | 5311 | for ($min = 0; $min <= 55; $min = $min + 5) { |
5312 | - $retstring .= '<option value="' . $min . '"'; |
|
5312 | + $retstring .= '<option value="'.$min.'"'; |
|
5313 | 5313 | if ($minSelected == $min) |
5314 | 5314 | $retstring .= ' selected'; |
5315 | - $retstring .= '>' . $min . '</option>'; |
|
5315 | + $retstring .= '>'.$min.'</option>'; |
|
5316 | 5316 | } |
5317 | 5317 | $retstring .= "</select>"; |
5318 | 5318 | } |
5319 | 5319 | elseif ($typehour == 'text') { |
5320 | - $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" size="1" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; |
|
5320 | + $retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" size="1" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; |
|
5321 | 5321 | } |
5322 | 5322 | |
5323 | 5323 | if ($typehour != 'text') |
5324 | - $retstring .= ' ' . $langs->trans('MinuteShort'); |
|
5324 | + $retstring .= ' '.$langs->trans('MinuteShort'); |
|
5325 | 5325 | |
5326 | 5326 | //$retstring.=" "; |
5327 | 5327 | |
@@ -5364,30 +5364,30 @@ discard block |
||
5364 | 5364 | } |
5365 | 5365 | } |
5366 | 5366 | if (!is_object($objecttmp)) { |
5367 | - dol_syslog('Error bad setup of type for field ' . $InfoFieldList, LOG_WARNING); |
|
5368 | - return 'Error bad setup of type for field ' . join(',', $InfoFieldList); |
|
5367 | + dol_syslog('Error bad setup of type for field '.$InfoFieldList, LOG_WARNING); |
|
5368 | + return 'Error bad setup of type for field '.join(',', $InfoFieldList); |
|
5369 | 5369 | } |
5370 | 5370 | |
5371 | 5371 | $prefixforautocompletemode = $objecttmp->element; |
5372 | 5372 | if ($prefixforautocompletemode == 'societe') |
5373 | 5373 | $prefixforautocompletemode = 'company'; |
5374 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
5374 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
5375 | 5375 | |
5376 | - dol_syslog(get_class($this) . "::selectForForms", LOG_DEBUG); |
|
5376 | + dol_syslog(get_class($this)."::selectForForms", LOG_DEBUG); |
|
5377 | 5377 | |
5378 | 5378 | $out = ''; |
5379 | 5379 | if (!empty(Globals::$conf->use_javascript_ajax) && !empty(Globals::$conf->global->$confkeyforautocompletemode) && !$forcecombo) { |
5380 | - $objectdesc = $classname . ':' . $classpath; |
|
5381 | - $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php'; |
|
5380 | + $objectdesc = $classname.':'.$classpath; |
|
5381 | + $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; |
|
5382 | 5382 | //if ($objecttmp->element == 'societe') $urlforajaxcall = DOL_URL_ROOT.'/societe/ajax/company.php'; |
5383 | 5383 | // No immediate load of all database |
5384 | - $urloption = 'htmlname=' . $htmlname . '&outjson=1&objectdesc=' . $objectdesc . ($moreparams ? $moreparams : ''); |
|
5384 | + $urloption = 'htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.($moreparams ? $moreparams : ''); |
|
5385 | 5385 | // Activate the auto complete using ajax call. |
5386 | 5386 | $out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, Globals::$conf->global->$confkeyforautocompletemode, 0, array()); |
5387 | 5387 | $out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>'; |
5388 | 5388 | if ($placeholder) |
5389 | - $placeholder = ' placeholder="' . $placeholder . '"'; |
|
5390 | - $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $preselectedvalue . '"' . $placeholder . ' />'; |
|
5389 | + $placeholder = ' placeholder="'.$placeholder.'"'; |
|
5390 | + $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$preselectedvalue.'"'.$placeholder.' />'; |
|
5391 | 5391 | } |
5392 | 5392 | else { |
5393 | 5393 | // Immediate load of all database |
@@ -5421,14 +5421,14 @@ discard block |
||
5421 | 5421 | $prefixforautocompletemode = $objecttmp->element; |
5422 | 5422 | if ($prefixforautocompletemode == 'societe') |
5423 | 5423 | $prefixforautocompletemode = 'company'; |
5424 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
5424 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
|
5425 | 5425 | |
5426 | 5426 | $fieldstoshow = 't.ref'; |
5427 | 5427 | if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields ( like societe, contact, ...) |
5428 | 5428 | $tmpfieldstoshow = ''; |
5429 | 5429 | foreach ($objecttmp->fields as $key => $val) { |
5430 | 5430 | if ($val['showoncombobox']) |
5431 | - $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; |
|
5431 | + $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; |
|
5432 | 5432 | } |
5433 | 5433 | if ($tmpfieldstoshow) |
5434 | 5434 | $fieldstoshow = $tmpfieldstoshow; |
@@ -5440,36 +5440,36 @@ discard block |
||
5440 | 5440 | $num = 0; |
5441 | 5441 | |
5442 | 5442 | // Search data |
5443 | - $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . MAIN_DB_PREFIX . $objecttmp->table_element . " as t"; |
|
5443 | + $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t"; |
|
5444 | 5444 | if ($objecttmp->ismultientitymanaged == 2) |
5445 | 5445 | if (!$user->rights->societe->client->voir && !$user->societe_id) |
5446 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
5446 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
5447 | 5447 | $sql .= " WHERE 1=1"; |
5448 | 5448 | if (!empty($objecttmp->ismultientitymanaged)) |
5449 | - $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; |
|
5449 | + $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; |
|
5450 | 5450 | if ($objecttmp->ismultientitymanaged == 1 && !empty($user->societe_id)) { |
5451 | 5451 | if ($objecttmp->element == 'societe') |
5452 | - $sql .= " AND t.rowid = " . $user->societe_id; |
|
5452 | + $sql .= " AND t.rowid = ".$user->societe_id; |
|
5453 | 5453 | else |
5454 | - $sql .= " AND t.fk_soc = " . $user->societe_id; |
|
5454 | + $sql .= " AND t.fk_soc = ".$user->societe_id; |
|
5455 | 5455 | } |
5456 | 5456 | if ($searchkey != '') |
5457 | 5457 | $sql .= natural_search(explode(',', $fieldstoshow), $searchkey); |
5458 | 5458 | if ($objecttmp->ismultientitymanaged == 2) |
5459 | 5459 | if (!$user->rights->societe->client->voir && !$user->societe_id) |
5460 | - $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
5460 | + $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
5461 | 5461 | $sql .= $this->db->order($fieldstoshow, "ASC"); |
5462 | 5462 | //$sql.=$this->db->plimit($limit, 0); |
5463 | 5463 | // Build output string |
5464 | 5464 | $resql = $this->db->query($sql); |
5465 | 5465 | if ($resql) { |
5466 | 5466 | if (!$forcecombo) { |
5467 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
5467 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
5468 | 5468 | $out .= ajax_combobox($htmlname, null, Globals::$conf->global->$confkeyforautocompletemode); |
5469 | 5469 | } |
5470 | 5470 | |
5471 | 5471 | // Construct $out and $outarray |
5472 | - $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n"; |
|
5472 | + $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n"; |
|
5473 | 5473 | |
5474 | 5474 | // Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4 |
5475 | 5475 | $textifempty = ' '; |
@@ -5482,7 +5482,7 @@ discard block |
||
5482 | 5482 | $textifempty .= $langs->trans("All"); |
5483 | 5483 | } |
5484 | 5484 | if ($showempty) |
5485 | - $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
5485 | + $out .= '<option value="-1">'.$textifempty.'</option>'."\n"; |
|
5486 | 5486 | |
5487 | 5487 | $num = $this->db->num_rows($resql); |
5488 | 5488 | $i = 0; |
@@ -5493,13 +5493,13 @@ discard block |
||
5493 | 5493 | $tmparray = explode(',', $fieldstoshow); |
5494 | 5494 | foreach ($tmparray as $key => $val) { |
5495 | 5495 | $val = preg_replace('/t\./', '', $val); |
5496 | - $label .= (($label && $obj->$val) ? ' - ' : '') . $obj->$val; |
|
5496 | + $label .= (($label && $obj->$val) ? ' - ' : '').$obj->$val; |
|
5497 | 5497 | } |
5498 | 5498 | if (empty($outputmode)) { |
5499 | 5499 | if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { |
5500 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $label . '</option>'; |
|
5500 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$label.'</option>'; |
|
5501 | 5501 | } else { |
5502 | - $out .= '<option value="' . $obj->rowid . '">' . $label . '</option>'; |
|
5502 | + $out .= '<option value="'.$obj->rowid.'">'.$label.'</option>'; |
|
5503 | 5503 | } |
5504 | 5504 | } else { |
5505 | 5505 | array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); |
@@ -5511,7 +5511,7 @@ discard block |
||
5511 | 5511 | } |
5512 | 5512 | } |
5513 | 5513 | |
5514 | - $out .= '</select>' . "\n"; |
|
5514 | + $out .= '</select>'."\n"; |
|
5515 | 5515 | } |
5516 | 5516 | else { |
5517 | 5517 | DolUtils::dol_print_error($this->db); |
@@ -5567,12 +5567,12 @@ discard block |
||
5567 | 5567 | $tmpplugin = empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) ? (constant('REQUIRE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : 'select2') : Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT; |
5568 | 5568 | |
5569 | 5569 | // Enhance with select2 |
5570 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
5570 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
5571 | 5571 | $out .= ajax_combobox($htmlname); |
5572 | 5572 | } |
5573 | 5573 | |
5574 | - $out .= '<select id="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($disabled ? 'disabled ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . '"'; |
|
5575 | - $out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); |
|
5574 | + $out .= '<select id="'.preg_replace('/^\./', '', $htmlname).'" '.($disabled ? 'disabled ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').'"'; |
|
5575 | + $out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); |
|
5576 | 5576 | $out .= '>'; |
5577 | 5577 | |
5578 | 5578 | if ($show_empty) { |
@@ -5581,7 +5581,7 @@ discard block |
||
5581 | 5581 | $textforempty = ' '; // If we use ajaxcombo, we need here to avoid to have an empty element that is too small. |
5582 | 5582 | if (!is_numeric($show_empty)) |
5583 | 5583 | $textforempty = $show_empty; |
5584 | - $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
|
5584 | + $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.($show_empty < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n"; |
|
5585 | 5585 | } |
5586 | 5586 | |
5587 | 5587 | if (is_array($array)) { |
@@ -5611,9 +5611,9 @@ discard block |
||
5611 | 5611 | |
5612 | 5612 | if ($key_in_label) { |
5613 | 5613 | if (empty($nohtmlescape)) |
5614 | - $selectOptionValue = DolUtils::dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
5614 | + $selectOptionValue = DolUtils::dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
5615 | 5615 | else |
5616 | - $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
5616 | + $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
5617 | 5617 | } |
5618 | 5618 | else { |
5619 | 5619 | if (empty($nohtmlescape)) |
@@ -5624,12 +5624,12 @@ discard block |
||
5624 | 5624 | $selectOptionValue = ' '; |
5625 | 5625 | } |
5626 | 5626 | |
5627 | - $out .= '<option value="' . $key . '"'; |
|
5628 | - $out .= $style . $disabled; |
|
5627 | + $out .= '<option value="'.$key.'"'; |
|
5628 | + $out .= $style.$disabled; |
|
5629 | 5629 | if ($id != '' && $id == $key && !$disabled) |
5630 | - $out .= ' selected'; // To preselect a value |
|
5630 | + $out .= ' selected'; // To preselect a value |
|
5631 | 5631 | if ($nohtmlescape) |
5632 | - $out .= ' data-html="' . DolUtils::dol_escape_htmltag($selectOptionValue) . '"'; |
|
5632 | + $out .= ' data-html="'.DolUtils::dol_escape_htmltag($selectOptionValue).'"'; |
|
5633 | 5633 | $out .= '>'; |
5634 | 5634 | //var_dump($selectOptionValue); |
5635 | 5635 | $out .= $selectOptionValue; |
@@ -5668,19 +5668,19 @@ discard block |
||
5668 | 5668 | if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) |
5669 | 5669 | return ''; |
5670 | 5670 | |
5671 | - $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>'; |
|
5671 | + $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>'; |
|
5672 | 5672 | |
5673 | 5673 | $tmpplugin = 'select2'; |
5674 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
|
5674 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
5675 | 5675 | <script type="text/javascript"> |
5676 | 5676 | $(document).ready(function () { |
5677 | 5677 | |
5678 | - ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . ' |
|
5678 | + ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').' |
|
5679 | 5679 | |
5680 | - $(".' . $htmlname . '").select2({ |
|
5680 | + $(".' . $htmlname.'").select2({ |
|
5681 | 5681 | ajax: { |
5682 | 5682 | dir: "ltr", |
5683 | - url: "' . $url . '", |
|
5683 | + url: "' . $url.'", |
|
5684 | 5684 | dataType: \'json\', |
5685 | 5685 | delay: 250, |
5686 | 5686 | data: function (params) { |
@@ -5707,9 +5707,9 @@ discard block |
||
5707 | 5707 | }, |
5708 | 5708 | language: select2arrayoflanguage, |
5709 | 5709 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
5710 | - placeholder: "' . dol_escape_js($placeholder) . '", |
|
5710 | + placeholder: "' . dol_escape_js($placeholder).'", |
|
5711 | 5711 | escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
5712 | - minimumInputLength: ' . $minimumInputLength . ', |
|
5712 | + minimumInputLength: ' . $minimumInputLength.', |
|
5713 | 5713 | formatResult: function(result, container, query, escapeMarkup) { |
5714 | 5714 | return escapeMarkup(result.text); |
5715 | 5715 | }, |
@@ -5717,10 +5717,10 @@ discard block |
||
5717 | 5717 | |
5718 | 5718 | ' . ($callurlonselect ? ' |
5719 | 5719 | /* Code to execute a GET when we select a value */ |
5720 | - $(".' . $htmlname . '").change(function() { |
|
5721 | - var selected = $(".' . $htmlname . '").val(); |
|
5720 | + $(".' . $htmlname.'").change(function() { |
|
5721 | + var selected = $(".' . $htmlname.'").val(); |
|
5722 | 5722 | console.log("We select in selectArrayAjax the entry "+selected) |
5723 | - $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
5723 | + $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
|
5724 | 5724 | $.each( saveRemoteData, function( key, value ) { |
5725 | 5725 | if (key == selected) |
5726 | 5726 | { |
@@ -5728,7 +5728,7 @@ discard block |
||
5728 | 5728 | location.assign(value.url); |
5729 | 5729 | } |
5730 | 5730 | }); |
5731 | - });' : '' ) . ' |
|
5731 | + });' : '').' |
|
5732 | 5732 | |
5733 | 5733 | }); |
5734 | 5734 | </script>'; |
@@ -5768,7 +5768,7 @@ discard block |
||
5768 | 5768 | if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) |
5769 | 5769 | return ''; |
5770 | 5770 | |
5771 | - $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"><option></option></select>'; |
|
5771 | + $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"><option></option></select>'; |
|
5772 | 5772 | |
5773 | 5773 | $formattedarrayresult = array(); |
5774 | 5774 | |
@@ -5781,20 +5781,20 @@ discard block |
||
5781 | 5781 | } |
5782 | 5782 | |
5783 | 5783 | $tmpplugin = 'select2'; |
5784 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
|
5784 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
5785 | 5785 | <script type="text/javascript"> |
5786 | 5786 | $(document).ready(function () { |
5787 | - var data = ' . json_encode($formattedarrayresult) . '; |
|
5787 | + var data = ' . json_encode($formattedarrayresult).'; |
|
5788 | 5788 | |
5789 | - ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . ' |
|
5789 | + ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').' |
|
5790 | 5790 | |
5791 | - $(".' . $htmlname . '").select2({ |
|
5791 | + $(".' . $htmlname.'").select2({ |
|
5792 | 5792 | data: data, |
5793 | 5793 | language: select2arrayoflanguage, |
5794 | 5794 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */ |
5795 | - placeholder: "' . dol_escape_js($placeholder) . '", |
|
5795 | + placeholder: "' . dol_escape_js($placeholder).'", |
|
5796 | 5796 | escapeMarkup: function (markup) { return markup; }, // let our custom formatter work |
5797 | - minimumInputLength: ' . $minimumInputLength . ', |
|
5797 | + minimumInputLength: ' . $minimumInputLength.', |
|
5798 | 5798 | formatResult: function(result, container, query, escapeMarkup) { |
5799 | 5799 | return escapeMarkup(result.text); |
5800 | 5800 | }, |
@@ -5832,11 +5832,11 @@ discard block |
||
5832 | 5832 | |
5833 | 5833 | ' . ($callurlonselect ? ' |
5834 | 5834 | /* Code to execute a GET when we select a value */ |
5835 | - $(".' . $htmlname . '").change(function() { |
|
5836 | - var selected = $(".' . $htmlname . '").val(); |
|
5835 | + $(".' . $htmlname.'").change(function() { |
|
5836 | + var selected = $(".' . $htmlname.'").val(); |
|
5837 | 5837 | console.log("We select "+selected) |
5838 | 5838 | |
5839 | - $(".' . $htmlname . '").val(""); /* reset visible combo value */ |
|
5839 | + $(".' . $htmlname.'").val(""); /* reset visible combo value */ |
|
5840 | 5840 | $.each( saveRemoteData, function( key, value ) { |
5841 | 5841 | if (key == selected) |
5842 | 5842 | { |
@@ -5844,7 +5844,7 @@ discard block |
||
5844 | 5844 | location.assign(value.url); |
5845 | 5845 | } |
5846 | 5846 | }); |
5847 | - });' : '' ) . ' |
|
5847 | + });' : '').' |
|
5848 | 5848 | |
5849 | 5849 | }); |
5850 | 5850 | </script>'; |
@@ -5884,28 +5884,28 @@ discard block |
||
5884 | 5884 | |
5885 | 5885 | // Add code for jquery to use multiselect |
5886 | 5886 | if (!empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) { |
5887 | - $out .= "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' --> |
|
5887 | + $out .= "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> |
|
5888 | 5888 | <script type="text/javascript">' . "\n"; |
5889 | 5889 | if ($addjscombo == 1) { |
5890 | 5890 | $tmpplugin = empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT; |
5891 | - $out .= 'function formatResult(record) {' . "\n"; |
|
5891 | + $out .= 'function formatResult(record) {'."\n"; |
|
5892 | 5892 | if ($elemtype == 'category') { |
5893 | - $out .= ' //return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png' . '"> <a href="' . DOL_URL_ROOT . '/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\'; |
|
5894 | - return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png' . '"> \'+record.text+\'</span>\';'; |
|
5893 | + $out .= ' //return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\'; |
|
5894 | + return \'<span><img src="' . DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';'; |
|
5895 | 5895 | } else { |
5896 | 5896 | $out .= 'return record.text;'; |
5897 | 5897 | } |
5898 | - $out .= '};' . "\n"; |
|
5899 | - $out .= 'function formatSelection(record) {' . "\n"; |
|
5898 | + $out .= '};'."\n"; |
|
5899 | + $out .= 'function formatSelection(record) {'."\n"; |
|
5900 | 5900 | if ($elemtype == 'category') { |
5901 | - $out .= ' //return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png' . '"> <a href="' . DOL_URL_ROOT . '/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\'; |
|
5902 | - return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png' . '"> \'+record.text+\'</span>\';'; |
|
5901 | + $out .= ' //return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\'; |
|
5902 | + return \'<span><img src="' . DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';'; |
|
5903 | 5903 | } else { |
5904 | 5904 | $out .= 'return record.text;'; |
5905 | 5905 | } |
5906 | - $out .= '};' . "\n"; |
|
5906 | + $out .= '};'."\n"; |
|
5907 | 5907 | $out .= '$(document).ready(function () { |
5908 | - $(\'#' . $htmlname . '\').' . $tmpplugin . '({ |
|
5908 | + $(\'#' . $htmlname.'\').'.$tmpplugin.'({ |
|
5909 | 5909 | dir: \'ltr\', |
5910 | 5910 | // Specify format function for dropdown item |
5911 | 5911 | formatResult: formatResult, |
@@ -5919,13 +5919,13 @@ discard block |
||
5919 | 5919 | // Add other js lib |
5920 | 5920 | // ... |
5921 | 5921 | $out .= '$(document).ready(function () { |
5922 | - $(\'#' . $htmlname . '\').multiSelect({ |
|
5922 | + $(\'#' . $htmlname.'\').multiSelect({ |
|
5923 | 5923 | containerHTML: \'<div class="multi-select-container">\', |
5924 | 5924 | menuHTML: \'<div class="multi-select-menu">\', |
5925 | - buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\', |
|
5925 | + buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\', |
|
5926 | 5926 | menuItemHTML: \'<label class="multi-select-menuitem">\', |
5927 | 5927 | activeClass: \'multi-select-container--open\', |
5928 | - noneText: \'' . $placeholder . '\' |
|
5928 | + noneText: \'' . $placeholder.'\' |
|
5929 | 5929 | }); |
5930 | 5930 | })'; |
5931 | 5931 | } |
@@ -5934,27 +5934,27 @@ discard block |
||
5934 | 5934 | |
5935 | 5935 | // Try also magic suggest |
5936 | 5936 | |
5937 | - $out .= '<select id="' . $htmlname . '" class="multiselect' . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n"; |
|
5937 | + $out .= '<select id="'.$htmlname.'" class="multiselect'.($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', $width) ? $width : $width.'px').'"' : '').'>'."\n"; |
|
5938 | 5938 | if (is_array($array) && !empty($array)) { |
5939 | 5939 | if ($value_as_key) |
5940 | 5940 | $array = array_combine($array, $array); |
5941 | 5941 | |
5942 | 5942 | if (!empty($array)) { |
5943 | 5943 | foreach ($array as $key => $value) { |
5944 | - $out .= '<option value="' . $key . '"'; |
|
5944 | + $out .= '<option value="'.$key.'"'; |
|
5945 | 5945 | if (is_array($selected) && !empty($selected) && in_array($key, $selected) && !empty($key)) { |
5946 | 5946 | $out .= ' selected'; |
5947 | 5947 | } |
5948 | 5948 | $out .= '>'; |
5949 | 5949 | |
5950 | 5950 | $newval = ($translate ? $langs->trans($value) : $value); |
5951 | - $newval = ($key_in_label ? $key . ' - ' . $newval : $newval); |
|
5951 | + $newval = ($key_in_label ? $key.' - '.$newval : $newval); |
|
5952 | 5952 | $out .= dol_htmlentitiesbr($newval); |
5953 | - $out .= '</option>' . "\n"; |
|
5953 | + $out .= '</option>'."\n"; |
|
5954 | 5954 | } |
5955 | 5955 | } |
5956 | 5956 | } |
5957 | - $out .= '</select>' . "\n"; |
|
5957 | + $out .= '</select>'."\n"; |
|
5958 | 5958 | |
5959 | 5959 | return $out; |
5960 | 5960 | } |
@@ -5975,7 +5975,7 @@ discard block |
||
5975 | 5975 | if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) |
5976 | 5976 | return ''; |
5977 | 5977 | |
5978 | - $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; |
|
5978 | + $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; |
|
5979 | 5979 | if (!empty($user->conf->$tmpvar)) { |
5980 | 5980 | $tmparray = explode(',', $user->conf->$tmpvar); |
5981 | 5981 | foreach ($array as $key => $val) { |
@@ -5997,28 +5997,28 @@ discard block |
||
5997 | 5997 | var_dump(array_key_exists('enabled', $val)); |
5998 | 5998 | var_dump(!$val['enabled']); */ |
5999 | 5999 | if (array_key_exists('enabled', $val) && isset($val['enabled']) && !$val['enabled']) { |
6000 | - unset($array[$key]); // We don't want this field |
|
6000 | + unset($array[$key]); // We don't want this field |
|
6001 | 6001 | continue; |
6002 | 6002 | } |
6003 | 6003 | if ($val['label']) { |
6004 | - $lis .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . (empty($val['checked']) ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . DolUtils::dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>'; |
|
6005 | - $listcheckedstring .= (empty($val['checked']) ? '' : $key . ','); |
|
6004 | + $lis .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.(empty($val['checked']) ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.DolUtils::dol_escape_htmltag($langs->trans($val['label'])).'</label></li>'; |
|
6005 | + $listcheckedstring .= (empty($val['checked']) ? '' : $key.','); |
|
6006 | 6006 | } |
6007 | 6007 | } |
6008 | 6008 | |
6009 | - $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' --> |
|
6009 | + $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' --> |
|
6010 | 6010 | |
6011 | 6011 | <dl class="dropdown"> |
6012 | 6012 | <dt> |
6013 | 6013 | <a href="#"> |
6014 | - ' . img_picto('', 'list') . ' |
|
6014 | + ' . img_picto('', 'list').' |
|
6015 | 6015 | </a> |
6016 | - <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '"> |
|
6016 | + <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'"> |
|
6017 | 6017 | </dt> |
6018 | 6018 | <dd class="dropdowndd"> |
6019 | - <div class="multiselectcheckbox' . $htmlname . '"> |
|
6020 | - <ul class="ul' . $htmlname . '"> |
|
6021 | - ' . $lis . ' |
|
6019 | + <div class="multiselectcheckbox' . $htmlname.'"> |
|
6020 | + <ul class="ul' . $htmlname.'"> |
|
6021 | + ' . $lis.' |
|
6022 | 6022 | </ul> |
6023 | 6023 | </div> |
6024 | 6024 | </dd> |
@@ -6026,15 +6026,15 @@ discard block |
||
6026 | 6026 | |
6027 | 6027 | <script type="text/javascript"> |
6028 | 6028 | jQuery(document).ready(function () { |
6029 | - $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { |
|
6029 | + $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { |
|
6030 | 6030 | console.log("A new field was added/removed") |
6031 | 6031 | $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\') |
6032 | 6032 | var title = $(this).val() + ","; |
6033 | 6033 | if ($(this).is(\':checked\')) { |
6034 | - $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val()); |
|
6034 | + $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val()); |
|
6035 | 6035 | } |
6036 | 6036 | else { |
6037 | - $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') ) |
|
6037 | + $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') ) |
|
6038 | 6038 | } |
6039 | 6039 | // Now, we submit page |
6040 | 6040 | $(this).parents(\'form:first\').submit(); |
@@ -6058,7 +6058,7 @@ discard block |
||
6058 | 6058 | { |
6059 | 6059 | global $db; |
6060 | 6060 | |
6061 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
6061 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
6062 | 6062 | |
6063 | 6063 | $cat = new Categorie($db); |
6064 | 6064 | $categories = $cat->containing($id, $type); |
@@ -6066,12 +6066,12 @@ discard block |
||
6066 | 6066 | if ($rendermode == 1) { |
6067 | 6067 | $toprint = array(); |
6068 | 6068 | foreach ($categories as $c) { |
6069 | - $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text |
|
6069 | + $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text |
|
6070 | 6070 | foreach ($ways as $way) { |
6071 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
6071 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
6072 | 6072 | } |
6073 | 6073 | } |
6074 | - return '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
6074 | + return '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
6075 | 6075 | } |
6076 | 6076 | |
6077 | 6077 | if ($rendermode == 0) { |
@@ -6107,7 +6107,7 @@ discard block |
||
6107 | 6107 | 'morehtmlright' => $morehtmlright, |
6108 | 6108 | 'compatibleImportElementsList' => & $compatibleImportElementsList, |
6109 | 6109 | ); |
6110 | - $reshook = $hookmanager->executeHooks('showLinkedObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
6110 | + $reshook = $hookmanager->executeHooks('showLinkedObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
6111 | 6111 | |
6112 | 6112 | if (empty($reshook)) { |
6113 | 6113 | $nbofdifferenttypes = count($object->linkedObjects); |
@@ -6117,15 +6117,15 @@ discard block |
||
6117 | 6117 | |
6118 | 6118 | |
6119 | 6119 | print '<div class="div-table-responsive-no-min">'; |
6120 | - print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >'; |
|
6120 | + print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >'; |
|
6121 | 6121 | |
6122 | 6122 | print '<tr class="liste_titre">'; |
6123 | - print '<td>' . $langs->trans("Type") . '</td>'; |
|
6124 | - print '<td>' . $langs->trans("Ref") . '</td>'; |
|
6123 | + print '<td>'.$langs->trans("Type").'</td>'; |
|
6124 | + print '<td>'.$langs->trans("Ref").'</td>'; |
|
6125 | 6125 | print '<td align="center"></td>'; |
6126 | - print '<td align="center">' . $langs->trans("Date") . '</td>'; |
|
6127 | - print '<td align="right">' . $langs->trans("AmountHTShort") . '</td>'; |
|
6128 | - print '<td align="right">' . $langs->trans("Status") . '</td>'; |
|
6126 | + print '<td align="center">'.$langs->trans("Date").'</td>'; |
|
6127 | + print '<td align="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
6128 | + print '<td align="right">'.$langs->trans("Status").'</td>'; |
|
6129 | 6129 | print '<td></td>'; |
6130 | 6130 | print '</tr>'; |
6131 | 6131 | |
@@ -6143,13 +6143,13 @@ discard block |
||
6143 | 6143 | if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { |
6144 | 6144 | $element = $regs[1]; |
6145 | 6145 | $subelement = $regs[2]; |
6146 | - $tplpath = $element . '/' . $subelement; |
|
6146 | + $tplpath = $element.'/'.$subelement; |
|
6147 | 6147 | } |
6148 | 6148 | $tplname = 'linkedobjectblock'; |
6149 | 6149 | |
6150 | 6150 | // To work with non standard path |
6151 | 6151 | if ($objecttype == 'facture') { |
6152 | - $tplpath = 'compta/' . $element; |
|
6152 | + $tplpath = 'compta/'.$element; |
|
6153 | 6153 | if (empty(Globals::$conf->facture->enabled)) |
6154 | 6154 | continue; // Do not show if module disabled |
6155 | 6155 | } |
@@ -6160,7 +6160,7 @@ discard block |
||
6160 | 6160 | continue; // Do not show if module disabled |
6161 | 6161 | } |
6162 | 6162 | else if ($objecttype == 'propal') { |
6163 | - $tplpath = 'comm/' . $element; |
|
6163 | + $tplpath = 'comm/'.$element; |
|
6164 | 6164 | if (empty(Globals::$conf->propal->enabled)) |
6165 | 6165 | continue; // Do not show if module disabled |
6166 | 6166 | } |
@@ -6198,14 +6198,14 @@ discard block |
||
6198 | 6198 | |
6199 | 6199 | |
6200 | 6200 | // Output template part (modules that overwrite templates must declare this into descriptor) |
6201 | - $dirtpls = array_merge(Globals::$conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); |
|
6201 | + $dirtpls = array_merge(Globals::$conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); |
|
6202 | 6202 | foreach ($dirtpls as $reldir) { |
6203 | 6203 | if ($nboftypesoutput == ($nbofdifferenttypes - 1)) { // No more type to show after |
6204 | 6204 | global $noMoreLinkedObjectBlockAfter; |
6205 | 6205 | $noMoreLinkedObjectBlockAfter = 1; |
6206 | 6206 | } |
6207 | 6207 | |
6208 | - $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php'); |
|
6208 | + $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php'); |
|
6209 | 6209 | if ($res) { |
6210 | 6210 | $nboftypesoutput++; |
6211 | 6211 | break; |
@@ -6214,7 +6214,7 @@ discard block |
||
6214 | 6214 | } |
6215 | 6215 | |
6216 | 6216 | if (!$nboftypesoutput) { |
6217 | - print '<tr><td class="impair opacitymedium" colspan="7">' . $langs->trans("None") . '</td></tr>'; |
|
6217 | + print '<tr><td class="impair opacitymedium" colspan="7">'.$langs->trans("None").'</td></tr>'; |
|
6218 | 6218 | } |
6219 | 6219 | |
6220 | 6220 | print '</table>'; |
@@ -6254,26 +6254,26 @@ discard block |
||
6254 | 6254 | if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { |
6255 | 6255 | $listofidcompanytoscan = $object->thirdparty->id; |
6256 | 6256 | if (($object->thirdparty->parent > 0) && !empty(Globals::$conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) |
6257 | - $listofidcompanytoscan .= ',' . $object->thirdparty->parent; |
|
6257 | + $listofidcompanytoscan .= ','.$object->thirdparty->parent; |
|
6258 | 6258 | if (($object->fk_project > 0) && !empty(Globals::$conf->global->THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO)) { |
6259 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
6259 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
6260 | 6260 | $tmpproject = new Project($this->db); |
6261 | 6261 | $tmpproject->fetch($object->fk_project); |
6262 | 6262 | if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) |
6263 | - $listofidcompanytoscan .= ',' . $tmpproject->socid; |
|
6263 | + $listofidcompanytoscan .= ','.$tmpproject->socid; |
|
6264 | 6264 | unset($tmpproject); |
6265 | 6265 | } |
6266 | 6266 | |
6267 | 6267 | $possiblelinks = array( |
6268 | - 'propal' => array('enabled' => Globals::$conf->propal->enabled, 'perms' => 1, 'label' => 'LinkToProposal', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('propal') . ')'), |
|
6269 | - 'order' => array('enabled' => Globals::$conf->commande->enabled, 'perms' => 1, 'label' => 'LinkToOrder', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('commande') . ')'), |
|
6270 | - 'invoice' => array('enabled' => Globals::$conf->facture->enabled, 'perms' => 1, 'label' => 'LinkToInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total as total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('invoice') . ')'), |
|
6271 | - 'invoice_template' => array('enabled' => Globals::$conf->facture->enabled, 'perms' => 1, 'label' => 'LinkToTemplateInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('invoice') . ')'), |
|
6272 | - 'contrat' => array('enabled' => Globals::$conf->contrat->enabled, 'perms' => 1, 'label' => 'LinkToContract', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('contract') . ')'), |
|
6273 | - 'fichinter' => array('enabled' => Globals::$conf->ficheinter->enabled, 'perms' => 1, 'label' => 'LinkToIntervention', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('intervention') . ')'), |
|
6274 | - 'supplier_proposal' => array('enabled' => Globals::$conf->supplier_proposal->enabled, 'perms' => 1, 'label' => 'LinkToSupplierProposal', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('supplier_proposal') . ')'), |
|
6275 | - 'order_supplier' => array('enabled' => Globals::$conf->supplier_order->enabled, 'perms' => 1, 'label' => 'LinkToSupplierOrder', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('commande_fournisseur') . ')'), |
|
6276 | - 'invoice_supplier' => array('enabled' => Globals::$conf->supplier_invoice->enabled, 'perms' => 1, 'label' => 'LinkToSupplierInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('facture_fourn') . ')') |
|
6268 | + 'propal' => array('enabled' => Globals::$conf->propal->enabled, 'perms' => 1, 'label' => 'LinkToProposal', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'), |
|
6269 | + 'order' => array('enabled' => Globals::$conf->commande->enabled, 'perms' => 1, 'label' => 'LinkToOrder', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'), |
|
6270 | + 'invoice' => array('enabled' => Globals::$conf->facture->enabled, 'perms' => 1, 'label' => 'LinkToInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'), |
|
6271 | + 'invoice_template' => array('enabled' => Globals::$conf->facture->enabled, 'perms' => 1, 'label' => 'LinkToTemplateInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'), |
|
6272 | + 'contrat' => array('enabled' => Globals::$conf->contrat->enabled, 'perms' => 1, 'label' => 'LinkToContract', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'), |
|
6273 | + 'fichinter' => array('enabled' => Globals::$conf->ficheinter->enabled, 'perms' => 1, 'label' => 'LinkToIntervention', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'), |
|
6274 | + 'supplier_proposal' => array('enabled' => Globals::$conf->supplier_proposal->enabled, 'perms' => 1, 'label' => 'LinkToSupplierProposal', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'), |
|
6275 | + 'order_supplier' => array('enabled' => Globals::$conf->supplier_order->enabled, 'perms' => 1, 'label' => 'LinkToSupplierOrder', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'), |
|
6276 | + 'invoice_supplier' => array('enabled' => Globals::$conf->supplier_invoice->enabled, 'perms' => 1, 'label' => 'LinkToSupplierInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn').')') |
|
6277 | 6277 | ); |
6278 | 6278 | } |
6279 | 6279 | |
@@ -6282,7 +6282,7 @@ discard block |
||
6282 | 6282 | // Can complete the possiblelink array |
6283 | 6283 | $hookmanager->initHooks(array('commonobject')); |
6284 | 6284 | $parameters = array('listofidcompanytoscan' => $listofidcompanytoscan); |
6285 | - $reshook = $hookmanager->executeHooks('showLinkToObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
6285 | + $reshook = $hookmanager->executeHooks('showLinkToObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
6286 | 6286 | if (empty($reshook)) { |
6287 | 6287 | if (is_array($hookmanager->resArray) && count($hookmanager->resArray)) { |
6288 | 6288 | $possiblelinks = array_merge($possiblelinks, $hookmanager->resArray); |
@@ -6300,7 +6300,7 @@ discard block |
||
6300 | 6300 | continue; |
6301 | 6301 | |
6302 | 6302 | if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { |
6303 | - print '<div id="' . $key . 'list"' . (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ' style="display:none"' : '') . '>'; |
|
6303 | + print '<div id="'.$key.'list"'.(empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ' style="display:none"' : '').'>'; |
|
6304 | 6304 | $sql = $possiblelink['sql']; |
6305 | 6305 | |
6306 | 6306 | $resqllist = $this->db->query($sql); |
@@ -6308,34 +6308,34 @@ discard block |
||
6308 | 6308 | $num = $this->db->num_rows($resqllist); |
6309 | 6309 | $i = 0; |
6310 | 6310 | |
6311 | - print '<br><form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">'; |
|
6312 | - print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
6311 | + print '<br><form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">'; |
|
6312 | + print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
6313 | 6313 | print '<input type="hidden" name="action" value="addlink">'; |
6314 | - print '<input type="hidden" name="addlink" value="' . $key . '">'; |
|
6314 | + print '<input type="hidden" name="addlink" value="'.$key.'">'; |
|
6315 | 6315 | print '<table class="noborder">'; |
6316 | 6316 | print '<tr class="liste_titre">'; |
6317 | 6317 | print '<td class="nowrap"></td>'; |
6318 | - print '<td align="center">' . $langs->trans("Ref") . '</td>'; |
|
6319 | - print '<td align="left">' . $langs->trans("RefCustomer") . '</td>'; |
|
6320 | - print '<td align="right">' . $langs->trans("AmountHTShort") . '</td>'; |
|
6321 | - print '<td align="left">' . $langs->trans("Company") . '</td>'; |
|
6318 | + print '<td align="center">'.$langs->trans("Ref").'</td>'; |
|
6319 | + print '<td align="left">'.$langs->trans("RefCustomer").'</td>'; |
|
6320 | + print '<td align="right">'.$langs->trans("AmountHTShort").'</td>'; |
|
6321 | + print '<td align="left">'.$langs->trans("Company").'</td>'; |
|
6322 | 6322 | print '</tr>'; |
6323 | 6323 | while ($i < $num) { |
6324 | 6324 | $objp = $this->db->fetch_object($resqllist); |
6325 | 6325 | |
6326 | 6326 | print '<tr class="oddeven">'; |
6327 | 6327 | print '<td aling="left">'; |
6328 | - print '<input type="radio" name="idtolinkto" value=' . $objp->rowid . '>'; |
|
6328 | + print '<input type="radio" name="idtolinkto" value='.$objp->rowid.'>'; |
|
6329 | 6329 | print '</td>'; |
6330 | - print '<td align="center">' . $objp->ref . '</td>'; |
|
6331 | - print '<td>' . $objp->ref_client . '</td>'; |
|
6332 | - print '<td align="right">' . price($objp->total_ht) . '</td>'; |
|
6333 | - print '<td>' . $objp->name . '</td>'; |
|
6330 | + print '<td align="center">'.$objp->ref.'</td>'; |
|
6331 | + print '<td>'.$objp->ref_client.'</td>'; |
|
6332 | + print '<td align="right">'.price($objp->total_ht).'</td>'; |
|
6333 | + print '<td>'.$objp->name.'</td>'; |
|
6334 | 6334 | print '</tr>'; |
6335 | 6335 | $i++; |
6336 | 6336 | } |
6337 | 6337 | print '</table>'; |
6338 | - print '<div class="center"><input type="submit" class="button valignmiddle" value="' . $langs->trans('ToLink') . '"> <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>'; |
|
6338 | + print '<div class="center"><input type="submit" class="button valignmiddle" value="'.$langs->trans('ToLink').'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></div>'; |
|
6339 | 6339 | |
6340 | 6340 | print '</form>'; |
6341 | 6341 | $this->db->free($resqllist); |
@@ -6349,20 +6349,20 @@ discard block |
||
6349 | 6349 | |
6350 | 6350 | //$linktoelem.=($linktoelem?' ':''); |
6351 | 6351 | if ($num > 0) |
6352 | - $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; |
|
6352 | + $linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; |
|
6353 | 6353 | //else $linktoelem.=$langs->trans($possiblelink['label']); |
6354 | 6354 | else |
6355 | - $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; |
|
6355 | + $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>'; |
|
6356 | 6356 | } |
6357 | 6357 | } |
6358 | 6358 | |
6359 | 6359 | if ($linktoelemlist) { |
6360 | 6360 | $linktoelem = ' |
6361 | 6361 | <dl class="dropdown" id="linktoobjectname"> |
6362 | - <dt><a href="#linktoobjectname">' . $langs->trans("LinkTo") . '...</a></dt> |
|
6362 | + <dt><a href="#linktoobjectname">' . $langs->trans("LinkTo").'...</a></dt> |
|
6363 | 6363 | <dd> |
6364 | 6364 | <div class="multiselectlinkto"> |
6365 | - <ul class="ulselectedfields">' . $linktoelemlist . ' |
|
6365 | + <ul class="ulselectedfields">' . $linktoelemlist.' |
|
6366 | 6366 | </ul> |
6367 | 6367 | </div> |
6368 | 6368 | </dd> |
@@ -6409,18 +6409,18 @@ discard block |
||
6409 | 6409 | |
6410 | 6410 | $disabled = ($disabled ? ' disabled' : ''); |
6411 | 6411 | |
6412 | - $resultyesno = '<select class="flat width75" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n"; |
|
6412 | + $resultyesno = '<select class="flat width75" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n"; |
|
6413 | 6413 | if ($useempty) |
6414 | - $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; |
|
6414 | + $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n"; |
|
6415 | 6415 | if (("$value" == 'yes') || ($value == 1)) { |
6416 | - $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans("Yes") . '</option>' . "\n"; |
|
6417 | - $resultyesno .= '<option value="' . $no . '">' . $langs->trans("No") . '</option>' . "\n"; |
|
6416 | + $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans("Yes").'</option>'."\n"; |
|
6417 | + $resultyesno .= '<option value="'.$no.'">'.$langs->trans("No").'</option>'."\n"; |
|
6418 | 6418 | } else { |
6419 | 6419 | $selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); |
6420 | - $resultyesno .= '<option value="' . $yes . '">' . $langs->trans("Yes") . '</option>' . "\n"; |
|
6421 | - $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans("No") . '</option>' . "\n"; |
|
6420 | + $resultyesno .= '<option value="'.$yes.'">'.$langs->trans("Yes").'</option>'."\n"; |
|
6421 | + $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans("No").'</option>'."\n"; |
|
6422 | 6422 | } |
6423 | - $resultyesno .= '</select>' . "\n"; |
|
6423 | + $resultyesno .= '</select>'."\n"; |
|
6424 | 6424 | return $resultyesno; |
6425 | 6425 | } |
6426 | 6426 | |
@@ -6438,12 +6438,12 @@ discard block |
||
6438 | 6438 | { |
6439 | 6439 | // phpcs:enable |
6440 | 6440 | $sql = "SELECT rowid, label"; |
6441 | - $sql .= " FROM " . MAIN_DB_PREFIX . "export_model"; |
|
6442 | - $sql .= " WHERE type = '" . $type . "'"; |
|
6441 | + $sql .= " FROM ".MAIN_DB_PREFIX."export_model"; |
|
6442 | + $sql .= " WHERE type = '".$type."'"; |
|
6443 | 6443 | $sql .= " ORDER BY rowid"; |
6444 | 6444 | $result = $this->db->query($sql); |
6445 | 6445 | if ($result) { |
6446 | - print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
|
6446 | + print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">'; |
|
6447 | 6447 | if ($useempty) { |
6448 | 6448 | print '<option value="-1"> </option>'; |
6449 | 6449 | } |
@@ -6453,9 +6453,9 @@ discard block |
||
6453 | 6453 | while ($i < $num) { |
6454 | 6454 | $obj = $this->db->fetch_object($result); |
6455 | 6455 | if ($selected == $obj->rowid) { |
6456 | - print '<option value="' . $obj->rowid . '" selected>'; |
|
6456 | + print '<option value="'.$obj->rowid.'" selected>'; |
|
6457 | 6457 | } else { |
6458 | - print '<option value="' . $obj->rowid . '">'; |
|
6458 | + print '<option value="'.$obj->rowid.'">'; |
|
6459 | 6459 | } |
6460 | 6460 | print $obj->label; |
6461 | 6461 | print '</option>'; |
@@ -6498,7 +6498,7 @@ discard block |
||
6498 | 6498 | // Add where from hooks |
6499 | 6499 | if (is_object($hookmanager)) { |
6500 | 6500 | $parameters = array(); |
6501 | - $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook |
|
6501 | + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook |
|
6502 | 6502 | $object->next_prev_filter .= $hookmanager->resPrint; |
6503 | 6503 | } |
6504 | 6504 | $previous_ref = $next_ref = ''; |
@@ -6524,8 +6524,8 @@ discard block |
||
6524 | 6524 | $stringforfirstkey .= ' CTL +'; |
6525 | 6525 | } |
6526 | 6526 | |
6527 | - $previous_ref = $object->ref_previous ? '<a accesskey="p" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>'; |
|
6528 | - $next_ref = $object->ref_next ? '<a accesskey="n" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>'; |
|
6527 | + $previous_ref = $object->ref_previous ? '<a accesskey="p" title="'.$stringforfirstkey.' p" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>'; |
|
6528 | + $next_ref = $object->ref_next ? '<a accesskey="n" title="'.$stringforfirstkey.' n" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>'; |
|
6529 | 6529 | } |
6530 | 6530 | |
6531 | 6531 | //print "xx".$previous_ref."x".$next_ref; |
@@ -6533,30 +6533,30 @@ discard block |
||
6533 | 6533 | |
6534 | 6534 | // Right part of banner |
6535 | 6535 | if ($morehtmlright) |
6536 | - $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; |
|
6536 | + $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>'; |
|
6537 | 6537 | |
6538 | 6538 | if ($previous_ref || $next_ref || $morehtml) { |
6539 | 6539 | $ret .= '<div class="pagination paginationref"><ul class="right">'; |
6540 | 6540 | } |
6541 | 6541 | if ($morehtml) { |
6542 | - $ret .= '<li class="noborder litext">' . $morehtml . '</li>'; |
|
6542 | + $ret .= '<li class="noborder litext">'.$morehtml.'</li>'; |
|
6543 | 6543 | } |
6544 | 6544 | if ($shownav && ($previous_ref || $next_ref)) { |
6545 | - $ret .= '<li class="pagination">' . $previous_ref . '</li>'; |
|
6546 | - $ret .= '<li class="pagination">' . $next_ref . '</li>'; |
|
6545 | + $ret .= '<li class="pagination">'.$previous_ref.'</li>'; |
|
6546 | + $ret .= '<li class="pagination">'.$next_ref.'</li>'; |
|
6547 | 6547 | } |
6548 | 6548 | if ($previous_ref || $next_ref || $morehtml) { |
6549 | 6549 | $ret .= '</ul></div>'; |
6550 | 6550 | } |
6551 | 6551 | |
6552 | 6552 | $parameters = array(); |
6553 | - $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook |
|
6553 | + $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook |
|
6554 | 6554 | if (empty($reshook)) |
6555 | 6555 | $morehtmlstatus .= $hookmanager->resPrint; |
6556 | 6556 | else |
6557 | 6557 | $morehtmlstatus = $hookmanager->resPrint; |
6558 | 6558 | if ($morehtmlstatus) |
6559 | - $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; |
|
6559 | + $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>'; |
|
6560 | 6560 | |
6561 | 6561 | $parameters = array(); |
6562 | 6562 | $reshook = $hookmanager->executeHooks('moreHtmlRef', $parameters, $object); // Note that $action and $object may have been modified by hook |
@@ -6568,29 +6568,29 @@ discard block |
||
6568 | 6568 | // Left part of banner |
6569 | 6569 | if ($morehtmlleft) { |
6570 | 6570 | if (Globals::$conf->browser->layout == 'phone') |
6571 | - $ret .= '<div class="floatleft">' . $morehtmlleft . '</div>'; // class="center" to have photo in middle |
|
6571 | + $ret .= '<div class="floatleft">'.$morehtmlleft.'</div>'; // class="center" to have photo in middle |
|
6572 | 6572 | else |
6573 | - $ret .= '<div class="inline-block floatleft">' . $morehtmlleft . '</div>'; |
|
6573 | + $ret .= '<div class="inline-block floatleft">'.$morehtmlleft.'</div>'; |
|
6574 | 6574 | } |
6575 | 6575 | |
6576 | 6576 | //if (Globals::$conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; |
6577 | - $ret .= '<div class="inline-block floatleft valignmiddle refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">'; |
|
6577 | + $ret .= '<div class="inline-block floatleft valignmiddle refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">'; |
|
6578 | 6578 | |
6579 | 6579 | // For thirdparty, contact, user, member, the ref is the id, so we show something else |
6580 | 6580 | if ($object->element == 'societe') { |
6581 | 6581 | $ret .= dol_htmlentities($object->name); |
6582 | 6582 | } else if ($object->element == 'member') { |
6583 | - $ret .= $object->ref . '<br>'; |
|
6583 | + $ret .= $object->ref.'<br>'; |
|
6584 | 6584 | $fullname = $object->getFullName($langs); |
6585 | 6585 | if ($object->morphy == 'mor' && $object->societe) { |
6586 | - $ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . ')' : ''); |
|
6586 | + $ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).')' : ''); |
|
6587 | 6587 | } else { |
6588 | - $ret .= dol_htmlentities($fullname) . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); |
|
6588 | + $ret .= dol_htmlentities($fullname).((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); |
|
6589 | 6589 | } |
6590 | 6590 | } else if (in_array($object->element, array('contact', 'user', 'usergroup'))) { |
6591 | 6591 | $ret .= dol_htmlentities($object->getFullName($langs)); |
6592 | 6592 | } else if (in_array($object->element, array('action', 'agenda'))) { |
6593 | - $ret .= $object->ref . '<br>' . $object->label; |
|
6593 | + $ret .= $object->ref.'<br>'.$object->label; |
|
6594 | 6594 | } else if (in_array($object->element, array('adherent_type'))) { |
6595 | 6595 | $ret .= $object->label; |
6596 | 6596 | } else if ($object->element == 'ecm_directories') { |
@@ -6600,7 +6600,7 @@ discard block |
||
6600 | 6600 | |
6601 | 6601 | |
6602 | 6602 | if ($morehtmlref) { |
6603 | - $ret .= ' ' . $morehtmlref; |
|
6603 | + $ret .= ' '.$morehtmlref; |
|
6604 | 6604 | } |
6605 | 6605 | $ret .= '</div>'; |
6606 | 6606 | |
@@ -6633,9 +6633,9 @@ discard block |
||
6633 | 6633 | } |
6634 | 6634 | |
6635 | 6635 | // Barcode image |
6636 | - $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code); |
|
6637 | - $out = '<!-- url barcode = ' . $url . ' -->'; |
|
6638 | - $out .= '<img src="' . $url . '">'; |
|
6636 | + $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); |
|
6637 | + $out = '<!-- url barcode = '.$url.' -->'; |
|
6638 | + $out .= '<img src="'.$url.'">'; |
|
6639 | 6639 | return $out; |
6640 | 6640 | } |
6641 | 6641 | |
@@ -6670,46 +6670,46 @@ discard block |
||
6670 | 6670 | $dir = Globals::$conf->societe->multidir_output[$entity]; |
6671 | 6671 | if (!empty($object->logo)) { |
6672 | 6672 | if ((string) $imagesize == 'mini') { |
6673 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . '/logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
|
6673 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs |
|
6674 | 6674 | } else { |
6675 | 6675 | if ((string) $imagesize == 'small') { |
6676 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . '/logos/' . getImageFileNameForSize($object->logo, '_small'); |
|
6676 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.getImageFileNameForSize($object->logo, '_small'); |
|
6677 | 6677 | } else { |
6678 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . '/logos/' . $object->logo; |
|
6678 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo; |
|
6679 | 6679 | } |
6680 | 6680 | } |
6681 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . '/logos/' . $object->logo; |
|
6681 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo; |
|
6682 | 6682 | } |
6683 | 6683 | $email = $object->email; |
6684 | 6684 | } else if ($modulepart == 'contact') { |
6685 | - $dir = Globals::$conf->societe->multidir_output[$entity] . '/contact'; |
|
6685 | + $dir = Globals::$conf->societe->multidir_output[$entity].'/contact'; |
|
6686 | 6686 | if (!empty($object->photo)) { |
6687 | 6687 | if ((string) $imagesize == 'mini') { |
6688 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . '/photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
6688 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.getImageFileNameForSize($object->photo, '_mini'); |
|
6689 | 6689 | } else if ((string) $imagesize == 'small') { |
6690 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . '/photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
6690 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.getImageFileNameForSize($object->photo, '_small'); |
|
6691 | 6691 | } else { |
6692 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . '/photos/' . $object->photo; |
|
6692 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo; |
|
6693 | 6693 | } |
6694 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . '/photos/' . $object->photo; |
|
6694 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo; |
|
6695 | 6695 | } |
6696 | 6696 | $email = $object->email; |
6697 | 6697 | $capture = 'user'; |
6698 | 6698 | } else { |
6699 | 6699 | if ($modulepart == 'userphoto') { |
6700 | - $dir = Globals::$conf->user->dir_output ?? (DOL_BASE_URI . '/users'); |
|
6700 | + $dir = Globals::$conf->user->dir_output ?? (DOL_BASE_URI.'/users'); |
|
6701 | 6701 | if (!empty($object->photo)) { |
6702 | 6702 | if ((string) $imagesize == 'mini') { |
6703 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . $object->id . '/' . getImageFileNameForSize($object->photo, '_mini'); |
|
6703 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').$object->id.'/'.getImageFileNameForSize($object->photo, '_mini'); |
|
6704 | 6704 | } else if ((string) $imagesize == 'small') { |
6705 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . $object->id . '/' . getImageFileNameForSize($object->photo, '_small'); |
|
6705 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').$object->id.'/'.getImageFileNameForSize($object->photo, '_small'); |
|
6706 | 6706 | } else { |
6707 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . '/' . $object->id . '/' . $object->photo; |
|
6707 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id.'/'.$object->photo; |
|
6708 | 6708 | } |
6709 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . '/' . $object->id . '/' . $object->photo; |
|
6709 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id.'/'.$object->photo; |
|
6710 | 6710 | } |
6711 | 6711 | if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS)) { |
6712 | - $altfile = $object->id . ".jpg"; // For backward compatibility |
|
6712 | + $altfile = $object->id.".jpg"; // For backward compatibility |
|
6713 | 6713 | } |
6714 | 6714 | $email = $object->email; |
6715 | 6715 | $capture = 'user'; |
@@ -6718,15 +6718,15 @@ discard block |
||
6718 | 6718 | $dir = Globals::$conf->adherent->dir_output; |
6719 | 6719 | if (!empty($object->photo)) { |
6720 | 6720 | if ((string) $imagesize == 'mini') |
6721 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
6721 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
|
6722 | 6722 | else if ((string) $imagesize == 'small') |
6723 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
6723 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); |
|
6724 | 6724 | else |
6725 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
6726 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
6725 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
|
6726 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; |
|
6727 | 6727 | } |
6728 | 6728 | if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS)) |
6729 | - $altfile = $object->id . ".jpg"; // For backward compatibility |
|
6729 | + $altfile = $object->id.".jpg"; // For backward compatibility |
|
6730 | 6730 | $email = $object->email; |
6731 | 6731 | $capture = 'user'; |
6732 | 6732 | } |
@@ -6735,15 +6735,15 @@ discard block |
||
6735 | 6735 | $dir = Globals::$conf->$modulepart->dir_output; |
6736 | 6736 | if (!empty($object->photo)) { |
6737 | 6737 | if ((string) $imagesize == 'mini') |
6738 | - $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
6738 | + $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_mini'); |
|
6739 | 6739 | else if ((string) $imagesize == 'small') |
6740 | - $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
6740 | + $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_small'); |
|
6741 | 6741 | else |
6742 | - $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo; |
|
6743 | - $originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo; |
|
6742 | + $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo; |
|
6743 | + $originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo; |
|
6744 | 6744 | } |
6745 | 6745 | if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS)) |
6746 | - $altfile = $object->id . ".jpg"; // For backward compatibility |
|
6746 | + $altfile = $object->id.".jpg"; // For backward compatibility |
|
6747 | 6747 | $email = $object->email; |
6748 | 6748 | } |
6749 | 6749 | } |
@@ -6752,27 +6752,27 @@ discard block |
||
6752 | 6752 | $capture = $forcecapture; |
6753 | 6753 | |
6754 | 6754 | if ($dir) { |
6755 | - if ($file && file_exists($dir . "/" . $file)) { |
|
6755 | + if ($file && file_exists($dir."/".$file)) { |
|
6756 | 6756 | if ($addlinktofullsize) { |
6757 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
6757 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
|
6758 | 6758 | if ($urladvanced) |
6759 | - $ret .= '<a href="' . $urladvanced . '">'; |
|
6759 | + $ret .= '<a href="'.$urladvanced.'">'; |
|
6760 | 6760 | else |
6761 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
6761 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
|
6762 | 6762 | } |
6763 | - $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">'; |
|
6763 | + $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="Photo" id="photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">'; |
|
6764 | 6764 | if ($addlinktofullsize) |
6765 | 6765 | $ret .= '</a>'; |
6766 | 6766 | } |
6767 | - else if ($altfile && file_exists($dir . "/" . $altfile)) { |
|
6767 | + else if ($altfile && file_exists($dir."/".$altfile)) { |
|
6768 | 6768 | if ($addlinktofullsize) { |
6769 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
|
6769 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity); |
|
6770 | 6770 | if ($urladvanced) |
6771 | - $ret .= '<a href="' . $urladvanced . '">'; |
|
6771 | + $ret .= '<a href="'.$urladvanced.'">'; |
|
6772 | 6772 | else |
6773 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
6773 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">'; |
|
6774 | 6774 | } |
6775 | - $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo alt" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" class="' . $cssclass . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($altfile) . '&cache=' . $cache . '">'; |
|
6775 | + $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" class="'.$cssclass.'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">'; |
|
6776 | 6776 | if ($addlinktofullsize) |
6777 | 6777 | $ret .= '</a>'; |
6778 | 6778 | } |
@@ -6796,10 +6796,10 @@ discard block |
||
6796 | 6796 | $ret .= '<!-- Put link to gravatar -->'; |
6797 | 6797 | //$defaultimg=urlencode(dol_buildpath($nophoto,3)); |
6798 | 6798 | $defaultimg = 'mm'; |
6799 | - $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Gravatar avatar" title="' . $email . ' Gravatar avatar" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="https://www.gravatar.com/avatar/' . dol_hash(strtolower(trim($email)), 3) . '?s=' . $width . '&d=' . $defaultimg . '">'; // gravatar need md5 hash |
|
6799 | + $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="Gravatar avatar" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)), 3).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash |
|
6800 | 6800 | } else { |
6801 | 6801 | //$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">'; |
6802 | - $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '">'; |
|
6802 | + $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_BASE_URI.$nophoto.'">'; |
|
6803 | 6803 | } |
6804 | 6804 | } |
6805 | 6805 | |
@@ -6809,13 +6809,13 @@ discard block |
||
6809 | 6809 | } |
6810 | 6810 | $ret .= '<table class="nobordernopadding centpercent">'; |
6811 | 6811 | if ($object->photo) { |
6812 | - $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> ' . $langs->trans("Delete") . '<br><br></td></tr>'; |
|
6812 | + $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>'; |
|
6813 | 6813 | } |
6814 | - $ret .= '<tr><td class="tdoverflow"><input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput"' . ($capture ? ' capture="' . $capture . '"' : '') . '></td></tr>'; |
|
6814 | + $ret .= '<tr><td class="tdoverflow"><input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput"'.($capture ? ' capture="'.$capture.'"' : '').'></td></tr>'; |
|
6815 | 6815 | $ret .= '</table>'; |
6816 | 6816 | } |
6817 | 6817 | } else |
6818 | - DolUtils::dol_print_error('', 'Call of showphoto with wrong parameters modulepart=' . $modulepart); |
|
6818 | + DolUtils::dol_print_error('', 'Call of showphoto with wrong parameters modulepart='.$modulepart); |
|
6819 | 6819 | |
6820 | 6820 | return $ret; |
6821 | 6821 | } |
@@ -6858,37 +6858,37 @@ discard block |
||
6858 | 6858 | if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) { |
6859 | 6859 | $sql .= ", e.label"; |
6860 | 6860 | } |
6861 | - $sql .= " FROM " . MAIN_DB_PREFIX . "usergroup as ug "; |
|
6861 | + $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as ug "; |
|
6862 | 6862 | if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) { |
6863 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entity as e ON e.rowid=ug.entity"; |
|
6863 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e ON e.rowid=ug.entity"; |
|
6864 | 6864 | if ($force_entity) |
6865 | - $sql .= " WHERE ug.entity IN (0," . $force_entity . ")"; |
|
6865 | + $sql .= " WHERE ug.entity IN (0,".$force_entity.")"; |
|
6866 | 6866 | else |
6867 | 6867 | $sql .= " WHERE ug.entity IS NOT NULL"; |
6868 | 6868 | } |
6869 | 6869 | else { |
6870 | - $sql .= " WHERE ug.entity IN (0," . Globals::$conf->entity . ")"; |
|
6870 | + $sql .= " WHERE ug.entity IN (0,".Globals::$conf->entity.")"; |
|
6871 | 6871 | } |
6872 | 6872 | if (is_array($exclude) && $excludeGroups) |
6873 | - $sql .= " AND ug.rowid NOT IN ('" . $excludeGroups . "')"; |
|
6873 | + $sql .= " AND ug.rowid NOT IN ('".$excludeGroups."')"; |
|
6874 | 6874 | if (is_array($include) && $includeGroups) |
6875 | - $sql .= " AND ug.rowid IN ('" . $includeGroups . "')"; |
|
6875 | + $sql .= " AND ug.rowid IN ('".$includeGroups."')"; |
|
6876 | 6876 | $sql .= " ORDER BY ug.nom ASC"; |
6877 | 6877 | |
6878 | - dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG); |
|
6878 | + dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG); |
|
6879 | 6879 | $resql = $this->db->query($sql); |
6880 | 6880 | if ($resql) { |
6881 | 6881 | // Enhance with select2 |
6882 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
6882 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
6883 | 6883 | $out .= ajax_combobox($htmlname); |
6884 | 6884 | |
6885 | - $out .= '<select class="flat minwidth200" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
|
6885 | + $out .= '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; |
|
6886 | 6886 | |
6887 | 6887 | $num = $this->db->num_rows($resql); |
6888 | 6888 | $i = 0; |
6889 | 6889 | if ($num) { |
6890 | 6890 | if ($show_empty && !$multiple) |
6891 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; |
|
6891 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n"; |
|
6892 | 6892 | |
6893 | 6893 | while ($i < $num) { |
6894 | 6894 | $obj = $this->db->fetch_object($resql); |
@@ -6896,17 +6896,17 @@ discard block |
||
6896 | 6896 | if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly)) |
6897 | 6897 | $disableline = 1; |
6898 | 6898 | |
6899 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
6899 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
6900 | 6900 | if ($disableline) |
6901 | 6901 | $out .= ' disabled'; |
6902 | - if ((is_object($selected[0]) && $selected[0]->id == $obj->rowid) || (!is_object($selected[0]) && in_array($obj->rowid, $selected) )) { |
|
6902 | + if ((is_object($selected[0]) && $selected[0]->id == $obj->rowid) || (!is_object($selected[0]) && in_array($obj->rowid, $selected))) { |
|
6903 | 6903 | $out .= ' selected'; |
6904 | 6904 | } |
6905 | 6905 | $out .= '>'; |
6906 | 6906 | |
6907 | 6907 | $out .= $obj->name; |
6908 | 6908 | if (!empty(Globals::$conf->multicompany->enabled) && empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE) && Globals::$conf->entity == 1) { |
6909 | - $out .= " (" . $obj->label . ")"; |
|
6909 | + $out .= " (".$obj->label.")"; |
|
6910 | 6910 | } |
6911 | 6911 | |
6912 | 6912 | $out .= '</option>'; |
@@ -6914,8 +6914,8 @@ discard block |
||
6914 | 6914 | } |
6915 | 6915 | } else { |
6916 | 6916 | if ($show_empty) |
6917 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; |
|
6918 | - $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; |
|
6917 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n"; |
|
6918 | + $out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; |
|
6919 | 6919 | } |
6920 | 6920 | $out .= '</select>'; |
6921 | 6921 | } |
@@ -6936,8 +6936,8 @@ discard block |
||
6936 | 6936 | global $conf, $langs; |
6937 | 6937 | |
6938 | 6938 | $out = '<div class="nowrap">'; |
6939 | - $out .= '<input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . DolUtils::dol_escape_htmltag($langs->trans("Search")) . '" title="' . DolUtils::dol_escape_htmltag($langs->trans("Search")) . '">'; |
|
6940 | - $out .= '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . DolUtils::dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . DolUtils::dol_escape_htmltag($langs->trans("RemoveFilter")) . '">'; |
|
6939 | + $out .= '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.DolUtils::dol_escape_htmltag($langs->trans("Search")).'" title="'.DolUtils::dol_escape_htmltag($langs->trans("Search")).'">'; |
|
6940 | + $out .= '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.DolUtils::dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.DolUtils::dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; |
|
6941 | 6941 | $out .= '</div>'; |
6942 | 6942 | |
6943 | 6943 | return $out; |
@@ -6962,12 +6962,12 @@ discard block |
||
6962 | 6962 | $("#checkallactions").click(function() { |
6963 | 6963 | if($(this).is(\':checked\')){ |
6964 | 6964 | console.log("We check all"); |
6965 | - $(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); |
|
6965 | + $(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); |
|
6966 | 6966 | } |
6967 | 6967 | else |
6968 | 6968 | { |
6969 | 6969 | console.log("We uncheck all"); |
6970 | - $(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); |
|
6970 | + $(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); |
|
6971 | 6971 | }' . "\n"; |
6972 | 6972 | if ($calljsfunction) |
6973 | 6973 | $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
@@ -7016,64 +7016,64 @@ discard block |
||
7016 | 7016 | { |
7017 | 7017 | global $db, $conf, $langs, $user; |
7018 | 7018 | |
7019 | - $sql = 'SELECT rowid, label FROM ' . MAIN_DB_PREFIX . 'c_exp_tax_cat WHERE active = 1'; |
|
7020 | - $sql .= ' AND entity IN (0,' . getEntity('exp_tax_cat') . ')'; |
|
7019 | + $sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1'; |
|
7020 | + $sql .= ' AND entity IN (0,'.getEntity('exp_tax_cat').')'; |
|
7021 | 7021 | if (!empty($excludeid)) |
7022 | - $sql .= ' AND rowid NOT IN (' . implode(',', $excludeid) . ')'; |
|
7022 | + $sql .= ' AND rowid NOT IN ('.implode(',', $excludeid).')'; |
|
7023 | 7023 | $sql .= ' ORDER BY label'; |
7024 | 7024 | |
7025 | 7025 | $resql = $db->query($sql); |
7026 | 7026 | if ($resql) { |
7027 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
7027 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
|
7028 | 7028 | if ($useempty) |
7029 | 7029 | $out .= '<option value="0"> </option>'; |
7030 | 7030 | |
7031 | 7031 | while ($obj = $db->fetch_object($resql)) { |
7032 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>'; |
|
7032 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>'; |
|
7033 | 7033 | } |
7034 | 7034 | $out .= '</select>'; |
7035 | 7035 | if (!empty($htmlname) && $user->admin) |
7036 | - $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
7036 | + $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
7037 | 7037 | |
7038 | 7038 | if (!empty($target)) { |
7039 | - $sql = "SELECT c.id FROM " . MAIN_DB_PREFIX . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
|
7039 | + $sql = "SELECT c.id FROM ".MAIN_DB_PREFIX."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
|
7040 | 7040 | $resql = $db->query($sql); |
7041 | 7041 | if ($resql) { |
7042 | 7042 | if ($db->num_rows($resql) > 0) { |
7043 | 7043 | $obj = $db->fetch_object($resql); |
7044 | 7044 | $out .= '<script type="text/javascript"> |
7045 | 7045 | $(function() { |
7046 | - $("select[name=' . $target . ']").on("change", function() { |
|
7046 | + $("select[name=' . $target.']").on("change", function() { |
|
7047 | 7047 | var current_val = $(this).val(); |
7048 | - if (current_val == ' . $obj->id . ') {'; |
|
7048 | + if (current_val == ' . $obj->id.') {'; |
|
7049 | 7049 | if (!empty($default_selected) || !empty($selected)) |
7050 | - $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; |
|
7050 | + $out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; |
|
7051 | 7051 | |
7052 | 7052 | $out .= ' |
7053 | - $("select[name=' . $htmlname . ']").change(); |
|
7053 | + $("select[name=' . $htmlname.']").change(); |
|
7054 | 7054 | } |
7055 | 7055 | }); |
7056 | 7056 | |
7057 | - $("select[name=' . $htmlname . ']").change(function() { |
|
7057 | + $("select[name=' . $htmlname.']").change(function() { |
|
7058 | 7058 | |
7059 | - if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { |
|
7059 | + if ($("select[name=' . $target.']").val() == '.$obj->id.') { |
|
7060 | 7060 | // get price of kilometer to fill the unit price |
7061 | - var data = ' . json_encode($params) . '; |
|
7061 | + var data = ' . json_encode($params).'; |
|
7062 | 7062 | data.fk_c_exp_tax_cat = $(this).val(); |
7063 | 7063 | |
7064 | 7064 | $.ajax({ |
7065 | 7065 | method: "POST", |
7066 | 7066 | dataType: "json", |
7067 | 7067 | data: data, |
7068 | - url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php') . '", |
|
7068 | + url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php').'", |
|
7069 | 7069 | }).done(function( data, textStatus, jqXHR ) { |
7070 | 7070 | console.log(data); |
7071 | 7071 | if (typeof data.up != "undefined") { |
7072 | 7072 | $("input[name=value_unit]").val(data.up); |
7073 | - $("select[name=' . $htmlname . ']").attr("title", data.title); |
|
7073 | + $("select[name=' . $htmlname.']").attr("title", data.title); |
|
7074 | 7074 | } else { |
7075 | 7075 | $("input[name=value_unit]").val(""); |
7076 | - $("select[name=' . $htmlname . ']").attr("title", ""); |
|
7076 | + $("select[name=' . $htmlname.']").attr("title", ""); |
|
7077 | 7077 | } |
7078 | 7078 | }); |
7079 | 7079 | } |
@@ -7103,17 +7103,17 @@ discard block |
||
7103 | 7103 | { |
7104 | 7104 | global $db, $conf, $langs; |
7105 | 7105 | |
7106 | - $sql = 'SELECT rowid, range_ik FROM ' . MAIN_DB_PREFIX . 'c_exp_tax_range'; |
|
7107 | - $sql .= ' WHERE entity = ' . Globals::$conf->entity . ' AND active = 1'; |
|
7106 | + $sql = 'SELECT rowid, range_ik FROM '.MAIN_DB_PREFIX.'c_exp_tax_range'; |
|
7107 | + $sql .= ' WHERE entity = '.Globals::$conf->entity.' AND active = 1'; |
|
7108 | 7108 | |
7109 | 7109 | $resql = $db->query($sql); |
7110 | 7110 | if ($resql) { |
7111 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
7111 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
|
7112 | 7112 | if ($useempty) |
7113 | 7113 | $out .= '<option value="0"></option>'; |
7114 | 7114 | |
7115 | 7115 | while ($obj = $db->fetch_object($resql)) { |
7116 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>'; |
|
7116 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>'; |
|
7117 | 7117 | } |
7118 | 7118 | $out .= '</select>'; |
7119 | 7119 | } else { |
@@ -7137,16 +7137,16 @@ discard block |
||
7137 | 7137 | { |
7138 | 7138 | global $db, $langs; |
7139 | 7139 | |
7140 | - $sql = 'SELECT id, code, label FROM ' . MAIN_DB_PREFIX . 'c_type_fees'; |
|
7140 | + $sql = 'SELECT id, code, label FROM '.MAIN_DB_PREFIX.'c_type_fees'; |
|
7141 | 7141 | $sql .= ' WHERE active = 1'; |
7142 | 7142 | |
7143 | 7143 | $resql = $db->query($sql); |
7144 | 7144 | if ($resql) { |
7145 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
|
7145 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">'; |
|
7146 | 7146 | if ($useempty) |
7147 | 7147 | $out .= '<option value="0"></option>'; |
7148 | 7148 | if ($allchoice) |
7149 | - $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; |
|
7149 | + $out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; |
|
7150 | 7150 | |
7151 | 7151 | $field = 'code'; |
7152 | 7152 | if ($useid) |
@@ -7154,7 +7154,7 @@ discard block |
||
7154 | 7154 | |
7155 | 7155 | while ($obj = $db->fetch_object($resql)) { |
7156 | 7156 | $key = $langs->trans($obj->code); |
7157 | - $out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; |
|
7157 | + $out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; |
|
7158 | 7158 | } |
7159 | 7159 | $out .= '</select>'; |
7160 | 7160 | } else { |
@@ -113,22 +113,24 @@ discard block |
||
113 | 113 | if (!empty($perm)) { |
114 | 114 | $tmp = explode(':', $typeofdata); |
115 | 115 | $ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">'; |
116 | - if ($fieldrequired) |
|
117 | - $ret .= '<span class="fieldrequired">'; |
|
116 | + if ($fieldrequired) { |
|
117 | + $ret .= '<span class="fieldrequired">'; |
|
118 | + } |
|
118 | 119 | $ret .= $langs->trans($text); |
119 | - if ($fieldrequired) |
|
120 | - $ret .= '</span>'; |
|
120 | + if ($fieldrequired) { |
|
121 | + $ret .= '</span>'; |
|
122 | + } |
|
121 | 123 | $ret .= '</div>' . "\n"; |
122 | - } |
|
123 | - else { |
|
124 | - if ($fieldrequired) |
|
125 | - $ret .= '<span class="fieldrequired">'; |
|
124 | + } else { |
|
125 | + if ($fieldrequired) { |
|
126 | + $ret .= '<span class="fieldrequired">'; |
|
127 | + } |
|
126 | 128 | $ret .= $langs->trans($text); |
127 | - if ($fieldrequired) |
|
128 | - $ret .= '</span>'; |
|
129 | + if ($fieldrequired) { |
|
130 | + $ret .= '</span>'; |
|
131 | + } |
|
129 | 132 | } |
130 | - } |
|
131 | - else { |
|
133 | + } else { |
|
132 | 134 | if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) { |
133 | 135 | $ret .= '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">'; |
134 | 136 | } |
@@ -193,8 +195,9 @@ discard block |
||
193 | 195 | $ret = ''; |
194 | 196 | |
195 | 197 | // Check parameters |
196 | - if (empty($typeofdata)) |
|
197 | - return 'ErrorBadParameter'; |
|
198 | + if (empty($typeofdata)) { |
|
199 | + return 'ErrorBadParameter'; |
|
200 | + } |
|
198 | 201 | |
199 | 202 | // When option to edit inline is activated |
200 | 203 | if (!empty(Globals::$conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker |
@@ -206,10 +209,12 @@ discard block |
||
206 | 209 | $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">'; |
207 | 210 | $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
208 | 211 | $ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">'; |
209 | - if (empty($notabletag)) |
|
210 | - $ret .= '<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">'; |
|
211 | - if (empty($notabletag)) |
|
212 | - $ret .= '<tr><td>'; |
|
212 | + if (empty($notabletag)) { |
|
213 | + $ret .= '<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">'; |
|
214 | + } |
|
215 | + if (empty($notabletag)) { |
|
216 | + $ret .= '<tr><td>'; |
|
217 | + } |
|
213 | 218 | if (preg_match('/^(string|email)/', $typeofdata)) { |
214 | 219 | $tmp = explode(':', $typeofdata); |
215 | 220 | $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . ($tmp[1] ? ' size="' . $tmp[1] . '"' : '') . '>'; |
@@ -248,35 +253,39 @@ discard block |
||
248 | 253 | $doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), ($tmp[2] ? $tmp[2] : ''), ($tmp[3] ? $tmp[3] : '100'), ($tmp[1] ? $tmp[1] : 'dolibarr_notes'), 'In', ($tmp[5] ? $tmp[5] : 0), true, true, ($tmp[6] ? $tmp[6] : '20'), ($tmp[7] ? $tmp[7] : '100')); |
249 | 254 | $ret .= $doleditor->Create(1); |
250 | 255 | } |
251 | - if (empty($notabletag)) |
|
252 | - $ret .= '</td>'; |
|
256 | + if (empty($notabletag)) { |
|
257 | + $ret .= '</td>'; |
|
258 | + } |
|
253 | 259 | |
254 | - if (empty($notabletag)) |
|
255 | - $ret .= '<td align="left">'; |
|
260 | + if (empty($notabletag)) { |
|
261 | + $ret .= '<td align="left">'; |
|
262 | + } |
|
256 | 263 | //else $ret.='<div class="clearboth"></div>'; |
257 | 264 | $ret .= '<input type="submit" class="button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">'; |
258 | - if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) |
|
259 | - $ret .= '<br>' . "\n"; |
|
265 | + if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) { |
|
266 | + $ret .= '<br>' . "\n"; |
|
267 | + } |
|
260 | 268 | $ret .= '<input type="submit" class="button' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
261 | - if (empty($notabletag)) |
|
262 | - $ret .= '</td>'; |
|
269 | + if (empty($notabletag)) { |
|
270 | + $ret .= '</td>'; |
|
271 | + } |
|
263 | 272 | |
264 | - if (empty($notabletag)) |
|
265 | - $ret .= '</tr></table>' . "\n"; |
|
273 | + if (empty($notabletag)) { |
|
274 | + $ret .= '</tr></table>' . "\n"; |
|
275 | + } |
|
266 | 276 | $ret .= '</form>' . "\n"; |
267 | - } |
|
268 | - else { |
|
269 | - if (preg_match('/^(email)/', $typeofdata)) |
|
270 | - $ret .= dol_print_email($value, 0, 0, 0, 0, 1); |
|
271 | - elseif (preg_match('/^(amount|numeric)/', $typeofdata)) |
|
272 | - $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, Globals::$conf->currency) : ''); |
|
273 | - elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) |
|
274 | - $ret .= dol_htmlentitiesbr($value); |
|
275 | - elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') |
|
276 | - $ret .= DolUtils::dol_print_date($value, 'day'); |
|
277 | - elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') |
|
278 | - $ret .= DolUtils::dol_print_date($value, 'dayhour'); |
|
279 | - else if (preg_match('/^select;/', $typeofdata)) { |
|
277 | + } else { |
|
278 | + if (preg_match('/^(email)/', $typeofdata)) { |
|
279 | + $ret .= dol_print_email($value, 0, 0, 0, 0, 1); |
|
280 | + } elseif (preg_match('/^(amount|numeric)/', $typeofdata)) { |
|
281 | + $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, Globals::$conf->currency) : ''); |
|
282 | + } elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { |
|
283 | + $ret .= dol_htmlentitiesbr($value); |
|
284 | + } elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { |
|
285 | + $ret .= DolUtils::dol_print_date($value, 'day'); |
|
286 | + } elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { |
|
287 | + $ret .= DolUtils::dol_print_date($value, 'dayhour'); |
|
288 | + } else if (preg_match('/^select;/', $typeofdata)) { |
|
280 | 289 | $arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); |
281 | 290 | foreach ($arraydata as $val) { |
282 | 291 | $tmp = explode(':', $val); |
@@ -291,8 +300,9 @@ discard block |
||
291 | 300 | $tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : ''); |
292 | 301 | } |
293 | 302 | $ret .= $tmpcontent; |
294 | - } else |
|
295 | - $ret .= $value; |
|
303 | + } else { |
|
304 | + $ret .= $value; |
|
305 | + } |
|
296 | 306 | |
297 | 307 | if ($formatfunc && method_exists($object, $formatfunc)) { |
298 | 308 | $ret = $object->$formatfunc($ret); |
@@ -322,12 +332,13 @@ discard block |
||
322 | 332 | $out = ''; |
323 | 333 | |
324 | 334 | // Check parameters |
325 | - if (preg_match('/^text/', $inputType)) |
|
326 | - $value = dol_nl2br($value); |
|
327 | - else if (preg_match('/^numeric/', $inputType)) |
|
328 | - $value = price($value); |
|
329 | - else if ($inputType == 'day' || $inputType == 'datepicker') |
|
330 | - $value = DolUtils::dol_print_date($value, 'day'); |
|
335 | + if (preg_match('/^text/', $inputType)) { |
|
336 | + $value = dol_nl2br($value); |
|
337 | + } else if (preg_match('/^numeric/', $inputType)) { |
|
338 | + $value = price($value); |
|
339 | + } else if ($inputType == 'day' || $inputType == 'datepicker') { |
|
340 | + $value = DolUtils::dol_print_date($value, 'day'); |
|
341 | + } |
|
331 | 342 | |
332 | 343 | if ($condition) { |
333 | 344 | $element = false; |
@@ -352,32 +363,35 @@ discard block |
||
352 | 363 | if (preg_match('/^(string|email|numeric)/', $inputType)) { |
353 | 364 | $tmp = explode(':', $inputType); |
354 | 365 | $inputType = $tmp[0]; |
355 | - if (!empty($tmp[1])) |
|
356 | - $inputOption = $tmp[1]; |
|
357 | - if (!empty($tmp[2])) |
|
358 | - $savemethod = $tmp[2]; |
|
366 | + if (!empty($tmp[1])) { |
|
367 | + $inputOption = $tmp[1]; |
|
368 | + } |
|
369 | + if (!empty($tmp[2])) { |
|
370 | + $savemethod = $tmp[2]; |
|
371 | + } |
|
359 | 372 | $out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n"; |
360 | - } |
|
361 | - else if ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { |
|
373 | + } else if ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) { |
|
362 | 374 | $tmp = explode(':', $inputType); |
363 | 375 | $inputType = $tmp[0]; |
364 | - if (!empty($tmp[1])) |
|
365 | - $inputOption = $tmp[1]; |
|
366 | - if (!empty($tmp[2])) |
|
367 | - $savemethod = $tmp[2]; |
|
376 | + if (!empty($tmp[1])) { |
|
377 | + $inputOption = $tmp[1]; |
|
378 | + } |
|
379 | + if (!empty($tmp[2])) { |
|
380 | + $savemethod = $tmp[2]; |
|
381 | + } |
|
368 | 382 | |
369 | 383 | $out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format |
370 | - } |
|
371 | - else if (preg_match('/^(select|autocomplete)/', $inputType)) { |
|
384 | + } else if (preg_match('/^(select|autocomplete)/', $inputType)) { |
|
372 | 385 | $tmp = explode(':', $inputType); |
373 | 386 | $inputType = $tmp[0]; |
374 | 387 | $loadmethod = $tmp[1]; |
375 | - if (!empty($tmp[2])) |
|
376 | - $savemethod = $tmp[2]; |
|
377 | - if (!empty($tmp[3])) |
|
378 | - $button_only = true; |
|
379 | - } |
|
380 | - else if (preg_match('/^textarea/', $inputType)) { |
|
388 | + if (!empty($tmp[2])) { |
|
389 | + $savemethod = $tmp[2]; |
|
390 | + } |
|
391 | + if (!empty($tmp[3])) { |
|
392 | + $button_only = true; |
|
393 | + } |
|
394 | + } else if (preg_match('/^textarea/', $inputType)) { |
|
381 | 395 | $tmp = explode(':', $inputType); |
382 | 396 | $inputType = $tmp[0]; |
383 | 397 | $rows = (empty($tmp[1]) ? '8' : $tmp[1]); |
@@ -386,12 +400,15 @@ discard block |
||
386 | 400 | $tmp = explode(':', $inputType); |
387 | 401 | $inputType = $tmp[0]; |
388 | 402 | $toolbar = $tmp[1]; |
389 | - if (!empty($tmp[2])) |
|
390 | - $width = $tmp[2]; |
|
391 | - if (!empty($tmp[3])) |
|
392 | - $heigth = $tmp[3]; |
|
393 | - if (!empty($tmp[4])) |
|
394 | - $savemethod = $tmp[4]; |
|
403 | + if (!empty($tmp[2])) { |
|
404 | + $width = $tmp[2]; |
|
405 | + } |
|
406 | + if (!empty($tmp[3])) { |
|
407 | + $heigth = $tmp[3]; |
|
408 | + } |
|
409 | + if (!empty($tmp[4])) { |
|
410 | + $savemethod = $tmp[4]; |
|
411 | + } |
|
395 | 412 | |
396 | 413 | if (!empty(Globals::$conf->fckeditor->enabled)) { |
397 | 414 | $out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n"; |
@@ -404,18 +421,23 @@ discard block |
||
404 | 421 | $out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n"; |
405 | 422 | $out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n"; |
406 | 423 | $out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n"; |
407 | - if (!empty($savemethod)) |
|
408 | - $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n"; |
|
409 | - if (!empty($ext_element)) |
|
410 | - $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n"; |
|
424 | + if (!empty($savemethod)) { |
|
425 | + $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n"; |
|
426 | + } |
|
427 | + if (!empty($ext_element)) { |
|
428 | + $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n"; |
|
429 | + } |
|
411 | 430 | if (!empty($custommsg)) { |
412 | 431 | if (is_array($custommsg)) { |
413 | - if (!empty($custommsg['success'])) |
|
414 | - $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n"; |
|
415 | - if (!empty($custommsg['error'])) |
|
416 | - $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n"; |
|
417 | - } else |
|
418 | - $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n"; |
|
432 | + if (!empty($custommsg['success'])) { |
|
433 | + $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n"; |
|
434 | + } |
|
435 | + if (!empty($custommsg['error'])) { |
|
436 | + $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n"; |
|
437 | + } |
|
438 | + } else { |
|
439 | + $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n"; |
|
440 | + } |
|
419 | 441 | } |
420 | 442 | if ($inputType == 'textarea') { |
421 | 443 | $out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n"; |
@@ -567,20 +589,22 @@ discard block |
||
567 | 589 | global $conf, $langs; |
568 | 590 | |
569 | 591 | $alt = ''; |
570 | - if ($tooltiptrigger) |
|
571 | - $alt = $langs->transnoentitiesnoconv("ClickToShowHelp"); |
|
592 | + if ($tooltiptrigger) { |
|
593 | + $alt = $langs->transnoentitiesnoconv("ClickToShowHelp"); |
|
594 | + } |
|
572 | 595 | |
573 | 596 | //For backwards compatibility |
574 | - if ($type == '0') |
|
575 | - $type = 'info'; |
|
576 | - elseif ($type == '1') |
|
577 | - $type = 'help'; |
|
597 | + if ($type == '0') { |
|
598 | + $type = 'info'; |
|
599 | + } elseif ($type == '1') { |
|
600 | + $type = 'help'; |
|
601 | + } |
|
578 | 602 | |
579 | 603 | // If info or help with no javascript, show only text |
580 | 604 | if (empty(Globals::$conf->use_javascript_ajax)) { |
581 | - if ($type == 'info' || $type == 'help') |
|
582 | - return $text; |
|
583 | - else { |
|
605 | + if ($type == 'info' || $type == 'help') { |
|
606 | + return $text; |
|
607 | + } else { |
|
584 | 608 | $alt = $htmltext; |
585 | 609 | $htmltext = ''; |
586 | 610 | } |
@@ -588,27 +612,30 @@ discard block |
||
588 | 612 | |
589 | 613 | // If info or help with smartphone, show only text (tooltip hover can't works) |
590 | 614 | if (!empty(Globals::$conf->dol_no_mouse_hover) && empty($tooltiptrigger)) { |
591 | - if ($type == 'info' || $type == 'help') |
|
592 | - return $text; |
|
615 | + if ($type == 'info' || $type == 'help') { |
|
616 | + return $text; |
|
617 | + } |
|
593 | 618 | } |
594 | 619 | // If info or help with smartphone, show only text (tooltip on lick does not works with dialog on smaprtphone) |
595 | 620 | if (!empty(Globals::$conf->dol_no_mouse_hover) && !empty($tooltiptrigger)) { |
596 | - if ($type == 'info' || $type == 'help') |
|
597 | - return $text; |
|
598 | - } |
|
599 | - |
|
600 | - if ($type == 'info') |
|
601 | - $img = img_help(0, $alt); |
|
602 | - elseif ($type == 'help') |
|
603 | - $img = img_help(($tooltiptrigger != '' ? 2 : 1), $alt); |
|
604 | - elseif ($type == 'superadmin') |
|
605 | - $img = img_picto($alt, 'redstar'); |
|
606 | - elseif ($type == 'admin') |
|
607 | - $img = img_picto($alt, 'star'); |
|
608 | - elseif ($type == 'warning') |
|
609 | - $img = img_warning($alt); |
|
610 | - else |
|
611 | - $img = img_picto($alt, $type); |
|
621 | + if ($type == 'info' || $type == 'help') { |
|
622 | + return $text; |
|
623 | + } |
|
624 | + } |
|
625 | + |
|
626 | + if ($type == 'info') { |
|
627 | + $img = img_help(0, $alt); |
|
628 | + } elseif ($type == 'help') { |
|
629 | + $img = img_help(($tooltiptrigger != '' ? 2 : 1), $alt); |
|
630 | + } elseif ($type == 'superadmin') { |
|
631 | + $img = img_picto($alt, 'redstar'); |
|
632 | + } elseif ($type == 'admin') { |
|
633 | + $img = img_picto($alt, 'star'); |
|
634 | + } elseif ($type == 'warning') { |
|
635 | + $img = img_warning($alt); |
|
636 | + } else { |
|
637 | + $img = img_picto($alt, $type); |
|
638 | + } |
|
612 | 639 | |
613 | 640 | return $this->textwithtooltip($text, $htmltext, (($tooltiptrigger && !$img) ? 3 : 2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger, $forcenowrap); |
614 | 641 | } |
@@ -625,8 +652,9 @@ discard block |
||
625 | 652 | { |
626 | 653 | global $conf, $langs, $hookmanager; |
627 | 654 | |
628 | - if (count($arrayofaction) == 0) |
|
629 | - return; |
|
655 | + if (count($arrayofaction) == 0) { |
|
656 | + return; |
|
657 | + } |
|
630 | 658 | |
631 | 659 | $disabled = 0; |
632 | 660 | $ret = '<div class="centpercent center">'; |
@@ -758,10 +786,11 @@ discard block |
||
758 | 786 | $i++; |
759 | 787 | } |
760 | 788 | |
761 | - if (empty($disablefavorites)) |
|
762 | - array_multisort($favorite, SORT_DESC, $label, SORT_ASC, $countryArray); |
|
763 | - else |
|
764 | - $countryArray = dol_sort_array($countryArray, 'label'); |
|
789 | + if (empty($disablefavorites)) { |
|
790 | + array_multisort($favorite, SORT_DESC, $label, SORT_ASC, $countryArray); |
|
791 | + } else { |
|
792 | + $countryArray = dol_sort_array($countryArray, 'label'); |
|
793 | + } |
|
765 | 794 | |
766 | 795 | if ($showempty) { |
767 | 796 | $out .= '<option value=""> </option>' . "\n"; |
@@ -771,8 +800,9 @@ discard block |
||
771 | 800 | //if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; |
772 | 801 | $out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
773 | 802 | $out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; |
774 | - if ($mysoc->isInEEC()) |
|
775 | - $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
|
803 | + if ($mysoc->isInEEC()) { |
|
804 | + $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; |
|
805 | + } |
|
776 | 806 | $out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; |
777 | 807 | $out .= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; |
778 | 808 | } |
@@ -783,8 +813,9 @@ discard block |
||
783 | 813 | continue; |
784 | 814 | } |
785 | 815 | |
786 | - if (empty($disablefavorites) && $row['favorite'] && $row['code_iso']) |
|
787 | - $atleastonefavorite++; |
|
816 | + if (empty($disablefavorites) && $row['favorite'] && $row['code_iso']) { |
|
817 | + $atleastonefavorite++; |
|
818 | + } |
|
788 | 819 | if (empty($row['favorite']) && $atleastonefavorite) { |
789 | 820 | $atleastonefavorite = 0; |
790 | 821 | $out .= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>'; |
@@ -795,18 +826,19 @@ discard block |
||
795 | 826 | } else { |
796 | 827 | $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '">'; |
797 | 828 | } |
798 | - if ($row['label']) |
|
799 | - $out .= dol_trunc($row['label'], $maxlength, 'middle'); |
|
800 | - else |
|
801 | - $out .= ' '; |
|
802 | - if ($row['code_iso']) |
|
803 | - $out .= ' (' . $row['code_iso'] . ')'; |
|
829 | + if ($row['label']) { |
|
830 | + $out .= dol_trunc($row['label'], $maxlength, 'middle'); |
|
831 | + } else { |
|
832 | + $out .= ' '; |
|
833 | + } |
|
834 | + if ($row['code_iso']) { |
|
835 | + $out .= ' (' . $row['code_iso'] . ')'; |
|
836 | + } |
|
804 | 837 | $out .= '</option>'; |
805 | 838 | } |
806 | 839 | } |
807 | 840 | $out .= '</select>'; |
808 | - } |
|
809 | - else { |
|
841 | + } else { |
|
810 | 842 | DolUtils::dol_print_error($this->db); |
811 | 843 | } |
812 | 844 | |
@@ -880,8 +912,9 @@ discard block |
||
880 | 912 | $out .= '<option value="' . $row['rowid'] . '">'; |
881 | 913 | } |
882 | 914 | |
883 | - if ($row['code']) |
|
884 | - $out .= $row['code']; |
|
915 | + if ($row['code']) { |
|
916 | + $out .= $row['code']; |
|
917 | + } |
|
885 | 918 | |
886 | 919 | $out .= '</option>'; |
887 | 920 | } |
@@ -919,24 +952,28 @@ discard block |
||
919 | 952 | |
920 | 953 | // If product & services are enabled or both disabled. |
921 | 954 | if ($forceall == 1 || (empty($forceall) && !empty(Globals::$conf->product->enabled) && !empty(Globals::$conf->service->enabled)) || (empty($forceall) && empty(Globals::$conf->product->enabled) && empty(Globals::$conf->service->enabled))) { |
922 | - if (empty($hidetext)) |
|
923 | - print $langs->trans("Type") . ': '; |
|
955 | + if (empty($hidetext)) { |
|
956 | + print $langs->trans("Type") . ': '; |
|
957 | + } |
|
924 | 958 | print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
925 | 959 | if ($showempty) { |
926 | 960 | print '<option value="-1"'; |
927 | - if ($selected == -1) |
|
928 | - print ' selected'; |
|
961 | + if ($selected == -1) { |
|
962 | + print ' selected'; |
|
963 | + } |
|
929 | 964 | print '> </option>'; |
930 | 965 | } |
931 | 966 | |
932 | 967 | print '<option value="0"'; |
933 | - if (0 == $selected) |
|
934 | - print ' selected'; |
|
968 | + if (0 == $selected) { |
|
969 | + print ' selected'; |
|
970 | + } |
|
935 | 971 | print '>' . $langs->trans("Product"); |
936 | 972 | |
937 | 973 | print '<option value="1"'; |
938 | - if (1 == $selected) |
|
939 | - print ' selected'; |
|
974 | + if (1 == $selected) { |
|
975 | + print ' selected'; |
|
976 | + } |
|
940 | 977 | print '>' . $langs->trans("Service"); |
941 | 978 | |
942 | 979 | print '</select>'; |
@@ -967,8 +1004,10 @@ discard block |
||
967 | 1004 | global $langs; |
968 | 1005 | |
969 | 1006 | $num = count($this->cache_types_fees); |
970 | - if ($num > 0) |
|
971 | - return 0; // Cache already loaded |
|
1007 | + if ($num > 0) { |
|
1008 | + return 0; |
|
1009 | + } |
|
1010 | + // Cache already loaded |
|
972 | 1011 | |
973 | 1012 | dol_syslog(__METHOD__, LOG_DEBUG); |
974 | 1013 | |
@@ -1022,23 +1061,26 @@ discard block |
||
1022 | 1061 | print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
1023 | 1062 | if ($showempty) { |
1024 | 1063 | print '<option value="-1"'; |
1025 | - if ($selected == -1) |
|
1026 | - print ' selected'; |
|
1064 | + if ($selected == -1) { |
|
1065 | + print ' selected'; |
|
1066 | + } |
|
1027 | 1067 | print '> </option>'; |
1028 | 1068 | } |
1029 | 1069 | |
1030 | 1070 | foreach ($this->cache_types_fees as $key => $value) { |
1031 | 1071 | print '<option value="' . $key . '"'; |
1032 | - if ($key == $selected) |
|
1033 | - print ' selected'; |
|
1072 | + if ($key == $selected) { |
|
1073 | + print ' selected'; |
|
1074 | + } |
|
1034 | 1075 | print '>'; |
1035 | 1076 | print $value; |
1036 | 1077 | print '</option>'; |
1037 | 1078 | } |
1038 | 1079 | |
1039 | 1080 | print '</select>'; |
1040 | - if ($user->admin) |
|
1041 | - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
1081 | + if ($user->admin) { |
|
1082 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
1083 | + } |
|
1042 | 1084 | } |
1043 | 1085 | |
1044 | 1086 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -1101,9 +1143,9 @@ discard block |
||
1101 | 1143 | $urloption = 'htmlname=' . $htmlname . '&outjson=1&filter=' . $filter . ($showtype ? '&showtype=' . $showtype : ''); |
1102 | 1144 | $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, Globals::$conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); |
1103 | 1145 | $out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>'; |
1104 | - if (empty($hidelabel)) |
|
1105 | - print $langs->trans("RefOrLabel") . ' : '; |
|
1106 | - else if ($hidelabel > 1) { |
|
1146 | + if (empty($hidelabel)) { |
|
1147 | + print $langs->trans("RefOrLabel") . ' : '; |
|
1148 | + } else if ($hidelabel > 1) { |
|
1107 | 1149 | $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
1108 | 1150 | if ($hidelabel == 2) { |
1109 | 1151 | $out .= img_picto($langs->trans("Search"), 'search'); |
@@ -1150,10 +1192,11 @@ discard block |
||
1150 | 1192 | $num = 0; |
1151 | 1193 | $outarray = array(); |
1152 | 1194 | |
1153 | - if ($selected === '') |
|
1154 | - $selected = array(); |
|
1155 | - else if (!is_array($selected)) |
|
1156 | - $selected = array($selected); |
|
1195 | + if ($selected === '') { |
|
1196 | + $selected = array(); |
|
1197 | + } else if (!is_array($selected)) { |
|
1198 | + $selected = array($selected); |
|
1199 | + } |
|
1157 | 1200 | |
1158 | 1201 | // Clean $filter that may contains sql conditions so sql code |
1159 | 1202 | if (function_exists('testSqlAndScriptInject')) { |
@@ -1171,21 +1214,26 @@ discard block |
||
1171 | 1214 | } |
1172 | 1215 | |
1173 | 1216 | $sql .= " FROM (" . MAIN_DB_PREFIX . "societe as s"; |
1174 | - if (!$user->rights->societe->client->voir && !$user->socid) |
|
1175 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
1217 | + if (!$user->rights->societe->client->voir && !$user->socid) { |
|
1218 | + $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
1219 | + } |
|
1176 | 1220 | $sql .= " )"; |
1177 | 1221 | if (Globals::$conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) { |
1178 | 1222 | $sql .= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "c_country as dictp ON dictp.rowid=s.fk_pays"; |
1179 | 1223 | } |
1180 | 1224 | $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; |
1181 | - if (!empty($user->socid)) |
|
1182 | - $sql .= " AND s.rowid = " . $user->socid; |
|
1183 | - if ($filter) |
|
1184 | - $sql .= " AND (" . $filter . ")"; |
|
1185 | - if (!$user->rights->societe->client->voir && !$user->socid) |
|
1186 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
1187 | - if (!empty(Globals::$conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) |
|
1188 | - $sql .= " AND s.status <> 0"; |
|
1225 | + if (!empty($user->socid)) { |
|
1226 | + $sql .= " AND s.rowid = " . $user->socid; |
|
1227 | + } |
|
1228 | + if ($filter) { |
|
1229 | + $sql .= " AND (" . $filter . ")"; |
|
1230 | + } |
|
1231 | + if (!$user->rights->societe->client->voir && !$user->socid) { |
|
1232 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
1233 | + } |
|
1234 | + if (!empty(Globals::$conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) { |
|
1235 | + $sql .= " AND s.status <> 0"; |
|
1236 | + } |
|
1189 | 1237 | // Add criteria |
1190 | 1238 | if ($filterkey && $filterkey != '') { |
1191 | 1239 | $sql .= " AND ("; |
@@ -1193,16 +1241,19 @@ discard block |
||
1193 | 1241 | // For natural search |
1194 | 1242 | $scrit = explode(' ', $filterkey); |
1195 | 1243 | $i = 0; |
1196 | - if (count($scrit) > 1) |
|
1197 | - $sql .= "("; |
|
1244 | + if (count($scrit) > 1) { |
|
1245 | + $sql .= "("; |
|
1246 | + } |
|
1198 | 1247 | foreach ($scrit as $crit) { |
1199 | - if ($i > 0) |
|
1200 | - $sql .= " AND "; |
|
1248 | + if ($i > 0) { |
|
1249 | + $sql .= " AND "; |
|
1250 | + } |
|
1201 | 1251 | $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
1202 | 1252 | $i++; |
1203 | 1253 | } |
1204 | - if (count($scrit) > 1) |
|
1205 | - $sql .= ")"; |
|
1254 | + if (count($scrit) > 1) { |
|
1255 | + $sql .= ")"; |
|
1256 | + } |
|
1206 | 1257 | if (!empty(Globals::$conf->barcode->enabled)) { |
1207 | 1258 | $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
1208 | 1259 | } |
@@ -1228,13 +1279,15 @@ discard block |
||
1228 | 1279 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
1229 | 1280 | //if (! empty(Globals::$conf->use_javascript_ajax) || $forcecombo) $textifempty=''; |
1230 | 1281 | if (!empty(Globals::$conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { |
1231 | - if ($showempty && !is_numeric($showempty)) |
|
1232 | - $textifempty = $langs->trans($showempty); |
|
1233 | - else |
|
1234 | - $textifempty .= $langs->trans("All"); |
|
1282 | + if ($showempty && !is_numeric($showempty)) { |
|
1283 | + $textifempty = $langs->trans($showempty); |
|
1284 | + } else { |
|
1285 | + $textifempty .= $langs->trans("All"); |
|
1286 | + } |
|
1235 | 1287 | } |
1236 | - if ($showempty) |
|
1237 | - $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
1288 | + if ($showempty) { |
|
1289 | + $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
1290 | + } |
|
1238 | 1291 | |
1239 | 1292 | $num = $this->db->num_rows($resql); |
1240 | 1293 | $i = 0; |
@@ -1259,16 +1312,21 @@ discard block |
||
1259 | 1312 | } |
1260 | 1313 | |
1261 | 1314 | if ($showtype) { |
1262 | - if ($obj->client || $obj->fournisseur) |
|
1263 | - $label .= ' ('; |
|
1264 | - if ($obj->client == 1 || $obj->client == 3) |
|
1265 | - $label .= $langs->trans("Customer"); |
|
1266 | - if ($obj->client == 2 || $obj->client == 3) |
|
1267 | - $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); |
|
1268 | - if ($obj->fournisseur) |
|
1269 | - $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); |
|
1270 | - if ($obj->client || $obj->fournisseur) |
|
1271 | - $label .= ')'; |
|
1315 | + if ($obj->client || $obj->fournisseur) { |
|
1316 | + $label .= ' ('; |
|
1317 | + } |
|
1318 | + if ($obj->client == 1 || $obj->client == 3) { |
|
1319 | + $label .= $langs->trans("Customer"); |
|
1320 | + } |
|
1321 | + if ($obj->client == 2 || $obj->client == 3) { |
|
1322 | + $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); |
|
1323 | + } |
|
1324 | + if ($obj->fournisseur) { |
|
1325 | + $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); |
|
1326 | + } |
|
1327 | + if ($obj->client || $obj->fournisseur) { |
|
1328 | + $label .= ')'; |
|
1329 | + } |
|
1272 | 1330 | } |
1273 | 1331 | |
1274 | 1332 | if (Globals::$conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) { |
@@ -1289,20 +1347,21 @@ discard block |
||
1289 | 1347 | } |
1290 | 1348 | |
1291 | 1349 | $i++; |
1292 | - if (($i % 10) == 0) |
|
1293 | - $out .= "\n"; |
|
1350 | + if (($i % 10) == 0) { |
|
1351 | + $out .= "\n"; |
|
1352 | + } |
|
1294 | 1353 | } |
1295 | 1354 | } |
1296 | 1355 | $out .= '</select>' . "\n"; |
1297 | - } |
|
1298 | - else { |
|
1356 | + } else { |
|
1299 | 1357 | DolUtils::dol_print_error($this->db); |
1300 | 1358 | } |
1301 | 1359 | |
1302 | 1360 | $this->result = array('nbofthirdparties' => $num); |
1303 | 1361 | |
1304 | - if ($outputmode) |
|
1305 | - return $outarray; |
|
1362 | + if ($outputmode) { |
|
1363 | + return $outarray; |
|
1364 | + } |
|
1306 | 1365 | return $out; |
1307 | 1366 | } |
1308 | 1367 | |
@@ -1328,8 +1387,9 @@ discard block |
||
1328 | 1387 | $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re"; |
1329 | 1388 | $sql .= " WHERE re.fk_soc = " . (int) $socid; |
1330 | 1389 | $sql .= " AND re.entity = " . Globals::$conf->entity; |
1331 | - if ($filter) |
|
1332 | - $sql .= " AND " . $filter; |
|
1390 | + if ($filter) { |
|
1391 | + $sql .= " AND " . $filter; |
|
1392 | + } |
|
1333 | 1393 | $sql .= " ORDER BY re.description ASC"; |
1334 | 1394 | |
1335 | 1395 | dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG); |
@@ -1346,18 +1406,23 @@ discard block |
||
1346 | 1406 | while ($i < $num) { |
1347 | 1407 | $obj = $this->db->fetch_object($resql); |
1348 | 1408 | $desc = dol_trunc($obj->description, 40); |
1349 | - if (preg_match('/\(CREDIT_NOTE\)/', $desc)) |
|
1350 | - $desc = preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $desc); |
|
1351 | - if (preg_match('/\(DEPOSIT\)/', $desc)) |
|
1352 | - $desc = preg_replace('/\(DEPOSIT\)/', $langs->trans("Deposit"), $desc); |
|
1353 | - if (preg_match('/\(EXCESS RECEIVED\)/', $desc)) |
|
1354 | - $desc = preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("ExcessReceived"), $desc); |
|
1355 | - if (preg_match('/\(EXCESS PAID\)/', $desc)) |
|
1356 | - $desc = preg_replace('/\(EXCESS PAID\)/', $langs->trans("ExcessPaid"), $desc); |
|
1409 | + if (preg_match('/\(CREDIT_NOTE\)/', $desc)) { |
|
1410 | + $desc = preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $desc); |
|
1411 | + } |
|
1412 | + if (preg_match('/\(DEPOSIT\)/', $desc)) { |
|
1413 | + $desc = preg_replace('/\(DEPOSIT\)/', $langs->trans("Deposit"), $desc); |
|
1414 | + } |
|
1415 | + if (preg_match('/\(EXCESS RECEIVED\)/', $desc)) { |
|
1416 | + $desc = preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("ExcessReceived"), $desc); |
|
1417 | + } |
|
1418 | + if (preg_match('/\(EXCESS PAID\)/', $desc)) { |
|
1419 | + $desc = preg_replace('/\(EXCESS PAID\)/', $langs->trans("ExcessPaid"), $desc); |
|
1420 | + } |
|
1357 | 1421 | |
1358 | 1422 | $selectstring = ''; |
1359 | - if ($selected > 0 && $selected == $obj->rowid) |
|
1360 | - $selectstring = ' selected'; |
|
1423 | + if ($selected > 0 && $selected == $obj->rowid) { |
|
1424 | + $selectstring = ' selected'; |
|
1425 | + } |
|
1361 | 1426 | |
1362 | 1427 | $disabled = ''; |
1363 | 1428 | if ($maxvalue > 0 && $obj->amount_ttc > $maxvalue) { |
@@ -1367,8 +1432,9 @@ discard block |
||
1367 | 1432 | |
1368 | 1433 | if (!empty(Globals::$conf->global->MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST) && !empty($obj->fk_facture_source)) { |
1369 | 1434 | $tmpfac = new Facture($this->db); |
1370 | - if ($tmpfac->fetch($obj->fk_facture_source) > 0) |
|
1371 | - $desc = $desc . ' - ' . $tmpfac->ref; |
|
1435 | + if ($tmpfac->fetch($obj->fk_facture_source) > 0) { |
|
1436 | + $desc = $desc . ' - ' . $tmpfac->ref; |
|
1437 | + } |
|
1372 | 1438 | } |
1373 | 1439 | |
1374 | 1440 | print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; |
@@ -1377,8 +1443,7 @@ discard block |
||
1377 | 1443 | } |
1378 | 1444 | print '</select>'; |
1379 | 1445 | return $qualifiedlines; |
1380 | - } |
|
1381 | - else { |
|
1446 | + } else { |
|
1382 | 1447 | DolUtils::dol_print_error($this->db); |
1383 | 1448 | return -1; |
1384 | 1449 | } |
@@ -1441,13 +1506,15 @@ discard block |
||
1441 | 1506 | |
1442 | 1507 | $langs->load('companies'); |
1443 | 1508 | |
1444 | - if (empty($htmlid)) |
|
1445 | - $htmlid = $htmlname; |
|
1509 | + if (empty($htmlid)) { |
|
1510 | + $htmlid = $htmlname; |
|
1511 | + } |
|
1446 | 1512 | |
1447 | - if ($selected === '') |
|
1448 | - $selected = array(); |
|
1449 | - else if (!is_array($selected)) |
|
1450 | - $selected = array($selected); |
|
1513 | + if ($selected === '') { |
|
1514 | + $selected = array(); |
|
1515 | + } else if (!is_array($selected)) { |
|
1516 | + $selected = array($selected); |
|
1517 | + } |
|
1451 | 1518 | $out = ''; |
1452 | 1519 | |
1453 | 1520 | if (!is_object($hookmanager)) { |
@@ -1457,16 +1524,20 @@ discard block |
||
1457 | 1524 | |
1458 | 1525 | // We search third parties |
1459 | 1526 | $sql = "SELECT sp.rowid, sp.lastname, sp.statut, sp.firstname, sp.poste"; |
1460 | - if ($showsoc > 0) |
|
1461 | - $sql .= " , s.nom as company"; |
|
1527 | + if ($showsoc > 0) { |
|
1528 | + $sql .= " , s.nom as company"; |
|
1529 | + } |
|
1462 | 1530 | $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as sp"; |
1463 | - if ($showsoc > 0) |
|
1464 | - $sql .= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid=sp.fk_soc"; |
|
1531 | + if ($showsoc > 0) { |
|
1532 | + $sql .= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid=sp.fk_soc"; |
|
1533 | + } |
|
1465 | 1534 | $sql .= " WHERE sp.entity IN (" . getEntity('socpeople') . ")"; |
1466 | - if ($socid > 0 || $socid == -1) |
|
1467 | - $sql .= " AND sp.fk_soc=" . $socid; |
|
1468 | - if (!empty(Globals::$conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) |
|
1469 | - $sql .= " AND sp.statut <> 0"; |
|
1535 | + if ($socid > 0 || $socid == -1) { |
|
1536 | + $sql .= " AND sp.fk_soc=" . $socid; |
|
1537 | + } |
|
1538 | + if (!empty(Globals::$conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) { |
|
1539 | + $sql .= " AND sp.statut <> 0"; |
|
1540 | + } |
|
1470 | 1541 | $sql .= " ORDER BY sp.lastname ASC"; |
1471 | 1542 | |
1472 | 1543 | dol_syslog(get_class($this) . "::select_contacts", LOG_DEBUG); |
@@ -1479,12 +1550,15 @@ discard block |
||
1479 | 1550 | $out .= ajax_combobox($htmlid, $events, Globals::$conf->global->CONTACT_USE_SEARCH_TO_SELECT); |
1480 | 1551 | } |
1481 | 1552 | |
1482 | - if ($htmlname != 'none' || $options_only) |
|
1483 | - $out .= '<select class="flat' . ($moreclass ? ' ' . $moreclass : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; |
|
1484 | - if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) |
|
1485 | - $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; |
|
1486 | - if ($showempty == 2) |
|
1487 | - $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>' . $langs->trans("Internal") . '</option>'; |
|
1553 | + if ($htmlname != 'none' || $options_only) { |
|
1554 | + $out .= '<select class="flat' . ($moreclass ? ' ' . $moreclass : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>'; |
|
1555 | + } |
|
1556 | + if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { |
|
1557 | + $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>'; |
|
1558 | + } |
|
1559 | + if ($showempty == 2) { |
|
1560 | + $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>' . $langs->trans("Internal") . '</option>'; |
|
1561 | + } |
|
1488 | 1562 | $num = $this->db->num_rows($resql); |
1489 | 1563 | $i = 0; |
1490 | 1564 | if ($num) { |
@@ -1500,49 +1574,56 @@ discard block |
||
1500 | 1574 | if ($obj->statut == 1) { |
1501 | 1575 | if ($htmlname != 'none') { |
1502 | 1576 | $disabled = 0; |
1503 | - if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude)) |
|
1504 | - $disabled = 1; |
|
1505 | - if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) |
|
1506 | - $disabled = 1; |
|
1577 | + if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude)) { |
|
1578 | + $disabled = 1; |
|
1579 | + } |
|
1580 | + if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) { |
|
1581 | + $disabled = 1; |
|
1582 | + } |
|
1507 | 1583 | if (!empty($selected) && in_array($obj->rowid, $selected)) { |
1508 | 1584 | $out .= '<option value="' . $obj->rowid . '"'; |
1509 | - if ($disabled) |
|
1510 | - $out .= ' disabled'; |
|
1585 | + if ($disabled) { |
|
1586 | + $out .= ' disabled'; |
|
1587 | + } |
|
1511 | 1588 | $out .= ' selected>'; |
1512 | 1589 | $out .= $contactstatic->getFullName($langs); |
1513 | - if ($showfunction && $obj->poste) |
|
1514 | - $out .= ' (' . $obj->poste . ')'; |
|
1515 | - if (($showsoc > 0) && $obj->company) |
|
1516 | - $out .= ' - (' . $obj->company . ')'; |
|
1590 | + if ($showfunction && $obj->poste) { |
|
1591 | + $out .= ' (' . $obj->poste . ')'; |
|
1592 | + } |
|
1593 | + if (($showsoc > 0) && $obj->company) { |
|
1594 | + $out .= ' - (' . $obj->company . ')'; |
|
1595 | + } |
|
1517 | 1596 | $out .= '</option>'; |
1518 | - } |
|
1519 | - else { |
|
1597 | + } else { |
|
1520 | 1598 | $out .= '<option value="' . $obj->rowid . '"'; |
1521 | - if ($disabled) |
|
1522 | - $out .= ' disabled'; |
|
1599 | + if ($disabled) { |
|
1600 | + $out .= ' disabled'; |
|
1601 | + } |
|
1523 | 1602 | $out .= '>'; |
1524 | 1603 | $out .= $contactstatic->getFullName($langs); |
1525 | - if ($showfunction && $obj->poste) |
|
1526 | - $out .= ' (' . $obj->poste . ')'; |
|
1527 | - if (($showsoc > 0) && $obj->company) |
|
1528 | - $out .= ' - (' . $obj->company . ')'; |
|
1604 | + if ($showfunction && $obj->poste) { |
|
1605 | + $out .= ' (' . $obj->poste . ')'; |
|
1606 | + } |
|
1607 | + if (($showsoc > 0) && $obj->company) { |
|
1608 | + $out .= ' - (' . $obj->company . ')'; |
|
1609 | + } |
|
1529 | 1610 | $out .= '</option>'; |
1530 | 1611 | } |
1531 | - } |
|
1532 | - else { |
|
1612 | + } else { |
|
1533 | 1613 | if (in_array($obj->rowid, $selected)) { |
1534 | 1614 | $out .= $contactstatic->getFullName($langs); |
1535 | - if ($showfunction && $obj->poste) |
|
1536 | - $out .= ' (' . $obj->poste . ')'; |
|
1537 | - if (($showsoc > 0) && $obj->company) |
|
1538 | - $out .= ' - (' . $obj->company . ')'; |
|
1615 | + if ($showfunction && $obj->poste) { |
|
1616 | + $out .= ' (' . $obj->poste . ')'; |
|
1617 | + } |
|
1618 | + if (($showsoc > 0) && $obj->company) { |
|
1619 | + $out .= ' - (' . $obj->company . ')'; |
|
1620 | + } |
|
1539 | 1621 | } |
1540 | 1622 | } |
1541 | 1623 | } |
1542 | 1624 | $i++; |
1543 | 1625 | } |
1544 | - } |
|
1545 | - else { |
|
1626 | + } else { |
|
1546 | 1627 | $out .= '<option value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled>'; |
1547 | 1628 | $out .= ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); |
1548 | 1629 | $out .= '</option>'; |
@@ -1623,24 +1704,27 @@ discard block |
||
1623 | 1704 | global $conf, $user, $langs; |
1624 | 1705 | |
1625 | 1706 | // If no preselected user defined, we take current user |
1626 | - if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty(Globals::$conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) |
|
1627 | - $selected = $user->id; |
|
1707 | + if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty(Globals::$conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) { |
|
1708 | + $selected = $user->id; |
|
1709 | + } |
|
1628 | 1710 | |
1629 | - if ($selected === '') |
|
1630 | - $selected = array(); |
|
1631 | - else if (!is_array($selected)) |
|
1632 | - $selected = array($selected); |
|
1711 | + if ($selected === '') { |
|
1712 | + $selected = array(); |
|
1713 | + } else if (!is_array($selected)) { |
|
1714 | + $selected = array($selected); |
|
1715 | + } |
|
1633 | 1716 | |
1634 | 1717 | $excludeUsers = null; |
1635 | 1718 | $includeUsers = null; |
1636 | 1719 | |
1637 | 1720 | // Permettre l'exclusion d'utilisateurs |
1638 | - if (is_array($exclude)) |
|
1639 | - $excludeUsers = implode(",", $exclude); |
|
1721 | + if (is_array($exclude)) { |
|
1722 | + $excludeUsers = implode(",", $exclude); |
|
1723 | + } |
|
1640 | 1724 | // Permettre l'inclusion d'utilisateurs |
1641 | - if (is_array($include)) |
|
1642 | - $includeUsers = implode(",", $include); |
|
1643 | - else if ($include == 'hierarchy') { |
|
1725 | + if (is_array($include)) { |
|
1726 | + $includeUsers = implode(",", $include); |
|
1727 | + } else if ($include == 'hierarchy') { |
|
1644 | 1728 | // Build list includeUsers to have only hierarchy |
1645 | 1729 | $includeUsers = implode(",", $user->getAllChildIds(0)); |
1646 | 1730 | } else if ($include == 'hierarchyme') { |
@@ -1659,12 +1743,12 @@ discard block |
||
1659 | 1743 | $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
1660 | 1744 | if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) { |
1661 | 1745 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entity as e ON e.rowid=u.entity"; |
1662 | - if ($force_entity) |
|
1663 | - $sql .= " WHERE u.entity IN (0," . $force_entity . ")"; |
|
1664 | - else |
|
1665 | - $sql .= " WHERE u.entity IS NOT NULL"; |
|
1666 | - } |
|
1667 | - else { |
|
1746 | + if ($force_entity) { |
|
1747 | + $sql .= " WHERE u.entity IN (0," . $force_entity . ")"; |
|
1748 | + } else { |
|
1749 | + $sql .= " WHERE u.entity IS NOT NULL"; |
|
1750 | + } |
|
1751 | + } else { |
|
1668 | 1752 | if (!empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
1669 | 1753 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ug"; |
1670 | 1754 | $sql .= " ON ug.fk_user = u.rowid"; |
@@ -1673,16 +1757,21 @@ discard block |
||
1673 | 1757 | $sql .= " WHERE u.entity IN (0," . Globals::$conf->entity . ")"; |
1674 | 1758 | } |
1675 | 1759 | } |
1676 | - if (!empty($user->societe_id)) |
|
1677 | - $sql .= " AND u.fk_soc = " . $user->societe_id; |
|
1678 | - if (is_array($exclude) && $excludeUsers) |
|
1679 | - $sql .= " AND u.rowid NOT IN (" . $excludeUsers . ")"; |
|
1680 | - if ($includeUsers) |
|
1681 | - $sql .= " AND u.rowid IN (" . $includeUsers . ")"; |
|
1682 | - if (!empty(Globals::$conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) |
|
1683 | - $sql .= " AND u.statut <> 0"; |
|
1684 | - if (!empty($morefilter)) |
|
1685 | - $sql .= " " . $morefilter; |
|
1760 | + if (!empty($user->societe_id)) { |
|
1761 | + $sql .= " AND u.fk_soc = " . $user->societe_id; |
|
1762 | + } |
|
1763 | + if (is_array($exclude) && $excludeUsers) { |
|
1764 | + $sql .= " AND u.rowid NOT IN (" . $excludeUsers . ")"; |
|
1765 | + } |
|
1766 | + if ($includeUsers) { |
|
1767 | + $sql .= " AND u.rowid IN (" . $includeUsers . ")"; |
|
1768 | + } |
|
1769 | + if (!empty(Globals::$conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) { |
|
1770 | + $sql .= " AND u.statut <> 0"; |
|
1771 | + } |
|
1772 | + if (!empty($morefilter)) { |
|
1773 | + $sql .= " " . $morefilter; |
|
1774 | + } |
|
1686 | 1775 | |
1687 | 1776 | if (empty(Globals::$conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname |
1688 | 1777 | $sql .= " ORDER BY u.firstname ASC"; |
@@ -1702,10 +1791,12 @@ discard block |
||
1702 | 1791 | |
1703 | 1792 | // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined |
1704 | 1793 | $out .= '<select class="flat' . ($morecss ? ' minwidth100 ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>'; |
1705 | - if ($show_empty && !$multiple) |
|
1706 | - $out .= '<option value="-1"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '> </option>' . "\n"; |
|
1707 | - if ($show_every) |
|
1708 | - $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; |
|
1794 | + if ($show_empty && !$multiple) { |
|
1795 | + $out .= '<option value="-1"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '> </option>' . "\n"; |
|
1796 | + } |
|
1797 | + if ($show_every) { |
|
1798 | + $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; |
|
1799 | + } |
|
1709 | 1800 | |
1710 | 1801 | $userstatic = new User($this->db); |
1711 | 1802 | |
@@ -1717,19 +1808,21 @@ discard block |
||
1717 | 1808 | $userstatic->firstname = $obj->firstname; |
1718 | 1809 | |
1719 | 1810 | $disableline = ''; |
1720 | - if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly)) |
|
1721 | - $disableline = ($enableonlytext ? $enableonlytext : '1'); |
|
1811 | + if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly)) { |
|
1812 | + $disableline = ($enableonlytext ? $enableonlytext : '1'); |
|
1813 | + } |
|
1722 | 1814 | |
1723 | 1815 | if ((is_object($selected) && $selected->id == $obj->rowid) || (!is_object($selected) && in_array($obj->rowid, $selected) )) { |
1724 | 1816 | $out .= '<option value="' . $obj->rowid . '"'; |
1725 | - if ($disableline) |
|
1726 | - $out .= ' disabled'; |
|
1817 | + if ($disableline) { |
|
1818 | + $out .= ' disabled'; |
|
1819 | + } |
|
1727 | 1820 | $out .= ' selected>'; |
1728 | - } |
|
1729 | - else { |
|
1821 | + } else { |
|
1730 | 1822 | $out .= '<option value="' . $obj->rowid . '"'; |
1731 | - if ($disableline) |
|
1732 | - $out .= ' disabled'; |
|
1823 | + if ($disableline) { |
|
1824 | + $out .= ' disabled'; |
|
1825 | + } |
|
1733 | 1826 | $out .= '>'; |
1734 | 1827 | } |
1735 | 1828 | |
@@ -1783,8 +1876,9 @@ discard block |
||
1783 | 1876 | DolUtils::dol_print_error($this->db); |
1784 | 1877 | } |
1785 | 1878 | |
1786 | - if ($outputmode) |
|
1787 | - return $outarray; |
|
1879 | + if ($outputmode) { |
|
1880 | + return $outarray; |
|
1881 | + } |
|
1788 | 1882 | return $out; |
1789 | 1883 | } |
1790 | 1884 | |
@@ -1836,15 +1930,18 @@ discard block |
||
1836 | 1930 | } |
1837 | 1931 | $nbassignetouser = count($assignedtouser); |
1838 | 1932 | |
1839 | - if ($nbassignetouser && $action != 'view') |
|
1840 | - $out .= '<br>'; |
|
1841 | - if ($nbassignetouser) |
|
1842 | - $out .= '<ul class="attendees">'; |
|
1933 | + if ($nbassignetouser && $action != 'view') { |
|
1934 | + $out .= '<br>'; |
|
1935 | + } |
|
1936 | + if ($nbassignetouser) { |
|
1937 | + $out .= '<ul class="attendees">'; |
|
1938 | + } |
|
1843 | 1939 | $i = 0; |
1844 | 1940 | $ownerid = 0; |
1845 | 1941 | foreach ($assignedtouser as $key => $value) { |
1846 | - if ($value['id'] == $ownerid) |
|
1847 | - continue; |
|
1942 | + if ($value['id'] == $ownerid) { |
|
1943 | + continue; |
|
1944 | + } |
|
1848 | 1945 | |
1849 | 1946 | $out .= '<li>'; |
1850 | 1947 | $userstatic->fetch($value['id']); |
@@ -1870,8 +1967,9 @@ discard block |
||
1870 | 1967 | $out .= '</li>'; |
1871 | 1968 | $i++; |
1872 | 1969 | } |
1873 | - if ($nbassignetouser) |
|
1874 | - $out .= '</ul>'; |
|
1970 | + if ($nbassignetouser) { |
|
1971 | + $out .= '</ul>'; |
|
1972 | + } |
|
1875 | 1973 | |
1876 | 1974 | //$out.='</form>'; |
1877 | 1975 | return $out; |
@@ -2002,9 +2100,9 @@ discard block |
||
2002 | 2100 | </script> |
2003 | 2101 | <?php |
2004 | 2102 | } |
2005 | - if (empty($hidelabel)) |
|
2006 | - print $langs->trans("RefOrLabel") . ' : '; |
|
2007 | - else if ($hidelabel > 1) { |
|
2103 | + if (empty($hidelabel)) { |
|
2104 | + print $langs->trans("RefOrLabel") . ' : '; |
|
2105 | + } else if ($hidelabel > 1) { |
|
2008 | 2106 | $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; |
2009 | 2107 | if ($hidelabel == 2) { |
2010 | 2108 | print img_picto($langs->trans("Search"), 'search'); |
@@ -2095,13 +2193,15 @@ discard block |
||
2095 | 2193 | // Price by quantity |
2096 | 2194 | if (!empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { |
2097 | 2195 | $sql .= ", (SELECT pp.rowid FROM " . MAIN_DB_PREFIX . "product_price as pp WHERE pp.fk_product = p.rowid"; |
2098 | - if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) |
|
2099 | - $sql .= " AND price_level=" . $price_level; |
|
2196 | + if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { |
|
2197 | + $sql .= " AND price_level=" . $price_level; |
|
2198 | + } |
|
2100 | 2199 | $sql .= " ORDER BY date_price"; |
2101 | 2200 | $sql .= " DESC LIMIT 1) as price_rowid"; |
2102 | 2201 | $sql .= ", (SELECT pp.price_by_qty FROM " . MAIN_DB_PREFIX . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable |
2103 | - if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) |
|
2104 | - $sql .= " AND price_level=" . $price_level; |
|
2202 | + if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { |
|
2203 | + $sql .= " AND price_level=" . $price_level; |
|
2204 | + } |
|
2105 | 2205 | $sql .= " ORDER BY date_price"; |
2106 | 2206 | $sql .= " DESC LIMIT 1) as price_by_qty"; |
2107 | 2207 | $selectFields .= ", price_rowid, price_by_qty"; |
@@ -2143,14 +2243,15 @@ discard block |
||
2143 | 2243 | $sql .= " AND p.finished = " . $finished; |
2144 | 2244 | } elseif ($finished == 1) { |
2145 | 2245 | $sql .= " AND p.finished = " . $finished; |
2146 | - if ($status >= 0) |
|
2147 | - $sql .= " AND p.tosell = " . $status; |
|
2148 | - } |
|
2149 | - elseif ($status >= 0) { |
|
2246 | + if ($status >= 0) { |
|
2247 | + $sql .= " AND p.tosell = " . $status; |
|
2248 | + } |
|
2249 | + } elseif ($status >= 0) { |
|
2150 | 2250 | $sql .= " AND p.tosell = " . $status; |
2151 | 2251 | } |
2152 | - if (strval($filtertype) != '') |
|
2153 | - $sql .= " AND p.fk_product_type=" . $filtertype; |
|
2252 | + if (strval($filtertype) != '') { |
|
2253 | + $sql .= " AND p.fk_product_type=" . $filtertype; |
|
2254 | + } |
|
2154 | 2255 | // Add criteria on ref/label |
2155 | 2256 | if ($filterkey != '') { |
2156 | 2257 | $sql .= ' AND ('; |
@@ -2158,28 +2259,35 @@ discard block |
||
2158 | 2259 | // For natural search |
2159 | 2260 | $scrit = explode(' ', $filterkey); |
2160 | 2261 | $i = 0; |
2161 | - if (count($scrit) > 1) |
|
2162 | - $sql .= "("; |
|
2262 | + if (count($scrit) > 1) { |
|
2263 | + $sql .= "("; |
|
2264 | + } |
|
2163 | 2265 | foreach ($scrit as $crit) { |
2164 | - if ($i > 0) |
|
2165 | - $sql .= " AND "; |
|
2266 | + if ($i > 0) { |
|
2267 | + $sql .= " AND "; |
|
2268 | + } |
|
2166 | 2269 | $sql .= "(p.ref LIKE '" . $db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $db->escape($prefix . $crit) . "%'"; |
2167 | - if (!empty(Globals::$conf->global->MAIN_MULTILANGS)) |
|
2168 | - $sql .= " OR pl.label LIKE '" . $db->escape($prefix . $crit) . "%'"; |
|
2270 | + if (!empty(Globals::$conf->global->MAIN_MULTILANGS)) { |
|
2271 | + $sql .= " OR pl.label LIKE '" . $db->escape($prefix . $crit) . "%'"; |
|
2272 | + } |
|
2169 | 2273 | if (!empty(Globals::$conf->global->PRODUCT_AJAX_SEARCH_ON_DESCRIPTION)) { |
2170 | 2274 | $sql .= " OR p.description LIKE '" . $db->escape($prefix . $crit) . "%'"; |
2171 | - if (!empty(Globals::$conf->global->MAIN_MULTILANGS)) |
|
2172 | - $sql .= " OR pl.description LIKE '" . $db->escape($prefix . $crit) . "%'"; |
|
2275 | + if (!empty(Globals::$conf->global->MAIN_MULTILANGS)) { |
|
2276 | + $sql .= " OR pl.description LIKE '" . $db->escape($prefix . $crit) . "%'"; |
|
2277 | + } |
|
2173 | 2278 | } |
2174 | - if (!empty(Globals::$conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) |
|
2175 | - $sql .= " OR pfp.ref_fourn LIKE '" . $db->escape($prefix . $crit) . "%'"; |
|
2279 | + if (!empty(Globals::$conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) { |
|
2280 | + $sql .= " OR pfp.ref_fourn LIKE '" . $db->escape($prefix . $crit) . "%'"; |
|
2281 | + } |
|
2176 | 2282 | $sql .= ")"; |
2177 | 2283 | $i++; |
2178 | 2284 | } |
2179 | - if (count($scrit) > 1) |
|
2180 | - $sql .= ")"; |
|
2181 | - if (!empty(Globals::$conf->barcode->enabled)) |
|
2182 | - $sql .= " OR p.barcode LIKE '" . $db->escape($prefix . $filterkey) . "%'"; |
|
2285 | + if (count($scrit) > 1) { |
|
2286 | + $sql .= ")"; |
|
2287 | + } |
|
2288 | + if (!empty(Globals::$conf->barcode->enabled)) { |
|
2289 | + $sql .= " OR p.barcode LIKE '" . $db->escape($prefix . $filterkey) . "%'"; |
|
2290 | + } |
|
2183 | 2291 | $sql .= ')'; |
2184 | 2292 | } |
2185 | 2293 | if (count($warehouseStatusArray)) { |
@@ -2218,13 +2326,15 @@ discard block |
||
2218 | 2326 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. |
2219 | 2327 | //if (! empty(Globals::$conf->use_javascript_ajax) || $forcecombo) $textifempty=''; |
2220 | 2328 | if (!empty(Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { |
2221 | - if ($showempty && !is_numeric($showempty)) |
|
2222 | - $textifempty = $langs->trans($showempty); |
|
2223 | - else |
|
2224 | - $textifempty .= $langs->trans("All"); |
|
2329 | + if ($showempty && !is_numeric($showempty)) { |
|
2330 | + $textifempty = $langs->trans($showempty); |
|
2331 | + } else { |
|
2332 | + $textifempty .= $langs->trans("All"); |
|
2333 | + } |
|
2225 | 2334 | } |
2226 | - if ($showempty) |
|
2227 | - $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
2335 | + if ($showempty) { |
|
2336 | + $out .= '<option value="0" selected>' . $textifempty . '</option>'; |
|
2337 | + } |
|
2228 | 2338 | |
2229 | 2339 | $i = 0; |
2230 | 2340 | while ($num && $i < $num) { |
@@ -2298,11 +2408,11 @@ discard block |
||
2298 | 2408 | |
2299 | 2409 | $this->db->free($result); |
2300 | 2410 | |
2301 | - if (empty($outputmode)) |
|
2302 | - return $out; |
|
2411 | + if (empty($outputmode)) { |
|
2412 | + return $out; |
|
2413 | + } |
|
2303 | 2414 | return $outarray; |
2304 | - } |
|
2305 | - else { |
|
2415 | + } else { |
|
2306 | 2416 | DolUtils::dol_print_error($db); |
2307 | 2417 | } |
2308 | 2418 | } |
@@ -2339,10 +2449,12 @@ discard block |
||
2339 | 2449 | $maxlengtharticle = (empty(Globals::$conf->global->PRODUCT_MAX_LENGTH_COMBO) ? 48 : Globals::$conf->global->PRODUCT_MAX_LENGTH_COMBO); |
2340 | 2450 | |
2341 | 2451 | $label = $objp->label; |
2342 | - if (!empty($objp->label_translated)) |
|
2343 | - $label = $objp->label_translated; |
|
2344 | - if (!empty($filterkey) && $filterkey != '') |
|
2345 | - $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1); |
|
2452 | + if (!empty($objp->label_translated)) { |
|
2453 | + $label = $objp->label_translated; |
|
2454 | + } |
|
2455 | + if (!empty($filterkey) && $filterkey != '') { |
|
2456 | + $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1); |
|
2457 | + } |
|
2346 | 2458 | |
2347 | 2459 | $outkey = $objp->rowid; |
2348 | 2460 | $outref = $objp->ref; |
@@ -2360,23 +2472,27 @@ discard block |
||
2360 | 2472 | $opt .= ' pbq="' . $objp->price_by_qty_rowid . '" data-pbq="' . $objp->price_by_qty_rowid . '" data-pbqqty="' . $objp->price_by_qty_quantity . '" data-pbqpercent="' . $objp->price_by_qty_remise_percent . '"'; |
2361 | 2473 | } |
2362 | 2474 | if (!empty(Globals::$conf->stock->enabled) && $objp->fk_product_type == 0 && isset($objp->stock)) { |
2363 | - if ($objp->stock > 0) |
|
2364 | - $opt .= ' class="product_line_stock_ok"'; |
|
2365 | - else if ($objp->stock <= 0) |
|
2366 | - $opt .= ' class="product_line_stock_too_low"'; |
|
2475 | + if ($objp->stock > 0) { |
|
2476 | + $opt .= ' class="product_line_stock_ok"'; |
|
2477 | + } else if ($objp->stock <= 0) { |
|
2478 | + $opt .= ' class="product_line_stock_too_low"'; |
|
2479 | + } |
|
2367 | 2480 | } |
2368 | 2481 | $opt .= '>'; |
2369 | 2482 | $opt .= $objp->ref; |
2370 | - if ($outbarcode) |
|
2371 | - $opt .= ' (' . $outbarcode . ')'; |
|
2483 | + if ($outbarcode) { |
|
2484 | + $opt .= ' (' . $outbarcode . ')'; |
|
2485 | + } |
|
2372 | 2486 | $opt .= ' - ' . dol_trunc($label, $maxlengtharticle); |
2373 | 2487 | |
2374 | 2488 | $objRef = $objp->ref; |
2375 | - if (!empty($filterkey) && $filterkey != '') |
|
2376 | - $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
2489 | + if (!empty($filterkey) && $filterkey != '') { |
|
2490 | + $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
2491 | + } |
|
2377 | 2492 | $outval .= $objRef; |
2378 | - if ($outbarcode) |
|
2379 | - $outval .= ' (' . $outbarcode . ')'; |
|
2493 | + if ($outbarcode) { |
|
2494 | + $outval .= ' (' . $outbarcode . ')'; |
|
2495 | + } |
|
2380 | 2496 | $outval .= ' - ' . dol_trunc($label, $maxlengtharticle); |
2381 | 2497 | |
2382 | 2498 | $found = 0; |
@@ -2575,15 +2691,18 @@ discard block |
||
2575 | 2691 | $sql .= " pfp.supplier_reputation"; |
2576 | 2692 | $sql .= " FROM " . MAIN_DB_PREFIX . "product as p"; |
2577 | 2693 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; |
2578 | - if ($socid) |
|
2579 | - $sql .= " AND pfp.fk_soc = " . $socid; |
|
2694 | + if ($socid) { |
|
2695 | + $sql .= " AND pfp.fk_soc = " . $socid; |
|
2696 | + } |
|
2580 | 2697 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON pfp.fk_soc = s.rowid"; |
2581 | 2698 | $sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; |
2582 | 2699 | $sql .= " AND p.tobuy = 1"; |
2583 | - if (strval($filtertype) != '') |
|
2584 | - $sql .= " AND p.fk_product_type=" . $this->db->escape($filtertype); |
|
2585 | - if (!empty($filtre)) |
|
2586 | - $sql .= " " . $filtre; |
|
2700 | + if (strval($filtertype) != '') { |
|
2701 | + $sql .= " AND p.fk_product_type=" . $this->db->escape($filtertype); |
|
2702 | + } |
|
2703 | + if (!empty($filtre)) { |
|
2704 | + $sql .= " " . $filtre; |
|
2705 | + } |
|
2587 | 2706 | // Add criteria on ref/label |
2588 | 2707 | if ($filterkey != '') { |
2589 | 2708 | $sql .= ' AND ('; |
@@ -2591,18 +2710,22 @@ discard block |
||
2591 | 2710 | // For natural search |
2592 | 2711 | $scrit = explode(' ', $filterkey); |
2593 | 2712 | $i = 0; |
2594 | - if (count($scrit) > 1) |
|
2595 | - $sql .= "("; |
|
2713 | + if (count($scrit) > 1) { |
|
2714 | + $sql .= "("; |
|
2715 | + } |
|
2596 | 2716 | foreach ($scrit as $crit) { |
2597 | - if ($i > 0) |
|
2598 | - $sql .= " AND "; |
|
2717 | + if ($i > 0) { |
|
2718 | + $sql .= " AND "; |
|
2719 | + } |
|
2599 | 2720 | $sql .= "(pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%')"; |
2600 | 2721 | $i++; |
2601 | 2722 | } |
2602 | - if (count($scrit) > 1) |
|
2603 | - $sql .= ")"; |
|
2604 | - if (!empty(Globals::$conf->barcode->enabled)) |
|
2605 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
2723 | + if (count($scrit) > 1) { |
|
2724 | + $sql .= ")"; |
|
2725 | + } |
|
2726 | + if (!empty(Globals::$conf->barcode->enabled)) { |
|
2727 | + $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'"; |
|
2728 | + } |
|
2606 | 2729 | $sql .= ')'; |
2607 | 2730 | } |
2608 | 2731 | $sql .= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC"; |
@@ -2619,18 +2742,21 @@ discard block |
||
2619 | 2742 | |
2620 | 2743 | //$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax |
2621 | 2744 | $out .= '<select class="flat maxwidthonsmartphone" id="' . $htmlname . '" name="' . $htmlname . '">'; |
2622 | - if (!$selected) |
|
2623 | - $out .= '<option value="0" selected> </option>'; |
|
2624 | - else |
|
2625 | - $out .= '<option value="0"> </option>'; |
|
2745 | + if (!$selected) { |
|
2746 | + $out .= '<option value="0" selected> </option>'; |
|
2747 | + } else { |
|
2748 | + $out .= '<option value="0"> </option>'; |
|
2749 | + } |
|
2626 | 2750 | |
2627 | 2751 | $i = 0; |
2628 | 2752 | while ($i < $num) { |
2629 | 2753 | $objp = $this->db->fetch_object($result); |
2630 | 2754 | |
2631 | 2755 | $outkey = $objp->idprodfournprice; // id in table of price |
2632 | - if (!$outkey && $alsoproductwithnosupplierprice) |
|
2633 | - $outkey = 'idprod_' . $objp->rowid; // id of product |
|
2756 | + if (!$outkey && $alsoproductwithnosupplierprice) { |
|
2757 | + $outkey = 'idprod_' . $objp->rowid; |
|
2758 | + } |
|
2759 | + // id of product |
|
2634 | 2760 | |
2635 | 2761 | $outref = $objp->ref; |
2636 | 2762 | $outval = ''; |
@@ -2641,32 +2767,39 @@ discard block |
||
2641 | 2767 | $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : ''; |
2642 | 2768 | |
2643 | 2769 | $opt = '<option value="' . $outkey . '"'; |
2644 | - if ($selected && $selected == $objp->idprodfournprice) |
|
2645 | - $opt .= ' selected'; |
|
2646 | - if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) |
|
2647 | - $opt .= ' disabled'; |
|
2770 | + if ($selected && $selected == $objp->idprodfournprice) { |
|
2771 | + $opt .= ' selected'; |
|
2772 | + } |
|
2773 | + if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) { |
|
2774 | + $opt .= ' disabled'; |
|
2775 | + } |
|
2648 | 2776 | if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { |
2649 | 2777 | $opt .= ' pbq="' . $objp->idprodfournprice . '" data-pbq="' . $objp->idprodfournprice . '" data-pbqqty="' . $objp->quantity . '" data-pbqpercent="' . $objp->remise_percent . '"'; |
2650 | 2778 | } |
2651 | 2779 | $opt .= '>'; |
2652 | 2780 | |
2653 | 2781 | $objRef = $objp->ref; |
2654 | - if ($filterkey && $filterkey != '') |
|
2655 | - $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
2782 | + if ($filterkey && $filterkey != '') { |
|
2783 | + $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1); |
|
2784 | + } |
|
2656 | 2785 | $objRefFourn = $objp->ref_fourn; |
2657 | - if ($filterkey && $filterkey != '') |
|
2658 | - $objRefFourn = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
2786 | + if ($filterkey && $filterkey != '') { |
|
2787 | + $objRefFourn = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRefFourn, 1); |
|
2788 | + } |
|
2659 | 2789 | $label = $objp->label; |
2660 | - if ($filterkey && $filterkey != '') |
|
2661 | - $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1); |
|
2790 | + if ($filterkey && $filterkey != '') { |
|
2791 | + $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1); |
|
2792 | + } |
|
2662 | 2793 | |
2663 | 2794 | $opt .= $objp->ref; |
2664 | - if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) |
|
2665 | - $opt .= ' (' . $objp->ref_fourn . ')'; |
|
2795 | + if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
|
2796 | + $opt .= ' (' . $objp->ref_fourn . ')'; |
|
2797 | + } |
|
2666 | 2798 | $opt .= ' - '; |
2667 | 2799 | $outval .= $objRef; |
2668 | - if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) |
|
2669 | - $outval .= ' (' . $objRefFourn . ')'; |
|
2800 | + if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { |
|
2801 | + $outval .= ' (' . $objRefFourn . ')'; |
|
2802 | + } |
|
2670 | 2803 | $outval .= ' - '; |
2671 | 2804 | $opt .= dol_trunc($label, 72) . ' - '; |
2672 | 2805 | $outval .= dol_trunc($label, 72) . ' - '; |
@@ -2760,11 +2893,11 @@ discard block |
||
2760 | 2893 | include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
2761 | 2894 | $out .= ajax_combobox($htmlname); |
2762 | 2895 | |
2763 | - if (empty($outputmode)) |
|
2764 | - return $out; |
|
2896 | + if (empty($outputmode)) { |
|
2897 | + return $out; |
|
2898 | + } |
|
2765 | 2899 | return $outarray; |
2766 | - } |
|
2767 | - else { |
|
2900 | + } else { |
|
2768 | 2901 | DolUtils::dol_print_error($this->db); |
2769 | 2902 | } |
2770 | 2903 | } |
@@ -2853,8 +2986,9 @@ discard block |
||
2853 | 2986 | $opt .= " - "; |
2854 | 2987 | $opt .= price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->trans("Unit"); |
2855 | 2988 | } |
2856 | - if ($objp->duration) |
|
2857 | - $opt .= " - " . $objp->duration; |
|
2989 | + if ($objp->duration) { |
|
2990 | + $opt .= " - " . $objp->duration; |
|
2991 | + } |
|
2858 | 2992 | $opt .= "</option>\n"; |
2859 | 2993 | |
2860 | 2994 | $form .= $opt; |
@@ -2865,8 +2999,7 @@ discard block |
||
2865 | 2999 | $form .= '</select>'; |
2866 | 3000 | $this->db->free($result); |
2867 | 3001 | return $form; |
2868 | - } |
|
2869 | - else { |
|
3002 | + } else { |
|
2870 | 3003 | DolUtils::dol_print_error($this->db); |
2871 | 3004 | } |
2872 | 3005 | } |
@@ -2894,8 +3027,9 @@ discard block |
||
2894 | 3027 | $resql = $this->db->query($sql); |
2895 | 3028 | if ($resql) { |
2896 | 3029 | print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
2897 | - if ($showempty) |
|
2898 | - print '<option value="0"> </option>'; |
|
3030 | + if ($showempty) { |
|
3031 | + print '<option value="0"> </option>'; |
|
3032 | + } |
|
2899 | 3033 | $num = $this->db->num_rows($resql); |
2900 | 3034 | $i = 0; |
2901 | 3035 | if ($num) { |
@@ -2929,8 +3063,10 @@ discard block |
||
2929 | 3063 | global $langs; |
2930 | 3064 | |
2931 | 3065 | $num = count($this->cache_conditions_paiements); |
2932 | - if ($num > 0) |
|
2933 | - return 0; // Cache already loaded |
|
3066 | + if ($num > 0) { |
|
3067 | + return 0; |
|
3068 | + } |
|
3069 | + // Cache already loaded |
|
2934 | 3070 | |
2935 | 3071 | dol_syslog(__METHOD__, LOG_DEBUG); |
2936 | 3072 | |
@@ -2975,8 +3111,10 @@ discard block |
||
2975 | 3111 | global $langs; |
2976 | 3112 | |
2977 | 3113 | $num = count($this->cache_availability); |
2978 | - if ($num > 0) |
|
2979 | - return 0; // Cache already loaded |
|
3114 | + if ($num > 0) { |
|
3115 | + return 0; |
|
3116 | + } |
|
3117 | + // Cache already loaded |
|
2980 | 3118 | |
2981 | 3119 | dol_syslog(__METHOD__, LOG_DEBUG); |
2982 | 3120 | |
@@ -3027,8 +3165,9 @@ discard block |
||
3027 | 3165 | dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG); |
3028 | 3166 | |
3029 | 3167 | print '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">'; |
3030 | - if ($addempty) |
|
3031 | - print '<option value="0"> </option>'; |
|
3168 | + if ($addempty) { |
|
3169 | + print '<option value="0"> </option>'; |
|
3170 | + } |
|
3032 | 3171 | foreach ($this->cache_availability as $id => $arrayavailability) { |
3033 | 3172 | if ($selected == $id) { |
3034 | 3173 | print '<option value="' . $id . '" selected>'; |
@@ -3039,8 +3178,9 @@ discard block |
||
3039 | 3178 | print '</option>'; |
3040 | 3179 | } |
3041 | 3180 | print '</select>'; |
3042 | - if ($user->admin) |
|
3043 | - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
3181 | + if ($user->admin) { |
|
3182 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
3183 | + } |
|
3044 | 3184 | } |
3045 | 3185 | |
3046 | 3186 | /** |
@@ -3053,8 +3193,10 @@ discard block |
||
3053 | 3193 | global $langs; |
3054 | 3194 | |
3055 | 3195 | $num = count($this->cache_demand_reason); |
3056 | - if ($num > 0) |
|
3057 | - return 0; // Cache already loaded |
|
3196 | + if ($num > 0) { |
|
3197 | + return 0; |
|
3198 | + } |
|
3199 | + // Cache already loaded |
|
3058 | 3200 | |
3059 | 3201 | $sql = "SELECT rowid, code, label"; |
3060 | 3202 | $sql .= " FROM " . MAIN_DB_PREFIX . 'c_input_reason'; |
@@ -3070,10 +3212,14 @@ discard block |
||
3070 | 3212 | |
3071 | 3213 | // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut |
3072 | 3214 | $label = ($obj->label != '-' ? $obj->label : ''); |
3073 | - if ($langs->trans("DemandReasonType" . $obj->code) != ("DemandReasonType" . $obj->code)) |
|
3074 | - $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work |
|
3075 | - if ($langs->trans($obj->code) != $obj->code) |
|
3076 | - $label = $langs->trans($obj->code); // So translation key SRC_XXX will work |
|
3215 | + if ($langs->trans("DemandReasonType" . $obj->code) != ("DemandReasonType" . $obj->code)) { |
|
3216 | + $label = $langs->trans("DemandReasonType" . $obj->code); |
|
3217 | + } |
|
3218 | + // So translation key DemandReasonTypeSRC_XXX will work |
|
3219 | + if ($langs->trans($obj->code) != $obj->code) { |
|
3220 | + $label = $langs->trans($obj->code); |
|
3221 | + } |
|
3222 | + // So translation key SRC_XXX will work |
|
3077 | 3223 | |
3078 | 3224 | $tmparray[$obj->rowid]['id'] = $obj->rowid; |
3079 | 3225 | $tmparray[$obj->rowid]['code'] = $obj->code; |
@@ -3085,8 +3231,7 @@ discard block |
||
3085 | 3231 | |
3086 | 3232 | unset($tmparray); |
3087 | 3233 | return $num; |
3088 | - } |
|
3089 | - else { |
|
3234 | + } else { |
|
3090 | 3235 | DolUtils::dol_print_error($this->db); |
3091 | 3236 | return -1; |
3092 | 3237 | } |
@@ -3109,11 +3254,13 @@ discard block |
||
3109 | 3254 | $this->loadCacheInputReason(); |
3110 | 3255 | |
3111 | 3256 | print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">'; |
3112 | - if ($addempty) |
|
3113 | - print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; |
|
3257 | + if ($addempty) { |
|
3258 | + print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>'; |
|
3259 | + } |
|
3114 | 3260 | foreach ($this->cache_demand_reason as $id => $arraydemandreason) { |
3115 | - if ($arraydemandreason['code'] == $exclude) |
|
3116 | - continue; |
|
3261 | + if ($arraydemandreason['code'] == $exclude) { |
|
3262 | + continue; |
|
3263 | + } |
|
3117 | 3264 | |
3118 | 3265 | if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { |
3119 | 3266 | print '<option value="' . $arraydemandreason['id'] . '" selected>'; |
@@ -3125,8 +3272,9 @@ discard block |
||
3125 | 3272 | print '</option>'; |
3126 | 3273 | } |
3127 | 3274 | print '</select>'; |
3128 | - if ($user->admin) |
|
3129 | - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
3275 | + if ($user->admin) { |
|
3276 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
3277 | + } |
|
3130 | 3278 | } |
3131 | 3279 | |
3132 | 3280 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -3141,8 +3289,10 @@ discard block |
||
3141 | 3289 | global $langs; |
3142 | 3290 | |
3143 | 3291 | $num = count($this->cache_types_paiements); |
3144 | - if ($num > 0) |
|
3145 | - return $num; // Cache already loaded |
|
3292 | + if ($num > 0) { |
|
3293 | + return $num; |
|
3294 | + } |
|
3295 | + // Cache already loaded |
|
3146 | 3296 | |
3147 | 3297 | dol_syslog(__METHOD__, LOG_DEBUG); |
3148 | 3298 | |
@@ -3203,12 +3353,14 @@ discard block |
||
3203 | 3353 | $this->load_cache_conditions_paiements(); |
3204 | 3354 | |
3205 | 3355 | // Set default value if not already set by caller |
3206 | - if (empty($selected) && !empty(Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID)) |
|
3207 | - $selected = Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID; |
|
3356 | + if (empty($selected) && !empty(Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID)) { |
|
3357 | + $selected = Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID; |
|
3358 | + } |
|
3208 | 3359 | |
3209 | 3360 | print '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
3210 | - if ($addempty) |
|
3211 | - print '<option value="0"> </option>'; |
|
3361 | + if ($addempty) { |
|
3362 | + print '<option value="0"> </option>'; |
|
3363 | + } |
|
3212 | 3364 | foreach ($this->cache_conditions_paiements as $id => $arrayconditions) { |
3213 | 3365 | if ($selected == $id) { |
3214 | 3366 | print '<option value="' . $id . '" selected>'; |
@@ -3219,8 +3371,9 @@ discard block |
||
3219 | 3371 | print '</option>'; |
3220 | 3372 | } |
3221 | 3373 | print '</select>'; |
3222 | - if ($user->admin && empty($noinfoadmin)) |
|
3223 | - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
3374 | + if ($user->admin && empty($noinfoadmin)) { |
|
3375 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
3376 | + } |
|
3224 | 3377 | } |
3225 | 3378 | |
3226 | 3379 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -3246,59 +3399,68 @@ discard block |
||
3246 | 3399 | dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG); |
3247 | 3400 | |
3248 | 3401 | $filterarray = array(); |
3249 | - if ($filtertype == 'CRDT') |
|
3250 | - $filterarray = array(0, 2, 3); |
|
3251 | - elseif ($filtertype == 'DBIT') |
|
3252 | - $filterarray = array(1, 2, 3); |
|
3253 | - elseif ($filtertype != '' && $filtertype != '-1') |
|
3254 | - $filterarray = explode(',', $filtertype); |
|
3402 | + if ($filtertype == 'CRDT') { |
|
3403 | + $filterarray = array(0, 2, 3); |
|
3404 | + } elseif ($filtertype == 'DBIT') { |
|
3405 | + $filterarray = array(1, 2, 3); |
|
3406 | + } elseif ($filtertype != '' && $filtertype != '-1') { |
|
3407 | + $filterarray = explode(',', $filtertype); |
|
3408 | + } |
|
3255 | 3409 | |
3256 | 3410 | $this->load_cache_types_paiements(); |
3257 | 3411 | |
3258 | 3412 | print '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
3259 | - if ($empty) |
|
3260 | - print '<option value=""> </option>'; |
|
3413 | + if ($empty) { |
|
3414 | + print '<option value=""> </option>'; |
|
3415 | + } |
|
3261 | 3416 | foreach ($this->cache_types_paiements as $id => $arraytypes) { |
3262 | 3417 | // If not good status |
3263 | - if ($active >= 0 && $arraytypes['active'] != $active) |
|
3264 | - continue; |
|
3418 | + if ($active >= 0 && $arraytypes['active'] != $active) { |
|
3419 | + continue; |
|
3420 | + } |
|
3265 | 3421 | |
3266 | 3422 | // On passe si on a demande de filtrer sur des modes de paiments particuliers |
3267 | - if (count($filterarray) && !in_array($arraytypes['type'], $filterarray)) |
|
3268 | - continue; |
|
3423 | + if (count($filterarray) && !in_array($arraytypes['type'], $filterarray)) { |
|
3424 | + continue; |
|
3425 | + } |
|
3269 | 3426 | |
3270 | 3427 | // We discard empty line if showempty is on because an empty line has already been output. |
3271 | - if ($empty && empty($arraytypes['code'])) |
|
3272 | - continue; |
|
3273 | - |
|
3274 | - if ($format == 0) |
|
3275 | - print '<option value="' . $id . '"'; |
|
3276 | - elseif ($format == 1) |
|
3277 | - print '<option value="' . $arraytypes['code'] . '"'; |
|
3278 | - elseif ($format == 2) |
|
3279 | - print '<option value="' . $arraytypes['code'] . '"'; |
|
3280 | - elseif ($format == 3) |
|
3281 | - print '<option value="' . $id . '"'; |
|
3428 | + if ($empty && empty($arraytypes['code'])) { |
|
3429 | + continue; |
|
3430 | + } |
|
3431 | + |
|
3432 | + if ($format == 0) { |
|
3433 | + print '<option value="' . $id . '"'; |
|
3434 | + } elseif ($format == 1) { |
|
3435 | + print '<option value="' . $arraytypes['code'] . '"'; |
|
3436 | + } elseif ($format == 2) { |
|
3437 | + print '<option value="' . $arraytypes['code'] . '"'; |
|
3438 | + } elseif ($format == 3) { |
|
3439 | + print '<option value="' . $id . '"'; |
|
3440 | + } |
|
3282 | 3441 | // Si selected est text, on compare avec code, sinon avec id |
3283 | - if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) |
|
3284 | - print ' selected'; |
|
3285 | - elseif ($selected == $id) |
|
3286 | - print ' selected'; |
|
3442 | + if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { |
|
3443 | + print ' selected'; |
|
3444 | + } elseif ($selected == $id) { |
|
3445 | + print ' selected'; |
|
3446 | + } |
|
3287 | 3447 | print '>'; |
3288 | - if ($format == 0) |
|
3289 | - $value = ($maxlength ? dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']); |
|
3290 | - elseif ($format == 1) |
|
3291 | - $value = $arraytypes['code']; |
|
3292 | - elseif ($format == 2) |
|
3293 | - $value = ($maxlength ? dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']); |
|
3294 | - elseif ($format == 3) |
|
3295 | - $value = $arraytypes['code']; |
|
3448 | + if ($format == 0) { |
|
3449 | + $value = ($maxlength ? dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']); |
|
3450 | + } elseif ($format == 1) { |
|
3451 | + $value = $arraytypes['code']; |
|
3452 | + } elseif ($format == 2) { |
|
3453 | + $value = ($maxlength ? dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']); |
|
3454 | + } elseif ($format == 3) { |
|
3455 | + $value = $arraytypes['code']; |
|
3456 | + } |
|
3296 | 3457 | print $value ? $value : ' '; |
3297 | 3458 | print '</option>'; |
3298 | 3459 | } |
3299 | 3460 | print '</select>'; |
3300 | - if ($user->admin && !$noadmininfo) |
|
3301 | - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
3461 | + if ($user->admin && !$noadmininfo) { |
|
3462 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
3463 | + } |
|
3302 | 3464 | } |
3303 | 3465 | |
3304 | 3466 | /** |
@@ -3352,8 +3514,9 @@ discard block |
||
3352 | 3514 | $sql = "SELECT rowid, code, libelle as label"; |
3353 | 3515 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_shipment_mode"; |
3354 | 3516 | $sql .= " WHERE active > 0"; |
3355 | - if ($filtre) |
|
3356 | - $sql .= " AND " . $filtre; |
|
3517 | + if ($filtre) { |
|
3518 | + $sql .= " AND " . $filtre; |
|
3519 | + } |
|
3357 | 3520 | $sql .= " ORDER BY libelle ASC"; |
3358 | 3521 | |
3359 | 3522 | dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG); |
@@ -3378,8 +3541,9 @@ discard block |
||
3378 | 3541 | $i++; |
3379 | 3542 | } |
3380 | 3543 | print "</select>"; |
3381 | - if ($user->admin) |
|
3382 | - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
3544 | + if ($user->admin) { |
|
3545 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
3546 | + } |
|
3383 | 3547 | } else { |
3384 | 3548 | print $langs->trans("NoShippingMethodDefined"); |
3385 | 3549 | } |
@@ -3492,8 +3656,9 @@ discard block |
||
3492 | 3656 | |
3493 | 3657 | $resql = $this->db->query($sql); |
3494 | 3658 | if ($resql && $this->db->num_rows($resql) > 0) { |
3495 | - if ($showempty) |
|
3496 | - $return .= '<option value="none"></option>'; |
|
3659 | + if ($showempty) { |
|
3660 | + $return .= '<option value="none"></option>'; |
|
3661 | + } |
|
3497 | 3662 | |
3498 | 3663 | while ($res = $this->db->fetch_object($resql)) { |
3499 | 3664 | $unitLabel = $res->label; |
@@ -3536,10 +3701,12 @@ discard block |
||
3536 | 3701 | $sql = "SELECT rowid, label, bank, clos as status, currency_code"; |
3537 | 3702 | $sql .= " FROM " . MAIN_DB_PREFIX . "bank_account"; |
3538 | 3703 | $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; |
3539 | - if ($statut != 2) |
|
3540 | - $sql .= " AND clos = '" . $statut . "'"; |
|
3541 | - if ($filtre) |
|
3542 | - $sql .= " AND " . $filtre; |
|
3704 | + if ($statut != 2) { |
|
3705 | + $sql .= " AND clos = '" . $statut . "'"; |
|
3706 | + } |
|
3707 | + if ($filtre) { |
|
3708 | + $sql .= " AND " . $filtre; |
|
3709 | + } |
|
3543 | 3710 | $sql .= " ORDER BY label"; |
3544 | 3711 | |
3545 | 3712 | dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG); |
@@ -3561,23 +3728,24 @@ discard block |
||
3561 | 3728 | print '<option value="' . $obj->rowid . '">'; |
3562 | 3729 | } |
3563 | 3730 | print trim($obj->label); |
3564 | - if ($showcurrency) |
|
3565 | - print ' (' . $obj->currency_code . ')'; |
|
3566 | - if ($statut == 2 && $obj->status == 1) |
|
3567 | - print ' (' . $langs->trans("Closed") . ')'; |
|
3731 | + if ($showcurrency) { |
|
3732 | + print ' (' . $obj->currency_code . ')'; |
|
3733 | + } |
|
3734 | + if ($statut == 2 && $obj->status == 1) { |
|
3735 | + print ' (' . $langs->trans("Closed") . ')'; |
|
3736 | + } |
|
3568 | 3737 | print '</option>'; |
3569 | 3738 | $i++; |
3570 | 3739 | } |
3571 | 3740 | print "</select>"; |
3741 | + } else { |
|
3742 | + if ($statut == 0) { |
|
3743 | + print '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; |
|
3744 | + } else { |
|
3745 | + print '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; |
|
3746 | + } |
|
3572 | 3747 | } |
3573 | - else { |
|
3574 | - if ($statut == 0) |
|
3575 | - print '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; |
|
3576 | - else |
|
3577 | - print '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; |
|
3578 | - } |
|
3579 | - } |
|
3580 | - else { |
|
3748 | + } else { |
|
3581 | 3749 | DolUtils::dol_print_error($this->db); |
3582 | 3750 | } |
3583 | 3751 | |
@@ -3601,8 +3769,9 @@ discard block |
||
3601 | 3769 | print '<input type="hidden" name="action" value="setbankaccount">'; |
3602 | 3770 | print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
3603 | 3771 | $nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty); |
3604 | - if ($nbaccountfound > 0) |
|
3605 | - print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
3772 | + if ($nbaccountfound > 0) { |
|
3773 | + print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
3774 | + } |
|
3606 | 3775 | print '</form>'; |
3607 | 3776 | } else { |
3608 | 3777 | |
@@ -3612,8 +3781,9 @@ discard block |
||
3612 | 3781 | require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
3613 | 3782 | $bankstatic = new Account($this->db); |
3614 | 3783 | $result = $bankstatic->fetch($selected); |
3615 | - if ($result) |
|
3616 | - print $bankstatic->getNomUrl(1); |
|
3784 | + if ($result) { |
|
3785 | + print $bankstatic->getNomUrl(1); |
|
3786 | + } |
|
3617 | 3787 | } else { |
3618 | 3788 | print " "; |
3619 | 3789 | } |
@@ -3659,15 +3829,16 @@ discard block |
||
3659 | 3829 | $i = 0; |
3660 | 3830 | while ($i < $num) { |
3661 | 3831 | $objp = $this->db->fetch_object($result); |
3662 | - if ($objp) |
|
3663 | - $cate_arbo[$objp->rowid] = array('id' => $objp->rowid, 'fulllabel' => $objp->label); |
|
3832 | + if ($objp) { |
|
3833 | + $cate_arbo[$objp->rowid] = array('id' => $objp->rowid, 'fulllabel' => $objp->label); |
|
3834 | + } |
|
3664 | 3835 | $i++; |
3665 | 3836 | } |
3666 | 3837 | $this->db->free($result); |
3667 | - } else |
|
3668 | - DolUtils::dol_print_error($this->db); |
|
3669 | - } |
|
3670 | - else { |
|
3838 | + } else { |
|
3839 | + DolUtils::dol_print_error($this->db); |
|
3840 | + } |
|
3841 | + } else { |
|
3671 | 3842 | $cat = new Categorie($this->db); |
3672 | 3843 | $cate_arbo = $cat->get_full_arbo($type, $excludeafterid); |
3673 | 3844 | } |
@@ -3675,9 +3846,9 @@ discard block |
||
3675 | 3846 | $output = '<select class="flat" name="' . $htmlname . '" id="' . $htmlname . '">'; |
3676 | 3847 | $outarray = array(); |
3677 | 3848 | if (is_array($cate_arbo)) { |
3678 | - if (!count($cate_arbo)) |
|
3679 | - $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; |
|
3680 | - else { |
|
3849 | + if (!count($cate_arbo)) { |
|
3850 | + $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; |
|
3851 | + } else { |
|
3681 | 3852 | $output .= '<option value="-1"> </option>'; |
3682 | 3853 | foreach ($cate_arbo as $key => $value) { |
3683 | 3854 | if ($cate_arbo[$key]['id'] == $selected || ($selected == 'auto' && count($cate_arbo) == 1)) { |
@@ -3694,8 +3865,9 @@ discard block |
||
3694 | 3865 | $output .= '</select>'; |
3695 | 3866 | $output .= "\n"; |
3696 | 3867 | |
3697 | - if ($outputmode) |
|
3698 | - return $outarray; |
|
3868 | + if ($outputmode) { |
|
3869 | + return $outarray; |
|
3870 | + } |
|
3699 | 3871 | return $output; |
3700 | 3872 | } |
3701 | 3873 | |
@@ -3759,8 +3931,9 @@ discard block |
||
3759 | 3931 | |
3760 | 3932 | // Clean parameters |
3761 | 3933 | $newselectedchoice = empty($selectedchoice) ? "no" : $selectedchoice; |
3762 | - if (Globals::$conf->browser->layout == 'phone') |
|
3763 | - $width = '95%'; |
|
3934 | + if (Globals::$conf->browser->layout == 'phone') { |
|
3935 | + $width = '95%'; |
|
3936 | + } |
|
3764 | 3937 | |
3765 | 3938 | if (is_array($formquestion) && !empty($formquestion)) { |
3766 | 3939 | // First add hidden fields and value |
@@ -3774,8 +3947,9 @@ discard block |
||
3774 | 3947 | |
3775 | 3948 | // Now add questions |
3776 | 3949 | $more .= '<table class="paddingtopbottomonly" width="100%">' . "\n"; |
3777 | - if (!empty($formquestion['text'])) |
|
3778 | - $more .= '<tr><td colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; |
|
3950 | + if (!empty($formquestion['text'])) { |
|
3951 | + $more .= '<tr><td colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n"; |
|
3952 | + } |
|
3779 | 3953 | foreach ($formquestion as $key => $input) { |
3780 | 3954 | if (is_array($input) && !empty($input)) { |
3781 | 3955 | $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); |
@@ -3788,42 +3962,45 @@ discard block |
||
3788 | 3962 | $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td><td align="left"><input type="password" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $size . ' value="' . $input['value'] . '"' . $moreattr . ' /></td></tr>' . "\n"; |
3789 | 3963 | } elseif ($input['type'] == 'select') { |
3790 | 3964 | $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>'; |
3791 | - if (!empty($input['label'])) |
|
3792 | - $more .= $input['label'] . '</td><td class="tdtop" align="left">'; |
|
3965 | + if (!empty($input['label'])) { |
|
3966 | + $more .= $input['label'] . '</td><td class="tdtop" align="left">'; |
|
3967 | + } |
|
3793 | 3968 | $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss); |
3794 | 3969 | $more .= '</td></tr>' . "\n"; |
3795 | - } |
|
3796 | - elseif ($input['type'] == 'checkbox') { |
|
3970 | + } elseif ($input['type'] == 'checkbox') { |
|
3797 | 3971 | $more .= '<tr>'; |
3798 | 3972 | $more .= '<td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . ' </td><td align="left">'; |
3799 | 3973 | $more .= '<input type="checkbox" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $moreattr; |
3800 | - if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0') |
|
3801 | - $more .= ' checked'; |
|
3802 | - if (is_bool($input['value']) && $input['value']) |
|
3803 | - $more .= ' checked'; |
|
3804 | - if (isset($input['disabled'])) |
|
3805 | - $more .= ' disabled'; |
|
3974 | + if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0') { |
|
3975 | + $more .= ' checked'; |
|
3976 | + } |
|
3977 | + if (is_bool($input['value']) && $input['value']) { |
|
3978 | + $more .= ' checked'; |
|
3979 | + } |
|
3980 | + if (isset($input['disabled'])) { |
|
3981 | + $more .= ' disabled'; |
|
3982 | + } |
|
3806 | 3983 | $more .= ' /></td>'; |
3807 | 3984 | $more .= '</tr>' . "\n"; |
3808 | - } |
|
3809 | - elseif ($input['type'] == 'radio') { |
|
3985 | + } elseif ($input['type'] == 'radio') { |
|
3810 | 3986 | $i = 0; |
3811 | 3987 | foreach ($input['values'] as $selkey => $selval) { |
3812 | 3988 | $more .= '<tr>'; |
3813 | - if ($i == 0) |
|
3814 | - $more .= '<td' . (empty($input['tdclass']) ? ' class="tdtop"' : (' class="tdtop ' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td>'; |
|
3815 | - else |
|
3816 | - $more .= '<td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '> </td>'; |
|
3989 | + if ($i == 0) { |
|
3990 | + $more .= '<td' . (empty($input['tdclass']) ? ' class="tdtop"' : (' class="tdtop ' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td>'; |
|
3991 | + } else { |
|
3992 | + $more .= '<td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '> </td>'; |
|
3993 | + } |
|
3817 | 3994 | $more .= '<td><input type="radio" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '" value="' . $selkey . '"' . $moreattr; |
3818 | - if ($input['disabled']) |
|
3819 | - $more .= ' disabled'; |
|
3995 | + if ($input['disabled']) { |
|
3996 | + $more .= ' disabled'; |
|
3997 | + } |
|
3820 | 3998 | $more .= ' /> '; |
3821 | 3999 | $more .= $selval; |
3822 | 4000 | $more .= '</td></tr>' . "\n"; |
3823 | 4001 | $i++; |
3824 | 4002 | } |
3825 | - } |
|
3826 | - elseif ($input['type'] == 'date') { |
|
4003 | + } elseif ($input['type'] == 'date') { |
|
3827 | 4004 | $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td>'; |
3828 | 4005 | $more .= '<td align="left">'; |
3829 | 4006 | $more .= $this->selectDate($input['value'], $input['name'], 0, 0, 0, '', 1, 0); |
@@ -3835,13 +4012,12 @@ discard block |
||
3835 | 4012 | $formquestion[] = array('name' => $input['name'] . 'min'); |
3836 | 4013 | } elseif ($input['type'] == 'other') { |
3837 | 4014 | $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>'; |
3838 | - if (!empty($input['label'])) |
|
3839 | - $more .= $input['label'] . '</td><td align="left">'; |
|
4015 | + if (!empty($input['label'])) { |
|
4016 | + $more .= $input['label'] . '</td><td align="left">'; |
|
4017 | + } |
|
3840 | 4018 | $more .= $input['value']; |
3841 | 4019 | $more .= '</td></tr>' . "\n"; |
3842 | - } |
|
3843 | - |
|
3844 | - elseif ($input['type'] == 'onecolumn') { |
|
4020 | + } elseif ($input['type'] == 'onecolumn') { |
|
3845 | 4021 | $more .= '<tr><td colspan="2" align="left">'; |
3846 | 4022 | $more .= $input['value']; |
3847 | 4023 | $more .= '</td></tr>' . "\n"; |
@@ -3854,10 +4030,12 @@ discard block |
||
3854 | 4030 | // JQUI method dialog is broken with jmobile, we use standard HTML. |
3855 | 4031 | // Note: When using dol_use_jmobile or no js, you must also check code for button use a GET url with action=xxx and check that you also output the confirm code when action=xxx |
3856 | 4032 | // See page product/card.php for example |
3857 | - if (!empty(Globals::$conf->dol_use_jmobile)) |
|
3858 | - $useajax = 0; |
|
3859 | - if (empty(Globals::$conf->use_javascript_ajax)) |
|
3860 | - $useajax = 0; |
|
4033 | + if (!empty(Globals::$conf->dol_use_jmobile)) { |
|
4034 | + $useajax = 0; |
|
4035 | + } |
|
4036 | + if (empty(Globals::$conf->use_javascript_ajax)) { |
|
4037 | + $useajax = 0; |
|
4038 | + } |
|
3861 | 4039 | |
3862 | 4040 | if ($useajax) { |
3863 | 4041 | $autoOpen = true; |
@@ -3875,10 +4053,12 @@ discard block |
||
3875 | 4053 | if (is_array($formquestion)) { |
3876 | 4054 | foreach ($formquestion as $key => $input) { |
3877 | 4055 | //print "xx ".$key." rr ".is_array($input)."<br>\n"; |
3878 | - if (is_array($input) && isset($input['name'])) |
|
3879 | - array_push($inputok, $input['name']); |
|
3880 | - if (isset($input['inputko']) && $input['inputko'] == 1) |
|
3881 | - array_push($inputko, $input['name']); |
|
4056 | + if (is_array($input) && isset($input['name'])) { |
|
4057 | + array_push($inputok, $input['name']); |
|
4058 | + } |
|
4059 | + if (isset($input['inputko']) && $input['inputko'] == 1) { |
|
4060 | + array_push($inputko, $input['name']); |
|
4061 | + } |
|
3882 | 4062 | } |
3883 | 4063 | } |
3884 | 4064 | // Show JQuery confirm box. Note that global var $useglobalvars is used inside this template |
@@ -3963,12 +4143,14 @@ discard block |
||
3963 | 4143 | } else { |
3964 | 4144 | $formconfirm .= "\n<!-- begin formconfirm page=" . $page . " -->\n"; |
3965 | 4145 | |
3966 | - if (empty($disableformtag)) |
|
3967 | - $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n"; |
|
4146 | + if (empty($disableformtag)) { |
|
4147 | + $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n"; |
|
4148 | + } |
|
3968 | 4149 | |
3969 | 4150 | $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
3970 | - if (empty($disableformtag)) |
|
3971 | - $formconfirm .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n"; |
|
4151 | + if (empty($disableformtag)) { |
|
4152 | + $formconfirm .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n"; |
|
4153 | + } |
|
3972 | 4154 | |
3973 | 4155 | $formconfirm .= '<table width="100%" class="valid">' . "\n"; |
3974 | 4156 | |
@@ -3993,8 +4175,9 @@ discard block |
||
3993 | 4175 | |
3994 | 4176 | $formconfirm .= '</table>' . "\n"; |
3995 | 4177 | |
3996 | - if (empty($disableformtag)) |
|
3997 | - $formconfirm .= "</form>\n"; |
|
4178 | + if (empty($disableformtag)) { |
|
4179 | + $formconfirm .= "</form>\n"; |
|
4180 | + } |
|
3998 | 4181 | $formconfirm .= '<br>'; |
3999 | 4182 | |
4000 | 4183 | $formconfirm .= "<!-- end formconfirm -->\n"; |
@@ -4184,14 +4367,16 @@ discard block |
||
4184 | 4367 | $ret .= '<td align="left"><input type="submit" class="button" value="' . $langs->trans("Modify") . '"></td>'; |
4185 | 4368 | $ret .= '</tr></table></form>'; |
4186 | 4369 | } else { |
4187 | - if ($displayhour) |
|
4188 | - $ret .= DolUtils::dol_print_date($selected, 'dayhour'); |
|
4189 | - else |
|
4190 | - $ret .= DolUtils::dol_print_date($selected, 'day'); |
|
4370 | + if ($displayhour) { |
|
4371 | + $ret .= DolUtils::dol_print_date($selected, 'dayhour'); |
|
4372 | + } else { |
|
4373 | + $ret .= DolUtils::dol_print_date($selected, 'day'); |
|
4374 | + } |
|
4191 | 4375 | } |
4192 | 4376 | |
4193 | - if (empty($nooutput)) |
|
4194 | - print $ret; |
|
4377 | + if (empty($nooutput)) { |
|
4378 | + print $ret; |
|
4379 | + } |
|
4195 | 4380 | return $ret; |
4196 | 4381 | } |
4197 | 4382 | |
@@ -4317,10 +4502,10 @@ discard block |
||
4317 | 4502 | } else { |
4318 | 4503 | if (!empty($rate)) { |
4319 | 4504 | print price($rate, 1, $langs, 1, 0); |
4320 | - if ($currency && $rate != 1) |
|
4321 | - print ' (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . Globals::$conf->currency . ')'; |
|
4322 | - } |
|
4323 | - else { |
|
4505 | + if ($currency && $rate != 1) { |
|
4506 | + print ' (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . Globals::$conf->currency . ')'; |
|
4507 | + } |
|
4508 | + } else { |
|
4324 | 4509 | print 1; |
4325 | 4510 | } |
4326 | 4511 | } |
@@ -4353,34 +4538,41 @@ discard block |
||
4353 | 4538 | print '<div class="inline-block">'; |
4354 | 4539 | if (!empty($discount_type)) { |
4355 | 4540 | if (!empty(Globals::$conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { |
4356 | - if (!$filter || $filter == "fk_invoice_supplier_source IS NULL") |
|
4357 | - $translationKey = 'HasAbsoluteDiscountFromSupplier'; // If we want deposit to be substracted to payments only and not to total of final invoice |
|
4358 | - else |
|
4359 | - $translationKey = 'HasCreditNoteFromSupplier'; |
|
4360 | - } |
|
4361 | - else { |
|
4362 | - if (!$filter || $filter == "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") |
|
4363 | - $translationKey = 'HasAbsoluteDiscountFromSupplier'; |
|
4364 | - else |
|
4365 | - $translationKey = 'HasCreditNoteFromSupplier'; |
|
4541 | + if (!$filter || $filter == "fk_invoice_supplier_source IS NULL") { |
|
4542 | + $translationKey = 'HasAbsoluteDiscountFromSupplier'; |
|
4543 | + } |
|
4544 | + // If we want deposit to be substracted to payments only and not to total of final invoice |
|
4545 | + else { |
|
4546 | + $translationKey = 'HasCreditNoteFromSupplier'; |
|
4547 | + } |
|
4548 | + } else { |
|
4549 | + if (!$filter || $filter == "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { |
|
4550 | + $translationKey = 'HasAbsoluteDiscountFromSupplier'; |
|
4551 | + } else { |
|
4552 | + $translationKey = 'HasCreditNoteFromSupplier'; |
|
4553 | + } |
|
4366 | 4554 | } |
4367 | 4555 | } else { |
4368 | 4556 | if (!empty(Globals::$conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { |
4369 | - if (!$filter || $filter == "fk_facture_source IS NULL") |
|
4370 | - $translationKey = 'CompanyHasAbsoluteDiscount'; // If we want deposit to be substracted to payments only and not to total of final invoice |
|
4371 | - else |
|
4372 | - $translationKey = 'CompanyHasCreditNote'; |
|
4373 | - } |
|
4374 | - else { |
|
4375 | - if (!$filter || $filter == "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") |
|
4376 | - $translationKey = 'CompanyHasAbsoluteDiscount'; |
|
4377 | - else |
|
4378 | - $translationKey = 'CompanyHasCreditNote'; |
|
4557 | + if (!$filter || $filter == "fk_facture_source IS NULL") { |
|
4558 | + $translationKey = 'CompanyHasAbsoluteDiscount'; |
|
4559 | + } |
|
4560 | + // If we want deposit to be substracted to payments only and not to total of final invoice |
|
4561 | + else { |
|
4562 | + $translationKey = 'CompanyHasCreditNote'; |
|
4563 | + } |
|
4564 | + } else { |
|
4565 | + if (!$filter || $filter == "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { |
|
4566 | + $translationKey = 'CompanyHasAbsoluteDiscount'; |
|
4567 | + } else { |
|
4568 | + $translationKey = 'CompanyHasCreditNote'; |
|
4569 | + } |
|
4379 | 4570 | } |
4380 | 4571 | } |
4381 | 4572 | print $langs->trans($translationKey, price($amount, 0, $langs, 0, 0, -1, Globals::$conf->currency)); |
4382 | - if (empty($hidelist)) |
|
4383 | - print ': '; |
|
4573 | + if (empty($hidelist)) { |
|
4574 | + print ': '; |
|
4575 | + } |
|
4384 | 4576 | print '</div>'; |
4385 | 4577 | if (empty($hidelist)) { |
4386 | 4578 | print '<div class="inline-block" style="padding-right: 10px">'; |
@@ -4390,15 +4582,18 @@ discard block |
||
4390 | 4582 | } else { |
4391 | 4583 | $newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available |
4392 | 4584 | } |
4393 | - if ($filter) |
|
4394 | - $newfilter .= ' AND (' . $filter . ')'; |
|
4585 | + if ($filter) { |
|
4586 | + $newfilter .= ' AND (' . $filter . ')'; |
|
4587 | + } |
|
4395 | 4588 | $nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue); |
4396 | 4589 | if ($nbqualifiedlines > 0) { |
4397 | 4590 | print ' <input type="submit" class="button" value="' . DolUtils::dol_escape_htmltag($langs->trans("UseLine")) . '"'; |
4398 | - if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") |
|
4399 | - print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
4400 | - if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") |
|
4401 | - print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
4591 | + if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { |
|
4592 | + print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
4593 | + } |
|
4594 | + if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { |
|
4595 | + print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; |
|
4596 | + } |
|
4402 | 4597 | |
4403 | 4598 | print '>'; |
4404 | 4599 | } |
@@ -4499,10 +4694,11 @@ discard block |
||
4499 | 4694 | } |
4500 | 4695 | } |
4501 | 4696 | |
4502 | - if ($nooutput) |
|
4503 | - return $out; |
|
4504 | - else |
|
4505 | - print $out; |
|
4697 | + if ($nooutput) { |
|
4698 | + return $out; |
|
4699 | + } else { |
|
4700 | + print $out; |
|
4701 | + } |
|
4506 | 4702 | } |
4507 | 4703 | |
4508 | 4704 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -4535,8 +4731,10 @@ discard block |
||
4535 | 4731 | |
4536 | 4732 | $out = ''; |
4537 | 4733 | |
4538 | - if ($selected == 'euro' || $selected == 'euros') |
|
4539 | - $selected = 'EUR'; // Pour compatibilite |
|
4734 | + if ($selected == 'euro' || $selected == 'euros') { |
|
4735 | + $selected = 'EUR'; |
|
4736 | + } |
|
4737 | + // Pour compatibilite |
|
4540 | 4738 | |
4541 | 4739 | $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">'; |
4542 | 4740 | foreach ($langs->cache_currencies as $code_iso => $currency) { |
@@ -4550,8 +4748,9 @@ discard block |
||
4550 | 4748 | $out .= '</option>'; |
4551 | 4749 | } |
4552 | 4750 | $out .= '</select>'; |
4553 | - if ($user->admin) |
|
4554 | - $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
4751 | + if ($user->admin) { |
|
4752 | + $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
4753 | + } |
|
4555 | 4754 | |
4556 | 4755 | // Make select dynamic |
4557 | 4756 | include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
@@ -4580,14 +4779,16 @@ discard block |
||
4580 | 4779 | $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; |
4581 | 4780 | $resql = $db->query($sql); |
4582 | 4781 | if ($resql) { |
4583 | - while ($obj = $db->fetch_object($resql)) |
|
4584 | - $TCurrency[$obj->code] = $obj->code; |
|
4782 | + while ($obj = $db->fetch_object($resql)) { |
|
4783 | + $TCurrency[$obj->code] = $obj->code; |
|
4784 | + } |
|
4585 | 4785 | } |
4586 | 4786 | |
4587 | 4787 | $out = ''; |
4588 | 4788 | $out .= '<select class="flat" name="' . $htmlname . '" id="' . $htmlname . '">'; |
4589 | - if ($useempty) |
|
4590 | - $out .= '<option value=""></option>'; |
|
4789 | + if ($useempty) { |
|
4790 | + $out .= '<option value=""></option>'; |
|
4791 | + } |
|
4591 | 4792 | // If company current currency not in table, we add it into list. Should always be available. |
4592 | 4793 | if (!in_array(Globals::$conf->currency, $TCurrency)) { |
4593 | 4794 | $TCurrency[Globals::$conf->currency] = Globals::$conf->currency; |
@@ -4595,10 +4796,11 @@ discard block |
||
4595 | 4796 | if (count($TCurrency) > 0) { |
4596 | 4797 | foreach ($langs->cache_currencies as $code_iso => $currency) { |
4597 | 4798 | if (isset($TCurrency[$code_iso])) { |
4598 | - if (!empty($selected) && $selected == $code_iso) |
|
4599 | - $out .= '<option value="' . $code_iso . '" selected="selected">'; |
|
4600 | - else |
|
4601 | - $out .= '<option value="' . $code_iso . '">'; |
|
4799 | + if (!empty($selected) && $selected == $code_iso) { |
|
4800 | + $out .= '<option value="' . $code_iso . '" selected="selected">'; |
|
4801 | + } else { |
|
4802 | + $out .= '<option value="' . $code_iso . '">'; |
|
4803 | + } |
|
4602 | 4804 | |
4603 | 4805 | $out .= $currency['label']; |
4604 | 4806 | $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; |
@@ -4628,8 +4830,10 @@ discard block |
||
4628 | 4830 | global $langs; |
4629 | 4831 | |
4630 | 4832 | $num = count($this->cache_vatrates); |
4631 | - if ($num > 0) |
|
4632 | - return $num; // Cache already loaded |
|
4833 | + if ($num > 0) { |
|
4834 | + return $num; |
|
4835 | + } |
|
4836 | + // Cache already loaded |
|
4633 | 4837 | |
4634 | 4838 | dol_syslog(__METHOD__, LOG_DEBUG); |
4635 | 4839 | |
@@ -4658,20 +4862,23 @@ discard block |
||
4658 | 4862 | $this->cache_vatrates[$i]['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * |
4659 | 4863 | $this->cache_vatrates[$i]['labelallrates'] = $obj->taux . '/' . ($obj->localtax1 ? $obj->localtax1 : '0') . '/' . ($obj->localtax2 ? $obj->localtax2 : '0') . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
4660 | 4864 | $positiverates = ''; |
4661 | - if ($obj->taux) |
|
4662 | - $positiverates .= ($positiverates ? '/' : '') . $obj->taux; |
|
4663 | - if ($obj->localtax1) |
|
4664 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; |
|
4665 | - if ($obj->localtax2) |
|
4666 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; |
|
4667 | - if (empty($positiverates)) |
|
4668 | - $positiverates = '0'; |
|
4865 | + if ($obj->taux) { |
|
4866 | + $positiverates .= ($positiverates ? '/' : '') . $obj->taux; |
|
4867 | + } |
|
4868 | + if ($obj->localtax1) { |
|
4869 | + $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1; |
|
4870 | + } |
|
4871 | + if ($obj->localtax2) { |
|
4872 | + $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2; |
|
4873 | + } |
|
4874 | + if (empty($positiverates)) { |
|
4875 | + $positiverates = '0'; |
|
4876 | + } |
|
4669 | 4877 | $this->cache_vatrates[$i]['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label |
4670 | 4878 | } |
4671 | 4879 | |
4672 | 4880 | return $num; |
4673 | - } |
|
4674 | - else { |
|
4881 | + } else { |
|
4675 | 4882 | $this->error = '<font class="error">' . $langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code) . '</font>'; |
4676 | 4883 | return -1; |
4677 | 4884 | } |
@@ -4808,16 +5015,19 @@ discard block |
||
4808 | 5015 | $selectedfound = false; |
4809 | 5016 | foreach ($this->cache_vatrates as $rate) { |
4810 | 5017 | // Keep only 0 if seller is not subject to VAT |
4811 | - if ($disabled && $rate['txtva'] != 0) |
|
4812 | - continue; |
|
5018 | + if ($disabled && $rate['txtva'] != 0) { |
|
5019 | + continue; |
|
5020 | + } |
|
4813 | 5021 | |
4814 | 5022 | // Define key to use into select list |
4815 | 5023 | $key = $rate['txtva']; |
4816 | 5024 | $key .= $rate['nprtva'] ? '*' : ''; |
4817 | - if ($mode > 0 && $rate['code']) |
|
4818 | - $key .= ' (' . $rate['code'] . ')'; |
|
4819 | - if ($mode < 0) |
|
4820 | - $key = $rate['rowid']; |
|
5025 | + if ($mode > 0 && $rate['code']) { |
|
5026 | + $key .= ' (' . $rate['code'] . ')'; |
|
5027 | + } |
|
5028 | + if ($mode < 0) { |
|
5029 | + $key = $rate['rowid']; |
|
5030 | + } |
|
4821 | 5031 | |
4822 | 5032 | $return .= '<option value="' . $key . '"'; |
4823 | 5033 | if (!$selectedfound) { |
@@ -4844,10 +5054,10 @@ discard block |
||
4844 | 5054 | $return .= '</option>'; |
4845 | 5055 | } |
4846 | 5056 | |
4847 | - if (!$options_only) |
|
4848 | - $return .= '</select>'; |
|
4849 | - } |
|
4850 | - else { |
|
5057 | + if (!$options_only) { |
|
5058 | + $return .= '</select>'; |
|
5059 | + } |
|
5060 | + } else { |
|
4851 | 5061 | $return .= $this->error; |
4852 | 5062 | } |
4853 | 5063 | |
@@ -4919,12 +5129,15 @@ discard block |
||
4919 | 5129 | |
4920 | 5130 | $retstring = ''; |
4921 | 5131 | |
4922 | - if ($prefix == '') |
|
4923 | - $prefix = 're'; |
|
4924 | - if ($h == '') |
|
4925 | - $h = 0; |
|
4926 | - if ($m == '') |
|
4927 | - $m = 0; |
|
5132 | + if ($prefix == '') { |
|
5133 | + $prefix = 're'; |
|
5134 | + } |
|
5135 | + if ($h == '') { |
|
5136 | + $h = 0; |
|
5137 | + } |
|
5138 | + if ($m == '') { |
|
5139 | + $m = 0; |
|
5140 | + } |
|
4928 | 5141 | $emptydate = 0; |
4929 | 5142 | $emptyhours = 0; |
4930 | 5143 | if ($empty == 1) { |
@@ -4973,10 +5186,12 @@ discard block |
||
4973 | 5186 | $smin = !isset(Globals::$conf->global->MAIN_DEFAULT_DATE_MIN) ? ($h == -1 ? '59' : '') : Globals::$conf->global->MAIN_DEFAULT_DATE_MIN; |
4974 | 5187 | $ssec = !isset(Globals::$conf->global->MAIN_DEFAULT_DATE_SEC) ? ($h == -1 ? '59' : '') : Globals::$conf->global->MAIN_DEFAULT_DATE_SEC; |
4975 | 5188 | } |
4976 | - if ($h == 3) |
|
4977 | - $shour = ''; |
|
4978 | - if ($m == 3) |
|
4979 | - $smin = ''; |
|
5189 | + if ($h == 3) { |
|
5190 | + $shour = ''; |
|
5191 | + } |
|
5192 | + if ($m == 3) { |
|
5193 | + $smin = ''; |
|
5194 | + } |
|
4980 | 5195 | |
4981 | 5196 | // You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery' |
4982 | 5197 | $usecalendar = 'combo'; |
@@ -5008,14 +5223,14 @@ discard block |
||
5008 | 5223 | $base = DOL_URL_ROOT . '/core/'; |
5009 | 5224 | $retstring .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; |
5010 | 5225 | $retstring .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; |
5011 | - } else |
|
5012 | - $retstring .= '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
5226 | + } else { |
|
5227 | + $retstring .= '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; |
|
5228 | + } |
|
5013 | 5229 | |
5014 | 5230 | $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n"; |
5015 | 5231 | $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n"; |
5016 | 5232 | $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n"; |
5017 | - } |
|
5018 | - elseif ($usecalendar == 'jquery') { |
|
5233 | + } elseif ($usecalendar == 'jquery') { |
|
5019 | 5234 | if (!$disabled) { |
5020 | 5235 | // Output javascript for datepicker |
5021 | 5236 | $retstring .= "<script type='text/javascript'>"; |
@@ -5125,32 +5340,38 @@ discard block |
||
5125 | 5340 | } |
5126 | 5341 | } |
5127 | 5342 | |
5128 | - if ($d && $h) |
|
5129 | - $retstring .= ($h == 2 ? '<br>' : ' '); |
|
5343 | + if ($d && $h) { |
|
5344 | + $retstring .= ($h == 2 ? '<br>' : ' '); |
|
5345 | + } |
|
5130 | 5346 | |
5131 | 5347 | if ($h) { |
5132 | 5348 | // Show hour |
5133 | 5349 | $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">'; |
5134 | - if ($emptyhours) |
|
5135 | - $retstring .= '<option value="-1"> </option>'; |
|
5350 | + if ($emptyhours) { |
|
5351 | + $retstring .= '<option value="-1"> </option>'; |
|
5352 | + } |
|
5136 | 5353 | for ($hour = 0; $hour < 24; $hour++) { |
5137 | - if (strlen($hour) < 2) |
|
5138 | - $hour = "0" . $hour; |
|
5354 | + if (strlen($hour) < 2) { |
|
5355 | + $hour = "0" . $hour; |
|
5356 | + } |
|
5139 | 5357 | $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour . (empty(Globals::$conf->dol_optimize_smallscreen) ? '' : 'H') . '</option>'; |
5140 | 5358 | } |
5141 | 5359 | $retstring .= '</select>'; |
5142 | - if ($m && empty(Globals::$conf->dol_optimize_smallscreen)) |
|
5143 | - $retstring .= ":"; |
|
5360 | + if ($m && empty(Globals::$conf->dol_optimize_smallscreen)) { |
|
5361 | + $retstring .= ":"; |
|
5362 | + } |
|
5144 | 5363 | } |
5145 | 5364 | |
5146 | 5365 | if ($m) { |
5147 | 5366 | // Show minutes |
5148 | 5367 | $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">'; |
5149 | - if ($emptyhours) |
|
5150 | - $retstring .= '<option value="-1"> </option>'; |
|
5368 | + if ($emptyhours) { |
|
5369 | + $retstring .= '<option value="-1"> </option>'; |
|
5370 | + } |
|
5151 | 5371 | for ($min = 0; $min < 60; $min++) { |
5152 | - if (strlen($min) < 2) |
|
5153 | - $min = "0" . $min; |
|
5372 | + if (strlen($min) < 2) { |
|
5373 | + $min = "0" . $min; |
|
5374 | + } |
|
5154 | 5375 | $retstring .= '<option value="' . $min . '"' . (($min == $smin) ? ' selected' : '') . '>' . $min . (empty(Globals::$conf->dol_optimize_smallscreen) ? '' : '') . '</option>'; |
5155 | 5376 | } |
5156 | 5377 | $retstring .= '</select>'; |
@@ -5181,21 +5402,25 @@ discard block |
||
5181 | 5402 | } */ |
5182 | 5403 | // Update the hour part |
5183 | 5404 | if ($h) { |
5184 | - if ($fullday) |
|
5185 | - $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
|
5405 | + if ($fullday) { |
|
5406 | + $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
|
5407 | + } |
|
5186 | 5408 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; |
5187 | 5409 | $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . DolUtils::dol_print_date(dol_now(), '%H') . '\');'; |
5188 | - if ($fullday) |
|
5189 | - $reset_scripts .= ' } '; |
|
5410 | + if ($fullday) { |
|
5411 | + $reset_scripts .= ' } '; |
|
5412 | + } |
|
5190 | 5413 | } |
5191 | 5414 | // Update the minute part |
5192 | 5415 | if ($m) { |
5193 | - if ($fullday) |
|
5194 | - $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
|
5416 | + if ($fullday) { |
|
5417 | + $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
|
5418 | + } |
|
5195 | 5419 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; |
5196 | 5420 | $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . DolUtils::dol_print_date(dol_now(), '%M') . '\');'; |
5197 | - if ($fullday) |
|
5198 | - $reset_scripts .= ' } '; |
|
5421 | + if ($fullday) { |
|
5422 | + $reset_scripts .= ' } '; |
|
5423 | + } |
|
5199 | 5424 | } |
5200 | 5425 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
5201 | 5426 | if ($reset_scripts && empty(Globals::$conf->dol_optimize_smallscreen)) { |
@@ -5217,19 +5442,23 @@ discard block |
||
5217 | 5442 | $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . DolUtils::dol_print_date(dol_now(), '%Y') . '\');'; |
5218 | 5443 | // Update the hour part |
5219 | 5444 | if ($h) { |
5220 | - if ($fullday) |
|
5221 | - $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
|
5445 | + if ($fullday) { |
|
5446 | + $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
|
5447 | + } |
|
5222 | 5448 | $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . DolUtils::dol_print_date(dol_now(), '%H') . '\');'; |
5223 | - if ($fullday) |
|
5224 | - $reset_scripts .= ' } '; |
|
5449 | + if ($fullday) { |
|
5450 | + $reset_scripts .= ' } '; |
|
5451 | + } |
|
5225 | 5452 | } |
5226 | 5453 | // Update the minute part |
5227 | 5454 | if ($m) { |
5228 | - if ($fullday) |
|
5229 | - $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
|
5455 | + if ($fullday) { |
|
5456 | + $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; |
|
5457 | + } |
|
5230 | 5458 | $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . DolUtils::dol_print_date(dol_now(), '%M') . '\');'; |
5231 | - if ($fullday) |
|
5232 | - $reset_scripts .= ' } '; |
|
5459 | + if ($fullday) { |
|
5460 | + $reset_scripts .= ' } '; |
|
5461 | + } |
|
5233 | 5462 | } |
5234 | 5463 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick |
5235 | 5464 | if ($reset_scripts && empty(Globals::$conf->dol_optimize_smallscreen)) { |
@@ -5292,41 +5521,46 @@ discard block |
||
5292 | 5521 | $retstring .= "</select>"; |
5293 | 5522 | } elseif ($typehour == 'text' || $typehour == 'textselect') { |
5294 | 5523 | $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" size="1" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; |
5295 | - } else |
|
5296 | - return 'BadValueForParameterTypeHour'; |
|
5524 | + } else { |
|
5525 | + return 'BadValueForParameterTypeHour'; |
|
5526 | + } |
|
5297 | 5527 | |
5298 | - if ($typehour != 'text') |
|
5299 | - $retstring .= ' ' . $langs->trans('HourShort'); |
|
5300 | - else |
|
5301 | - $retstring .= '<span class="hideonsmartphone">:</span>'; |
|
5528 | + if ($typehour != 'text') { |
|
5529 | + $retstring .= ' ' . $langs->trans('HourShort'); |
|
5530 | + } else { |
|
5531 | + $retstring .= '<span class="hideonsmartphone">:</span>'; |
|
5532 | + } |
|
5302 | 5533 | |
5303 | 5534 | // Minutes |
5304 | - if ($minunderhours) |
|
5305 | - $retstring .= '<br>'; |
|
5306 | - else |
|
5307 | - $retstring .= '<span class="hideonsmartphone"> </span>'; |
|
5535 | + if ($minunderhours) { |
|
5536 | + $retstring .= '<br>'; |
|
5537 | + } else { |
|
5538 | + $retstring .= '<span class="hideonsmartphone"> </span>'; |
|
5539 | + } |
|
5308 | 5540 | |
5309 | 5541 | if ($typehour == 'select' || $typehour == 'textselect') { |
5310 | 5542 | $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>'; |
5311 | 5543 | for ($min = 0; $min <= 55; $min = $min + 5) { |
5312 | 5544 | $retstring .= '<option value="' . $min . '"'; |
5313 | - if ($minSelected == $min) |
|
5314 | - $retstring .= ' selected'; |
|
5545 | + if ($minSelected == $min) { |
|
5546 | + $retstring .= ' selected'; |
|
5547 | + } |
|
5315 | 5548 | $retstring .= '>' . $min . '</option>'; |
5316 | 5549 | } |
5317 | 5550 | $retstring .= "</select>"; |
5318 | - } |
|
5319 | - elseif ($typehour == 'text') { |
|
5551 | + } elseif ($typehour == 'text') { |
|
5320 | 5552 | $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" size="1" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; |
5321 | 5553 | } |
5322 | 5554 | |
5323 | - if ($typehour != 'text') |
|
5324 | - $retstring .= ' ' . $langs->trans('MinuteShort'); |
|
5555 | + if ($typehour != 'text') { |
|
5556 | + $retstring .= ' ' . $langs->trans('MinuteShort'); |
|
5557 | + } |
|
5325 | 5558 | |
5326 | 5559 | //$retstring.=" "; |
5327 | 5560 | |
5328 | - if (!empty($nooutput)) |
|
5329 | - return $retstring; |
|
5561 | + if (!empty($nooutput)) { |
|
5562 | + return $retstring; |
|
5563 | + } |
|
5330 | 5564 | |
5331 | 5565 | print $retstring; |
5332 | 5566 | return; |
@@ -5369,8 +5603,9 @@ discard block |
||
5369 | 5603 | } |
5370 | 5604 | |
5371 | 5605 | $prefixforautocompletemode = $objecttmp->element; |
5372 | - if ($prefixforautocompletemode == 'societe') |
|
5373 | - $prefixforautocompletemode = 'company'; |
|
5606 | + if ($prefixforautocompletemode == 'societe') { |
|
5607 | + $prefixforautocompletemode = 'company'; |
|
5608 | + } |
|
5374 | 5609 | $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
5375 | 5610 | |
5376 | 5611 | dol_syslog(get_class($this) . "::selectForForms", LOG_DEBUG); |
@@ -5385,11 +5620,11 @@ discard block |
||
5385 | 5620 | // Activate the auto complete using ajax call. |
5386 | 5621 | $out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, Globals::$conf->global->$confkeyforautocompletemode, 0, array()); |
5387 | 5622 | $out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>'; |
5388 | - if ($placeholder) |
|
5389 | - $placeholder = ' placeholder="' . $placeholder . '"'; |
|
5623 | + if ($placeholder) { |
|
5624 | + $placeholder = ' placeholder="' . $placeholder . '"'; |
|
5625 | + } |
|
5390 | 5626 | $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $preselectedvalue . '"' . $placeholder . ' />'; |
5391 | - } |
|
5392 | - else { |
|
5627 | + } else { |
|
5393 | 5628 | // Immediate load of all database |
5394 | 5629 | $out .= $this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo); |
5395 | 5630 | } |
@@ -5419,19 +5654,22 @@ discard block |
||
5419 | 5654 | global $conf, $langs, $user; |
5420 | 5655 | |
5421 | 5656 | $prefixforautocompletemode = $objecttmp->element; |
5422 | - if ($prefixforautocompletemode == 'societe') |
|
5423 | - $prefixforautocompletemode = 'company'; |
|
5657 | + if ($prefixforautocompletemode == 'societe') { |
|
5658 | + $prefixforautocompletemode = 'company'; |
|
5659 | + } |
|
5424 | 5660 | $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT |
5425 | 5661 | |
5426 | 5662 | $fieldstoshow = 't.ref'; |
5427 | 5663 | if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields ( like societe, contact, ...) |
5428 | 5664 | $tmpfieldstoshow = ''; |
5429 | 5665 | foreach ($objecttmp->fields as $key => $val) { |
5430 | - if ($val['showoncombobox']) |
|
5431 | - $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; |
|
5666 | + if ($val['showoncombobox']) { |
|
5667 | + $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key; |
|
5668 | + } |
|
5432 | 5669 | } |
5433 | - if ($tmpfieldstoshow) |
|
5434 | - $fieldstoshow = $tmpfieldstoshow; |
|
5670 | + if ($tmpfieldstoshow) { |
|
5671 | + $fieldstoshow = $tmpfieldstoshow; |
|
5672 | + } |
|
5435 | 5673 | } |
5436 | 5674 | |
5437 | 5675 | $out = ''; |
@@ -5441,23 +5679,28 @@ discard block |
||
5441 | 5679 | |
5442 | 5680 | // Search data |
5443 | 5681 | $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . MAIN_DB_PREFIX . $objecttmp->table_element . " as t"; |
5444 | - if ($objecttmp->ismultientitymanaged == 2) |
|
5445 | - if (!$user->rights->societe->client->voir && !$user->societe_id) |
|
5446 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
5682 | + if ($objecttmp->ismultientitymanaged == 2) { |
|
5683 | + if (!$user->rights->societe->client->voir && !$user->societe_id) |
|
5684 | + $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
5685 | + } |
|
5447 | 5686 | $sql .= " WHERE 1=1"; |
5448 | - if (!empty($objecttmp->ismultientitymanaged)) |
|
5449 | - $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; |
|
5687 | + if (!empty($objecttmp->ismultientitymanaged)) { |
|
5688 | + $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; |
|
5689 | + } |
|
5450 | 5690 | if ($objecttmp->ismultientitymanaged == 1 && !empty($user->societe_id)) { |
5451 | - if ($objecttmp->element == 'societe') |
|
5452 | - $sql .= " AND t.rowid = " . $user->societe_id; |
|
5453 | - else |
|
5454 | - $sql .= " AND t.fk_soc = " . $user->societe_id; |
|
5455 | - } |
|
5456 | - if ($searchkey != '') |
|
5457 | - $sql .= natural_search(explode(',', $fieldstoshow), $searchkey); |
|
5458 | - if ($objecttmp->ismultientitymanaged == 2) |
|
5459 | - if (!$user->rights->societe->client->voir && !$user->societe_id) |
|
5460 | - $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
5691 | + if ($objecttmp->element == 'societe') { |
|
5692 | + $sql .= " AND t.rowid = " . $user->societe_id; |
|
5693 | + } else { |
|
5694 | + $sql .= " AND t.fk_soc = " . $user->societe_id; |
|
5695 | + } |
|
5696 | + } |
|
5697 | + if ($searchkey != '') { |
|
5698 | + $sql .= natural_search(explode(',', $fieldstoshow), $searchkey); |
|
5699 | + } |
|
5700 | + if ($objecttmp->ismultientitymanaged == 2) { |
|
5701 | + if (!$user->rights->societe->client->voir && !$user->societe_id) |
|
5702 | + $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; |
|
5703 | + } |
|
5461 | 5704 | $sql .= $this->db->order($fieldstoshow, "ASC"); |
5462 | 5705 | //$sql.=$this->db->plimit($limit, 0); |
5463 | 5706 | // Build output string |
@@ -5476,13 +5719,15 @@ discard block |
||
5476 | 5719 | |
5477 | 5720 | //if (! empty(Globals::$conf->use_javascript_ajax) || $forcecombo) $textifempty=''; |
5478 | 5721 | if (!empty(Globals::$conf->global->$confkeyforautocompletemode)) { |
5479 | - if ($showempty && !is_numeric($showempty)) |
|
5480 | - $textifempty = $langs->trans($showempty); |
|
5481 | - else |
|
5482 | - $textifempty .= $langs->trans("All"); |
|
5722 | + if ($showempty && !is_numeric($showempty)) { |
|
5723 | + $textifempty = $langs->trans($showempty); |
|
5724 | + } else { |
|
5725 | + $textifempty .= $langs->trans("All"); |
|
5726 | + } |
|
5483 | 5727 | } |
5484 | - if ($showempty) |
|
5485 | - $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
5728 | + if ($showempty) { |
|
5729 | + $out .= '<option value="-1">' . $textifempty . '</option>' . "\n"; |
|
5730 | + } |
|
5486 | 5731 | |
5487 | 5732 | $num = $this->db->num_rows($resql); |
5488 | 5733 | $i = 0; |
@@ -5506,21 +5751,22 @@ discard block |
||
5506 | 5751 | } |
5507 | 5752 | |
5508 | 5753 | $i++; |
5509 | - if (($i % 10) == 0) |
|
5510 | - $out .= "\n"; |
|
5754 | + if (($i % 10) == 0) { |
|
5755 | + $out .= "\n"; |
|
5756 | + } |
|
5511 | 5757 | } |
5512 | 5758 | } |
5513 | 5759 | |
5514 | 5760 | $out .= '</select>' . "\n"; |
5515 | - } |
|
5516 | - else { |
|
5761 | + } else { |
|
5517 | 5762 | DolUtils::dol_print_error($this->db); |
5518 | 5763 | } |
5519 | 5764 | |
5520 | 5765 | $this->result = array('nbofelement' => $num); |
5521 | 5766 | |
5522 | - if ($outputmode) |
|
5523 | - return $outarray; |
|
5767 | + if ($outputmode) { |
|
5768 | + return $outarray; |
|
5769 | + } |
|
5524 | 5770 | return $out; |
5525 | 5771 | } |
5526 | 5772 | |
@@ -5556,8 +5802,9 @@ discard block |
||
5556 | 5802 | //if (preg_match('/^multi/',$htmlname)) $jsbeautify = 1; |
5557 | 5803 | $jsbeautify = 1; |
5558 | 5804 | |
5559 | - if ($value_as_key) |
|
5560 | - $array = array_combine($array, $array); |
|
5805 | + if ($value_as_key) { |
|
5806 | + $array = array_combine($array, $array); |
|
5807 | + } |
|
5561 | 5808 | |
5562 | 5809 | $out = ''; |
5563 | 5810 | |
@@ -5577,10 +5824,13 @@ discard block |
||
5577 | 5824 | |
5578 | 5825 | if ($show_empty) { |
5579 | 5826 | $textforempty = ' '; |
5580 | - if (!empty(Globals::$conf->use_javascript_ajax)) |
|
5581 | - $textforempty = ' '; // If we use ajaxcombo, we need here to avoid to have an empty element that is too small. |
|
5582 | - if (!is_numeric($show_empty)) |
|
5583 | - $textforempty = $show_empty; |
|
5827 | + if (!empty(Globals::$conf->use_javascript_ajax)) { |
|
5828 | + $textforempty = ' '; |
|
5829 | + } |
|
5830 | + // If we use ajaxcombo, we need here to avoid to have an empty element that is too small. |
|
5831 | + if (!is_numeric($show_empty)) { |
|
5832 | + $textforempty = $show_empty; |
|
5833 | + } |
|
5584 | 5834 | $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n"; |
5585 | 5835 | } |
5586 | 5836 | |
@@ -5593,10 +5843,11 @@ discard block |
||
5593 | 5843 | } |
5594 | 5844 | |
5595 | 5845 | // Sort |
5596 | - if ($sort == 'ASC') |
|
5597 | - asort($array); |
|
5598 | - elseif ($sort == 'DESC') |
|
5599 | - arsort($array); |
|
5846 | + if ($sort == 'ASC') { |
|
5847 | + asort($array); |
|
5848 | + } elseif ($sort == 'DESC') { |
|
5849 | + arsort($array); |
|
5850 | + } |
|
5600 | 5851 | |
5601 | 5852 | foreach ($array as $key => $value) { |
5602 | 5853 | $disabled = ''; |
@@ -5610,26 +5861,31 @@ discard block |
||
5610 | 5861 | } |
5611 | 5862 | |
5612 | 5863 | if ($key_in_label) { |
5613 | - if (empty($nohtmlescape)) |
|
5614 | - $selectOptionValue = DolUtils::dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
5615 | - else |
|
5616 | - $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
5617 | - } |
|
5618 | - else { |
|
5619 | - if (empty($nohtmlescape)) |
|
5620 | - $selectOptionValue = DolUtils::dol_escape_htmltag($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
5621 | - else |
|
5622 | - $selectOptionValue = $maxlen ? dol_trunc($value, $maxlen) : $value; |
|
5623 | - if ($value == '' || $value == '-') |
|
5624 | - $selectOptionValue = ' '; |
|
5864 | + if (empty($nohtmlescape)) { |
|
5865 | + $selectOptionValue = DolUtils::dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value)); |
|
5866 | + } else { |
|
5867 | + $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
5868 | + } |
|
5869 | + } else { |
|
5870 | + if (empty($nohtmlescape)) { |
|
5871 | + $selectOptionValue = DolUtils::dol_escape_htmltag($maxlen ? dol_trunc($value, $maxlen) : $value); |
|
5872 | + } else { |
|
5873 | + $selectOptionValue = $maxlen ? dol_trunc($value, $maxlen) : $value; |
|
5874 | + } |
|
5875 | + if ($value == '' || $value == '-') { |
|
5876 | + $selectOptionValue = ' '; |
|
5877 | + } |
|
5625 | 5878 | } |
5626 | 5879 | |
5627 | 5880 | $out .= '<option value="' . $key . '"'; |
5628 | 5881 | $out .= $style . $disabled; |
5629 | - if ($id != '' && $id == $key && !$disabled) |
|
5630 | - $out .= ' selected'; // To preselect a value |
|
5631 | - if ($nohtmlescape) |
|
5632 | - $out .= ' data-html="' . DolUtils::dol_escape_htmltag($selectOptionValue) . '"'; |
|
5882 | + if ($id != '' && $id == $key && !$disabled) { |
|
5883 | + $out .= ' selected'; |
|
5884 | + } |
|
5885 | + // To preselect a value |
|
5886 | + if ($nohtmlescape) { |
|
5887 | + $out .= ' data-html="' . DolUtils::dol_escape_htmltag($selectOptionValue) . '"'; |
|
5888 | + } |
|
5633 | 5889 | $out .= '>'; |
5634 | 5890 | //var_dump($selectOptionValue); |
5635 | 5891 | $out .= $selectOptionValue; |
@@ -5665,8 +5921,9 @@ discard block |
||
5665 | 5921 | global $delayedhtmlcontent; |
5666 | 5922 | |
5667 | 5923 | // TODO Use an internal dolibarr component instead of select2 |
5668 | - if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) |
|
5669 | - return ''; |
|
5924 | + if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
|
5925 | + return ''; |
|
5926 | + } |
|
5670 | 5927 | |
5671 | 5928 | $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>'; |
5672 | 5929 | |
@@ -5765,8 +6022,9 @@ discard block |
||
5765 | 6022 | global $delayedhtmlcontent; |
5766 | 6023 | |
5767 | 6024 | // TODO Use an internal dolibarr component instead of select2 |
5768 | - if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) |
|
5769 | - return ''; |
|
6025 | + if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) { |
|
6026 | + return ''; |
|
6027 | + } |
|
5770 | 6028 | |
5771 | 6029 | $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"><option></option></select>'; |
5772 | 6030 | |
@@ -5936,8 +6194,9 @@ discard block |
||
5936 | 6194 | |
5937 | 6195 | $out .= '<select id="' . $htmlname . '" class="multiselect' . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n"; |
5938 | 6196 | if (is_array($array) && !empty($array)) { |
5939 | - if ($value_as_key) |
|
5940 | - $array = array_combine($array, $array); |
|
6197 | + if ($value_as_key) { |
|
6198 | + $array = array_combine($array, $array); |
|
6199 | + } |
|
5941 | 6200 | |
5942 | 6201 | if (!empty($array)) { |
5943 | 6202 | foreach ($array as $key => $value) { |
@@ -5972,8 +6231,9 @@ discard block |
||
5972 | 6231 | { |
5973 | 6232 | global $conf, $langs, $user; |
5974 | 6233 | |
5975 | - if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) |
|
5976 | - return ''; |
|
6234 | + if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
|
6235 | + return ''; |
|
6236 | + } |
|
5977 | 6237 | |
5978 | 6238 | $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; |
5979 | 6239 | if (!empty($user->conf->$tmpvar)) { |
@@ -5981,10 +6241,11 @@ discard block |
||
5981 | 6241 | foreach ($array as $key => $val) { |
5982 | 6242 | //var_dump($key); |
5983 | 6243 | //var_dump($tmparray); |
5984 | - if (in_array($key, $tmparray)) |
|
5985 | - $array[$key]['checked'] = 1; |
|
5986 | - else |
|
5987 | - $array[$key]['checked'] = 0; |
|
6244 | + if (in_array($key, $tmparray)) { |
|
6245 | + $array[$key]['checked'] = 1; |
|
6246 | + } else { |
|
6247 | + $array[$key]['checked'] = 0; |
|
6248 | + } |
|
5988 | 6249 | } |
5989 | 6250 | } |
5990 | 6251 | //var_dump($array); |
@@ -6150,40 +6411,47 @@ discard block |
||
6150 | 6411 | // To work with non standard path |
6151 | 6412 | if ($objecttype == 'facture') { |
6152 | 6413 | $tplpath = 'compta/' . $element; |
6153 | - if (empty(Globals::$conf->facture->enabled)) |
|
6154 | - continue; // Do not show if module disabled |
|
6155 | - } |
|
6156 | - else if ($objecttype == 'facturerec') { |
|
6414 | + if (empty(Globals::$conf->facture->enabled)) { |
|
6415 | + continue; |
|
6416 | + } |
|
6417 | + // Do not show if module disabled |
|
6418 | + } else if ($objecttype == 'facturerec') { |
|
6157 | 6419 | $tplpath = 'compta/facture'; |
6158 | 6420 | $tplname = 'linkedobjectblockForRec'; |
6159 | - if (empty(Globals::$conf->facture->enabled)) |
|
6160 | - continue; // Do not show if module disabled |
|
6161 | - } |
|
6162 | - else if ($objecttype == 'propal') { |
|
6421 | + if (empty(Globals::$conf->facture->enabled)) { |
|
6422 | + continue; |
|
6423 | + } |
|
6424 | + // Do not show if module disabled |
|
6425 | + } else if ($objecttype == 'propal') { |
|
6163 | 6426 | $tplpath = 'comm/' . $element; |
6164 | - if (empty(Globals::$conf->propal->enabled)) |
|
6165 | - continue; // Do not show if module disabled |
|
6166 | - } |
|
6167 | - else if ($objecttype == 'supplier_proposal') { |
|
6168 | - if (empty(Globals::$conf->supplier_proposal->enabled)) |
|
6169 | - continue; // Do not show if module disabled |
|
6170 | - } |
|
6171 | - else if ($objecttype == 'shipping' || $objecttype == 'shipment') { |
|
6427 | + if (empty(Globals::$conf->propal->enabled)) { |
|
6428 | + continue; |
|
6429 | + } |
|
6430 | + // Do not show if module disabled |
|
6431 | + } else if ($objecttype == 'supplier_proposal') { |
|
6432 | + if (empty(Globals::$conf->supplier_proposal->enabled)) { |
|
6433 | + continue; |
|
6434 | + } |
|
6435 | + // Do not show if module disabled |
|
6436 | + } else if ($objecttype == 'shipping' || $objecttype == 'shipment') { |
|
6172 | 6437 | $tplpath = 'expedition'; |
6173 | - if (empty(Globals::$conf->expedition->enabled)) |
|
6174 | - continue; // Do not show if module disabled |
|
6175 | - } |
|
6176 | - else if ($objecttype == 'reception') { |
|
6438 | + if (empty(Globals::$conf->expedition->enabled)) { |
|
6439 | + continue; |
|
6440 | + } |
|
6441 | + // Do not show if module disabled |
|
6442 | + } else if ($objecttype == 'reception') { |
|
6177 | 6443 | $tplpath = 'reception'; |
6178 | - if (empty(Globals::$conf->reception->enabled)) |
|
6179 | - continue; // Do not show if module disabled |
|
6180 | - } |
|
6181 | - else if ($objecttype == 'delivery') { |
|
6444 | + if (empty(Globals::$conf->reception->enabled)) { |
|
6445 | + continue; |
|
6446 | + } |
|
6447 | + // Do not show if module disabled |
|
6448 | + } else if ($objecttype == 'delivery') { |
|
6182 | 6449 | $tplpath = 'livraison'; |
6183 | - if (empty(Globals::$conf->expedition->enabled)) |
|
6184 | - continue; // Do not show if module disabled |
|
6185 | - } |
|
6186 | - else if ($objecttype == 'invoice_supplier') { |
|
6450 | + if (empty(Globals::$conf->expedition->enabled)) { |
|
6451 | + continue; |
|
6452 | + } |
|
6453 | + // Do not show if module disabled |
|
6454 | + } else if ($objecttype == 'invoice_supplier') { |
|
6187 | 6455 | $tplpath = 'fourn/facture'; |
6188 | 6456 | } else if ($objecttype == 'order_supplier') { |
6189 | 6457 | $tplpath = 'fourn/commande'; |
@@ -6247,20 +6515,23 @@ discard block |
||
6247 | 6515 | $linktoelemlist = ''; |
6248 | 6516 | $listofidcompanytoscan = ''; |
6249 | 6517 | |
6250 | - if (!is_object($object->thirdparty)) |
|
6251 | - $object->fetch_thirdparty(); |
|
6518 | + if (!is_object($object->thirdparty)) { |
|
6519 | + $object->fetch_thirdparty(); |
|
6520 | + } |
|
6252 | 6521 | |
6253 | 6522 | $possiblelinks = array(); |
6254 | 6523 | if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { |
6255 | 6524 | $listofidcompanytoscan = $object->thirdparty->id; |
6256 | - if (($object->thirdparty->parent > 0) && !empty(Globals::$conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) |
|
6257 | - $listofidcompanytoscan .= ',' . $object->thirdparty->parent; |
|
6525 | + if (($object->thirdparty->parent > 0) && !empty(Globals::$conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) { |
|
6526 | + $listofidcompanytoscan .= ',' . $object->thirdparty->parent; |
|
6527 | + } |
|
6258 | 6528 | if (($object->fk_project > 0) && !empty(Globals::$conf->global->THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO)) { |
6259 | 6529 | include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
6260 | 6530 | $tmpproject = new Project($this->db); |
6261 | 6531 | $tmpproject->fetch($object->fk_project); |
6262 | - if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) |
|
6263 | - $listofidcompanytoscan .= ',' . $tmpproject->socid; |
|
6532 | + if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { |
|
6533 | + $listofidcompanytoscan .= ',' . $tmpproject->socid; |
|
6534 | + } |
|
6264 | 6535 | unset($tmpproject); |
6265 | 6536 | } |
6266 | 6537 | |
@@ -6296,8 +6567,9 @@ discard block |
||
6296 | 6567 | foreach ($possiblelinks as $key => $possiblelink) { |
6297 | 6568 | $num = 0; |
6298 | 6569 | |
6299 | - if (empty($possiblelink['enabled'])) |
|
6300 | - continue; |
|
6570 | + if (empty($possiblelink['enabled'])) { |
|
6571 | + continue; |
|
6572 | + } |
|
6301 | 6573 | |
6302 | 6574 | if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { |
6303 | 6575 | print '<div id="' . $key . 'list"' . (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ' style="display:none"' : '') . '>'; |
@@ -6348,11 +6620,13 @@ discard block |
||
6348 | 6620 | } |
6349 | 6621 | |
6350 | 6622 | //$linktoelem.=($linktoelem?' ':''); |
6351 | - if ($num > 0) |
|
6352 | - $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; |
|
6623 | + if ($num > 0) { |
|
6624 | + $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; |
|
6625 | + } |
|
6353 | 6626 | //else $linktoelem.=$langs->trans($possiblelink['label']); |
6354 | - else |
|
6355 | - $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; |
|
6627 | + else { |
|
6628 | + $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>'; |
|
6629 | + } |
|
6356 | 6630 | } |
6357 | 6631 | } |
6358 | 6632 | |
@@ -6410,8 +6684,9 @@ discard block |
||
6410 | 6684 | $disabled = ($disabled ? ' disabled' : ''); |
6411 | 6685 | |
6412 | 6686 | $resultyesno = '<select class="flat width75" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n"; |
6413 | - if ($useempty) |
|
6414 | - $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; |
|
6687 | + if ($useempty) { |
|
6688 | + $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n"; |
|
6689 | + } |
|
6415 | 6690 | if (("$value" == 'yes') || ($value == 1)) { |
6416 | 6691 | $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans("Yes") . '</option>' . "\n"; |
6417 | 6692 | $resultyesno .= '<option value="' . $no . '">' . $langs->trans("No") . '</option>' . "\n"; |
@@ -6490,10 +6765,12 @@ discard block |
||
6490 | 6765 | global $langs, $conf, $hookmanager; |
6491 | 6766 | |
6492 | 6767 | $ret = ''; |
6493 | - if (empty($fieldid)) |
|
6494 | - $fieldid = 'rowid'; |
|
6495 | - if (empty($fieldref)) |
|
6496 | - $fieldref = 'ref'; |
|
6768 | + if (empty($fieldid)) { |
|
6769 | + $fieldid = 'rowid'; |
|
6770 | + } |
|
6771 | + if (empty($fieldref)) { |
|
6772 | + $fieldref = 'ref'; |
|
6773 | + } |
|
6497 | 6774 | |
6498 | 6775 | // Add where from hooks |
6499 | 6776 | if (is_object($hookmanager)) { |
@@ -6532,8 +6809,9 @@ discard block |
||
6532 | 6809 | $ret .= '<!-- Start banner content --><div style="vertical-align: middle">'; |
6533 | 6810 | |
6534 | 6811 | // Right part of banner |
6535 | - if ($morehtmlright) |
|
6536 | - $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; |
|
6812 | + if ($morehtmlright) { |
|
6813 | + $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>'; |
|
6814 | + } |
|
6537 | 6815 | |
6538 | 6816 | if ($previous_ref || $next_ref || $morehtml) { |
6539 | 6817 | $ret .= '<div class="pagination paginationref"><ul class="right">'; |
@@ -6551,26 +6829,32 @@ discard block |
||
6551 | 6829 | |
6552 | 6830 | $parameters = array(); |
6553 | 6831 | $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook |
6554 | - if (empty($reshook)) |
|
6555 | - $morehtmlstatus .= $hookmanager->resPrint; |
|
6556 | - else |
|
6557 | - $morehtmlstatus = $hookmanager->resPrint; |
|
6558 | - if ($morehtmlstatus) |
|
6559 | - $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; |
|
6832 | + if (empty($reshook)) { |
|
6833 | + $morehtmlstatus .= $hookmanager->resPrint; |
|
6834 | + } else { |
|
6835 | + $morehtmlstatus = $hookmanager->resPrint; |
|
6836 | + } |
|
6837 | + if ($morehtmlstatus) { |
|
6838 | + $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>'; |
|
6839 | + } |
|
6560 | 6840 | |
6561 | 6841 | $parameters = array(); |
6562 | 6842 | $reshook = $hookmanager->executeHooks('moreHtmlRef', $parameters, $object); // Note that $action and $object may have been modified by hook |
6563 | - if (empty($reshook)) |
|
6564 | - $morehtmlref .= $hookmanager->resPrint; |
|
6565 | - elseif ($reshook > 0) |
|
6566 | - $morehtmlref = $hookmanager->resPrint; |
|
6843 | + if (empty($reshook)) { |
|
6844 | + $morehtmlref .= $hookmanager->resPrint; |
|
6845 | + } elseif ($reshook > 0) { |
|
6846 | + $morehtmlref = $hookmanager->resPrint; |
|
6847 | + } |
|
6567 | 6848 | |
6568 | 6849 | // Left part of banner |
6569 | 6850 | if ($morehtmlleft) { |
6570 | - if (Globals::$conf->browser->layout == 'phone') |
|
6571 | - $ret .= '<div class="floatleft">' . $morehtmlleft . '</div>'; // class="center" to have photo in middle |
|
6572 | - else |
|
6573 | - $ret .= '<div class="inline-block floatleft">' . $morehtmlleft . '</div>'; |
|
6851 | + if (Globals::$conf->browser->layout == 'phone') { |
|
6852 | + $ret .= '<div class="floatleft">' . $morehtmlleft . '</div>'; |
|
6853 | + } |
|
6854 | + // class="center" to have photo in middle |
|
6855 | + else { |
|
6856 | + $ret .= '<div class="inline-block floatleft">' . $morehtmlleft . '</div>'; |
|
6857 | + } |
|
6574 | 6858 | } |
6575 | 6859 | |
6576 | 6860 | //if (Globals::$conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>'; |
@@ -6595,8 +6879,9 @@ discard block |
||
6595 | 6879 | $ret .= $object->label; |
6596 | 6880 | } else if ($object->element == 'ecm_directories') { |
6597 | 6881 | $ret .= ''; |
6598 | - } else if ($fieldref != 'none') |
|
6599 | - $ret .= dol_htmlentities($object->$fieldref); |
|
6882 | + } else if ($fieldref != 'none') { |
|
6883 | + $ret .= dol_htmlentities($object->$fieldref); |
|
6884 | + } |
|
6600 | 6885 | |
6601 | 6886 | |
6602 | 6887 | if ($morehtmlref) { |
@@ -6621,15 +6906,17 @@ discard block |
||
6621 | 6906 | global $conf; |
6622 | 6907 | |
6623 | 6908 | //Check if barcode is filled in the card |
6624 | - if (empty($object->barcode)) |
|
6625 | - return ''; |
|
6909 | + if (empty($object->barcode)) { |
|
6910 | + return ''; |
|
6911 | + } |
|
6626 | 6912 | |
6627 | 6913 | // Complete object if not complete |
6628 | 6914 | if (empty($object->barcode_type_code) || empty($object->barcode_type_coder)) { |
6629 | 6915 | $result = $object->fetch_barcode(); |
6630 | 6916 | //Check if fetch_barcode() failed |
6631 | - if ($result < 1) |
|
6632 | - return '<!-- ErrorFetchBarcode -->'; |
|
6917 | + if ($result < 1) { |
|
6918 | + return '<!-- ErrorFetchBarcode -->'; |
|
6919 | + } |
|
6633 | 6920 | } |
6634 | 6921 | |
6635 | 6922 | // Barcode image |
@@ -6717,66 +7004,74 @@ discard block |
||
6717 | 7004 | if ($modulepart == 'memberphoto') { |
6718 | 7005 | $dir = Globals::$conf->adherent->dir_output; |
6719 | 7006 | if (!empty($object->photo)) { |
6720 | - if ((string) $imagesize == 'mini') |
|
6721 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
6722 | - else if ((string) $imagesize == 'small') |
|
6723 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
6724 | - else |
|
6725 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
7007 | + if ((string) $imagesize == 'mini') { |
|
7008 | + $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
7009 | + } else if ((string) $imagesize == 'small') { |
|
7010 | + $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
7011 | + } else { |
|
7012 | + $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
|
7013 | + } |
|
6726 | 7014 | $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo; |
6727 | 7015 | } |
6728 | - if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS)) |
|
6729 | - $altfile = $object->id . ".jpg"; // For backward compatibility |
|
7016 | + if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS)) { |
|
7017 | + $altfile = $object->id . ".jpg"; |
|
7018 | + } |
|
7019 | + // For backward compatibility |
|
6730 | 7020 | $email = $object->email; |
6731 | 7021 | $capture = 'user'; |
6732 | - } |
|
6733 | - else { |
|
7022 | + } else { |
|
6734 | 7023 | // Generic case to show photos |
6735 | 7024 | $dir = Globals::$conf->$modulepart->dir_output; |
6736 | 7025 | if (!empty($object->photo)) { |
6737 | - if ((string) $imagesize == 'mini') |
|
6738 | - $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
6739 | - else if ((string) $imagesize == 'small') |
|
6740 | - $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
6741 | - else |
|
6742 | - $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo; |
|
7026 | + if ((string) $imagesize == 'mini') { |
|
7027 | + $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_mini'); |
|
7028 | + } else if ((string) $imagesize == 'small') { |
|
7029 | + $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_small'); |
|
7030 | + } else { |
|
7031 | + $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo; |
|
7032 | + } |
|
6743 | 7033 | $originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo; |
6744 | 7034 | } |
6745 | - if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS)) |
|
6746 | - $altfile = $object->id . ".jpg"; // For backward compatibility |
|
7035 | + if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS)) { |
|
7036 | + $altfile = $object->id . ".jpg"; |
|
7037 | + } |
|
7038 | + // For backward compatibility |
|
6747 | 7039 | $email = $object->email; |
6748 | 7040 | } |
6749 | 7041 | } |
6750 | 7042 | } |
6751 | - if ($forcecapture) |
|
6752 | - $capture = $forcecapture; |
|
7043 | + if ($forcecapture) { |
|
7044 | + $capture = $forcecapture; |
|
7045 | + } |
|
6753 | 7046 | |
6754 | 7047 | if ($dir) { |
6755 | 7048 | if ($file && file_exists($dir . "/" . $file)) { |
6756 | 7049 | if ($addlinktofullsize) { |
6757 | 7050 | $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
6758 | - if ($urladvanced) |
|
6759 | - $ret .= '<a href="' . $urladvanced . '">'; |
|
6760 | - else |
|
6761 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
7051 | + if ($urladvanced) { |
|
7052 | + $ret .= '<a href="' . $urladvanced . '">'; |
|
7053 | + } else { |
|
7054 | + $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
7055 | + } |
|
6762 | 7056 | } |
6763 | 7057 | $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">'; |
6764 | - if ($addlinktofullsize) |
|
6765 | - $ret .= '</a>'; |
|
6766 | - } |
|
6767 | - else if ($altfile && file_exists($dir . "/" . $altfile)) { |
|
7058 | + if ($addlinktofullsize) { |
|
7059 | + $ret .= '</a>'; |
|
7060 | + } |
|
7061 | + } else if ($altfile && file_exists($dir . "/" . $altfile)) { |
|
6768 | 7062 | if ($addlinktofullsize) { |
6769 | 7063 | $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); |
6770 | - if ($urladvanced) |
|
6771 | - $ret .= '<a href="' . $urladvanced . '">'; |
|
6772 | - else |
|
6773 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
7064 | + if ($urladvanced) { |
|
7065 | + $ret .= '<a href="' . $urladvanced . '">'; |
|
7066 | + } else { |
|
7067 | + $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">'; |
|
7068 | + } |
|
6774 | 7069 | } |
6775 | 7070 | $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo alt" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" class="' . $cssclass . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($altfile) . '&cache=' . $cache . '">'; |
6776 | - if ($addlinktofullsize) |
|
6777 | - $ret .= '</a>'; |
|
6778 | - } |
|
6779 | - else { |
|
7071 | + if ($addlinktofullsize) { |
|
7072 | + $ret .= '</a>'; |
|
7073 | + } |
|
7074 | + } else { |
|
6780 | 7075 | $nophoto = '/public/theme/common/nophoto.png'; |
6781 | 7076 | if (in_array($modulepart, array('userphoto', 'contact'))) { // For module that are "physical" users |
6782 | 7077 | $nophoto = '/public/theme/common/user_anonymous.png'; |
@@ -6814,8 +7109,9 @@ discard block |
||
6814 | 7109 | $ret .= '<tr><td class="tdoverflow"><input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput"' . ($capture ? ' capture="' . $capture . '"' : '') . '></td></tr>'; |
6815 | 7110 | $ret .= '</table>'; |
6816 | 7111 | } |
6817 | - } else |
|
6818 | - DolUtils::dol_print_error('', 'Call of showphoto with wrong parameters modulepart=' . $modulepart); |
|
7112 | + } else { |
|
7113 | + DolUtils::dol_print_error('', 'Call of showphoto with wrong parameters modulepart=' . $modulepart); |
|
7114 | + } |
|
6819 | 7115 | |
6820 | 7116 | return $ret; |
6821 | 7117 | } |
@@ -6842,14 +7138,17 @@ discard block |
||
6842 | 7138 | global $conf, $user, $langs; |
6843 | 7139 | |
6844 | 7140 | // Permettre l'exclusion de groupes |
6845 | - if (is_array($exclude)) |
|
6846 | - $excludeGroups = implode("','", $exclude); |
|
7141 | + if (is_array($exclude)) { |
|
7142 | + $excludeGroups = implode("','", $exclude); |
|
7143 | + } |
|
6847 | 7144 | // Permettre l'inclusion de groupes |
6848 | - if (is_array($include)) |
|
6849 | - $includeGroups = implode("','", $include); |
|
7145 | + if (is_array($include)) { |
|
7146 | + $includeGroups = implode("','", $include); |
|
7147 | + } |
|
6850 | 7148 | |
6851 | - if (!is_array($selected)) |
|
6852 | - $selected = array($selected); |
|
7149 | + if (!is_array($selected)) { |
|
7150 | + $selected = array($selected); |
|
7151 | + } |
|
6853 | 7152 | |
6854 | 7153 | $out = ''; |
6855 | 7154 | |
@@ -6861,18 +7160,20 @@ discard block |
||
6861 | 7160 | $sql .= " FROM " . MAIN_DB_PREFIX . "usergroup as ug "; |
6862 | 7161 | if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) { |
6863 | 7162 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entity as e ON e.rowid=ug.entity"; |
6864 | - if ($force_entity) |
|
6865 | - $sql .= " WHERE ug.entity IN (0," . $force_entity . ")"; |
|
6866 | - else |
|
6867 | - $sql .= " WHERE ug.entity IS NOT NULL"; |
|
6868 | - } |
|
6869 | - else { |
|
7163 | + if ($force_entity) { |
|
7164 | + $sql .= " WHERE ug.entity IN (0," . $force_entity . ")"; |
|
7165 | + } else { |
|
7166 | + $sql .= " WHERE ug.entity IS NOT NULL"; |
|
7167 | + } |
|
7168 | + } else { |
|
6870 | 7169 | $sql .= " WHERE ug.entity IN (0," . Globals::$conf->entity . ")"; |
6871 | 7170 | } |
6872 | - if (is_array($exclude) && $excludeGroups) |
|
6873 | - $sql .= " AND ug.rowid NOT IN ('" . $excludeGroups . "')"; |
|
6874 | - if (is_array($include) && $includeGroups) |
|
6875 | - $sql .= " AND ug.rowid IN ('" . $includeGroups . "')"; |
|
7171 | + if (is_array($exclude) && $excludeGroups) { |
|
7172 | + $sql .= " AND ug.rowid NOT IN ('" . $excludeGroups . "')"; |
|
7173 | + } |
|
7174 | + if (is_array($include) && $includeGroups) { |
|
7175 | + $sql .= " AND ug.rowid IN ('" . $includeGroups . "')"; |
|
7176 | + } |
|
6876 | 7177 | $sql .= " ORDER BY ug.nom ASC"; |
6877 | 7178 | |
6878 | 7179 | dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG); |
@@ -6887,18 +7188,21 @@ discard block |
||
6887 | 7188 | $num = $this->db->num_rows($resql); |
6888 | 7189 | $i = 0; |
6889 | 7190 | if ($num) { |
6890 | - if ($show_empty && !$multiple) |
|
6891 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; |
|
7191 | + if ($show_empty && !$multiple) { |
|
7192 | + $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n"; |
|
7193 | + } |
|
6892 | 7194 | |
6893 | 7195 | while ($i < $num) { |
6894 | 7196 | $obj = $this->db->fetch_object($resql); |
6895 | 7197 | $disableline = 0; |
6896 | - if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly)) |
|
6897 | - $disableline = 1; |
|
7198 | + if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly)) { |
|
7199 | + $disableline = 1; |
|
7200 | + } |
|
6898 | 7201 | |
6899 | 7202 | $out .= '<option value="' . $obj->rowid . '"'; |
6900 | - if ($disableline) |
|
6901 | - $out .= ' disabled'; |
|
7203 | + if ($disableline) { |
|
7204 | + $out .= ' disabled'; |
|
7205 | + } |
|
6902 | 7206 | if ((is_object($selected[0]) && $selected[0]->id == $obj->rowid) || (!is_object($selected[0]) && in_array($obj->rowid, $selected) )) { |
6903 | 7207 | $out .= ' selected'; |
6904 | 7208 | } |
@@ -6913,13 +7217,13 @@ discard block |
||
6913 | 7217 | $i++; |
6914 | 7218 | } |
6915 | 7219 | } else { |
6916 | - if ($show_empty) |
|
6917 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; |
|
7220 | + if ($show_empty) { |
|
7221 | + $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n"; |
|
7222 | + } |
|
6918 | 7223 | $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; |
6919 | 7224 | } |
6920 | 7225 | $out .= '</select>'; |
6921 | - } |
|
6922 | - else { |
|
7226 | + } else { |
|
6923 | 7227 | DolUtils::dol_print_error($this->db); |
6924 | 7228 | } |
6925 | 7229 | |
@@ -6955,8 +7259,9 @@ discard block |
||
6955 | 7259 | global $conf, $langs; |
6956 | 7260 | |
6957 | 7261 | $out = ''; |
6958 | - if (!empty(Globals::$conf->use_javascript_ajax)) |
|
6959 | - $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="checkallactions" name="checkallactions" class="checkallactions"></div>'; |
|
7262 | + if (!empty(Globals::$conf->use_javascript_ajax)) { |
|
7263 | + $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="checkallactions" name="checkallactions" class="checkallactions"></div>'; |
|
7264 | + } |
|
6960 | 7265 | $out .= '<script type="text/javascript"> |
6961 | 7266 | $(document).ready(function() { |
6962 | 7267 | $("#checkallactions").click(function() { |
@@ -6969,8 +7274,9 @@ discard block |
||
6969 | 7274 | console.log("We uncheck all"); |
6970 | 7275 | $(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); |
6971 | 7276 | }' . "\n"; |
6972 | - if ($calljsfunction) |
|
6973 | - $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
|
7277 | + if ($calljsfunction) { |
|
7278 | + $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; |
|
7279 | + } |
|
6974 | 7280 | $out .= ' }); |
6975 | 7281 | |
6976 | 7282 | $(".checkforselect").change(function() { |
@@ -7018,22 +7324,25 @@ discard block |
||
7018 | 7324 | |
7019 | 7325 | $sql = 'SELECT rowid, label FROM ' . MAIN_DB_PREFIX . 'c_exp_tax_cat WHERE active = 1'; |
7020 | 7326 | $sql .= ' AND entity IN (0,' . getEntity('exp_tax_cat') . ')'; |
7021 | - if (!empty($excludeid)) |
|
7022 | - $sql .= ' AND rowid NOT IN (' . implode(',', $excludeid) . ')'; |
|
7327 | + if (!empty($excludeid)) { |
|
7328 | + $sql .= ' AND rowid NOT IN (' . implode(',', $excludeid) . ')'; |
|
7329 | + } |
|
7023 | 7330 | $sql .= ' ORDER BY label'; |
7024 | 7331 | |
7025 | 7332 | $resql = $db->query($sql); |
7026 | 7333 | if ($resql) { |
7027 | 7334 | $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
7028 | - if ($useempty) |
|
7029 | - $out .= '<option value="0"> </option>'; |
|
7335 | + if ($useempty) { |
|
7336 | + $out .= '<option value="0"> </option>'; |
|
7337 | + } |
|
7030 | 7338 | |
7031 | 7339 | while ($obj = $db->fetch_object($resql)) { |
7032 | 7340 | $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>'; |
7033 | 7341 | } |
7034 | 7342 | $out .= '</select>'; |
7035 | - if (!empty($htmlname) && $user->admin) |
|
7036 | - $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
7343 | + if (!empty($htmlname) && $user->admin) { |
|
7344 | + $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
7345 | + } |
|
7037 | 7346 | |
7038 | 7347 | if (!empty($target)) { |
7039 | 7348 | $sql = "SELECT c.id FROM " . MAIN_DB_PREFIX . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; |
@@ -7046,8 +7355,9 @@ discard block |
||
7046 | 7355 | $("select[name=' . $target . ']").on("change", function() { |
7047 | 7356 | var current_val = $(this).val(); |
7048 | 7357 | if (current_val == ' . $obj->id . ') {'; |
7049 | - if (!empty($default_selected) || !empty($selected)) |
|
7050 | - $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; |
|
7358 | + if (!empty($default_selected) || !empty($selected)) { |
|
7359 | + $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; |
|
7360 | + } |
|
7051 | 7361 | |
7052 | 7362 | $out .= ' |
7053 | 7363 | $("select[name=' . $htmlname . ']").change(); |
@@ -7083,8 +7393,7 @@ discard block |
||
7083 | 7393 | } |
7084 | 7394 | } |
7085 | 7395 | } |
7086 | - } |
|
7087 | - else { |
|
7396 | + } else { |
|
7088 | 7397 | DolUtils::dol_print_error($db); |
7089 | 7398 | } |
7090 | 7399 | |
@@ -7109,8 +7418,9 @@ discard block |
||
7109 | 7418 | $resql = $db->query($sql); |
7110 | 7419 | if ($resql) { |
7111 | 7420 | $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
7112 | - if ($useempty) |
|
7113 | - $out .= '<option value="0"></option>'; |
|
7421 | + if ($useempty) { |
|
7422 | + $out .= '<option value="0"></option>'; |
|
7423 | + } |
|
7114 | 7424 | |
7115 | 7425 | while ($obj = $db->fetch_object($resql)) { |
7116 | 7426 | $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>'; |
@@ -7143,14 +7453,17 @@ discard block |
||
7143 | 7453 | $resql = $db->query($sql); |
7144 | 7454 | if ($resql) { |
7145 | 7455 | $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">'; |
7146 | - if ($useempty) |
|
7147 | - $out .= '<option value="0"></option>'; |
|
7148 | - if ($allchoice) |
|
7149 | - $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; |
|
7456 | + if ($useempty) { |
|
7457 | + $out .= '<option value="0"></option>'; |
|
7458 | + } |
|
7459 | + if ($allchoice) { |
|
7460 | + $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; |
|
7461 | + } |
|
7150 | 7462 | |
7151 | 7463 | $field = 'code'; |
7152 | - if ($useid) |
|
7153 | - $field = 'id'; |
|
7464 | + if ($useid) { |
|
7465 | + $field = 'id'; |
|
7466 | + } |
|
7154 | 7467 | |
7155 | 7468 | while ($obj = $db->fetch_object($resql)) { |
7156 | 7469 | $key = $langs->trans($obj->code); |
@@ -141,7 +141,7 @@ |
||
141 | 141 | */ |
142 | 142 | function top_htmlhead(/* $head, $title = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $disablejmobile = 0, $disablenofollow = 0 */) |
143 | 143 | { |
144 | - $this->top_httphead(); // TODO: Null method! |
|
144 | + $this->top_httphead(); // TODO: Null method! |
|
145 | 145 | // TODO: Nothing to do? |
146 | 146 | return; |
147 | 147 |