Passed
Push — master ( c34860...8f7a8e )
by Alxarafe
23:57
created
dolibarr/htdocs/user/group/list.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
  * 		\ingroup	core
26 26
  *      \brief      Page of user groups
27 27
  */
28
-require DOL_BASE_PATH . '/main.inc.php';
28
+require DOL_BASE_PATH.'/main.inc.php';
29 29
 
30
-require_once DOL_DOCUMENT_ROOT . '/user/class/usergroup.class.php';
30
+require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
31 31
 
32 32
 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
33 33
     if (!$user->rights->user->group_advance->read && !$user->admin) {
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 }
94 94
 
95 95
 $parameters = array();
96
-$reshook = $hookmanager->executeHooks('doActions', $parameters);    // Note that $action and $object may have been modified by some hooks
96
+$reshook = $hookmanager->executeHooks('doActions', $parameters); // Note that $action and $object may have been modified by some hooks
97 97
 if ($reshook < 0) {
98 98
     setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
99 99
 }
100 100
 
101 101
 if (empty($reshook)) {
102 102
     // Selection of new fields
103
-    include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
103
+    include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
104 104
 
105 105
     // Purge search criteria
106 106
     if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 llxHeader();
121 121
 
122 122
 $sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, COUNT(DISTINCT ugu.fk_user) as nb, COUNT(DISTINCT ugr.fk_id) as nbpermissions";
123
-$sql .= " FROM " . MAIN_DB_PREFIX . "usergroup as g";
124
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
125
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid";
123
+$sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g";
124
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
125
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid";
126 126
 if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && !$user->entity))) {
127 127
     $sql .= " WHERE g.entity IS NOT NULL";
128 128
 } else {
129
-    $sql .= " WHERE g.entity IN (0," . $conf->entity . ")";
129
+    $sql .= " WHERE g.entity IN (0,".$conf->entity.")";
130 130
 }
131 131
 if (!empty($search_group)) {
132 132
     natural_search(array("g.nom", "g.note"), $search_group);
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 
146 146
     $i = 0;
147 147
 
148
-    $param = "&search_group=" . urlencode($search_group) . "&amp;sall=" . urlencode($sall);
148
+    $param = "&search_group=".urlencode($search_group)."&amp;sall=".urlencode($sall);
149 149
     if ($optioncss != '') {
150
-        $param .= '&amp;optioncss=' . $optioncss;
150
+        $param .= '&amp;optioncss='.$optioncss;
151 151
     }
152 152
 
153 153
     $text = $langs->trans("ListOfGroups");
@@ -155,22 +155,22 @@  discard block
 block discarded – undo
155 155
     $newcardbutton = '';
156 156
     if ($caneditperms) {
157 157
         // $newcardbutton = '<a class="butActionNew" href="' . DOL_URL_ROOT . '/user/group/card.php?action=create&leftmenu="><span class="valignmiddle">' . $langs->trans('NewGroup') . '</span>';
158
-        $newcardbutton = '<a class="butActionNew" href="' . BASE_URI . '?controller=user/group&method=card&action=create&leftmenu="><span class="valignmiddle">' . $langs->trans('NewGroup') . '</span>';
158
+        $newcardbutton = '<a class="butActionNew" href="'.BASE_URI.'?controller=user/group&method=card&action=create&leftmenu="><span class="valignmiddle">'.$langs->trans('NewGroup').'</span>';
159 159
         $newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>';
160 160
         $newcardbutton .= '</a>';
161 161
     }
162 162
 
163
-    print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">' . "\n";
163
+    print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
164 164
     if ($optioncss != '') {
165
-        print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
165
+        print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
166 166
     }
167
-    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
167
+    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
168 168
     print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
169
-    print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
170
-    print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
171
-    print '<input type="hidden" name="page" value="' . $page . '">';
172
-    print '<input type="hidden" name="mode" value="' . $mode . '">';
173
-    print '<input type="hidden" name="contextpage" value="' . $contextpage . '">';
169
+    print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
170
+    print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
171
+    print '<input type="hidden" name="page" value="'.$page.'">';
172
+    print '<input type="hidden" name="mode" value="'.$mode.'">';
173
+    print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
174 174
 
175 175
     print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit);
176 176
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         foreach ($fieldstosearchall as $key => $val) {
179 179
             $fieldstosearchall[$key] = $langs->trans($val);
180 180
         }
181
-        print '<div class="divsearchfieldfilter">' . $langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall) . '</div>';
181
+        print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
182 182
     }
183 183
 
184 184
     $moreforfilter = '';
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     //$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);	// This also change content of $arrayfields
188 188
 
189 189
     print '<div class="div-table-responsive">';
190
-    print '<table class="tagtable liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
190
+    print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
191 191
 
192 192
     print '<tr class="liste_titre">';
193 193
     print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", $param, "", "", $sortfield, $sortorder);
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
         //multicompany
220 220
         if (!empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
221 221
             $mc->getInfo($obj->entity);
222
-            print '<td align="center">' . $mc->label . '</td>';
222
+            print '<td align="center">'.$mc->label.'</td>';
223 223
         }
224
-        print '<td align="center">' . $obj->nb . '</td>';
225
-        print '<td align="center">' . $obj->nbpermissions . '</td>';
226
-        print '<td align="right" class="nowrap">' . dol_print_date($db->jdate($obj->datec), "dayhour") . '</td>';
224
+        print '<td align="center">'.$obj->nb.'</td>';
225
+        print '<td align="center">'.$obj->nbpermissions.'</td>';
226
+        print '<td align="right" class="nowrap">'.dol_print_date($db->jdate($obj->datec), "dayhour").'</td>';
227 227
         print "</tr>\n";
228 228
         $i++;
229 229
     }
Please login to merge, or discard this patch.
dolibarr/htdocs/margin/lib/margins.lib.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,10 +75,10 @@
 block discarded – undo
75 75
     if ($user->rights->societe->lire) {
76 76
         //$head[$h][0] = DOL_URL_ROOT."/margin/customerMargins.php";
77 77
         $head[$h][0] = BASE_URI . '?controller=margin&method=customerMargins';
78
-		$head[$h][1] = $langs->trans("CustomerMargins");
79
-		$head[$h][2] = 'customerMargins';
80
-		$h++;
81
-	}
78
+        $head[$h][1] = $langs->trans("CustomerMargins");
79
+        $head[$h][2] = 'customerMargins';
80
+        $h++;
81
+    }
82 82
 
83 83
     if ($user->rights->margins->read->all) {
84 84
         $title = 'UserMargins';
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     $h = 0;
36 36
     $head = array();
37 37
 
38
-    $head[$h][0] = DOL_URL_ROOT . "/margin/admin/margin.php";
38
+    $head[$h][0] = DOL_URL_ROOT."/margin/admin/margin.php";
39 39
     $head[$h][1] = $langs->trans("Parameters");
40 40
     $head[$h][2] = 'parameters';
41 41
     $h++;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
     if ($user->rights->produit->lire) {
68 68
         // $head[$h][0] = DOL_URL_ROOT."/margin/productMargins.php";
69
-        $head[$h][0] = BASE_URI . '?controller=margin&method=productMargins';
69
+        $head[$h][0] = BASE_URI.'?controller=margin&method=productMargins';
70 70
         $head[$h][1] = $langs->trans("ProductMargins");
71 71
         $head[$h][2] = 'productMargins';
72 72
         $h++;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     if ($user->rights->societe->lire) {
76 76
         //$head[$h][0] = DOL_URL_ROOT."/margin/customerMargins.php";
77
-        $head[$h][0] = BASE_URI . '?controller=margin&method=customerMargins';
77
+        $head[$h][0] = BASE_URI.'?controller=margin&method=customerMargins';
78 78
 		$head[$h][1] = $langs->trans("CustomerMargins");
79 79
 		$head[$h][2] = 'customerMargins';
80 80
 		$h++;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     }
88 88
 
89 89
     //$head[$h][0] = DOL_URL_ROOT."/margin/agentMargins.php";
90
-    $head[$h][0] = BASE_URI . '?controller=margin&method=agentMargins';
90
+    $head[$h][0] = BASE_URI.'?controller=margin&method=agentMargins';
91 91
     $head[$h][1] = $langs->trans($title);
92 92
     $head[$h][2] = 'agentMargins';
93 93
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     if ($user->rights->margins->creer) {
96 96
         $h++;
97 97
         //$head[$h][0] = DOL_URL_ROOT."/margin/checkMargins.php";
98
-        $head[$h][0] = BASE_URI . '?controller=margin&method=checkMargins';
98
+        $head[$h][0] = BASE_URI.'?controller=margin&method=checkMargins';
99 99
         $head[$h][1] = $langs->trans('CheckMargins');
100 100
         $head[$h][2] = 'checkMargins';
101 101
     }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     $marque_tx_ret = '';
124 124
 
125 125
     if ($fk_pa > 0 && empty($paht)) {
126
-        require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
126
+        require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
127 127
         $product = new ProductFournisseur($db);
128 128
         if ($product->fetch_product_fournisseur_price($fk_pa)) {
129 129
             $paht_ret = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/contact.lib.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -32,34 +32,34 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function contact_prepare_head(Contact $object)
34 34
 {
35
-	global $db, $langs, $conf, $user;
35
+    global $db, $langs, $conf, $user;
36 36
 
37
-	$tab = 0;
38
-	$head = array();
37
+    $tab = 0;
38
+    $head = array();
39 39
 
40 40
     // $head[$tab][0] = DOL_URL_ROOT.'/contact/card.php?id='.$object->id;
41 41
     $head[$tab][0] = BASE_URI . '?controller=contact&method=card&id=' . $object->id;
42
-	$head[$tab][1] = $langs->trans("Card");
43
-	$head[$tab][2] = 'card';
44
-	$tab++;
42
+    $head[$tab][1] = $langs->trans("Card");
43
+    $head[$tab][2] = 'card';
44
+    $tab++;
45 45
 
46
-	if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_CONTACT_ACTIVE))
47
-		&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
48
-	{
49
-		$langs->load("ldap");
46
+    if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_CONTACT_ACTIVE))
47
+        && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
48
+    {
49
+        $langs->load("ldap");
50 50
 
51 51
         // $head[$tab][0] = DOL_URL_ROOT.'/contact/ldap.php?id='.$object->id;
52 52
         $head[$tab][0] = BASE_URI . '?controller=contact&method=ldap&id=' . $object->id;
53
-		$head[$tab][1] = $langs->trans("LDAPCard");
54
-		$head[$tab][2] = 'ldap';
55
-		$tab++;
56
-	}
53
+        $head[$tab][1] = $langs->trans("LDAPCard");
54
+        $head[$tab][2] = 'ldap';
55
+        $tab++;
56
+    }
57 57
 
58 58
     // $head[$tab][0] = DOL_URL_ROOT.'/contact/perso.php?id='.$object->id;
59 59
     $head[$tab][0] = BASE_URI . '?controller=contact&method=perso&id=' . $object->id;
60
-	$head[$tab][1] = $langs->trans("PersonalInformations");
61
-	$head[$tab][2] = 'perso';
62
-	$tab++;
60
+    $head[$tab][1] = $langs->trans("PersonalInformations");
61
+    $head[$tab][2] = 'perso';
62
+    $tab++;
63 63
 
64 64
     // Show more tabs from modules
65 65
     // Entries must be declared in modules descriptor with line
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	$head[$tab][2] = 'info';
109 109
 	$tab++;*/
110 110
 
111
-	complete_head_from_modules($conf,$langs,$object,$head,$tab,'contact','remove');
111
+    complete_head_from_modules($conf,$langs,$object,$head,$tab,'contact','remove');
112 112
 
113
-	return $head;
113
+    return $head;
114 114
 }
115 115
 
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -38,25 +38,25 @@  discard block
 block discarded – undo
38 38
 	$head = array();
39 39
 
40 40
     // $head[$tab][0] = DOL_URL_ROOT.'/contact/card.php?id='.$object->id;
41
-    $head[$tab][0] = BASE_URI . '?controller=contact&method=card&id=' . $object->id;
41
+    $head[$tab][0] = BASE_URI.'?controller=contact&method=card&id='.$object->id;
42 42
 	$head[$tab][1] = $langs->trans("Card");
43 43
 	$head[$tab][2] = 'card';
44 44
 	$tab++;
45 45
 
46
-	if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_CONTACT_ACTIVE))
47
-		&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin)))
46
+	if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_CONTACT_ACTIVE))
47
+		&& (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin)))
48 48
 	{
49 49
 		$langs->load("ldap");
50 50
 
51 51
         // $head[$tab][0] = DOL_URL_ROOT.'/contact/ldap.php?id='.$object->id;
52
-        $head[$tab][0] = BASE_URI . '?controller=contact&method=ldap&id=' . $object->id;
52
+        $head[$tab][0] = BASE_URI.'?controller=contact&method=ldap&id='.$object->id;
53 53
 		$head[$tab][1] = $langs->trans("LDAPCard");
54 54
 		$head[$tab][2] = 'ldap';
55 55
 		$tab++;
56 56
 	}
57 57
 
58 58
     // $head[$tab][0] = DOL_URL_ROOT.'/contact/perso.php?id='.$object->id;
59
-    $head[$tab][0] = BASE_URI . '?controller=contact&method=perso&id=' . $object->id;
59
+    $head[$tab][0] = BASE_URI.'?controller=contact&method=perso&id='.$object->id;
60 60
 	$head[$tab][1] = $langs->trans("PersonalInformations");
61 61
 	$head[$tab][2] = 'perso';
62 62
 	$tab++;
@@ -65,38 +65,38 @@  discard block
 block discarded – undo
65 65
     // Entries must be declared in modules descriptor with line
66 66
     // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
67 67
     // $this->tabs = array('entity:-tabname);   												to remove a tab
68
-    complete_head_from_modules($conf,$langs,$object,$head,$tab,'contact');
68
+    complete_head_from_modules($conf, $langs, $object, $head, $tab, 'contact');
69 69
 
70 70
     // Notes
71 71
     if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
72
-        $nbNote = (empty($object->note_private)?0:1)+(empty($object->note_public)?0:1);
72
+        $nbNote = (empty($object->note_private) ? 0 : 1) + (empty($object->note_public) ? 0 : 1);
73 73
         // $head[$tab][0] = DOL_URL_ROOT.'/contact/note.php?id='.$object->id;
74
-        $head[$tab][0] = BASE_URI . '?controller=contact&method=note&id=' . $object->id;
74
+        $head[$tab][0] = BASE_URI.'?controller=contact&method=note&id='.$object->id;
75 75
         $head[$tab][1] = $langs->trans("Note");
76
-        if($nbNote > 0) $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>';
76
+        if ($nbNote > 0) $head[$tab][1] .= ' <span class="badge">'.$nbNote.'</span>';
77 77
         $head[$tab][2] = 'note';
78 78
         $tab++;
79 79
     }
80 80
 
81 81
     require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
82 82
     require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
83
-    $upload_dir = $conf->societe->dir_output . "/contact/" . dol_sanitizeFileName($object->ref);
84
-    $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
85
-    $nbLinks=Link::count($db, $object->element, $object->id);
83
+    $upload_dir = $conf->societe->dir_output."/contact/".dol_sanitizeFileName($object->ref);
84
+    $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
85
+    $nbLinks = Link::count($db, $object->element, $object->id);
86 86
     // $head[$tab][0] = DOL_URL_ROOT.'/contact/document.php?id='.$object->id;
87
-    $head[$tab][0] = BASE_URI . '?controller=contact&method=document&id=' . $object->id;
87
+    $head[$tab][0] = BASE_URI.'?controller=contact&method=document&id='.$object->id;
88 88
     $head[$tab][1] = $langs->trans("Documents");
89
-    if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
89
+    if (($nbFiles + $nbLinks) > 0) $head[$tab][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>';
90 90
     $head[$tab][2] = 'documents';
91 91
     $tab++;
92 92
 
93 93
     // Agenda / Events
94
-    $head[$tab][0] = BASE_URI . '?controller=contact&method=agenda&id=' . $object->id;
95
-    $head[$tab][1].= $langs->trans("Events");
96
-    if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
94
+    $head[$tab][0] = BASE_URI.'?controller=contact&method=agenda&id='.$object->id;
95
+    $head[$tab][1] .= $langs->trans("Events");
96
+    if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
97 97
     {
98
-        $head[$tab][1].= '/';
99
-        $head[$tab][1].= $langs->trans("Agenda");
98
+        $head[$tab][1] .= '/';
99
+        $head[$tab][1] .= $langs->trans("Agenda");
100 100
     }
101 101
     $head[$tab][2] = 'agenda';
102 102
     $tab++;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	$head[$tab][2] = 'info';
109 109
 	$tab++;*/
110 110
 
111
-	complete_head_from_modules($conf,$langs,$object,$head,$tab,'contact','remove');
111
+	complete_head_from_modules($conf, $langs, $object, $head, $tab, 'contact', 'remove');
112 112
 
113 113
 	return $head;
114 114
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,9 @@  discard block
 block discarded – undo
73 73
         // $head[$tab][0] = DOL_URL_ROOT.'/contact/note.php?id='.$object->id;
74 74
         $head[$tab][0] = BASE_URI . '?controller=contact&method=note&id=' . $object->id;
75 75
         $head[$tab][1] = $langs->trans("Note");
76
-        if($nbNote > 0) $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>';
76
+        if($nbNote > 0) {
77
+            $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>';
78
+        }
77 79
         $head[$tab][2] = 'note';
78 80
         $tab++;
79 81
     }
@@ -86,7 +88,9 @@  discard block
 block discarded – undo
86 88
     // $head[$tab][0] = DOL_URL_ROOT.'/contact/document.php?id='.$object->id;
87 89
     $head[$tab][0] = BASE_URI . '?controller=contact&method=document&id=' . $object->id;
88 90
     $head[$tab][1] = $langs->trans("Documents");
89
-    if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
91
+    if (($nbFiles+$nbLinks) > 0) {
92
+        $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
93
+    }
90 94
     $head[$tab][2] = 'documents';
91 95
     $tab++;
92 96
 
Please login to merge, or discard this patch.
dolibarr/htdocs/don/card.php 3 patches
Indentation   +467 added lines, -467 removed lines patch added patch discarded remove patch
@@ -78,117 +78,117 @@  discard block
 block discarded – undo
78 78
 
79 79
 if ($action == 'update')
80 80
 {
81
-	if (! empty($cancel))
82
-	{
83
-		header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
84
-		exit;
85
-	}
81
+    if (! empty($cancel))
82
+    {
83
+        header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
84
+        exit;
85
+    }
86 86
 
87
-	$error=0;
87
+    $error=0;
88 88
 
89 89
     if (empty($donation_date))
90 90
     {
91
-	    setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
91
+        setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
92 92
         $action = "create";
93 93
         $error++;
94 94
     }
95 95
 
96
-	if (empty($amount))
97
-	{
98
-		setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
99
-		$action = "create";
100
-		$error++;
101
-	}
96
+    if (empty($amount))
97
+    {
98
+        setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
99
+        $action = "create";
100
+        $error++;
101
+    }
102 102
 
103
-	if (! $error)
104
-	{
105
-		$object->fetch($id);
106
-
107
-		$object->firstname   = GETPOST("firstname",'alpha');
108
-		$object->lastname    = GETPOST("lastname",'alpha');
109
-		$object->societe     = GETPOST("societe",'alpha');
110
-		$object->address     = GETPOST("address",'alpha');
111
-		$object->amount      = price2num(GETPOST("amount",'alpha'));
112
-		$object->town        = GETPOST("town",'alpha');
113
-		$object->zip         = GETPOST("zipcode",'alpha');
103
+    if (! $error)
104
+    {
105
+        $object->fetch($id);
106
+
107
+        $object->firstname   = GETPOST("firstname",'alpha');
108
+        $object->lastname    = GETPOST("lastname",'alpha');
109
+        $object->societe     = GETPOST("societe",'alpha');
110
+        $object->address     = GETPOST("address",'alpha');
111
+        $object->amount      = price2num(GETPOST("amount",'alpha'));
112
+        $object->town        = GETPOST("town",'alpha');
113
+        $object->zip         = GETPOST("zipcode",'alpha');
114 114
         $object->country_id  = GETPOST('country_id', 'int');
115 115
         $object->email       = GETPOST("email",'alpha');
116
-		$object->date        = $donation_date;
117
-		$object->public      = GETPOST("public",'alpha');
118
-		$object->fk_project  = GETPOST("fk_project",'alpha');
119
-		$object->note_private= GETPOST("note_private",'none');
120
-		$object->note_public = GETPOST("note_public",'none');
121
-		$object->modepaymentid = GETPOST('modepayment','int');
122
-
123
-		// Fill array 'array_options' with data from add form
116
+        $object->date        = $donation_date;
117
+        $object->public      = GETPOST("public",'alpha');
118
+        $object->fk_project  = GETPOST("fk_project",'alpha');
119
+        $object->note_private= GETPOST("note_private",'none');
120
+        $object->note_public = GETPOST("note_public",'none');
121
+        $object->modepaymentid = GETPOST('modepayment','int');
122
+
123
+        // Fill array 'array_options' with data from add form
124 124
         $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
125
-		if ($ret < 0) $error++;
125
+        if ($ret < 0) $error++;
126 126
 
127
-		if ($object->update($user) > 0)
128
-		{
129
-			header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
130
-			exit;
131
-		}
132
-	}
127
+        if ($object->update($user) > 0)
128
+        {
129
+            header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
130
+            exit;
131
+        }
132
+    }
133 133
 }
134 134
 
135 135
 if ($action == 'add')
136 136
 {
137
-	if (! empty($cancel))
138
-	{
139
-		header("Location: index.php");
140
-		exit;
141
-	}
137
+    if (! empty($cancel))
138
+    {
139
+        header("Location: index.php");
140
+        exit;
141
+    }
142 142
 
143
-	$error=0;
143
+    $error=0;
144 144
 
145 145
     if (empty($donation_date))
146 146
     {
147
-	    setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
147
+        setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
148 148
         $action = "create";
149 149
         $error++;
150 150
     }
151 151
 
152
-	if (empty($amount))
153
-	{
154
-		setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
155
-		$action = "create";
156
-		$error++;
157
-	}
152
+    if (empty($amount))
153
+    {
154
+        setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
155
+        $action = "create";
156
+        $error++;
157
+    }
158 158
 
159
-	if (! $error)
160
-	{
161
-		$object->firstname   = GETPOST("firstname",'alpha');
162
-		$object->lastname    = GETPOST("lastname",'alpha');
163
-		$object->societe     = GETPOST("societe",'alpha');
164
-		$object->address     = GETPOST("address",'alpha');
165
-		$object->amount      = price2num(GETPOST("amount",'alpha'));
166
-		$object->zip         = GETPOST("zipcode",'alpha');
167
-		$object->town        = GETPOST("town",'alpha');
159
+    if (! $error)
160
+    {
161
+        $object->firstname   = GETPOST("firstname",'alpha');
162
+        $object->lastname    = GETPOST("lastname",'alpha');
163
+        $object->societe     = GETPOST("societe",'alpha');
164
+        $object->address     = GETPOST("address",'alpha');
165
+        $object->amount      = price2num(GETPOST("amount",'alpha'));
166
+        $object->zip         = GETPOST("zipcode",'alpha');
167
+        $object->town        = GETPOST("town",'alpha');
168 168
         $object->country_id  = GETPOST('country_id', 'int');
169 169
         $object->email       = GETPOST("email",'alpha');
170
-		$object->date        = $donation_date;
171
-		$object->note_private= GETPOST("note_private",'none');
172
-		$object->note_public = GETPOST("note_public",'none');
173
-		$object->public      = GETPOST("public",'alpha');
174
-		$object->fk_project  = GETPOST("fk_project",'alpha');
175
-		$object->modepaymentid = GETPOST('modepayment','int');
176
-
177
-		// Fill array 'array_options' with data from add form
170
+        $object->date        = $donation_date;
171
+        $object->note_private= GETPOST("note_private",'none');
172
+        $object->note_public = GETPOST("note_public",'none');
173
+        $object->public      = GETPOST("public",'alpha');
174
+        $object->fk_project  = GETPOST("fk_project",'alpha');
175
+        $object->modepaymentid = GETPOST('modepayment','int');
176
+
177
+        // Fill array 'array_options' with data from add form
178 178
         $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
179
-		if ($ret < 0) $error++;
180
-
181
-		$res = $object->create($user);
182
-		if ($res > 0)
183
-		{
184
-			header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
185
-			exit;
186
-		}
187
-		else
188
-		{
189
-			setEventMessages($object->error, $object->errors, 'errors');
190
-		}
191
-	}
179
+        if ($ret < 0) $error++;
180
+
181
+        $res = $object->create($user);
182
+        if ($res > 0)
183
+        {
184
+            header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
185
+            exit;
186
+        }
187
+        else
188
+        {
189
+            setEventMessages($object->error, $object->errors, 'errors');
190
+        }
191
+    }
192 192
 }
193 193
 if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer)
194 194
 {
@@ -207,46 +207,46 @@  discard block
 block discarded – undo
207 207
 }
208 208
 if ($action == 'valid_promesse')
209 209
 {
210
-	$object->fetch($id);
211
-	if ($object->valid_promesse($id, $user->id) >= 0)
212
-	{
213
-		setEventMessages($langs->trans("DonationValidated", $object->ref), null);
210
+    $object->fetch($id);
211
+    if ($object->valid_promesse($id, $user->id) >= 0)
212
+    {
213
+        setEventMessages($langs->trans("DonationValidated", $object->ref), null);
214 214
 
215
-		header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
216
-		exit;
217
-	}
215
+        header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
216
+        exit;
217
+    }
218 218
     else {
219
-	    setEventMessages($object->error, $object->errors, 'errors');
219
+        setEventMessages($object->error, $object->errors, 'errors');
220 220
     }
221 221
 }
222 222
 if ($action == 'set_cancel')
223 223
 {
224
-	$object->fetch($id);
225
-	if ($object->set_cancel($id) >= 0)
224
+    $object->fetch($id);
225
+    if ($object->set_cancel($id) >= 0)
226 226
     {
227 227
         header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
228 228
         exit;
229 229
     }
230 230
     else {
231
-	    setEventMessages($object->error, $object->errors, 'errors');
231
+        setEventMessages($object->error, $object->errors, 'errors');
232 232
     }
233 233
 }
234 234
 if ($action == 'set_paid')
235 235
 {
236
-	$object->fetch($id);
237
-	if ($object->set_paid($id, $modepayment) >= 0)
238
-	{
239
-		header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
240
-		exit;
241
-	}
236
+    $object->fetch($id);
237
+    if ($object->set_paid($id, $modepayment) >= 0)
238
+    {
239
+        header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
240
+        exit;
241
+    }
242 242
     else {
243
-	    setEventMessages($object->error, $object->errors, 'errors');
243
+        setEventMessages($object->error, $object->errors, 'errors');
244 244
     }
245 245
 }
246 246
 else if ($action == 'classin' && $user->rights->don->creer)
247 247
 {
248
-	$object->fetch($id);
249
-	$object->setProject($projectid);
248
+    $object->fetch($id);
249
+    $object->setProject($projectid);
250 250
 }
251 251
 
252 252
 // Actions to build doc
@@ -321,50 +321,50 @@  discard block
 block discarded – undo
321 321
 
322 322
 if ($action == 'create')
323 323
 {
324
-	print load_fiche_titre($langs->trans("AddDonation"));
324
+    print load_fiche_titre($langs->trans("AddDonation"));
325 325
 
326
-	print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
327
-	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
328
-	print '<input type="hidden" name="action" value="add">';
326
+    print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
327
+    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
328
+    print '<input type="hidden" name="action" value="add">';
329 329
 
330
-	dol_fiche_head('');
330
+    dol_fiche_head('');
331 331
 
332
-	print '<table class="border" width="100%">';
333
-	print '<tbody>';
332
+    print '<table class="border" width="100%">';
333
+    print '<tbody>';
334 334
 
335
-	// Ref
336
-	print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>';
335
+    // Ref
336
+    print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>';
337 337
 
338
-	// Company
339
-	if (! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES))
340
-	{
341
-		// Thirdparty
342
-		print '<td>' . $langs->trans('Customer') . '</td>';
343
-		if ($soc->id > 0 && ! GETPOST('fac_rec','alpha'))
344
-		{
345
-			print '<td colspan="2">';
346
-			print $soc->getNomUrl(1);
347
-			print '<input type="hidden" name="socid" value="' . $soc->id . '">';
348
-			// Outstanding Bill
349
-			$outstandingBills = $soc->get_OutstandingBill();
350
-			print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
351
-			print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
352
-			if ($soc->outstanding_limit != '')
353
-			{
354
-				if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
355
-				print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
356
-			}
357
-			print ')';
358
-			print '</td>';
359
-		}
360
-		else
361
-		{
362
-			print '<td colspan="2">';
363
-			print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
364
-			// Option to reload page to retrieve customer informations. Note, this clear other input
365
-			if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
366
-			{
367
-				print '<script type="text/javascript">
338
+    // Company
339
+    if (! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES))
340
+    {
341
+        // Thirdparty
342
+        print '<td>' . $langs->trans('Customer') . '</td>';
343
+        if ($soc->id > 0 && ! GETPOST('fac_rec','alpha'))
344
+        {
345
+            print '<td colspan="2">';
346
+            print $soc->getNomUrl(1);
347
+            print '<input type="hidden" name="socid" value="' . $soc->id . '">';
348
+            // Outstanding Bill
349
+            $outstandingBills = $soc->get_OutstandingBill();
350
+            print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
351
+            print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
352
+            if ($soc->outstanding_limit != '')
353
+            {
354
+                if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
355
+                print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
356
+            }
357
+            print ')';
358
+            print '</td>';
359
+        }
360
+        else
361
+        {
362
+            print '<td colspan="2">';
363
+            print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
364
+            // Option to reload page to retrieve customer informations. Note, this clear other input
365
+            if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
366
+            {
367
+                print '<script type="text/javascript">
368 368
 				$(document).ready(function() {
369 369
 					$("#socid").change(function() {
370 370
 						var socid = $(this).val();
@@ -374,82 +374,82 @@  discard block
 block discarded – undo
374 374
 					});
375 375
 				});
376 376
 				</script>';
377
-			}
377
+            }
378 378
             //print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
379 379
             print ' <a href="' . BASE_URI . '?controller=societe&method=card&action=create&client=3&fournisseur=0&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create') . '">' . $langs->trans("AddThirdParty") . '</a>';
380
-			print '</td>';
381
-		}
382
-		print '</tr>' . "\n";
383
-	}
380
+            print '</td>';
381
+        }
382
+        print '</tr>' . "\n";
383
+    }
384 384
 
385
-	// Date
386
-	print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
387
-	print $form->selectDate($donation_date?$donation_date:-1, '', '', '', '', "add", 1, 1);
388
-	print '</td>';
385
+    // Date
386
+    print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
387
+    print $form->selectDate($donation_date?$donation_date:-1, '', '', '', '', "add", 1, 1);
388
+    print '</td>';
389 389
 
390
-	// Amount
391
-	print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.dol_escape_htmltag(GETPOST("amount")).'" size="10"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
390
+    // Amount
391
+    print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.dol_escape_htmltag(GETPOST("amount")).'" size="10"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
392 392
 
393
-	// Public donation
394
-	print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
395
-	print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1);
396
-	print "</td></tr>\n";
393
+    // Public donation
394
+    print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
395
+    print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1);
396
+    print "</td></tr>\n";
397 397
 
398
-	if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES))
399
-	{
400
-		print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.dol_escape_htmltag(GETPOST("societe")).'" class="maxwidth200"></td></tr>';
401
-		print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.dol_escape_htmltag(GETPOST("lastname")).'" class="maxwidth200"></td></tr>';
402
-		print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST("firstname")).'" class="maxwidth200"></td></tr>';
403
-		print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
404
-		print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="3">'.dol_escape_htmltag(GETPOST("address")).'</textarea></td></tr>';
405
-
406
-		// Zip / Town
407
-		print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
408
-		print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
409
-		print ' ';
410
-		print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
411
-		print '</tr>';
412
-
413
-		// Country
414
-		print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">';
415
-		print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id);
416
-		if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
417
-		print '</td></tr>';
418
-
419
-		print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>';
420
-	}
398
+    if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES))
399
+    {
400
+        print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.dol_escape_htmltag(GETPOST("societe")).'" class="maxwidth200"></td></tr>';
401
+        print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.dol_escape_htmltag(GETPOST("lastname")).'" class="maxwidth200"></td></tr>';
402
+        print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.dol_escape_htmltag(GETPOST("firstname")).'" class="maxwidth200"></td></tr>';
403
+        print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
404
+        print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="3">'.dol_escape_htmltag(GETPOST("address")).'</textarea></td></tr>';
405
+
406
+        // Zip / Town
407
+        print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
408
+        print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
409
+        print ' ';
410
+        print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
411
+        print '</tr>';
412
+
413
+        // Country
414
+        print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">';
415
+        print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id);
416
+        if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
417
+        print '</td></tr>';
421 418
 
422
-	// Payment mode
423
-	print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
424
-	$selected = GETPOST('modepayment','int');
425
-	$form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
426
-	print "</td></tr>\n";
419
+        print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>';
420
+    }
427 421
 
428
-	// Public note
429
-	print '<tr>';
430
-	print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>';
431
-	print '<td>';
422
+    // Payment mode
423
+    print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
424
+    $selected = GETPOST('modepayment','int');
425
+    $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
426
+    print "</td></tr>\n";
427
+
428
+    // Public note
429
+    print '<tr>';
430
+    print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>';
431
+    print '<td>';
432 432
 
433 433
     $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
434
-	print $doleditor->Create(1);
435
-	print '</td></tr>';
436
-
437
-	// Private note
438
-	if (empty($user->societe_id)) {
439
-		print '<tr>';
440
-		print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
441
-		print '<td>';
442
-
443
-		$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
444
-		print $doleditor->Create(1);
445
-		print '</td></tr>';
446
-	}
434
+    print $doleditor->Create(1);
435
+    print '</td></tr>';
436
+
437
+    // Private note
438
+    if (empty($user->societe_id)) {
439
+        print '<tr>';
440
+        print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
441
+        print '<td>';
447 442
 
448
-	if (! empty($conf->projet->enabled))
443
+        $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
444
+        print $doleditor->Create(1);
445
+        print '</td></tr>';
446
+    }
447
+
448
+    if (! empty($conf->projet->enabled))
449 449
     {
450 450
         print "<tr><td>".$langs->trans("Project")."</td><td>";
451 451
         $formproject->select_projects(-1, $projectid,'fk_project', 0, 0, 1, 1);
452
-		print "</td></tr>\n";
452
+        print "</td></tr>\n";
453 453
     }
454 454
 
455 455
     // Other attributes
@@ -458,21 +458,21 @@  discard block
 block discarded – undo
458 458
     print $hookmanager->resPrint;
459 459
     if (empty($reshook))
460 460
     {
461
-		print $object->showOptionals($extrafields,'edit',$parameters);
461
+        print $object->showOptionals($extrafields,'edit',$parameters);
462 462
     }
463 463
 
464 464
     print '</tbody>';
465
-	print "</table>\n";
465
+    print "</table>\n";
466 466
 
467
-	dol_fiche_end();
467
+    dol_fiche_end();
468 468
 
469
-	print '<div class="center">';
470
-	print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
471
-	print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
472
-	print '<input type="button" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" onClick="javascript:history.go(-1)">';
473
-	print '</div>';
469
+    print '<div class="center">';
470
+    print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
471
+    print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
472
+    print '<input type="button" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" onClick="javascript:history.go(-1)">';
473
+    print '</div>';
474 474
 
475
-	print "</form>\n";
475
+    print "</form>\n";
476 476
 }
477 477
 
478 478
 
@@ -484,80 +484,80 @@  discard block
 block discarded – undo
484 484
 
485 485
 if (! empty($id) && $action == 'edit')
486 486
 {
487
-	$result=$object->fetch($id);
488
-	if ($result < 0) {
489
-		dol_print_error($db,$object->error); exit;
490
-	}
491
-	$result=$object->fetch_optionals();
492
-	if ($result < 0) {
493
-		dol_print_error($db); exit;
494
-	}
487
+    $result=$object->fetch($id);
488
+    if ($result < 0) {
489
+        dol_print_error($db,$object->error); exit;
490
+    }
491
+    $result=$object->fetch_optionals();
492
+    if ($result < 0) {
493
+        dol_print_error($db); exit;
494
+    }
495 495
 
496
-	$hselected='card';
497
-	$head = donation_prepare_head($object);
496
+    $hselected='card';
497
+    $head = donation_prepare_head($object);
498 498
 
499
-	print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
500
-	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
501
-	print '<input type="hidden" name="action" value="update">';
502
-	print '<input type="hidden" name="rowid" value="'.$object->id.'">';
503
-	print '<input type="hidden" name="amount" value="'.$object->amount.'">';
499
+    print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
500
+    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
501
+    print '<input type="hidden" name="action" value="update">';
502
+    print '<input type="hidden" name="rowid" value="'.$object->id.'">';
503
+    print '<input type="hidden" name="amount" value="'.$object->amount.'">';
504 504
 
505 505
 
506
-	dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
506
+    dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
507 507
 
508
-	print '<table class="border" width="100%">';
508
+    print '<table class="border" width="100%">';
509 509
 
510
-	// Ref
511
-	print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2">';
512
-	print $object->getNomUrl();
513
-	print '</td>';
514
-	print '</tr>';
510
+    // Ref
511
+    print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="2">';
512
+    print $object->getNomUrl();
513
+    print '</td>';
514
+    print '</tr>';
515 515
 
516
-	// Date
517
-	print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Date").'</td><td>';
518
-	print $form->selectDate($object->date,'','','','',"update");
519
-	print '</td>';
516
+    // Date
517
+    print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Date").'</td><td>';
518
+    print $form->selectDate($object->date,'','','','',"update");
519
+    print '</td>';
520 520
 
521
-	// Amount
522
-	if ($object->statut == 0)
523
-	{
524
-		print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.dol_escape_htmltag($object->amount).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
525
-	}
526
-	else
527
-	{
528
-		print '<tr><td>'.$langs->trans("Amount").'</td><td>';
529
-		print price($object->amount,0,$langs,0,0,-1,$conf->currency);
530
-		print '</td></tr>';
531
-	}
521
+    // Amount
522
+    if ($object->statut == 0)
523
+    {
524
+        print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.dol_escape_htmltag($object->amount).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
525
+    }
526
+    else
527
+    {
528
+        print '<tr><td>'.$langs->trans("Amount").'</td><td>';
529
+        print price($object->amount,0,$langs,0,0,-1,$conf->currency);
530
+        print '</td></tr>';
531
+    }
532 532
 
533
-	print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
534
-	print $form->selectyesno("public",1,1);
535
-	print "</td>";
536
-	print "</tr>\n";
533
+    print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
534
+    print $form->selectyesno("public",1,1);
535
+    print "</td>";
536
+    print "</tr>\n";
537 537
 
538
-	$langs->load("companies");
539
-	print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="maxwidth200" value="'.dol_escape_htmltag($object->societe).'"></td></tr>';
540
-	print '<tr><td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.dol_escape_htmltag($object->lastname).'"></td></tr>';
541
-	print '<tr><td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="maxwidth200" value="'.dol_escape_htmltag($object->firstname).'"></td></tr>';
542
-	print '<tr><td>'.$langs->trans("Address").'</td><td>';
543
-	print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag($object->address).'</textarea></td></tr>';
538
+    $langs->load("companies");
539
+    print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="maxwidth200" value="'.dol_escape_htmltag($object->societe).'"></td></tr>';
540
+    print '<tr><td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="maxwidth200" value="'.dol_escape_htmltag($object->lastname).'"></td></tr>';
541
+    print '<tr><td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="maxwidth200" value="'.dol_escape_htmltag($object->firstname).'"></td></tr>';
542
+    print '<tr><td>'.$langs->trans("Address").'</td><td>';
543
+    print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag($object->address).'</textarea></td></tr>';
544 544
 
545 545
     // Zip / Town
546 546
     print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
547
-	print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
547
+    print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
548 548
     print ' ';
549
-	print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
550
-	print '</tr>';
549
+    print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
550
+    print '</tr>';
551 551
 
552
-	// Country
553
-	print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>';
554
-	print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id');
555
-	if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
556
-	print '</td></tr>';
552
+    // Country
553
+    print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>';
554
+    print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id');
555
+    if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
556
+    print '</td></tr>';
557 557
 
558
-	print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>';
558
+    print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>';
559 559
 
560
-	// Payment mode
560
+    // Payment mode
561 561
     print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
562 562
     if ($object->modepaymentid) $selected = $object->modepaymentid;
563 563
     else $selected = '';
@@ -565,16 +565,16 @@  discard block
 block discarded – undo
565 565
     print "</td></tr>\n";
566 566
 
567 567
     // Status
568
-	print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
568
+    print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
569 569
 
570 570
     // Project
571 571
     if (! empty($conf->projet->enabled))
572 572
     {
573
-    	$formproject=new FormProjets($db);
573
+        $formproject=new FormProjets($db);
574 574
 
575 575
         $langs->load('projects');
576 576
         print '<tr><td>'.$langs->trans('Project').'</td><td>';
577
-		$formproject->select_projects(-1, $object->fk_project,'fk_project', 0, 0, 1, 1);
577
+        $formproject->select_projects(-1, $object->fk_project,'fk_project', 0, 0, 1, 1);
578 578
         print '</td></tr>';
579 579
     }
580 580
 
@@ -584,16 +584,16 @@  discard block
 block discarded – undo
584 584
     print $hookmanager->resPrint;
585 585
     if (empty($reshook))
586 586
     {
587
-      	print $object->showOptionals($extrafields,'edit');
587
+            print $object->showOptionals($extrafields,'edit');
588 588
     }
589 589
 
590
-	print "</table>\n";
590
+    print "</table>\n";
591 591
 
592
-	dol_fiche_end();
592
+    dol_fiche_end();
593 593
 
594
-	print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
594
+    print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
595 595
 
596
-	print "</form>\n";
596
+    print "</form>\n";
597 597
 }
598 598
 
599 599
 
@@ -605,68 +605,68 @@  discard block
 block discarded – undo
605 605
 /* ************************************************************ */
606 606
 if (! empty($id) && $action != 'edit')
607 607
 {
608
-	// Confirmation delete
608
+    // Confirmation delete
609 609
     if ($action == 'delete')
610 610
     {
611 611
         $text=$langs->trans("ConfirmDeleteADonation");
612 612
         print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteADonation"),$text,"confirm_delete",'','',1);
613 613
     }
614 614
 
615
-	$result=$object->fetch($id);
616
-	if ($result < 0) {
617
-		dol_print_error($db,$object->error); exit;
618
-	}
619
-	$result=$object->fetch_optionals();
620
-	if ($result < 0) {
621
-		dol_print_error($db); exit;
622
-	}
615
+    $result=$object->fetch($id);
616
+    if ($result < 0) {
617
+        dol_print_error($db,$object->error); exit;
618
+    }
619
+    $result=$object->fetch_optionals();
620
+    if ($result < 0) {
621
+        dol_print_error($db); exit;
622
+    }
623 623
 
624
-	$hselected='card';
624
+    $hselected='card';
625 625
 
626
-	$head = donation_prepare_head($object);
627
-	dol_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'generic');
626
+    $head = donation_prepare_head($object);
627
+    dol_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'generic');
628 628
 
629
-	// Print form confirm
630
-	print $formconfirm;
629
+    // Print form confirm
630
+    print $formconfirm;
631 631
 
632 632
     // $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
633 633
     $linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
634 634
 
635
-	$morehtmlref='<div class="refidno">';
636
-	// Project
637
-	if (! empty($conf->projet->enabled))
638
-	{
639
-	    $langs->load("projects");
640
-	    $morehtmlref.=$langs->trans('Project') . ' ';
641
-	    if ($user->rights->don->creer)
642
-	    {
643
-	        if ($action != 'classify')
644
-	            $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
645
-	            if ($action == 'classify') {
646
-	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
635
+    $morehtmlref='<div class="refidno">';
636
+    // Project
637
+    if (! empty($conf->projet->enabled))
638
+    {
639
+        $langs->load("projects");
640
+        $morehtmlref.=$langs->trans('Project') . ' ';
641
+        if ($user->rights->don->creer)
642
+        {
643
+            if ($action != 'classify')
644
+                $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
645
+                if ($action == 'classify') {
646
+                    //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
647 647
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
648
-	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
649
-	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
650
-	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
651
-	                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
652
-	                $morehtmlref.='</form>';
653
-	            } else {
654
-	                $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
655
-	            }
656
-	    } else {
657
-	        if (! empty($object->fk_project)) {
658
-	            $proj = new Project($db);
659
-	            $proj->fetch($object->fk_project);
648
+                    $morehtmlref.='<input type="hidden" name="action" value="classin">';
649
+                    $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
650
+                    $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
651
+                    $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
652
+                    $morehtmlref.='</form>';
653
+                } else {
654
+                    $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
655
+                }
656
+        } else {
657
+            if (! empty($object->fk_project)) {
658
+                $proj = new Project($db);
659
+                $proj->fetch($object->fk_project);
660 660
                 // $morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
661 661
                 $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&methos=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
662
-	            $morehtmlref.=$proj->ref;
663
-	            $morehtmlref.='</a>';
664
-	        } else {
665
-	            $morehtmlref.='';
666
-	        }
667
-	    }
668
-	}
669
-	$morehtmlref.='</div>';
662
+                $morehtmlref.=$proj->ref;
663
+                $morehtmlref.='</a>';
664
+            } else {
665
+                $morehtmlref.='';
666
+            }
667
+        }
668
+    }
669
+    $morehtmlref.='</div>';
670 670
 
671 671
 
672 672
     dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
@@ -678,195 +678,195 @@  discard block
 block discarded – undo
678 678
 
679 679
     print '<table class="border" width="100%">';
680 680
 
681
-	// Date
682
-	print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td colspan="2">';
683
-	print dol_print_date($object->date,"day");
684
-	print "</td>";
681
+    // Date
682
+    print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td colspan="2">';
683
+    print dol_print_date($object->date,"day");
684
+    print "</td>";
685 685
 
686 686
     print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="2">';
687
-	print price($object->amount,0,$langs,0,0,-1,$conf->currency);
688
-	print '</td></tr>';
687
+    print price($object->amount,0,$langs,0,0,-1,$conf->currency);
688
+    print '</td></tr>';
689 689
 
690
-	print '<tr><td>'.$langs->trans("PublicDonation").'</td><td colspan="2">';
691
-	print yn($object->public);
692
-	print '</td></tr>';
690
+    print '<tr><td>'.$langs->trans("PublicDonation").'</td><td colspan="2">';
691
+    print yn($object->public);
692
+    print '</td></tr>';
693 693
 
694
-	print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2">'.$object->societe.'</td></tr>';
695
-	print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';
696
-	print '<tr><td>'.$langs->trans("Firstname").'</td><td colspan="2">'.$object->firstname.'</td></tr>';
694
+    print '<tr><td>'.$langs->trans("Company").'</td><td colspan="2">'.$object->societe.'</td></tr>';
695
+    print '<tr><td>'.$langs->trans("Lastname").'</td><td colspan="2">'.$object->lastname.'</td></tr>';
696
+    print '<tr><td>'.$langs->trans("Firstname").'</td><td colspan="2">'.$object->firstname.'</td></tr>';
697 697
 
698
-	// Payment mode
699
-	print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
700
-	$form->form_modes_reglement(null, $object->modepaymentid,'none');
701
-	print "</td></tr>\n";
698
+    // Payment mode
699
+    print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
700
+    $form->form_modes_reglement(null, $object->modepaymentid,'none');
701
+    print "</td></tr>\n";
702 702
 
703
-	// Other attributes
704
-	$cols = 2;
705
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
703
+    // Other attributes
704
+    $cols = 2;
705
+    include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
706 706
 
707
-	print '</table>';
707
+    print '</table>';
708 708
 
709
-	print '</div>';
710
-	print '<div class="fichehalfright">';
711
-	print '<div class="ficheaddleft">';
709
+    print '</div>';
710
+    print '<div class="fichehalfright">';
711
+    print '<div class="ficheaddleft">';
712 712
 
713
-	/*
713
+    /*
714 714
 	 * Payments
715 715
 	 */
716
-	$sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
717
-	$sql.= "c.code as type_code,c.libelle as paiement_type";
718
-	$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
719
-	$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
720
-	$sql.= ", ".MAIN_DB_PREFIX."don as d";
721
-	$sql.= " WHERE d.rowid = '".$id."'";
722
-	$sql.= " AND p.fk_donation = d.rowid";
723
-	$sql.= " AND d.entity IN (".getEntity('donation').")";
724
-	$sql.= " AND p.fk_typepayment = c.id";
725
-	$sql.= " ORDER BY dp";
726
-
727
-	//print $sql;
728
-	$resql = $db->query($sql);
729
-	if ($resql)
730
-	{
731
-		$num = $db->num_rows($resql);
732
-		$i = 0; $total = 0;
733
-		print '<table class="noborder" width="100%">';
734
-		print '<tr class="liste_titre">';
735
-		print '<td>'.$langs->trans("RefPayment").'</td>';
736
-		print '<td>'.$langs->trans("Date").'</td>';
737
-		print '<td>'.$langs->trans("Type").'</td>';
738
-   		print '<td align="right">'.$langs->trans("Amount").'</td>';
739
-   		print '</tr>';
740
-
741
-		while ($i < $num)
742
-		{
743
-			$objp = $db->fetch_object($resql);
744
-
745
-			print '<tr class="oddeven"><td>';
716
+    $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
717
+    $sql.= "c.code as type_code,c.libelle as paiement_type";
718
+    $sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
719
+    $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
720
+    $sql.= ", ".MAIN_DB_PREFIX."don as d";
721
+    $sql.= " WHERE d.rowid = '".$id."'";
722
+    $sql.= " AND p.fk_donation = d.rowid";
723
+    $sql.= " AND d.entity IN (".getEntity('donation').")";
724
+    $sql.= " AND p.fk_typepayment = c.id";
725
+    $sql.= " ORDER BY dp";
726
+
727
+    //print $sql;
728
+    $resql = $db->query($sql);
729
+    if ($resql)
730
+    {
731
+        $num = $db->num_rows($resql);
732
+        $i = 0; $total = 0;
733
+        print '<table class="noborder" width="100%">';
734
+        print '<tr class="liste_titre">';
735
+        print '<td>'.$langs->trans("RefPayment").'</td>';
736
+        print '<td>'.$langs->trans("Date").'</td>';
737
+        print '<td>'.$langs->trans("Type").'</td>';
738
+            print '<td align="right">'.$langs->trans("Amount").'</td>';
739
+            print '</tr>';
740
+
741
+        while ($i < $num)
742
+        {
743
+            $objp = $db->fetch_object($resql);
744
+
745
+            print '<tr class="oddeven"><td>';
746 746
             // print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
747 747
             print '<a href="' . BASE_URI . '?controller=don/payment&method=card&id=' . $objp->rowid . '">' . img_object($langs->trans("Payment"), "payment") . ' ' . $objp->rowid . '</a></td>';
748
-			print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
749
-		    $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
748
+            print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
749
+            $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
750 750
             print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
751
-			print '<td align="right">'.price($objp->amount)."</td>\n";
752
-			print "</tr>";
753
-			$totalpaid += $objp->amount;
754
-			$i++;
755
-		}
756
-
757
-		if ($object->paid == 0)
758
-		{
759
-			print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaid)."</td></tr>\n";
760
-			print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\">".price($object->amount)."</td></tr>\n";
761
-
762
-			$remaintopay = $object->amount - $totalpaid;
763
-
764
-			print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
765
-			print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':'').'><b>'.price($remaintopay)."</b></td></tr>\n";
766
-		}
767
-		print "</table>";
768
-		$db->free($resql);
769
-	}
770
-	else
771
-	{
772
-		dol_print_error($db);
773
-	}
751
+            print '<td align="right">'.price($objp->amount)."</td>\n";
752
+            print "</tr>";
753
+            $totalpaid += $objp->amount;
754
+            $i++;
755
+        }
756
+
757
+        if ($object->paid == 0)
758
+        {
759
+            print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaid)."</td></tr>\n";
760
+            print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\">".price($object->amount)."</td></tr>\n";
761
+
762
+            $remaintopay = $object->amount - $totalpaid;
763
+
764
+            print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
765
+            print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':'').'><b>'.price($remaintopay)."</b></td></tr>\n";
766
+        }
767
+        print "</table>";
768
+        $db->free($resql);
769
+    }
770
+    else
771
+    {
772
+        dol_print_error($db);
773
+    }
774 774
 
775
-	print '</div>';
776
-	print '</div>';
777
-	print '</div>';
775
+    print '</div>';
776
+    print '</div>';
777
+    print '</div>';
778 778
 
779
-	print '<div class="clearboth"></div>';
779
+    print '<div class="clearboth"></div>';
780 780
 
781 781
     dol_fiche_end();
782 782
 
783
-	$remaintopay = $object->amount - $totalpaid;
783
+    $remaintopay = $object->amount - $totalpaid;
784 784
 
785
-	// Actions buttons
785
+    // Actions buttons
786 786
 
787
-	print '<div class="tabsAction">';
787
+    print '<div class="tabsAction">';
788 788
 
789
-	print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&rowid='.$object->id.'">'.$langs->trans('Modify').'</a></div>';
789
+    print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&rowid='.$object->id.'">'.$langs->trans('Modify').'</a></div>';
790 790
 
791
-	if ($object->statut == 0)
792
-	{
793
-		print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>';
794
-	}
791
+    if ($object->statut == 0)
792
+    {
793
+        print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>';
794
+    }
795 795
 
796 796
     if (($object->statut == 0 || $object->statut == 1) && $totalpaid == 0 && $object->paid == 0)
797 797
     {
798 798
         print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>";
799 799
     }
800 800
 
801
-	// Create payment
802
-	if ($object->statut == 1 && $object->paid == 0 && $user->rights->don->creer)
803
-	{
804
-		if ($remaintopay == 0)
805
-		{
806
-			print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
807
-		}
808
-		else
809
-		{
810
-			print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/payment/payment.php?rowid=' . $object->id . '&amp;action=create">' . $langs->trans('DoPayment') . '</a></div>';
811
-		}
812
-	}
801
+    // Create payment
802
+    if ($object->statut == 1 && $object->paid == 0 && $user->rights->don->creer)
803
+    {
804
+        if ($remaintopay == 0)
805
+        {
806
+            print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
807
+        }
808
+        else
809
+        {
810
+            print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/payment/payment.php?rowid=' . $object->id . '&amp;action=create">' . $langs->trans('DoPayment') . '</a></div>';
811
+        }
812
+    }
813 813
 
814
-	// Classify 'paid'
815
-	if ($object->statut == 1 && round($remaintopay) == 0 && $object->paid == 0 && $user->rights->don->creer)
816
-	{
817
-		print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
818
-	}
814
+    // Classify 'paid'
815
+    if ($object->statut == 1 && round($remaintopay) == 0 && $object->paid == 0 && $user->rights->don->creer)
816
+    {
817
+        print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
818
+    }
819 819
 
820
-	// Delete
821
-	if ($user->rights->don->supprimer)
822
-	{
823
-		if ($object->statut == -1 || $object->statut == 0)
824
-		{
825
-			print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
826
-		}
827
-		else
828
-		{
829
-			print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
830
-		}
831
-	}
832
-	else
833
-	{
834
-		print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
835
-	}
820
+    // Delete
821
+    if ($user->rights->don->supprimer)
822
+    {
823
+        if ($object->statut == -1 || $object->statut == 0)
824
+        {
825
+            print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
826
+        }
827
+        else
828
+        {
829
+            print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
830
+        }
831
+    }
832
+    else
833
+    {
834
+        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
835
+    }
836 836
 
837
-	print "</div>";
837
+    print "</div>";
838 838
 
839 839
 
840 840
     print '<div class="fichecenter"><div class="fichehalfleft">';
841 841
 
842
-	/*
842
+    /*
843 843
 	 * Documents generes
844 844
 	 */
845
-	$filename	=	dol_sanitizeFileName($object->id);
846
-	$filedir	=	$conf->don->dir_output . "/" . dol_sanitizeFileName($object->id);
845
+    $filename	=	dol_sanitizeFileName($object->id);
846
+    $filedir	=	$conf->don->dir_output . "/" . dol_sanitizeFileName($object->id);
847 847
     $urlsource = $_SERVER['PHP_SELF'] . '&rowid=' . $object->id;
848
-	$genallowed	=	(($object->paid == 0 || $user->admin) && $user->rights->don->lire);
849
-	$delallowed	=	$user->rights->don->creer;
848
+    $genallowed	=	(($object->paid == 0 || $user->admin) && $user->rights->don->lire);
849
+    $delallowed	=	$user->rights->don->creer;
850 850
 
851
-	print $formfile->showdocuments('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
851
+    print $formfile->showdocuments('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
852 852
 
853
-	// Show links to link elements
854
-	$linktoelem = $form->showLinkToObjectBlock($object, null, array('don'));
855
-	$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
853
+    // Show links to link elements
854
+    $linktoelem = $form->showLinkToObjectBlock($object, null, array('don'));
855
+    $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
856 856
 
857
-		// Show online payment link
858
-		$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
857
+        // Show online payment link
858
+        $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
859 859
 
860
-		if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT &&
861
-		{
862
-			print '<br><!-- Link to pay -->'."\n";
863
-			require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
864
-			print showOnlinePaymentUrl('donation', $object->ref).'<br>';
865
-		}
860
+        if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT &&
861
+        {
862
+            print '<br><!-- Link to pay -->'."\n";
863
+            require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
864
+            print showOnlinePaymentUrl('donation', $object->ref).'<br>';
865
+        }
866 866
 
867
-	print '</div><div class="fichehalfright"><div class="ficheaddleft">';
867
+    print '</div><div class="fichehalfright"><div class="ficheaddleft">';
868 868
 
869
-	print '</div></div></div>';
869
+    print '</div></div></div>';
870 870
 }
871 871
 
872 872
 llxFooter();
Please login to merge, or discard this patch.
Spacing   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@  discard block
 block discarded – undo
30 30
 
31 31
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
32 32
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
33
-require DOL_BASE_PATH . '/main.inc.php';
34
-
35
-require_once DOL_DOCUMENT_ROOT . '/core/modules/dons/modules_don.php';
36
-require_once DOL_DOCUMENT_ROOT . '/core/lib/donation.lib.php';
37
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/don/class/don.class.php';
40
-require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
41
-require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
42
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
43
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmargin.class.php';
44
-require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
45
-if (! empty($conf->projet->enabled)) {
33
+require DOL_BASE_PATH.'/main.inc.php';
34
+
35
+require_once DOL_DOCUMENT_ROOT.'/core/modules/dons/modules_don.php';
36
+require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
37
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
40
+require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
41
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
43
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
44
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
45
+if (!empty($conf->projet->enabled)) {
46 46
     require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
47 47
     require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
48 48
 }
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 
51 51
 $langs->loadLangs(array("bills", "companies", "donations"));
52 52
 
53
-$id=GETPOST('rowid')?GETPOST('rowid','int'):GETPOST('id','int');
54
-$action=GETPOST('action','alpha');
55
-$cancel=GETPOST('cancel','alpha');
56
-$amount=GETPOST('amount');
57
-$donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
53
+$id = GETPOST('rowid') ?GETPOST('rowid', 'int') : GETPOST('id', 'int');
54
+$action = GETPOST('action', 'alpha');
55
+$cancel = GETPOST('cancel', 'alpha');
56
+$amount = GETPOST('amount');
57
+$donation_date = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
58 58
 $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
59 59
 
60 60
 $object = new Don($db);
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 $result = restrictedArea($user, 'don', $id);
65 65
 
66 66
 // fetch optionals attributes and labels
67
-$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
67
+$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
68 68
 
69 69
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
70
-$hookmanager->initHooks(array('doncard','globalcard'));
70
+$hookmanager->initHooks(array('doncard', 'globalcard'));
71 71
 
72 72
 /*
73 73
  * Actions
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
 
79 79
 if ($action == 'update')
80 80
 {
81
-	if (! empty($cancel))
81
+	if (!empty($cancel))
82 82
 	{
83 83
 		header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
84 84
 		exit;
85 85
 	}
86 86
 
87
-	$error=0;
87
+	$error = 0;
88 88
 
89 89
     if (empty($donation_date))
90 90
     {
@@ -100,28 +100,28 @@  discard block
 block discarded – undo
100 100
 		$error++;
101 101
 	}
102 102
 
103
-	if (! $error)
103
+	if (!$error)
104 104
 	{
105 105
 		$object->fetch($id);
106 106
 
107
-		$object->firstname   = GETPOST("firstname",'alpha');
108
-		$object->lastname    = GETPOST("lastname",'alpha');
109
-		$object->societe     = GETPOST("societe",'alpha');
110
-		$object->address     = GETPOST("address",'alpha');
111
-		$object->amount      = price2num(GETPOST("amount",'alpha'));
112
-		$object->town        = GETPOST("town",'alpha');
113
-		$object->zip         = GETPOST("zipcode",'alpha');
107
+		$object->firstname   = GETPOST("firstname", 'alpha');
108
+		$object->lastname    = GETPOST("lastname", 'alpha');
109
+		$object->societe     = GETPOST("societe", 'alpha');
110
+		$object->address     = GETPOST("address", 'alpha');
111
+		$object->amount      = price2num(GETPOST("amount", 'alpha'));
112
+		$object->town        = GETPOST("town", 'alpha');
113
+		$object->zip         = GETPOST("zipcode", 'alpha');
114 114
         $object->country_id  = GETPOST('country_id', 'int');
115
-        $object->email       = GETPOST("email",'alpha');
115
+        $object->email       = GETPOST("email", 'alpha');
116 116
 		$object->date        = $donation_date;
117
-		$object->public      = GETPOST("public",'alpha');
118
-		$object->fk_project  = GETPOST("fk_project",'alpha');
119
-		$object->note_private= GETPOST("note_private",'none');
120
-		$object->note_public = GETPOST("note_public",'none');
121
-		$object->modepaymentid = GETPOST('modepayment','int');
117
+		$object->public      = GETPOST("public", 'alpha');
118
+		$object->fk_project  = GETPOST("fk_project", 'alpha');
119
+		$object->note_private = GETPOST("note_private", 'none');
120
+		$object->note_public = GETPOST("note_public", 'none');
121
+		$object->modepaymentid = GETPOST('modepayment', 'int');
122 122
 
123 123
 		// Fill array 'array_options' with data from add form
124
-        $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
124
+        $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
125 125
 		if ($ret < 0) $error++;
126 126
 
127 127
 		if ($object->update($user) > 0)
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 
135 135
 if ($action == 'add')
136 136
 {
137
-	if (! empty($cancel))
137
+	if (!empty($cancel))
138 138
 	{
139 139
 		header("Location: index.php");
140 140
 		exit;
141 141
 	}
142 142
 
143
-	$error=0;
143
+	$error = 0;
144 144
 
145 145
     if (empty($donation_date))
146 146
     {
@@ -156,26 +156,26 @@  discard block
 block discarded – undo
156 156
 		$error++;
157 157
 	}
158 158
 
159
-	if (! $error)
159
+	if (!$error)
160 160
 	{
161
-		$object->firstname   = GETPOST("firstname",'alpha');
162
-		$object->lastname    = GETPOST("lastname",'alpha');
163
-		$object->societe     = GETPOST("societe",'alpha');
164
-		$object->address     = GETPOST("address",'alpha');
165
-		$object->amount      = price2num(GETPOST("amount",'alpha'));
166
-		$object->zip         = GETPOST("zipcode",'alpha');
167
-		$object->town        = GETPOST("town",'alpha');
161
+		$object->firstname   = GETPOST("firstname", 'alpha');
162
+		$object->lastname    = GETPOST("lastname", 'alpha');
163
+		$object->societe     = GETPOST("societe", 'alpha');
164
+		$object->address     = GETPOST("address", 'alpha');
165
+		$object->amount      = price2num(GETPOST("amount", 'alpha'));
166
+		$object->zip         = GETPOST("zipcode", 'alpha');
167
+		$object->town        = GETPOST("town", 'alpha');
168 168
         $object->country_id  = GETPOST('country_id', 'int');
169
-        $object->email       = GETPOST("email",'alpha');
169
+        $object->email       = GETPOST("email", 'alpha');
170 170
 		$object->date        = $donation_date;
171
-		$object->note_private= GETPOST("note_private",'none');
172
-		$object->note_public = GETPOST("note_public",'none');
173
-		$object->public      = GETPOST("public",'alpha');
174
-		$object->fk_project  = GETPOST("fk_project",'alpha');
175
-		$object->modepaymentid = GETPOST('modepayment','int');
171
+		$object->note_private = GETPOST("note_private", 'none');
172
+		$object->note_public = GETPOST("note_public", 'none');
173
+		$object->public      = GETPOST("public", 'alpha');
174
+		$object->fk_project  = GETPOST("fk_project", 'alpha');
175
+		$object->modepaymentid = GETPOST('modepayment', 'int');
176 176
 
177 177
 		// Fill array 'array_options' with data from add form
178
-        $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
178
+        $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
179 179
 		if ($ret < 0) $error++;
180 180
 
181 181
 		$res = $object->create($user);
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer)
194 194
 {
195 195
     $object->fetch($id);
196
-    $result=$object->delete($user);
196
+    $result = $object->delete($user);
197 197
     if ($result > 0)
198 198
     {
199 199
         header("Location: index.php");
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     }
202 202
     else
203 203
     {
204
-        dol_syslog($object->error,LOG_DEBUG);
204
+        dol_syslog($object->error, LOG_DEBUG);
205 205
         setEventMessages($object->error, $object->errors, 'errors');
206 206
     }
207 207
 }
@@ -312,18 +312,18 @@  discard block
 block discarded – undo
312 312
  * View
313 313
  */
314 314
 
315
-llxHeader('',$langs->trans("Donation"),'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones');
315
+llxHeader('', $langs->trans("Donation"), 'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones');
316 316
 
317
-$form=new Form($db);
317
+$form = new Form($db);
318 318
 $formfile = new FormFile($db);
319 319
 $formcompany = new FormCompany($db);
320
-if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
320
+if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
321 321
 
322 322
 if ($action == 'create')
323 323
 {
324 324
 	print load_fiche_titre($langs->trans("AddDonation"));
325 325
 
326
-	print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
326
+	print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
327 327
 	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
328 328
 	print '<input type="hidden" name="action" value="add">';
329 329
 
@@ -333,26 +333,26 @@  discard block
 block discarded – undo
333 333
 	print '<tbody>';
334 334
 
335 335
 	// Ref
336
-	print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans('Draft') . '</td></tr>';
336
+	print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
337 337
 
338 338
 	// Company
339
-	if (! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES))
339
+	if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES))
340 340
 	{
341 341
 		// Thirdparty
342
-		print '<td>' . $langs->trans('Customer') . '</td>';
343
-		if ($soc->id > 0 && ! GETPOST('fac_rec','alpha'))
342
+		print '<td>'.$langs->trans('Customer').'</td>';
343
+		if ($soc->id > 0 && !GETPOST('fac_rec', 'alpha'))
344 344
 		{
345 345
 			print '<td colspan="2">';
346 346
 			print $soc->getNomUrl(1);
347
-			print '<input type="hidden" name="socid" value="' . $soc->id . '">';
347
+			print '<input type="hidden" name="socid" value="'.$soc->id.'">';
348 348
 			// Outstanding Bill
349 349
 			$outstandingBills = $soc->get_OutstandingBill();
350
-			print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
350
+			print ' ('.$langs->trans('CurrentOutstandingBill').': ';
351 351
 			print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
352 352
 			if ($soc->outstanding_limit != '')
353 353
 			{
354 354
 				if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
355
-				print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
355
+				print ' / '.price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
356 356
 			}
357 357
 			print ')';
358 358
 			print '</td>';
@@ -376,15 +376,15 @@  discard block
 block discarded – undo
376 376
 				</script>';
377 377
 			}
378 378
             //print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
379
-            print ' <a href="' . BASE_URI . '?controller=societe&method=card&action=create&client=3&fournisseur=0&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create') . '">' . $langs->trans("AddThirdParty") . '</a>';
379
+            print ' <a href="'.BASE_URI.'?controller=societe&method=card&action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
380 380
 			print '</td>';
381 381
 		}
382
-		print '</tr>' . "\n";
382
+		print '</tr>'."\n";
383 383
 	}
384 384
 
385 385
 	// Date
386 386
 	print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Date").'</td><td>';
387
-	print $form->selectDate($donation_date?$donation_date:-1, '', '', '', '', "add", 1, 1);
387
+	print $form->selectDate($donation_date ? $donation_date : -1, '', '', '', '', "add", 1, 1);
388 388
 	print '</td>';
389 389
 
390 390
 	// Amount
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 
393 393
 	// Public donation
394 394
 	print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
395
-	print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1);
395
+	print $form->selectyesno("public", isset($_POST["public"]) ? $_POST["public"] : 1, 1);
396 396
 	print "</td></tr>\n";
397 397
 
398 398
 	if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES))
@@ -405,15 +405,15 @@  discard block
 block discarded – undo
405 405
 
406 406
 		// Zip / Town
407 407
 		print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
408
-		print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
408
+		print $formcompany->select_ziptown((isset($_POST["zipcode"]) ? $_POST["zipcode"] : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
409 409
 		print ' ';
410
-		print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
410
+		print $formcompany->select_ziptown((isset($_POST["town"]) ? $_POST["town"] : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
411 411
 		print '</tr>';
412 412
 
413 413
 		// Country
414 414
 		print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">';
415
-		print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id);
416
-		if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
415
+		print $form->select_country(GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id);
416
+		if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
417 417
 		print '</td></tr>';
418 418
 
419 419
 		print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>';
@@ -421,13 +421,13 @@  discard block
 block discarded – undo
421 421
 
422 422
 	// Payment mode
423 423
 	print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
424
-	$selected = GETPOST('modepayment','int');
424
+	$selected = GETPOST('modepayment', 'int');
425 425
 	$form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
426 426
 	print "</td></tr>\n";
427 427
 
428 428
 	// Public note
429 429
 	print '<tr>';
430
-	print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>';
430
+	print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
431 431
 	print '<td>';
432 432
 
433 433
     $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	// Private note
438 438
 	if (empty($user->societe_id)) {
439 439
 		print '<tr>';
440
-		print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
440
+		print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
441 441
 		print '<td>';
442 442
 
443 443
 		$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
@@ -445,20 +445,20 @@  discard block
 block discarded – undo
445 445
 		print '</td></tr>';
446 446
 	}
447 447
 
448
-	if (! empty($conf->projet->enabled))
448
+	if (!empty($conf->projet->enabled))
449 449
     {
450 450
         print "<tr><td>".$langs->trans("Project")."</td><td>";
451
-        $formproject->select_projects(-1, $projectid,'fk_project', 0, 0, 1, 1);
451
+        $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
452 452
 		print "</td></tr>\n";
453 453
     }
454 454
 
455 455
     // Other attributes
456
-    $parameters=array();
457
-    $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
456
+    $parameters = array();
457
+    $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
458 458
     print $hookmanager->resPrint;
459 459
     if (empty($reshook))
460 460
     {
461
-		print $object->showOptionals($extrafields,'edit',$parameters);
461
+		print $object->showOptionals($extrafields, 'edit', $parameters);
462 462
     }
463 463
 
464 464
     print '</tbody>';
@@ -482,21 +482,21 @@  discard block
 block discarded – undo
482 482
 /*                                                              */
483 483
 /* ************************************************************ */
484 484
 
485
-if (! empty($id) && $action == 'edit')
485
+if (!empty($id) && $action == 'edit')
486 486
 {
487
-	$result=$object->fetch($id);
487
+	$result = $object->fetch($id);
488 488
 	if ($result < 0) {
489
-		dol_print_error($db,$object->error); exit;
489
+		dol_print_error($db, $object->error); exit;
490 490
 	}
491
-	$result=$object->fetch_optionals();
491
+	$result = $object->fetch_optionals();
492 492
 	if ($result < 0) {
493 493
 		dol_print_error($db); exit;
494 494
 	}
495 495
 
496
-	$hselected='card';
496
+	$hselected = 'card';
497 497
 	$head = donation_prepare_head($object);
498 498
 
499
-	print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
499
+	print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
500 500
 	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
501 501
 	print '<input type="hidden" name="action" value="update">';
502 502
 	print '<input type="hidden" name="rowid" value="'.$object->id.'">';
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 
516 516
 	// Date
517 517
 	print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Date").'</td><td>';
518
-	print $form->selectDate($object->date,'','','','',"update");
518
+	print $form->selectDate($object->date, '', '', '', '', "update");
519 519
 	print '</td>';
520 520
 
521 521
 	// Amount
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
 	else
527 527
 	{
528 528
 		print '<tr><td>'.$langs->trans("Amount").'</td><td>';
529
-		print price($object->amount,0,$langs,0,0,-1,$conf->currency);
529
+		print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
530 530
 		print '</td></tr>';
531 531
 	}
532 532
 
533 533
 	print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
534
-	print $form->selectyesno("public",1,1);
534
+	print $form->selectyesno("public", 1, 1);
535 535
 	print "</td>";
536 536
 	print "</tr>\n";
537 537
 
@@ -544,15 +544,15 @@  discard block
 block discarded – undo
544 544
 
545 545
     // Zip / Town
546 546
     print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
547
-	print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
547
+	print $formcompany->select_ziptown((isset($_POST["zipcode"]) ? $_POST["zipcode"] : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
548 548
     print ' ';
549
-	print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
549
+	print $formcompany->select_ziptown((isset($_POST["town"]) ? $_POST["town"] : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id'));
550 550
 	print '</tr>';
551 551
 
552 552
 	// Country
553 553
 	print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>';
554
-	print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id');
555
-	if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
554
+	print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id');
555
+	if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
556 556
 	print '</td></tr>';
557 557
 
558 558
 	print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>';
@@ -568,23 +568,23 @@  discard block
 block discarded – undo
568 568
 	print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
569 569
 
570 570
     // Project
571
-    if (! empty($conf->projet->enabled))
571
+    if (!empty($conf->projet->enabled))
572 572
     {
573
-    	$formproject=new FormProjets($db);
573
+    	$formproject = new FormProjets($db);
574 574
 
575 575
         $langs->load('projects');
576 576
         print '<tr><td>'.$langs->trans('Project').'</td><td>';
577
-		$formproject->select_projects(-1, $object->fk_project,'fk_project', 0, 0, 1, 1);
577
+		$formproject->select_projects(-1, $object->fk_project, 'fk_project', 0, 0, 1, 1);
578 578
         print '</td></tr>';
579 579
     }
580 580
 
581 581
     // Other attributes
582
-    $parameters=array();
583
-    $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
582
+    $parameters = array();
583
+    $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
584 584
     print $hookmanager->resPrint;
585 585
     if (empty($reshook))
586 586
     {
587
-      	print $object->showOptionals($extrafields,'edit');
587
+      	print $object->showOptionals($extrafields, 'edit');
588 588
     }
589 589
 
590 590
 	print "</table>\n";
@@ -603,25 +603,25 @@  discard block
 block discarded – undo
603 603
 /* Donation card in view mode                                   */
604 604
 /*                                                              */
605 605
 /* ************************************************************ */
606
-if (! empty($id) && $action != 'edit')
606
+if (!empty($id) && $action != 'edit')
607 607
 {
608 608
 	// Confirmation delete
609 609
     if ($action == 'delete')
610 610
     {
611
-        $text=$langs->trans("ConfirmDeleteADonation");
612
-        print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteADonation"),$text,"confirm_delete",'','',1);
611
+        $text = $langs->trans("ConfirmDeleteADonation");
612
+        print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("DeleteADonation"), $text, "confirm_delete", '', '', 1);
613 613
     }
614 614
 
615
-	$result=$object->fetch($id);
615
+	$result = $object->fetch($id);
616 616
 	if ($result < 0) {
617
-		dol_print_error($db,$object->error); exit;
617
+		dol_print_error($db, $object->error); exit;
618 618
 	}
619
-	$result=$object->fetch_optionals();
619
+	$result = $object->fetch_optionals();
620 620
 	if ($result < 0) {
621 621
 		dol_print_error($db); exit;
622 622
 	}
623 623
 
624
-	$hselected='card';
624
+	$hselected = 'card';
625 625
 
626 626
 	$head = donation_prepare_head($object);
627 627
 	dol_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'generic');
@@ -630,43 +630,43 @@  discard block
 block discarded – undo
630 630
 	print $formconfirm;
631 631
 
632 632
     // $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
633
-    $linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
633
+    $linkback = '<a href="'.BASE_URI.'?controller=don&method=list'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
634 634
 
635
-	$morehtmlref='<div class="refidno">';
635
+	$morehtmlref = '<div class="refidno">';
636 636
 	// Project
637
-	if (! empty($conf->projet->enabled))
637
+	if (!empty($conf->projet->enabled))
638 638
 	{
639 639
 	    $langs->load("projects");
640
-	    $morehtmlref.=$langs->trans('Project') . ' ';
640
+	    $morehtmlref .= $langs->trans('Project').' ';
641 641
 	    if ($user->rights->don->creer)
642 642
 	    {
643 643
 	        if ($action != 'classify')
644
-	            $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
644
+	            $morehtmlref .= '<a href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
645 645
 	            if ($action == 'classify') {
646 646
 	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
647
-                    $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
648
-	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
649
-	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
650
-	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
651
-	                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
652
-	                $morehtmlref.='</form>';
647
+                    $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'&id='.$object->id.'">';
648
+	                $morehtmlref .= '<input type="hidden" name="action" value="classin">';
649
+	                $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
650
+	                $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
651
+	                $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
652
+	                $morehtmlref .= '</form>';
653 653
 	            } else {
654
-	                $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
654
+	                $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
655 655
 	            }
656 656
 	    } else {
657
-	        if (! empty($object->fk_project)) {
657
+	        if (!empty($object->fk_project)) {
658 658
 	            $proj = new Project($db);
659 659
 	            $proj->fetch($object->fk_project);
660 660
                 // $morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
661
-                $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&methos=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
662
-	            $morehtmlref.=$proj->ref;
663
-	            $morehtmlref.='</a>';
661
+                $morehtmlref .= '<a href="'.BASE_URI.'?controller=projet&methos=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
662
+	            $morehtmlref .= $proj->ref;
663
+	            $morehtmlref .= '</a>';
664 664
 	        } else {
665
-	            $morehtmlref.='';
665
+	            $morehtmlref .= '';
666 666
 	        }
667 667
 	    }
668 668
 	}
669
-	$morehtmlref.='</div>';
669
+	$morehtmlref .= '</div>';
670 670
 
671 671
 
672 672
     dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
@@ -680,11 +680,11 @@  discard block
 block discarded – undo
680 680
 
681 681
 	// Date
682 682
 	print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td colspan="2">';
683
-	print dol_print_date($object->date,"day");
683
+	print dol_print_date($object->date, "day");
684 684
 	print "</td>";
685 685
 
686 686
     print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="2">';
687
-	print price($object->amount,0,$langs,0,0,-1,$conf->currency);
687
+	print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
688 688
 	print '</td></tr>';
689 689
 
690 690
 	print '<tr><td>'.$langs->trans("PublicDonation").'</td><td colspan="2">';
@@ -697,12 +697,12 @@  discard block
 block discarded – undo
697 697
 
698 698
 	// Payment mode
699 699
 	print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
700
-	$form->form_modes_reglement(null, $object->modepaymentid,'none');
700
+	$form->form_modes_reglement(null, $object->modepaymentid, 'none');
701 701
 	print "</td></tr>\n";
702 702
 
703 703
 	// Other attributes
704 704
 	$cols = 2;
705
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
705
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
706 706
 
707 707
 	print '</table>';
708 708
 
@@ -714,15 +714,15 @@  discard block
 block discarded – undo
714 714
 	 * Payments
715 715
 	 */
716 716
 	$sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
717
-	$sql.= "c.code as type_code,c.libelle as paiement_type";
718
-	$sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
719
-	$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
720
-	$sql.= ", ".MAIN_DB_PREFIX."don as d";
721
-	$sql.= " WHERE d.rowid = '".$id."'";
722
-	$sql.= " AND p.fk_donation = d.rowid";
723
-	$sql.= " AND d.entity IN (".getEntity('donation').")";
724
-	$sql.= " AND p.fk_typepayment = c.id";
725
-	$sql.= " ORDER BY dp";
717
+	$sql .= "c.code as type_code,c.libelle as paiement_type";
718
+	$sql .= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
719
+	$sql .= ", ".MAIN_DB_PREFIX."c_paiement as c ";
720
+	$sql .= ", ".MAIN_DB_PREFIX."don as d";
721
+	$sql .= " WHERE d.rowid = '".$id."'";
722
+	$sql .= " AND p.fk_donation = d.rowid";
723
+	$sql .= " AND d.entity IN (".getEntity('donation').")";
724
+	$sql .= " AND p.fk_typepayment = c.id";
725
+	$sql .= " ORDER BY dp";
726 726
 
727 727
 	//print $sql;
728 728
 	$resql = $db->query($sql);
@@ -744,9 +744,9 @@  discard block
 block discarded – undo
744 744
 
745 745
 			print '<tr class="oddeven"><td>';
746 746
             // print '<a href="'.DOL_URL_ROOT.'/don/payment/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
747
-            print '<a href="' . BASE_URI . '?controller=don/payment&method=card&id=' . $objp->rowid . '">' . img_object($langs->trans("Payment"), "payment") . ' ' . $objp->rowid . '</a></td>';
748
-			print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
749
-		    $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
747
+            print '<a href="'.BASE_URI.'?controller=don/payment&method=card&id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a></td>';
748
+			print '<td>'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
749
+		    $labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type;
750 750
             print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
751 751
 			print '<td align="right">'.price($objp->amount)."</td>\n";
752 752
 			print "</tr>";
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 			$remaintopay = $object->amount - $totalpaid;
763 763
 
764 764
 			print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
765
-			print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':'').'><b>'.price($remaintopay)."</b></td></tr>\n";
765
+			print '<td align="right"'.($resteapayeraffiche ? ' class="amountremaintopay"' : '').'><b>'.price($remaintopay)."</b></td></tr>\n";
766 766
 		}
767 767
 		print "</table>";
768 768
 		$db->free($resql);
@@ -786,16 +786,16 @@  discard block
 block discarded – undo
786 786
 
787 787
 	print '<div class="tabsAction">';
788 788
 
789
-	print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&rowid='.$object->id.'">'.$langs->trans('Modify').'</a></div>';
789
+	print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$object->id.'">'.$langs->trans('Modify').'</a></div>';
790 790
 
791 791
 	if ($object->statut == 0)
792 792
 	{
793
-		print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>';
793
+		print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>';
794 794
 	}
795 795
 
796 796
     if (($object->statut == 0 || $object->statut == 1) && $totalpaid == 0 && $object->paid == 0)
797 797
     {
798
-        print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>";
798
+        print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>";
799 799
     }
800 800
 
801 801
 	// Create payment
@@ -803,18 +803,18 @@  discard block
 block discarded – undo
803 803
 	{
804 804
 		if ($remaintopay == 0)
805 805
 		{
806
-			print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
806
+			print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</span></div>';
807 807
 		}
808 808
 		else
809 809
 		{
810
-			print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/payment/payment.php?rowid=' . $object->id . '&amp;action=create">' . $langs->trans('DoPayment') . '</a></div>';
810
+			print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/payment/payment.php?rowid='.$object->id.'&amp;action=create">'.$langs->trans('DoPayment').'</a></div>';
811 811
 		}
812 812
 	}
813 813
 
814 814
 	// Classify 'paid'
815 815
 	if ($object->statut == 1 && round($remaintopay) == 0 && $object->paid == 0 && $user->rights->don->creer)
816 816
 	{
817
-		print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?rowid='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
817
+		print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
818 818
 	}
819 819
 
820 820
 	// Delete
@@ -842,20 +842,20 @@  discard block
 block discarded – undo
842 842
 	/*
843 843
 	 * Documents generes
844 844
 	 */
845
-	$filename	=	dol_sanitizeFileName($object->id);
846
-	$filedir	=	$conf->don->dir_output . "/" . dol_sanitizeFileName($object->id);
847
-    $urlsource = $_SERVER['PHP_SELF'] . '&rowid=' . $object->id;
848
-	$genallowed	=	(($object->paid == 0 || $user->admin) && $user->rights->don->lire);
849
-	$delallowed	=	$user->rights->don->creer;
845
+	$filename = dol_sanitizeFileName($object->id);
846
+	$filedir = $conf->don->dir_output."/".dol_sanitizeFileName($object->id);
847
+    $urlsource = $_SERVER['PHP_SELF'].'&rowid='.$object->id;
848
+	$genallowed	= (($object->paid == 0 || $user->admin) && $user->rights->don->lire);
849
+	$delallowed	= $user->rights->don->creer;
850 850
 
851
-	print $formfile->showdocuments('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
851
+	print $formfile->showdocuments('donation', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf);
852 852
 
853 853
 	// Show links to link elements
854 854
 	$linktoelem = $form->showLinkToObjectBlock($object, null, array('don'));
855 855
 	$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
856 856
 
857 857
 		// Show online payment link
858
-		$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
858
+		$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
859 859
 
860 860
 		if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT &&
861 861
 		{
Please login to merge, or discard this patch.
Braces   +41 added lines, -35 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
  */
75 75
 
76 76
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
77
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
77
+if ($reshook < 0) {
78
+    setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
79
+}
78 80
 
79 81
 if ($action == 'update')
80 82
 {
@@ -122,7 +124,9 @@  discard block
 block discarded – undo
122 124
 
123 125
 		// Fill array 'array_options' with data from add form
124 126
         $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
125
-		if ($ret < 0) $error++;
127
+		if ($ret < 0) {
128
+		    $error++;
129
+		}
126 130
 
127 131
 		if ($object->update($user) > 0)
128 132
 		{
@@ -176,15 +180,16 @@  discard block
 block discarded – undo
176 180
 
177 181
 		// Fill array 'array_options' with data from add form
178 182
         $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
179
-		if ($ret < 0) $error++;
183
+		if ($ret < 0) {
184
+		    $error++;
185
+		}
180 186
 
181 187
 		$res = $object->create($user);
182 188
 		if ($res > 0)
183 189
 		{
184 190
 			header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res);
185 191
 			exit;
186
-		}
187
-		else
192
+		} else
188 193
 		{
189 194
 			setEventMessages($object->error, $object->errors, 'errors');
190 195
 		}
@@ -198,8 +203,7 @@  discard block
 block discarded – undo
198 203
     {
199 204
         header("Location: index.php");
200 205
         exit;
201
-    }
202
-    else
206
+    } else
203 207
     {
204 208
         dol_syslog($object->error,LOG_DEBUG);
205 209
         setEventMessages($object->error, $object->errors, 'errors');
@@ -214,8 +218,7 @@  discard block
 block discarded – undo
214 218
 
215 219
 		header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
216 220
 		exit;
217
-	}
218
-    else {
221
+	} else {
219 222
 	    setEventMessages($object->error, $object->errors, 'errors');
220 223
     }
221 224
 }
@@ -226,8 +229,7 @@  discard block
 block discarded – undo
226 229
     {
227 230
         header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
228 231
         exit;
229
-    }
230
-    else {
232
+    } else {
231 233
 	    setEventMessages($object->error, $object->errors, 'errors');
232 234
     }
233 235
 }
@@ -238,12 +240,10 @@  discard block
 block discarded – undo
238 240
 	{
239 241
 		header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
240 242
 		exit;
241
-	}
242
-    else {
243
+	} else {
243 244
 	    setEventMessages($object->error, $object->errors, 'errors');
244 245
     }
245
-}
246
-else if ($action == 'classin' && $user->rights->don->creer)
246
+} else if ($action == 'classin' && $user->rights->don->creer)
247 247
 {
248 248
 	$object->fetch($id);
249 249
 	$object->setProject($projectid);
@@ -351,13 +351,14 @@  discard block
 block discarded – undo
351 351
 			print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
352 352
 			if ($soc->outstanding_limit != '')
353 353
 			{
354
-				if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
354
+				if ($outstandingBills > $soc->outstanding_limit) {
355
+				    print img_warning($langs->trans("OutstandingBillReached"));
356
+				}
355 357
 				print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
356 358
 			}
357 359
 			print ')';
358 360
 			print '</td>';
359
-		}
360
-		else
361
+		} else
361 362
 		{
362 363
 			print '<td colspan="2">';
363 364
 			print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
@@ -413,7 +414,9 @@  discard block
 block discarded – undo
413 414
 		// Country
414 415
 		print '<tr><td><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td class="maxwidthonsmartphone">';
415 416
 		print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id);
416
-		if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
417
+		if ($user->admin) {
418
+		    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
419
+		}
417 420
 		print '</td></tr>';
418 421
 
419 422
 		print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.dol_escape_htmltag(GETPOST("email")).'" class="maxwidth200"></td></tr>';
@@ -522,8 +525,7 @@  discard block
 block discarded – undo
522 525
 	if ($object->statut == 0)
523 526
 	{
524 527
 		print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.dol_escape_htmltag($object->amount).'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
525
-	}
526
-	else
528
+	} else
527 529
 	{
528 530
 		print '<tr><td>'.$langs->trans("Amount").'</td><td>';
529 531
 		print price($object->amount,0,$langs,0,0,-1,$conf->currency);
@@ -552,15 +554,20 @@  discard block
 block discarded – undo
552 554
 	// Country
553 555
 	print '<tr><td class="titlefieldcreate">'.$langs->trans('Country').'</td><td>';
554 556
 	print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id');
555
-	if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
557
+	if ($user->admin) {
558
+	    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
559
+	}
556 560
 	print '</td></tr>';
557 561
 
558 562
 	print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" class="maxwidth200" value="'.dol_escape_htmltag($object->email).'"></td></tr>';
559 563
 
560 564
 	// Payment mode
561 565
     print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
562
-    if ($object->modepaymentid) $selected = $object->modepaymentid;
563
-    else $selected = '';
566
+    if ($object->modepaymentid) {
567
+        $selected = $object->modepaymentid;
568
+    } else {
569
+        $selected = '';
570
+    }
564 571
     $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1);
565 572
     print "</td></tr>\n";
566 573
 
@@ -640,8 +647,9 @@  discard block
 block discarded – undo
640 647
 	    $morehtmlref.=$langs->trans('Project') . ' ';
641 648
 	    if ($user->rights->don->creer)
642 649
 	    {
643
-	        if ($action != 'classify')
644
-	            $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
650
+	        if ($action != 'classify') {
651
+	        	            $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
652
+	        }
645 653
 	            if ($action == 'classify') {
646 654
 	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
647 655
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
@@ -766,8 +774,7 @@  discard block
 block discarded – undo
766 774
 		}
767 775
 		print "</table>";
768 776
 		$db->free($resql);
769
-	}
770
-	else
777
+	} else
771 778
 	{
772 779
 		dol_print_error($db);
773 780
 	}
@@ -804,8 +811,7 @@  discard block
 block discarded – undo
804 811
 		if ($remaintopay == 0)
805 812
 		{
806 813
 			print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
807
-		}
808
-		else
814
+		} else
809 815
 		{
810 816
 			print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/don/payment/payment.php?rowid=' . $object->id . '&amp;action=create">' . $langs->trans('DoPayment') . '</a></div>';
811 817
 		}
@@ -823,13 +829,11 @@  discard block
 block discarded – undo
823 829
 		if ($object->statut == -1 || $object->statut == 0)
824 830
 		{
825 831
 			print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
826
-		}
827
-		else
832
+		} else
828 833
 		{
829 834
 			print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
830 835
 		}
831
-	}
832
-	else
836
+	} else
833 837
 	{
834 838
 		print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("Delete")."</a></div>";
835 839
 	}
@@ -857,9 +861,11 @@  discard block
 block discarded – undo
857 861
 		// Show online payment link
858 862
 		$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
859 863
 
860
-		if ($useonlinepayment) //$object->statut != Facture::STATUS_DRAFT &&
864
+		if ($useonlinepayment) {
865
+		    //$object->statut != Facture::STATUS_DRAFT &&
861 866
 		{
862 867
 			print '<br><!-- Link to pay -->'."\n";
868
+		}
863 869
 			require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
864 870
 			print showOnlinePaymentUrl('donation', $object->ref).'<br>';
865 871
 		}
Please login to merge, or discard this patch.
dolibarr/htdocs/don/note.php 3 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 
64 64
 if ($action == 'classin' && $user->rights->don->creer)
65 65
 {
66
-	$object->fetch($id);
67
-	$object->setProject($projectid);
66
+    $object->fetch($id);
67
+    $object->setProject($projectid);
68 68
 }
69 69
 
70 70
 /*
@@ -80,61 +80,61 @@  discard block
 block discarded – undo
80 80
 
81 81
 if ($id > 0 || ! empty($ref))
82 82
 {
83
-	$object = new Don($db);
84
-	$object->fetch($id,$ref);
83
+    $object = new Don($db);
84
+    $object->fetch($id,$ref);
85 85
 
86
-	$head = donation_prepare_head($object);
86
+    $head = donation_prepare_head($object);
87 87
 
88
-	dol_fiche_head($head, 'note', $langs->trans("Donation"), -1, 'generic');
88
+    dol_fiche_head($head, 'note', $langs->trans("Donation"), -1, 'generic');
89 89
 
90 90
     // $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
91 91
     $linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
92 92
 
93
-	$morehtmlref='<div class="refidno">';
94
-	// Project
95
-	if (! empty($conf->projet->enabled))
96
-	{
97
-	    $langs->load("projects");
98
-	    $morehtmlref.=$langs->trans('Project') . ' ';
99
-	    if ($user->rights->don->creer)
100
-	    {
101
-	        if ($action != 'classify')
102
-	            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
103
-	            if ($action == 'classify') {
104
-	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
93
+    $morehtmlref='<div class="refidno">';
94
+    // Project
95
+    if (! empty($conf->projet->enabled))
96
+    {
97
+        $langs->load("projects");
98
+        $morehtmlref.=$langs->trans('Project') . ' ';
99
+        if ($user->rights->don->creer)
100
+        {
101
+            if ($action != 'classify')
102
+                // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
103
+                if ($action == 'classify') {
104
+                    //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
105 105
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
106
-	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
107
-	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
108
-	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
109
-	                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
110
-	                $morehtmlref.='</form>';
111
-	            } else {
106
+                    $morehtmlref.='<input type="hidden" name="action" value="classin">';
107
+                    $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
108
+                    $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
109
+                    $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
110
+                    $morehtmlref.='</form>';
111
+                } else {
112 112
                     $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '&id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
113
-	            }
114
-	    } else {
115
-	        if (! empty($object->fk_project)) {
116
-	            $proj = new Project($db);
117
-	            $proj->fetch($object->fk_project);
113
+                }
114
+        } else {
115
+            if (! empty($object->fk_project)) {
116
+                $proj = new Project($db);
117
+                $proj->fetch($object->fk_project);
118 118
                 //$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
119 119
                 $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
120
-	            $morehtmlref.=$proj->ref;
121
-	            $morehtmlref.='</a>';
122
-	        } else {
123
-	            $morehtmlref.='';
124
-	        }
125
-	    }
126
-	}
127
-	$morehtmlref.='</div>';
120
+                $morehtmlref.=$proj->ref;
121
+                $morehtmlref.='</a>';
122
+            } else {
123
+                $morehtmlref.='';
124
+            }
125
+        }
126
+    }
127
+    $morehtmlref.='</div>';
128 128
 
129
-	dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
129
+    dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
130 130
 
131
-	print '<div class="fichecenter">';
132
-	print '<div class="underbanner clearboth"></div>';
131
+    print '<div class="fichecenter">';
132
+    print '<div class="underbanner clearboth"></div>';
133 133
 
134
-	$cssclass="titlefield";
135
-	include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
134
+    $cssclass="titlefield";
135
+    include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
136 136
 
137
-	dol_fiche_end();
137
+    dol_fiche_end();
138 138
 }
139 139
 
140 140
 llxFooter();
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -27,39 +27,39 @@  discard block
 block discarded – undo
27 27
 
28 28
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
29 29
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
30
-require DOL_BASE_PATH . '/main.inc.php';
31
-require_once DOL_DOCUMENT_ROOT . '/don/class/don.class.php';
30
+require DOL_BASE_PATH.'/main.inc.php';
31
+require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
32 32
 require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
33 33
 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
34
-if (! empty($conf->projet->enabled))
34
+if (!empty($conf->projet->enabled))
35 35
 {
36 36
     require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
37 37
     require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
38 38
 }
39 39
 
40 40
 // Load translation files required by the page
41
-$langs->loadLangs(array("companies","bills","donations"));
41
+$langs->loadLangs(array("companies", "bills", "donations"));
42 42
 
43
-$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int'));  // For backward compatibility
44
-$ref=GETPOST('ref','alpha');
45
-$action=GETPOST('action','alpha');
43
+$id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
44
+$ref = GETPOST('ref', 'alpha');
45
+$action = GETPOST('action', 'alpha');
46 46
 $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
47 47
 
48 48
 // Security check
49
-$socid=0;
50
-if ($user->societe_id) $socid=$user->societe_id;
51
-$result=restrictedArea($user,'don',$id,'');
49
+$socid = 0;
50
+if ($user->societe_id) $socid = $user->societe_id;
51
+$result = restrictedArea($user, 'don', $id, '');
52 52
 
53 53
 $object = new Don($db);
54 54
 $object->fetch($id);
55 55
 
56
-$permissionnote=$user->rights->don->creer;	// Used by the include of actions_setnotes.inc.php
56
+$permissionnote = $user->rights->don->creer; // Used by the include of actions_setnotes.inc.php
57 57
 
58 58
 
59 59
 /*
60 60
  * Actions
61 61
  */
62
-include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php';	// Must be include, not include_once
62
+include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
63 63
 
64 64
 if ($action == 'classin' && $user->rights->don->creer)
65 65
 {
@@ -71,67 +71,67 @@  discard block
 block discarded – undo
71 71
  * View
72 72
  */
73 73
 
74
-$title = $langs->trans('Donation') . " - " . $langs->trans('Notes');
74
+$title = $langs->trans('Donation')." - ".$langs->trans('Notes');
75 75
 $helpurl = "";
76 76
 llxHeader('', $title, $helpurl);
77 77
 
78 78
 $form = new Form($db);
79
-if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
79
+if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
80 80
 
81
-if ($id > 0 || ! empty($ref))
81
+if ($id > 0 || !empty($ref))
82 82
 {
83 83
 	$object = new Don($db);
84
-	$object->fetch($id,$ref);
84
+	$object->fetch($id, $ref);
85 85
 
86 86
 	$head = donation_prepare_head($object);
87 87
 
88 88
 	dol_fiche_head($head, 'note', $langs->trans("Donation"), -1, 'generic');
89 89
 
90 90
     // $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
91
-    $linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
91
+    $linkback = '<a href="'.BASE_URI.'?controller=don&method=list'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
92 92
 
93
-	$morehtmlref='<div class="refidno">';
93
+	$morehtmlref = '<div class="refidno">';
94 94
 	// Project
95
-	if (! empty($conf->projet->enabled))
95
+	if (!empty($conf->projet->enabled))
96 96
 	{
97 97
 	    $langs->load("projects");
98
-	    $morehtmlref.=$langs->trans('Project') . ' ';
98
+	    $morehtmlref .= $langs->trans('Project').' ';
99 99
 	    if ($user->rights->don->creer)
100 100
 	    {
101 101
 	        if ($action != 'classify')
102 102
 	            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
103 103
 	            if ($action == 'classify') {
104 104
 	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
105
-                    $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
106
-	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
107
-	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
108
-	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
109
-	                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
110
-	                $morehtmlref.='</form>';
105
+                    $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'&id='.$object->id.'">';
106
+	                $morehtmlref .= '<input type="hidden" name="action" value="classin">';
107
+	                $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
108
+	                $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
109
+	                $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
110
+	                $morehtmlref .= '</form>';
111 111
 	            } else {
112
-                    $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '&id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
112
+                    $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'&id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
113 113
 	            }
114 114
 	    } else {
115
-	        if (! empty($object->fk_project)) {
115
+	        if (!empty($object->fk_project)) {
116 116
 	            $proj = new Project($db);
117 117
 	            $proj->fetch($object->fk_project);
118 118
                 //$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
119
-                $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
120
-	            $morehtmlref.=$proj->ref;
121
-	            $morehtmlref.='</a>';
119
+                $morehtmlref .= '<a href="'.BASE_URI.'?controller=projet&method=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
120
+	            $morehtmlref .= $proj->ref;
121
+	            $morehtmlref .= '</a>';
122 122
 	        } else {
123
-	            $morehtmlref.='';
123
+	            $morehtmlref .= '';
124 124
 	        }
125 125
 	    }
126 126
 	}
127
-	$morehtmlref.='</div>';
127
+	$morehtmlref .= '</div>';
128 128
 
129 129
 	dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
130 130
 
131 131
 	print '<div class="fichecenter">';
132 132
 	print '<div class="underbanner clearboth"></div>';
133 133
 
134
-	$cssclass="titlefield";
134
+	$cssclass = "titlefield";
135 135
 	include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
136 136
 
137 137
 	dol_fiche_end();
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
 
48 48
 // Security check
49 49
 $socid=0;
50
-if ($user->societe_id) $socid=$user->societe_id;
50
+if ($user->societe_id) {
51
+    $socid=$user->societe_id;
52
+}
51 53
 $result=restrictedArea($user,'don',$id,'');
52 54
 
53 55
 $object = new Don($db);
@@ -98,11 +100,12 @@  discard block
 block discarded – undo
98 100
 	    $morehtmlref.=$langs->trans('Project') . ' ';
99 101
 	    if ($user->rights->don->creer)
100 102
 	    {
101
-	        if ($action != 'classify')
102
-	            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
103
+	        if ($action != 'classify') {
104
+	        	            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
103 105
 	            if ($action == 'classify') {
104 106
 	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
105 107
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
108
+	        }
106 109
 	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
107 110
 	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
108 111
 	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
Please login to merge, or discard this patch.
dolibarr/htdocs/don/list.php 2 patches
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
 
57 57
 if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers
58 58
 {
59
-	$search_all="";
59
+    $search_all="";
60 60
     $search_ref="";
61
-	$search_company="";
62
-	$search_name="";
63
-	$search_amount="";
61
+    $search_company="";
62
+    $search_name="";
63
+    $search_amount="";
64 64
 }
65 65
 
66 66
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 $sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
95 95
 if ($statut != '' && $statut != '-1')
96 96
 {
97
-	$sql .= " AND d.fk_statut IN (".$db->escape($statut).")";
97
+    $sql .= " AND d.fk_statut IN (".$db->escape($statut).")";
98 98
 }
99 99
 if (trim($search_ref) != '')
100 100
 {
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 $nbtotalofrecords = '';
120 120
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
121 121
 {
122
-	$result = $db->query($sql);
123
-	$nbtotalofrecords = $db->num_rows($result);
124
-	if (($page * $limit) > $nbtotalofrecords)	// if total resultset is smaller then paging size (filtering), goto and load page 0
125
-	{
126
-		$page = 0;
127
-		$offset = 0;
128
-	}
122
+    $result = $db->query($sql);
123
+    $nbtotalofrecords = $db->num_rows($result);
124
+    if (($page * $limit) > $nbtotalofrecords)	// if total resultset is smaller then paging size (filtering), goto and load page 0
125
+    {
126
+        $page = 0;
127
+        $offset = 0;
128
+    }
129 129
 }
130 130
 
131 131
 $sql.= $db->plimit($limit+1, $offset);
@@ -133,34 +133,34 @@  discard block
 block discarded – undo
133 133
 $resql = $db->query($sql);
134 134
 if ($resql)
135 135
 {
136
-	$num = $db->num_rows($resql);
137
-	$i = 0;
136
+    $num = $db->num_rows($resql);
137
+    $i = 0;
138 138
 
139
-	$param = '&statut='.$statut;
139
+    $param = '&statut='.$statut;
140 140
     //if ($page > 0) $param.= '&page='.$page;
141
-	if ($optioncss != '') $param.='&optioncss='.$optioncss;
141
+    if ($optioncss != '') $param.='&optioncss='.$optioncss;
142 142
 
143
-	$newcardbutton='';
144
-	if ($user->rights->don->creer)
145
-	{
143
+    $newcardbutton='';
144
+    if ($user->rights->don->creer)
145
+    {
146 146
         // $newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/don/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewDonation').'</span>';
147 147
         $newcardbutton = '<a class="butActionNew" href="' . BASE_URI . '?controller=don&method=card&action=create"><span class="valignmiddle">' . $langs->trans('NewDonation') . '</span>';
148
-		$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
149
-		$newcardbutton.= '</a>';
150
-	}
148
+        $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
149
+        $newcardbutton.= '</a>';
150
+    }
151 151
 
152
-	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
152
+    print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
153 153
     if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
154
-	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
155
-	print '<input type="hidden" name="action" value="list">';
156
-	print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
157
-	print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
154
+    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
155
+    print '<input type="hidden" name="action" value="list">';
156
+    print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
157
+    print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
158 158
     print '<input type="hidden" name="page" value="'.$page.'">';
159
-	print '<input type="hidden" name="type" value="'.$type.'">';
159
+    print '<input type="hidden" name="type" value="'.$type.'">';
160 160
 
161
-	print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords, 'title_generic.png', 0, $newcardbutton);
161
+    print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords, 'title_generic.png', 0, $newcardbutton);
162 162
 
163
-	if ($search_all)
163
+    if ($search_all)
164 164
     {
165 165
         foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
166 166
         print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'</div>';
@@ -195,65 +195,65 @@  discard block
 block discarded – undo
195 195
     $searchpicto=$form->showFilterAndCheckAddButtons(0);
196 196
     print $searchpicto;
197 197
     print '</td>';
198
-	print "</tr>\n";
198
+    print "</tr>\n";
199 199
 
200
-	print '<tr class="liste_titre">';
201
-	print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"d.rowid","", $param,"",$sortfield,$sortorder);
202
-	print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"d.societe","", $param,"",$sortfield,$sortorder);
203
-	print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"d.lastname","", $param,"",$sortfield,$sortorder);
204
-	print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"d.datedon","", $param,'align="center"',$sortfield,$sortorder);
205
-	if (! empty($conf->projet->enabled))
206
-	{
207
-	    $langs->load("projects");
208
-	    print_liste_field_titre("Project",$_SERVER["PHP_SELF"],"fk_projet","", $param,"",$sortfield,$sortorder);
209
-	}
210
-	print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"d.amount","", $param,'align="right"',$sortfield,$sortorder);
211
-	print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"d.fk_statut","", $param,'align="right"',$sortfield,$sortorder);
212
-	print_liste_field_titre('');
213
-	print "</tr>\n";
200
+    print '<tr class="liste_titre">';
201
+    print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"d.rowid","", $param,"",$sortfield,$sortorder);
202
+    print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"d.societe","", $param,"",$sortfield,$sortorder);
203
+    print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"d.lastname","", $param,"",$sortfield,$sortorder);
204
+    print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"d.datedon","", $param,'align="center"',$sortfield,$sortorder);
205
+    if (! empty($conf->projet->enabled))
206
+    {
207
+        $langs->load("projects");
208
+        print_liste_field_titre("Project",$_SERVER["PHP_SELF"],"fk_projet","", $param,"",$sortfield,$sortorder);
209
+    }
210
+    print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"d.amount","", $param,'align="right"',$sortfield,$sortorder);
211
+    print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"d.fk_statut","", $param,'align="right"',$sortfield,$sortorder);
212
+    print_liste_field_titre('');
213
+    print "</tr>\n";
214 214
 
215
-	while ($i < min($num,$limit))
216
-	{
217
-		$objp = $db->fetch_object($resql);
215
+    while ($i < min($num,$limit))
216
+    {
217
+        $objp = $db->fetch_object($resql);
218 218
 
219
-		print '<tr class="oddeven">';
220
-		$donationstatic->id=$objp->rowid;
221
-		$donationstatic->ref=$objp->rowid;
222
-		$donationstatic->lastname=$objp->lastname;
223
-		$donationstatic->firstname=$objp->firstname;
224
-		print "<td>".$donationstatic->getNomUrl(1)."</td>\n";
219
+        print '<tr class="oddeven">';
220
+        $donationstatic->id=$objp->rowid;
221
+        $donationstatic->ref=$objp->rowid;
222
+        $donationstatic->lastname=$objp->lastname;
223
+        $donationstatic->firstname=$objp->firstname;
224
+        print "<td>".$donationstatic->getNomUrl(1)."</td>\n";
225 225
         print "<td>".$objp->societe."</td>\n";
226
-		print "<td>".$donationstatic->getFullName($langs)."</td>\n";
227
-		print '<td align="center">'.dol_print_date($db->jdate($objp->datedon),'day').'</td>';
228
-		if (! empty($conf->projet->enabled))
229
-		{
230
-			print "<td>";
231
-			if ($objp->pid)
232
-			{
233
-				$projectstatic->id=$objp->pid;
234
-				$projectstatic->ref=$objp->ref;
235
-				$projectstatic->id=$objp->pid;
236
-				$projectstatic->public=$objp->public;
237
-				$projectstatic->title=$objp->title;
238
-				print $projectstatic->getNomUrl(1);
239
-			}
240
-			else print '&nbsp;';
241
-			print "</td>\n";
242
-		}
243
-		print '<td align="right">'.price($objp->amount).'</td>';
244
-		print '<td align="right">'.$donationstatic->LibStatut($objp->statut,5).'</td>';
226
+        print "<td>".$donationstatic->getFullName($langs)."</td>\n";
227
+        print '<td align="center">'.dol_print_date($db->jdate($objp->datedon),'day').'</td>';
228
+        if (! empty($conf->projet->enabled))
229
+        {
230
+            print "<td>";
231
+            if ($objp->pid)
232
+            {
233
+                $projectstatic->id=$objp->pid;
234
+                $projectstatic->ref=$objp->ref;
235
+                $projectstatic->id=$objp->pid;
236
+                $projectstatic->public=$objp->public;
237
+                $projectstatic->title=$objp->title;
238
+                print $projectstatic->getNomUrl(1);
239
+            }
240
+            else print '&nbsp;';
241
+            print "</td>\n";
242
+        }
243
+        print '<td align="right">'.price($objp->amount).'</td>';
244
+        print '<td align="right">'.$donationstatic->LibStatut($objp->statut,5).'</td>';
245 245
         print '<td></td>';
246
-		print "</tr>";
247
-		$i++;
248
-	}
249
-	print "</table>";
250
-	print '</div>';
246
+        print "</tr>";
247
+        $i++;
248
+    }
249
+    print "</table>";
250
+    print '</div>';
251 251
     print "</form>\n";
252 252
     $db->free($resql);
253 253
 }
254 254
 else
255 255
 {
256
-	dol_print_error($db);
256
+    dol_print_error($db);
257 257
 }
258 258
 
259 259
 llxFooter();
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -26,41 +26,41 @@  discard block
 block discarded – undo
26 26
 
27 27
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
28 28
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
29
-require DOL_BASE_PATH . '/main.inc.php';
30
-require_once DOL_DOCUMENT_ROOT . '/don/class/don.class.php';
31
-if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
29
+require DOL_BASE_PATH.'/main.inc.php';
30
+require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
31
+if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
32 32
 
33 33
 // Load translation files required by the page
34
-$langs->loadLangs(array("companies","donations"));
34
+$langs->loadLangs(array("companies", "donations"));
35 35
 
36
-$sortfield = GETPOST("sortfield",'alpha');
37
-$sortorder = GETPOST("sortorder",'alpha');
38
-$page = GETPOST("page",'int');
39
-$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
36
+$sortfield = GETPOST("sortfield", 'alpha');
37
+$sortorder = GETPOST("sortorder", 'alpha');
38
+$page = GETPOST("page", 'int');
39
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
40 40
 if (empty($page) || $page == -1) { $page = 0; }     // If $page is not defined, or '' or -1
41 41
 $offset = $limit * $page;
42 42
 $pageprev = $page - 1;
43 43
 $pagenext = $page + 1;
44
-if (! $sortorder) $sortorder="DESC";
45
-if (! $sortfield) $sortfield="d.datedon";
44
+if (!$sortorder) $sortorder = "DESC";
45
+if (!$sortfield) $sortfield = "d.datedon";
46 46
 
47
-$statut=(GETPOST("statut",'intcomma')!='')?GETPOST("statut",'intcomma'):"-1";
48
-$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
49
-$search_ref=GETPOST('search_ref','alpha');
50
-$search_company=GETPOST('search_company','alpha');
51
-$search_name=GETPOST('search_name','alpha');
52
-$search_amount = GETPOST('search_amount','alpha');
53
-$optioncss = GETPOST('optioncss','alpha');
47
+$statut = (GETPOST("statut", 'intcomma') != '') ?GETPOST("statut", 'intcomma') : "-1";
48
+$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
49
+$search_ref = GETPOST('search_ref', 'alpha');
50
+$search_company = GETPOST('search_company', 'alpha');
51
+$search_name = GETPOST('search_name', 'alpha');
52
+$search_amount = GETPOST('search_amount', 'alpha');
53
+$optioncss = GETPOST('optioncss', 'alpha');
54 54
 
55 55
 if (!$user->rights->don->lire) accessforbidden();
56 56
 
57
-if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers
57
+if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
58 58
 {
59
-	$search_all="";
60
-    $search_ref="";
61
-	$search_company="";
62
-	$search_name="";
63
-	$search_amount="";
59
+	$search_all = "";
60
+    $search_ref = "";
61
+	$search_company = "";
62
+	$search_name = "";
63
+	$search_amount = "";
64 64
 }
65 65
 
66 66
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@@ -79,26 +79,26 @@  discard block
 block discarded – undo
79 79
  * View
80 80
  */
81 81
 
82
-$form=new Form($db);
83
-if (! empty($conf->projet->enabled)) $projectstatic=new Project($db);
82
+$form = new Form($db);
83
+if (!empty($conf->projet->enabled)) $projectstatic = new Project($db);
84 84
 
85
-llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones');
85
+llxHeader('', $langs->trans("Donations"), 'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones');
86 86
 
87
-$donationstatic=new Don($db);
87
+$donationstatic = new Don($db);
88 88
 
89 89
 // Genere requete de liste des dons
90 90
 $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,";
91
-$sql.= " d.amount, d.fk_statut as statut, ";
92
-$sql.= " p.rowid as pid, p.ref, p.title, p.public";
93
-$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
94
-$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
91
+$sql .= " d.amount, d.fk_statut as statut, ";
92
+$sql .= " p.rowid as pid, p.ref, p.title, p.public";
93
+$sql .= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
94
+$sql .= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
95 95
 if ($statut != '' && $statut != '-1')
96 96
 {
97 97
 	$sql .= " AND d.fk_statut IN (".$db->escape($statut).")";
98 98
 }
99 99
 if (trim($search_ref) != '')
100 100
 {
101
-    $sql.= natural_search('d.ref', $search_ref);
101
+    $sql .= natural_search('d.ref', $search_ref);
102 102
 }
103 103
 if (trim($search_all) != '')
104 104
 {
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 {
113 113
     $sql .= natural_search(array('d.lastname', 'd.firstname'), $search_name);
114 114
 }
115
-if ($search_amount) $sql.= natural_search('d.amount', $search_amount, 1);
115
+if ($search_amount) $sql .= natural_search('d.amount', $search_amount, 1);
116 116
 
117
-$sql.= $db->order($sortfield,$sortorder);
117
+$sql .= $db->order($sortfield, $sortorder);
118 118
 
119 119
 $nbtotalofrecords = '';
120 120
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	}
129 129
 }
130 130
 
131
-$sql.= $db->plimit($limit+1, $offset);
131
+$sql .= $db->plimit($limit + 1, $offset);
132 132
 
133 133
 $resql = $db->query($sql);
134 134
 if ($resql)
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 
139 139
 	$param = '&statut='.$statut;
140 140
     //if ($page > 0) $param.= '&page='.$page;
141
-	if ($optioncss != '') $param.='&optioncss='.$optioncss;
141
+	if ($optioncss != '') $param .= '&optioncss='.$optioncss;
142 142
 
143
-	$newcardbutton='';
143
+	$newcardbutton = '';
144 144
 	if ($user->rights->don->creer)
145 145
 	{
146 146
         // $newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/don/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewDonation').'</span>';
147
-        $newcardbutton = '<a class="butActionNew" href="' . BASE_URI . '?controller=don&method=card&action=create"><span class="valignmiddle">' . $langs->trans('NewDonation') . '</span>';
148
-		$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
149
-		$newcardbutton.= '</a>';
147
+        $newcardbutton = '<a class="butActionNew" href="'.BASE_URI.'?controller=don&method=card&action=create"><span class="valignmiddle">'.$langs->trans('NewDonation').'</span>';
148
+		$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>';
149
+		$newcardbutton .= '</a>';
150 150
 	}
151 151
 
152 152
 	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
     print '<input type="hidden" name="page" value="'.$page.'">';
159 159
 	print '<input type="hidden" name="type" value="'.$type.'">';
160 160
 
161
-	print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords, 'title_generic.png', 0, $newcardbutton);
161
+	print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton);
162 162
 
163 163
 	if ($search_all)
164 164
     {
165
-        foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
166
-        print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'</div>';
165
+        foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
166
+        print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
167 167
     }
168 168
 
169 169
     print '<div class="div-table-responsive">';
170
-    print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
170
+    print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
171 171
 
172 172
     // Filters lines
173 173
     print '<tr class="liste_titre_filter">';
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     print '<td class="liste_titre" align="left">';
184 184
     print '&nbsp;';
185 185
     print '</td>';
186
-    if (! empty($conf->projet->enabled))
186
+    if (!empty($conf->projet->enabled))
187 187
     {
188 188
         print '<td class="liste_titre" align="right">';
189 189
         print '&nbsp;';
@@ -192,56 +192,56 @@  discard block
 block discarded – undo
192 192
     print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
193 193
     print '<td class="liste_titre" align="right"></td>';
194 194
     print '<td class="liste_titre" align="right">';
195
-    $searchpicto=$form->showFilterAndCheckAddButtons(0);
195
+    $searchpicto = $form->showFilterAndCheckAddButtons(0);
196 196
     print $searchpicto;
197 197
     print '</td>';
198 198
 	print "</tr>\n";
199 199
 
200 200
 	print '<tr class="liste_titre">';
201
-	print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"d.rowid","", $param,"",$sortfield,$sortorder);
202
-	print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"d.societe","", $param,"",$sortfield,$sortorder);
203
-	print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"d.lastname","", $param,"",$sortfield,$sortorder);
204
-	print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"d.datedon","", $param,'align="center"',$sortfield,$sortorder);
205
-	if (! empty($conf->projet->enabled))
201
+	print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder);
202
+	print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "d.societe", "", $param, "", $sortfield, $sortorder);
203
+	print_liste_field_titre("Name", $_SERVER["PHP_SELF"], "d.lastname", "", $param, "", $sortfield, $sortorder);
204
+	print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "d.datedon", "", $param, 'align="center"', $sortfield, $sortorder);
205
+	if (!empty($conf->projet->enabled))
206 206
 	{
207 207
 	    $langs->load("projects");
208
-	    print_liste_field_titre("Project",$_SERVER["PHP_SELF"],"fk_projet","", $param,"",$sortfield,$sortorder);
208
+	    print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "fk_projet", "", $param, "", $sortfield, $sortorder);
209 209
 	}
210
-	print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"d.amount","", $param,'align="right"',$sortfield,$sortorder);
211
-	print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"d.fk_statut","", $param,'align="right"',$sortfield,$sortorder);
210
+	print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, 'align="right"', $sortfield, $sortorder);
211
+	print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder);
212 212
 	print_liste_field_titre('');
213 213
 	print "</tr>\n";
214 214
 
215
-	while ($i < min($num,$limit))
215
+	while ($i < min($num, $limit))
216 216
 	{
217 217
 		$objp = $db->fetch_object($resql);
218 218
 
219 219
 		print '<tr class="oddeven">';
220
-		$donationstatic->id=$objp->rowid;
221
-		$donationstatic->ref=$objp->rowid;
222
-		$donationstatic->lastname=$objp->lastname;
223
-		$donationstatic->firstname=$objp->firstname;
220
+		$donationstatic->id = $objp->rowid;
221
+		$donationstatic->ref = $objp->rowid;
222
+		$donationstatic->lastname = $objp->lastname;
223
+		$donationstatic->firstname = $objp->firstname;
224 224
 		print "<td>".$donationstatic->getNomUrl(1)."</td>\n";
225 225
         print "<td>".$objp->societe."</td>\n";
226 226
 		print "<td>".$donationstatic->getFullName($langs)."</td>\n";
227
-		print '<td align="center">'.dol_print_date($db->jdate($objp->datedon),'day').'</td>';
228
-		if (! empty($conf->projet->enabled))
227
+		print '<td align="center">'.dol_print_date($db->jdate($objp->datedon), 'day').'</td>';
228
+		if (!empty($conf->projet->enabled))
229 229
 		{
230 230
 			print "<td>";
231 231
 			if ($objp->pid)
232 232
 			{
233
-				$projectstatic->id=$objp->pid;
234
-				$projectstatic->ref=$objp->ref;
235
-				$projectstatic->id=$objp->pid;
236
-				$projectstatic->public=$objp->public;
237
-				$projectstatic->title=$objp->title;
233
+				$projectstatic->id = $objp->pid;
234
+				$projectstatic->ref = $objp->ref;
235
+				$projectstatic->id = $objp->pid;
236
+				$projectstatic->public = $objp->public;
237
+				$projectstatic->title = $objp->title;
238 238
 				print $projectstatic->getNomUrl(1);
239 239
 			}
240 240
 			else print '&nbsp;';
241 241
 			print "</td>\n";
242 242
 		}
243 243
 		print '<td align="right">'.price($objp->amount).'</td>';
244
-		print '<td align="right">'.$donationstatic->LibStatut($objp->statut,5).'</td>';
244
+		print '<td align="right">'.$donationstatic->LibStatut($objp->statut, 5).'</td>';
245 245
         print '<td></td>';
246 246
 		print "</tr>";
247 247
 		$i++;
Please login to merge, or discard this patch.
dolibarr/htdocs/don/info.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 
24 24
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
25 25
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
26
-require DOL_BASE_PATH . '/main.inc.php';
27
-require_once DOL_DOCUMENT_ROOT . '/core/lib/donation.lib.php';
28
-require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
29
-require_once DOL_DOCUMENT_ROOT . '/don/class/don.class.php';
26
+require DOL_BASE_PATH.'/main.inc.php';
27
+require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
28
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
29
+require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
30 30
 if (!empty($conf->projet->enabled)) {
31
-    require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
32
-    require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
31
+    require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
32
+    require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
33 33
 }
34 34
 
35 35
 $langs->load("donations");
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 /*
57 57
  * View
58 58
  */
59
-$title = $langs->trans('Donation') . " - " . $langs->trans('Info');
59
+$title = $langs->trans('Donation')." - ".$langs->trans('Info');
60 60
 $helpurl = "";
61 61
 llxHeader('', $title, $helpurl);
62 62
 
@@ -72,34 +72,34 @@  discard block
 block discarded – undo
72 72
 dol_fiche_head($head, 'info', $langs->trans("Donation"), -1, 'generic');
73 73
 
74 74
 // $linkback = '<a href="' . DOL_URL_ROOT . '/don/list.php' . (!empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
75
-$linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
75
+$linkback = '<a href="'.BASE_URI.'?controller=don&method=list'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
76 76
 
77 77
 $morehtmlref = '<div class="refidno">';
78 78
 // Project
79 79
 if (!empty($conf->projet->enabled)) {
80 80
     $langs->load("projects");
81
-    $morehtmlref .= $langs->trans('Project') . ' ';
81
+    $morehtmlref .= $langs->trans('Project').' ';
82 82
     if ($user->rights->don->creer) {
83 83
         if ($action != 'classify')
84 84
             // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
85 85
             if ($action == 'classify') {
86 86
                 //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
87
-                $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
87
+                $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'&id='.$object->id.'">';
88 88
                 $morehtmlref .= '<input type="hidden" name="action" value="classin">';
89
-                $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
89
+                $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
90 90
                 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
91
-                $morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
91
+                $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
92 92
                 $morehtmlref .= '</form>';
93 93
             } else {
94 94
                 // $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
95
-                $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '&id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
95
+                $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'&id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
96 96
             }
97 97
     } else {
98 98
         if (!empty($object->fk_project)) {
99 99
             $proj = new Project($db);
100 100
             $proj->fetch($object->fk_project);
101 101
             // $morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
102
-            $morehtmlref .= '<a href="' . BASE_URI . 'controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
102
+            $morehtmlref .= '<a href="'.BASE_URI.'controller=projet&method=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
103 103
             $morehtmlref .= $proj->ref;
104 104
             $morehtmlref .= '</a>';
105 105
         } else {
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
41 41
 
42 42
 // Security check
43
-if ($user->societe_id) $socid = $user->societe_id;
43
+if ($user->societe_id) {
44
+    $socid = $user->societe_id;
45
+}
44 46
 $result = restrictedArea($user, 'don', $id, '');
45 47
 
46 48
 $object = new Don($db);
@@ -80,11 +82,12 @@  discard block
 block discarded – undo
80 82
     $langs->load("projects");
81 83
     $morehtmlref .= $langs->trans('Project') . ' ';
82 84
     if ($user->rights->don->creer) {
83
-        if ($action != 'classify')
84
-            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
85
+        if ($action != 'classify') {
86
+                    // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
85 87
             if ($action == 'classify') {
86 88
                 //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
87 89
                 $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
90
+        }
88 91
                 $morehtmlref .= '<input type="hidden" name="action" value="classin">';
89 92
                 $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
90 93
                 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
Please login to merge, or discard this patch.
dolibarr/htdocs/don/document.php 3 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 
86 86
 if ($action == 'classin' && $user->rights->don->creer)
87 87
 {
88
-	$object->fetch($id);
89
-	$object->setProject($projectid);
88
+    $object->fetch($id);
89
+    $object->setProject($projectid);
90 90
 }
91 91
 
92 92
 /*
@@ -103,77 +103,77 @@  discard block
 block discarded – undo
103 103
 
104 104
 if ($object->id)
105 105
 {
106
-	$object->fetch_thirdparty();
106
+    $object->fetch_thirdparty();
107 107
 
108
-	$head=donation_prepare_head($object);
108
+    $head=donation_prepare_head($object);
109 109
 
110
-	dol_fiche_head($head, 'documents',  $langs->trans("Donation"), -1, 'generic');
110
+    dol_fiche_head($head, 'documents',  $langs->trans("Donation"), -1, 'generic');
111 111
 
112 112
 
113
-	// Build file list
114
-	$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
115
-	$totalsize=0;
116
-	foreach($filearray as $key => $file)
117
-	{
118
-		$totalsize+=$file['size'];
119
-	}
113
+    // Build file list
114
+    $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
115
+    $totalsize=0;
116
+    foreach($filearray as $key => $file)
117
+    {
118
+        $totalsize+=$file['size'];
119
+    }
120 120
 
121 121
     // $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
122 122
     $linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
123 123
 
124
-	$morehtmlref='<div class="refidno">';
125
-	// Project
126
-	if (! empty($conf->projet->enabled))
127
-	{
128
-	    $langs->load("projects");
129
-	    $morehtmlref.=$langs->trans('Project') . ' ';
130
-	    if ($user->rights->don->creer)
131
-	    {
132
-	        if ($action != 'classify')
133
-	            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
134
-	            if ($action == 'classify') {
135
-	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
124
+    $morehtmlref='<div class="refidno">';
125
+    // Project
126
+    if (! empty($conf->projet->enabled))
127
+    {
128
+        $langs->load("projects");
129
+        $morehtmlref.=$langs->trans('Project') . ' ';
130
+        if ($user->rights->don->creer)
131
+        {
132
+            if ($action != 'classify')
133
+                // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
134
+                if ($action == 'classify') {
135
+                    //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
136 136
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
137
-	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
138
-	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
139
-	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
140
-	                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
141
-	                $morehtmlref.='</form>';
142
-	            } else {
143
-	                $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
144
-	            }
145
-	    } else {
146
-	        if (! empty($object->fk_project)) {
147
-	            $proj = new Project($db);
148
-	            $proj->fetch($object->fk_project);
137
+                    $morehtmlref.='<input type="hidden" name="action" value="classin">';
138
+                    $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
139
+                    $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
140
+                    $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
141
+                    $morehtmlref.='</form>';
142
+                } else {
143
+                    $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
144
+                }
145
+        } else {
146
+            if (! empty($object->fk_project)) {
147
+                $proj = new Project($db);
148
+                $proj->fetch($object->fk_project);
149 149
                 // $morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
150 150
                 $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
151 151
                 $morehtmlref .= $proj->ref;
152
-	            $morehtmlref.='</a>';
153
-	        } else {
154
-	            $morehtmlref.='';
155
-	        }
156
-	    }
157
-	}
158
-	$morehtmlref.='</div>';
152
+                $morehtmlref.='</a>';
153
+            } else {
154
+                $morehtmlref.='';
155
+            }
156
+        }
157
+    }
158
+    $morehtmlref.='</div>';
159 159
 
160 160
 
161
-	dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
161
+    dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
162 162
 
163
-	print '<div class="fichecenter">';
164
-	print '<div class="underbanner clearboth"></div>';
163
+    print '<div class="fichecenter">';
164
+    print '<div class="underbanner clearboth"></div>';
165 165
 
166 166
     print '<table class="border" width="100%">';
167 167
 
168
-	// Ref
169
-	/*
168
+    // Ref
169
+    /*
170 170
 	print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
171 171
 	print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
172 172
 	print '</td></tr>';
173 173
     */
174 174
 
175
-	// Societe
176
-	//print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
175
+    // Societe
176
+    //print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
177 177
 
178 178
     print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
179 179
     print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize,1,1).'</td></tr>';
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 }
194 194
 else
195 195
 {
196
-	print $langs->trans("ErrorUnknown");
196
+    print $langs->trans("ErrorUnknown");
197 197
 }
198 198
 
199 199
 llxFooter();
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -32,56 +32,56 @@  discard block
 block discarded – undo
32 32
 
33 33
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
34 34
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
35
-require DOL_BASE_PATH . '/main.inc.php';
35
+require DOL_BASE_PATH.'/main.inc.php';
36 36
 
37 37
 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
38 38
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
39 39
 require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
40 40
 require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
41
-if (! empty($conf->projet->enabled))
41
+if (!empty($conf->projet->enabled))
42 42
 {
43 43
     require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
44 44
     require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
45 45
 }
46 46
 
47 47
 // Load translation files required by the page
48
-$langs->loadLangs(array("companies","other","donations"));
48
+$langs->loadLangs(array("companies", "other", "donations"));
49 49
 
50
-$id = GETPOST('id','int');
50
+$id = GETPOST('id', 'int');
51 51
 $ref = GETPOST('ref', 'alpha');
52
-$action = GETPOST('action','alpha');
53
-$confirm = GETPOST('confirm','alpha');
52
+$action = GETPOST('action', 'alpha');
53
+$confirm = GETPOST('confirm', 'alpha');
54 54
 $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
55 55
 
56 56
 // Security check
57
-if ($user->societe_id) $socid=$user->societe_id;
57
+if ($user->societe_id) $socid = $user->societe_id;
58 58
 $result = restrictedArea($user, 'don', $id, '');
59 59
 
60 60
 
61 61
 // Get parameters
62
-$sortfield = GETPOST('sortfield','alpha');
63
-$sortorder = GETPOST('sortorder','alpha');
64
-$page = GETPOST('page','int');
62
+$sortfield = GETPOST('sortfield', 'alpha');
63
+$sortorder = GETPOST('sortorder', 'alpha');
64
+$page = GETPOST('page', 'int');
65 65
 if (empty($page) || $page == -1) { $page = 0; }     // If $page is not defined, or '' or -1
66 66
 $offset = $conf->liste_limit * $page;
67 67
 $pageprev = $page - 1;
68 68
 $pagenext = $page + 1;
69
-if (! $sortorder) $sortorder="ASC";
70
-if (! $sortfield) $sortfield="name";
69
+if (!$sortorder) $sortorder = "ASC";
70
+if (!$sortfield) $sortfield = "name";
71 71
 
72 72
 
73 73
 $object = new Don($db);
74 74
 $object->fetch($id, $ref);
75 75
 
76
-$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,0,0,0,$object,'donation'). '/'. dol_sanitizeFileName($object->ref);
77
-$modulepart='don';
76
+$upload_dir = $conf->don->dir_output.'/'.get_exdir($filename, 0, 0, 0, $object, 'donation').'/'.dol_sanitizeFileName($object->ref);
77
+$modulepart = 'don';
78 78
 
79 79
 
80 80
 /*
81 81
  * Actions
82 82
  */
83 83
 
84
-include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
84
+include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
85 85
 
86 86
 if ($action == 'classin' && $user->rights->don->creer)
87 87
 {
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
  */
95 95
 
96 96
 $form = new Form($db);
97
-if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
97
+if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
98 98
 
99
-$title = $langs->trans('Donation') . " - " . $langs->trans('Documents');
99
+$title = $langs->trans('Donation')." - ".$langs->trans('Documents');
100 100
 $helpurl = "";
101 101
 llxHeader('', $title, $helpurl);
102 102
 
@@ -105,57 +105,57 @@  discard block
 block discarded – undo
105 105
 {
106 106
 	$object->fetch_thirdparty();
107 107
 
108
-	$head=donation_prepare_head($object);
108
+	$head = donation_prepare_head($object);
109 109
 
110
-	dol_fiche_head($head, 'documents',  $langs->trans("Donation"), -1, 'generic');
110
+	dol_fiche_head($head, 'documents', $langs->trans("Donation"), -1, 'generic');
111 111
 
112 112
 
113 113
 	// Build file list
114
-	$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
115
-	$totalsize=0;
116
-	foreach($filearray as $key => $file)
114
+	$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
115
+	$totalsize = 0;
116
+	foreach ($filearray as $key => $file)
117 117
 	{
118
-		$totalsize+=$file['size'];
118
+		$totalsize += $file['size'];
119 119
 	}
120 120
 
121 121
     // $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
122
-    $linkback = '<a href="' . BASE_URI . '?controller=don&method=list' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
122
+    $linkback = '<a href="'.BASE_URI.'?controller=don&method=list'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
123 123
 
124
-	$morehtmlref='<div class="refidno">';
124
+	$morehtmlref = '<div class="refidno">';
125 125
 	// Project
126
-	if (! empty($conf->projet->enabled))
126
+	if (!empty($conf->projet->enabled))
127 127
 	{
128 128
 	    $langs->load("projects");
129
-	    $morehtmlref.=$langs->trans('Project') . ' ';
129
+	    $morehtmlref .= $langs->trans('Project').' ';
130 130
 	    if ($user->rights->don->creer)
131 131
 	    {
132 132
 	        if ($action != 'classify')
133 133
 	            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
134 134
 	            if ($action == 'classify') {
135 135
 	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
136
-                    $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
137
-	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
138
-	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
139
-	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
140
-	                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
141
-	                $morehtmlref.='</form>';
136
+                    $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'&id='.$object->id.'">';
137
+	                $morehtmlref .= '<input type="hidden" name="action" value="classin">';
138
+	                $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
139
+	                $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
140
+	                $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
141
+	                $morehtmlref .= '</form>';
142 142
 	            } else {
143
-	                $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
143
+	                $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
144 144
 	            }
145 145
 	    } else {
146
-	        if (! empty($object->fk_project)) {
146
+	        if (!empty($object->fk_project)) {
147 147
 	            $proj = new Project($db);
148 148
 	            $proj->fetch($object->fk_project);
149 149
                 // $morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
150
-                $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
150
+                $morehtmlref .= '<a href="'.BASE_URI.'?controller=projet&method=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
151 151
                 $morehtmlref .= $proj->ref;
152
-	            $morehtmlref.='</a>';
152
+	            $morehtmlref .= '</a>';
153 153
 	        } else {
154
-	            $morehtmlref.='';
154
+	            $morehtmlref .= '';
155 155
 	        }
156 156
 	    }
157 157
 	}
158
-	$morehtmlref.='</div>';
158
+	$morehtmlref .= '</div>';
159 159
 
160 160
 
161 161
 	dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	//print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
177 177
 
178 178
     print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
179
-    print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize,1,1).'</td></tr>';
179
+    print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
180 180
     print '</table>';
181 181
 
182 182
     print '</div>';
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
     $modulepart = 'don';
189 189
     $permission = $user->rights->don->lire;
190 190
     $permtoedit = $user->rights->don->creer;
191
-    $param = '&id=' . $object->id;
192
-    include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
191
+    $param = '&id='.$object->id;
192
+    include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
193 193
 }
194 194
 else
195 195
 {
Please login to merge, or discard this patch.
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
 $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
55 55
 
56 56
 // Security check
57
-if ($user->societe_id) $socid=$user->societe_id;
57
+if ($user->societe_id) {
58
+    $socid=$user->societe_id;
59
+}
58 60
 $result = restrictedArea($user, 'don', $id, '');
59 61
 
60 62
 
@@ -66,8 +68,12 @@  discard block
 block discarded – undo
66 68
 $offset = $conf->liste_limit * $page;
67 69
 $pageprev = $page - 1;
68 70
 $pagenext = $page + 1;
69
-if (! $sortorder) $sortorder="ASC";
70
-if (! $sortfield) $sortfield="name";
71
+if (! $sortorder) {
72
+    $sortorder="ASC";
73
+}
74
+if (! $sortfield) {
75
+    $sortfield="name";
76
+}
71 77
 
72 78
 
73 79
 $object = new Don($db);
@@ -129,11 +135,12 @@  discard block
 block discarded – undo
129 135
 	    $morehtmlref.=$langs->trans('Project') . ' ';
130 136
 	    if ($user->rights->don->creer)
131 137
 	    {
132
-	        if ($action != 'classify')
133
-	            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
138
+	        if ($action != 'classify') {
139
+	        	            // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
134 140
 	            if ($action == 'classify') {
135 141
 	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
136 142
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
143
+	        }
137 144
 	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
138 145
 	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
139 146
 	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
@@ -190,8 +197,7 @@  discard block
 block discarded – undo
190 197
     $permtoedit = $user->rights->don->creer;
191 198
     $param = '&id=' . $object->id;
192 199
     include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
193
-}
194
-else
200
+} else
195 201
 {
196 202
 	print $langs->trans("ErrorUnknown");
197 203
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/comm/propal/contact.php 3 patches
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -52,27 +52,27 @@  discard block
 block discarded – undo
52 52
 // Load object
53 53
 if ($id > 0 || ! empty($ref))
54 54
 {
55
-	$ret=$object->fetch($id, $ref);
56
-	if ($ret == 0)
57
-	{
58
-		$langs->load("errors");
59
-		setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
60
-		$error++;
61
-	}
62
-	else if ($ret < 0)
63
-	{
64
-		setEventMessages($object->error, $object->errors, 'errors');
65
-		$error++;
66
-	}
55
+    $ret=$object->fetch($id, $ref);
56
+    if ($ret == 0)
57
+    {
58
+        $langs->load("errors");
59
+        setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
60
+        $error++;
61
+    }
62
+    else if ($ret < 0)
63
+    {
64
+        setEventMessages($object->error, $object->errors, 'errors');
65
+        $error++;
66
+    }
67 67
 }
68 68
 if (! $error)
69 69
 {
70
-	$object->fetch_thirdparty();
70
+    $object->fetch_thirdparty();
71 71
 }
72 72
 else
73 73
 {
74
-	header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php');
75
-	exit;
74
+    header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php');
75
+    exit;
76 76
 }
77 77
 
78 78
 
@@ -84,52 +84,52 @@  discard block
 block discarded – undo
84 84
 {
85 85
     if ($object->id > 0)
86 86
     {
87
-    	$contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int'));
88
-  		$result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
87
+        $contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int'));
88
+            $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
89 89
     }
90 90
 
91
-	if ($result >= 0)
92
-	{
93
-		header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
94
-		exit;
95
-	}
96
-	else
97
-	{
98
-		if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
99
-		{
100
-			$langs->load("errors");
101
-			setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
102
-		}
103
-		else
104
-		{
105
-			setEventMessages($object->error, $object->errors, 'errors');
106
-		}
107
-	}
91
+    if ($result >= 0)
92
+    {
93
+        header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
94
+        exit;
95
+    }
96
+    else
97
+    {
98
+        if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
99
+        {
100
+            $langs->load("errors");
101
+            setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
102
+        }
103
+        else
104
+        {
105
+            setEventMessages($object->error, $object->errors, 'errors');
106
+        }
107
+    }
108 108
 }
109 109
 
110 110
 // Toggle the status of a contact
111 111
 else if ($action == 'swapstatut' && $user->rights->propale->creer)
112 112
 {
113
-	if ($object->id > 0)
114
-	{
115
-	    $result=$object->swapContactStatus(GETPOST('ligne'));
116
-	}
113
+    if ($object->id > 0)
114
+    {
115
+        $result=$object->swapContactStatus(GETPOST('ligne'));
116
+    }
117 117
 }
118 118
 
119 119
 // Deletes a contact
120 120
 else if ($action == 'deletecontact' && $user->rights->propale->creer)
121 121
 {
122
-	$result = $object->delete_contact($lineid);
123
-
124
-	if ($result >= 0)
125
-	{
126
-		header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
127
-		exit;
128
-	}
129
-	else
130
-	{
131
-		dol_print_error($db);
132
-	}
122
+    $result = $object->delete_contact($lineid);
123
+
124
+    if ($result >= 0)
125
+    {
126
+        header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
127
+        exit;
128
+    }
129
+    else
130
+    {
131
+        dol_print_error($db);
132
+    }
133 133
 }
134 134
 /*
135 135
 else if ($action == 'setaddress' && $user->rights->propale->creer)
@@ -152,68 +152,68 @@  discard block
 block discarded – undo
152 152
 if ($object->id > 0)
153 153
 {
154 154
     $head = propal_prepare_head($object);
155
-	dol_fiche_head($head, 'contact', $langs->trans("Proposal"), -1, 'propal');
155
+    dol_fiche_head($head, 'contact', $langs->trans("Proposal"), -1, 'propal');
156 156
 
157 157
 
158
-	// Proposal card
158
+    // Proposal card
159 159
 
160 160
     //$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
161 161
     $linkback = '<a href="' . BASE_URI . '?controller=comm/propal&method=list.php&restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
162 162
 
163
-	$morehtmlref='<div class="refidno">';
164
-	// Ref customer
165
-	$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
166
-	$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
167
-	// Thirdparty
168
-	$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer');
169
-	// Project
170
-	if (! empty($conf->projet->enabled))
171
-	{
172
-	    $langs->load("projects");
173
-	    $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
174
-	    if ($user->rights->propal->creer)
175
-	    {
176
-	        if ($action != 'classify')
177
-	            //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
178
-	            $morehtmlref.=' : ';
179
-	            if ($action == 'classify') {
180
-	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
163
+    $morehtmlref='<div class="refidno">';
164
+    // Ref customer
165
+    $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
166
+    $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
167
+    // Thirdparty
168
+    $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer');
169
+    // Project
170
+    if (! empty($conf->projet->enabled))
171
+    {
172
+        $langs->load("projects");
173
+        $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
174
+        if ($user->rights->propal->creer)
175
+        {
176
+            if ($action != 'classify')
177
+                //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
178
+                $morehtmlref.=' : ';
179
+                if ($action == 'classify') {
180
+                    //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
181 181
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
182
-	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
183
-	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
184
-	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
185
-	                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
186
-	                $morehtmlref.='</form>';
187
-	            } else {
188
-	                $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
189
-	            }
190
-	    } else {
191
-	        if (! empty($object->fk_project)) {
192
-	            $proj = new Project($db);
193
-	            $proj->fetch($object->fk_project);
182
+                    $morehtmlref.='<input type="hidden" name="action" value="classin">';
183
+                    $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
184
+                    $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
185
+                    $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
186
+                    $morehtmlref.='</form>';
187
+                } else {
188
+                    $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
189
+                }
190
+        } else {
191
+            if (! empty($object->fk_project)) {
192
+                $proj = new Project($db);
193
+                $proj->fetch($object->fk_project);
194 194
                 //$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
195 195
                 $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
196
-	            $morehtmlref.=$proj->ref;
197
-	            $morehtmlref.='</a>';
198
-	        } else {
199
-	            $morehtmlref.='';
200
-	        }
201
-	    }
202
-	}
203
-	$morehtmlref.='</div>';
204
-
205
-	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
206
-
207
-	dol_fiche_end();
208
-
209
-
210
-	// Contacts lines (modules that overwrite templates must declare this into descriptor)
211
-	$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
212
-	foreach($dirtpls as $reldir)
213
-	{
214
-		$res=@include dol_buildpath($reldir.'/contacts.tpl.php');
215
-		if ($res) break;
216
-	}
196
+                $morehtmlref.=$proj->ref;
197
+                $morehtmlref.='</a>';
198
+            } else {
199
+                $morehtmlref.='';
200
+            }
201
+        }
202
+    }
203
+    $morehtmlref.='</div>';
204
+
205
+    dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
206
+
207
+    dol_fiche_end();
208
+
209
+
210
+    // Contacts lines (modules that overwrite templates must declare this into descriptor)
211
+    $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
212
+    foreach($dirtpls as $reldir)
213
+    {
214
+        $res=@include dol_buildpath($reldir.'/contacts.tpl.php');
215
+        if ($res) break;
216
+    }
217 217
 }
218 218
 
219 219
 // End of page
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
29 29
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
30
-require DOL_BASE_PATH . '/main.inc.php';
30
+require DOL_BASE_PATH.'/main.inc.php';
31 31
 require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
32 32
 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
33 33
 require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
 // Load translation files required by the page
39 39
 $langs->loadLangs(array('facture', 'orders', 'sendings', 'companies'));
40 40
 
41
-$id=GETPOST('id','int');
42
-$ref= GETPOST('ref','alpha');
43
-$lineid=GETPOST('lineid','int');
44
-$action=GETPOST('action','alpha');
41
+$id = GETPOST('id', 'int');
42
+$ref = GETPOST('ref', 'alpha');
43
+$lineid = GETPOST('lineid', 'int');
44
+$action = GETPOST('action', 'alpha');
45 45
 
46 46
 // Security check
47
-if ($user->societe_id) $socid=$user->societe_id;
47
+if ($user->societe_id) $socid = $user->societe_id;
48 48
 $result = restrictedArea($user, 'propal', $id);
49 49
 
50 50
 $object = new Propal($db);
51 51
 
52 52
 // Load object
53
-if ($id > 0 || ! empty($ref))
53
+if ($id > 0 || !empty($ref))
54 54
 {
55
-	$ret=$object->fetch($id, $ref);
55
+	$ret = $object->fetch($id, $ref);
56 56
 	if ($ret == 0)
57 57
 	{
58 58
 		$langs->load("errors");
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		$error++;
66 66
 	}
67 67
 }
68
-if (! $error)
68
+if (!$error)
69 69
 {
70 70
 	$object->fetch_thirdparty();
71 71
 }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 {
85 85
     if ($object->id > 0)
86 86
     {
87
-    	$contactid = (GETPOST('userid','int') ? GETPOST('userid','int') : GETPOST('contactid','int'));
87
+    	$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
88 88
   		$result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
89 89
     }
90 90
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 {
113 113
 	if ($object->id > 0)
114 114
 	{
115
-	    $result=$object->swapContactStatus(GETPOST('ligne'));
115
+	    $result = $object->swapContactStatus(GETPOST('ligne'));
116 116
 	}
117 117
 }
118 118
 
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
  * View
144 144
  */
145 145
 
146
-llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
146
+llxHeader('', $langs->trans('Proposal'), 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
147 147
 
148 148
 $form = new Form($db);
149
-$formcompany= new FormCompany($db);
149
+$formcompany = new FormCompany($db);
150 150
 $formother = new FormOther($db);
151 151
 
152 152
 if ($object->id > 0)
@@ -158,49 +158,49 @@  discard block
 block discarded – undo
158 158
 	// Proposal card
159 159
 
160 160
     //$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
161
-    $linkback = '<a href="' . BASE_URI . '?controller=comm/propal&method=list.php&restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
161
+    $linkback = '<a href="'.BASE_URI.'?controller=comm/propal&method=list.php&restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
162 162
 
163
-	$morehtmlref='<div class="refidno">';
163
+	$morehtmlref = '<div class="refidno">';
164 164
 	// Ref customer
165
-	$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
166
-	$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
165
+	$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
166
+	$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
167 167
 	// Thirdparty
168
-	$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer');
168
+	$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
169 169
 	// Project
170
-	if (! empty($conf->projet->enabled))
170
+	if (!empty($conf->projet->enabled))
171 171
 	{
172 172
 	    $langs->load("projects");
173
-	    $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
173
+	    $morehtmlref .= '<br>'.$langs->trans('Project').' ';
174 174
 	    if ($user->rights->propal->creer)
175 175
 	    {
176 176
 	        if ($action != 'classify')
177 177
 	            //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
178
-	            $morehtmlref.=' : ';
178
+	            $morehtmlref .= ' : ';
179 179
 	            if ($action == 'classify') {
180 180
 	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
181
-                    $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
182
-	                $morehtmlref.='<input type="hidden" name="action" value="classin">';
183
-	                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
184
-	                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
185
-	                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
186
-	                $morehtmlref.='</form>';
181
+                    $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'&id='.$object->id.'">';
182
+	                $morehtmlref .= '<input type="hidden" name="action" value="classin">';
183
+	                $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
184
+	                $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
185
+	                $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
186
+	                $morehtmlref .= '</form>';
187 187
 	            } else {
188
-	                $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
188
+	                $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
189 189
 	            }
190 190
 	    } else {
191
-	        if (! empty($object->fk_project)) {
191
+	        if (!empty($object->fk_project)) {
192 192
 	            $proj = new Project($db);
193 193
 	            $proj->fetch($object->fk_project);
194 194
                 //$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
195
-                $morehtmlref .= '<a href="' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
196
-	            $morehtmlref.=$proj->ref;
197
-	            $morehtmlref.='</a>';
195
+                $morehtmlref .= '<a href="'.BASE_URI.'?controller=projet&method=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
196
+	            $morehtmlref .= $proj->ref;
197
+	            $morehtmlref .= '</a>';
198 198
 	        } else {
199
-	            $morehtmlref.='';
199
+	            $morehtmlref .= '';
200 200
 	        }
201 201
 	    }
202 202
 	}
203
-	$morehtmlref.='</div>';
203
+	$morehtmlref .= '</div>';
204 204
 
205 205
 	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
206 206
 
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
 
209 209
 
210 210
 	// Contacts lines (modules that overwrite templates must declare this into descriptor)
211
-	$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
212
-	foreach($dirtpls as $reldir)
211
+	$dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
212
+	foreach ($dirtpls as $reldir)
213 213
 	{
214
-		$res=@include dol_buildpath($reldir.'/contacts.tpl.php');
214
+		$res = @include dol_buildpath($reldir.'/contacts.tpl.php');
215 215
 		if ($res) break;
216 216
 	}
217 217
 }
Please login to merge, or discard this patch.
Braces   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -44,7 +44,9 @@  discard block
 block discarded – undo
44 44
 $action=GETPOST('action','alpha');
45 45
 
46 46
 // Security check
47
-if ($user->societe_id) $socid=$user->societe_id;
47
+if ($user->societe_id) {
48
+    $socid=$user->societe_id;
49
+}
48 50
 $result = restrictedArea($user, 'propal', $id);
49 51
 
50 52
 $object = new Propal($db);
@@ -58,8 +60,7 @@  discard block
 block discarded – undo
58 60
 		$langs->load("errors");
59 61
 		setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
60 62
 		$error++;
61
-	}
62
-	else if ($ret < 0)
63
+	} else if ($ret < 0)
63 64
 	{
64 65
 		setEventMessages($object->error, $object->errors, 'errors');
65 66
 		$error++;
@@ -68,8 +69,7 @@  discard block
 block discarded – undo
68 69
 if (! $error)
69 70
 {
70 71
 	$object->fetch_thirdparty();
71
-}
72
-else
72
+} else
73 73
 {
74 74
 	header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php');
75 75
 	exit;
@@ -92,15 +92,13 @@  discard block
 block discarded – undo
92 92
 	{
93 93
 		header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
94 94
 		exit;
95
-	}
96
-	else
95
+	} else
97 96
 	{
98 97
 		if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
99 98
 		{
100 99
 			$langs->load("errors");
101 100
 			setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
102
-		}
103
-		else
101
+		} else
104 102
 		{
105 103
 			setEventMessages($object->error, $object->errors, 'errors');
106 104
 		}
@@ -125,8 +123,7 @@  discard block
 block discarded – undo
125 123
 	{
126 124
 		header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
127 125
 		exit;
128
-	}
129
-	else
126
+	} else
130 127
 	{
131 128
 		dol_print_error($db);
132 129
 	}
@@ -173,9 +170,10 @@  discard block
 block discarded – undo
173 170
 	    $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
174 171
 	    if ($user->rights->propal->creer)
175 172
 	    {
176
-	        if ($action != 'classify')
177
-	            //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
173
+	        if ($action != 'classify') {
174
+	        	            //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
178 175
 	            $morehtmlref.=' : ';
176
+	        }
179 177
 	            if ($action == 'classify') {
180 178
 	                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
181 179
                     $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '&id=' . $object->id . '">';
@@ -212,7 +210,9 @@  discard block
 block discarded – undo
212 210
 	foreach($dirtpls as $reldir)
213 211
 	{
214 212
 		$res=@include dol_buildpath($reldir.'/contacts.tpl.php');
215
-		if ($res) break;
213
+		if ($res) {
214
+		    break;
215
+		}
216 216
 	}
217 217
 }
218 218
 
Please login to merge, or discard this patch.