27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/partnership/class/partnership.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/partnership/lib/partnership.lib.php';
37 $langs->loadLangs(array(
"companies",
"partnership",
"other"));
42 $action =
GETPOST(
'action',
'aZ09');
43 $confirm =
GETPOST(
'confirm',
'alpha');
44 $cancel =
GETPOST(
'cancel',
'aZ09');
45 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'partnershipcard';
46 $backtopage =
GETPOST(
'backtopage',
'alpha');
47 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
51 $socid =
GETPOST(
'socid',
'int');
52 if (!empty($user->socid)) {
53 $socid = $user->socid;
56 if (empty($id) && $socid && (
getDolGlobalString(
'PARTNERSHIP_IS_MANAGED_FOR',
'thirdparty') ==
'thirdparty')) {
68 $diroutputmassaction = $conf->partnership->dir_output.
'/temp/massgeneration/'.$user->id;
69 $hookmanager->initHooks(array(
'thirdpartypartnership',
'globalcard'));
72 $extrafields->fetch_name_optionals_label($object->table_element);
74 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
77 $search_all =
GETPOST(
"search_all",
'alpha');
80 foreach ($object->fields as $key => $val) {
81 if (
GETPOST(
'search_'.$key,
'alpha')) {
82 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
87 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
89 $permissiontoread = $user->rights->partnership->read;
90 $permissiontoadd = $user->rights->partnership->write;
91 $permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
92 $permissionnote = $user->rights->partnership->write;
93 $permissiondellink = $user->rights->partnership->write;
94 $usercanclose = $user->rights->partnership->write;
95 $upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
101 if (empty($conf->partnership->enabled)) {
104 if (empty($permissiontoread)) {
107 if ($action ==
'edit' && empty($permissiontoadd)) {
111 if (($action ==
'update' || $action ==
'edit') && $object->status != $object::STATUS_DRAFT && !empty($user->socid)) {
117 $result =
restrictedArea($user,
'societe', $id,
'&societe',
'',
'fk_soc',
'rowid', 0);
124 $parameters = array();
125 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
130 $date_start =
dol_mktime(0, 0, 0,
GETPOST(
'date_partnership_startmonth',
'int'),
GETPOST(
'date_partnership_startday',
'int'),
GETPOST(
'date_partnership_startyear',
'int'));
131 $date_end =
dol_mktime(0, 0, 0,
GETPOST(
'date_partnership_endmonth',
'int'),
GETPOST(
'date_partnership_endday',
'int'),
GETPOST(
'date_partnership_endyear',
'int'));
133 if (empty($reshook)) {
136 $backtopage = DOL_URL_ROOT.
'/partnership/partnership.php?id='.($id > 0 ? $id :
'__ID__');
139 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
142 $object->fields[
'fk_soc'][
'visible'] = 0;
143 if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) {
144 $object->fields[
'reason_decline_or_cancel'][
'visible'] = 1;
146 $object->fields[
'note_public'][
'visible'] = 1;
156 $title = $langs->trans(
"Partnership");
162 $langs->load(
"companies");
165 $result = $object->fetch($id);
167 if (!empty($conf->notification->enabled)) {
168 $langs->load(
"mails");
172 print
dol_get_fiche_head($head,
'partnership', $langs->trans(
"ThirdParty"), -1,
'company');
174 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
176 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
178 print
'<div class="fichecenter">';
180 print
'<div class="underbanner clearboth"></div>';
181 print
'<table class="border centpercent tableforfield">';
183 if (!empty($conf->global->SOCIETE_USEPREFIX)) {
184 print
'<tr><td>'.$langs->trans(
'Prefix').
'</td><td colspan="3">'.$object->prefix_comm.
'</td></tr>';
187 if ($object->client) {
188 print
'<tr><td class="titlefield">';
189 print $langs->trans(
'CustomerCode').
'</td><td colspan="3">';
191 $tmpcheck = $object->check_codeclient();
192 if ($tmpcheck != 0 && $tmpcheck != -5) {
193 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
198 if ($object->fournisseur) {
199 print
'<tr><td class="titlefield">';
200 print $langs->trans(
'SupplierCode').
'</td><td colspan="3">';
202 $tmpcheck = $object->check_codefournisseur();
203 if ($tmpcheck != 0 && $tmpcheck != -5) {
204 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
220 if ($object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
223 if ($action !=
'presend') {
224 print
'<div class="tabsAction">'.
"\n";
225 $parameters = array();
226 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
231 if (empty($reshook)) {
233 if ($permissiontoadd) {
234 print
dolGetButtonAction($langs->trans(
'AddPartnership'),
'',
'default', DOL_URL_ROOT.
'/partnership/partnership_card.php?action=create&fk_soc='.$object->id.
'&backtopage='.urlencode(DOL_URL_ROOT.
'/societe/partnership.php?id='.$object->id),
'', $permissiontoadd);
244 print
load_fiche_titre($langs->trans(
"PartnershipDedicatedToThisThirdParty", $langs->transnoentitiesnoconv(
"Partnership")), $morehtmlright,
'');
246 $socid = $object->id;
252 $partnershipid = $object->fetch(0,
'', 0, $socid);
254 if ($partnershipid > 0) {
255 print
'<div class="fichecenter">';
256 print
'<div class="fichehalfleft">';
257 print
'<div class="underbanner clearboth"></div>';
258 print
'<table class="border centpercent tableforfield">'.
"\n";
261 unset($object->fields[
'fk_soc']);
262 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
263 $forcefieldid =
'socid';
264 $forceobjectid = $object->fk_soc;
265 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
Class to manage third parties objects (customers, suppliers, prospects...)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dolGetButtonAction($label, $html='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.