Browse Source

NEW allow a document to be linked to project from another customer on config

Alexis Algoud 9 years ago
parent
commit
e5b6d39e51

+ 2 - 2
htdocs/core/class/html.formprojet.class.php

@@ -138,7 +138,7 @@ class FormProjets
 		$sql.= " WHERE p.entity IN (".getEntity('project', 1).")";
 		if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")";
 		if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
-		if ($socid > 0)  $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
+		if ($socid > 0 && empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY))  $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
 		if (!empty($filterkey)) {
 			$sql .= ' AND p.title LIKE "%'.$this->db->escape($filterkey).'%"';
 			$sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"';
@@ -204,7 +204,7 @@ class FormProjets
 							if ($discard_close == 2) $disabled=1;
 							$labeltoshow.=' - '.$langs->trans("Closed");
 						}
-						else if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
+						else if ( empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) &&  $socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
 						{
 							$disabled=1;
 							$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");

+ 1 - 0
htdocs/langs/en_US/admin.lang

@@ -68,6 +68,7 @@ SearchFilter=Search filters options
 NumberOfKeyToSearch=Nbr of characters to trigger search: %s
 ViewFullDateActions=Show full dates events in the third sheet
 NotAvailableWhenAjaxDisabled=Not available when Ajax disabled
+AllowToSelectProjectFromOtherCompany=In document, allow to link it to project from another company
 JavascriptDisabled=JavaScript disabled
 UsePopupCalendar=Use popup for dates input
 UsePreviewTabs=Use preview tabs

+ 16 - 1
htdocs/projet/admin/project.php

@@ -933,7 +933,22 @@ else
 	print '<input type="submit" class="button" name="PROJECT_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
 	print "</td>";
 }
-print '</tr></table></form>';
+print '</tr>';
+
+$var=!$var;
+print '<tr '.$bc[$var].'>';
+print '<td>'.$langs->trans("AllowToSelectProjectFromOtherCompany").'</td>';
+
+print '<td align="center" width="300">';
+echo ajax_constantonoff('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY');
+print '</td>';
+print '<td align="center" width="20">&nbsp;</td>';
+print '</tr>';
+
+print '</table></form>';
+
+
+
 
 llxFooter();
 $db->close();