diff --git a/ChangeLog b/ChangeLog index c477a17d684..66bccd31c06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,16 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 15.0.0 compared to 14.0.0 ***** + +For developers: +--------------- + +WARNING: + +Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: +* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook. + ***** ChangeLog for 14.0.0 compared to 13.0.0 ***** For users: diff --git a/dev/tools/spider.php b/dev/tools/spider.php new file mode 100644 index 00000000000..954978b24df --- /dev/null +++ b/dev/tools/spider.php @@ -0,0 +1,145 @@ +#!/usr/bin/env php +. + */ + +/** + * \file dev/tools/spider.php + * \brief Script to spider Dolibarr app. + * + * To use it: + * - Disable module "bookmark" + * - Exclude param optioncss, token, sortfield, sortorder + */ + +$crawledLinks=array(); +const MAX_DEPTH=2; + + +/** + * @param string $url URL + * @param string $depth Depth + * @return string String + */ +function followLink($url, $depth = 0) +{ + global $crawledLinks; + $crawling=array(); + if ($depth>MAX_DEPTH) { + echo "
The Crawler is giving up!
"; + return; + } + $options=array( + 'http'=>array( + 'method'=>"GET", + 'user-agent'=>"gfgBot/0.1\n" + ) + ); + $context=stream_context_create($options); + $doc=new DomDocument(); + @$doc->loadHTML(file_get_contents($url, false, $context)); + $links=$doc->getElementsByTagName('a'); + $pageTitle=getDocTitle($doc, $url); + $metaData=getDocMetaData($doc); + foreach ($links as $i) { + $link=$i->getAttribute('href'); + if (ignoreLink($link)) continue; + $link=convertLink($url, $link); + if (!in_array($link, $crawledLinks)) { + $crawledLinks[]=$link; + $crawling[]=$link; + insertIntoDatabase($link, $pageTitle, $metaData, $depth); + } + } + foreach ($crawling as $crawlURL) + followLink($crawlURL, $depth+1); +} + +/** + * @param string $site Site + * @param string $path Path + * @return string String + */ +function convertLink($site, $path) +{ + if (substr_compare($path, "//", 0, 2)==0) + return parse_url($site)['scheme'].$path; + elseif (substr_compare($path, "http://", 0, 7)==0 or + substr_compare($path, "https://", 0, 8)==0 or + substr_compare($path, "www.", 0, 4)==0) + return $path; + else return $site.'/'.$path; +} + +/** + * @param string $url URL + * @return boolean + */ +function ignoreLink($url) +{ + return $url[0]=="#" or substr($url, 0, 11) == "javascript:"; +} + +/** + * @param string $link URL + * @param string $title Title + * @param string $metaData Array + * @param int $depth Depth + * @return void + */ +function insertIntoDatabase($link, $title, &$metaData, $depth) +{ + //global $crawledLinks; + + echo "Inserting new record {URL= ".$link.", Title = '$title', Description = '".$metaData['description']."', Keywords = ' ".$metaData['keywords']."'}


"; + + //²$crawledLinks[]=$link; +} + +/** + * @param string $doc Doc + * @param string $url URL + * @return string URL/Title + */ +function getDocTitle(&$doc, $url) +{ + $titleNodes=$doc->getElementsByTagName('title'); + if (count($titleNodes)==0 or !isset($titleNodes[0]->nodeValue)) + return $url; + $title=str_replace('', '\n', $titleNodes[0]->nodeValue); + return (strlen($title)<1)?$url:$title; +} + +/** + * @param string $doc Doc + * @return array Array + */ +function getDocMetaData(&$doc) +{ + $metaData=array(); + $metaNodes=$doc->getElementsByTagName('meta'); + foreach ($metaNodes as $node) + $metaData[$node->getAttribute("name")] = $node->getAttribute("content"); + if (!isset($metaData['description'])) + $metaData['description']='No Description Available'; + if (!isset($metaData['keywords'])) $metaData['keywords']=''; + return array( + 'keywords'=>str_replace('', '\n', $metaData['keywords']), + 'description'=>str_replace('', '\n', $metaData['description']) + ); +} + + +followLink("http://localhost/dolibarr_dev/htdocs"); diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index e7983ae4b95..df14ef4c1b0 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -45,6 +45,11 @@ $arrayofparameters = array( 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) ); +// To fix when dire does not exists +dol_mkdir($conf->dav->dir_output.'/temp'); +dol_mkdir($conf->dav->dir_output.'/public'); +dol_mkdir($conf->dav->dir_output.'/private'); + /* * Actions diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 53d27efeba2..d01aece1ca0 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -34,13 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Translations $langs->loadLangs(array("admin", "eventorganization")); -// Access control -if (!$user->admin) { - accessforbidden(); -} - // Parameters $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); $value = GETPOST('value', 'alpha'); @@ -70,11 +66,21 @@ $setupnotempty = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); +// Access control +if (empty($user->admin)) { + accessforbidden(); +} + + /* * Actions */ +if ($cancel) { + $action =''; +} + if ((float) DOL_VERSION >= 6) { include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; } @@ -207,7 +213,7 @@ if ($action == 'edit') { print ''; print ''; - print ''; + print ''; foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { @@ -293,7 +299,9 @@ if ($action == 'edit') { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print '
'; - print ''; + print ''; + print '   '; + print ''; print '
'; print ''; @@ -301,7 +309,7 @@ if ($action == 'edit') { } else { if (!empty($arrayofparameters)) { print ''; - print ''; + print ''; foreach ($arrayofparameters as $constname => $val) { if ($val['enabled']==1) { diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index aa571644871..c02ee501d94 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -82,7 +82,8 @@ print '

'; if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { $setupcompanynotcomplete = 1; } -print img_picto('', 'company', 'class="paddingright"').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup")); +print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup")); +print '

'.$langs->trans("SetupDescription3b"); if (!empty($setupcompanynotcomplete)) { $langs->load("errors"); $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"'); @@ -93,7 +94,8 @@ print '
'; print '
'; // Show info setup module -print img_picto('', 'cog', 'class="paddingright"').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules")); +print img_picto('', 'cog', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules")); +print '

'.$langs->trans("SetupDescription4b"); if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled $langs->load("errors"); $warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"'); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 8d0fb1165a8..db3c45a0776 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -230,6 +230,9 @@ if (!empty($conf->agenda->enabled)) { if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) { $elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization')); } +if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) { + $elementList['partnership_send'] = img_picto('', 'partnership', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToPartnership')); +} $parameters = array('elementList'=>$elementList); $reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 2f935d82d1b..af3e5bf7c41 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -53,6 +53,16 @@ if ($cancel) { } if ($action == 'update') { + if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTTERM')) { + dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity); + } + if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTMODE')) { + dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTMODE", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTMODE"), 'chaine', 0, '', $conf->entity); + } + if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) { + dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity); + } + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); @@ -102,6 +112,7 @@ if ($conf->use_javascript_ajax) { print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE); } print ''; + /* print ''; print ''; - print ''; + + print ''; // Status /* diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index f69c7b476a2..1b6afa3cffe 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -82,7 +82,8 @@ class BonPrelevement extends CommonObject const STATUS_DRAFT = 0; const STATUS_TRANSFERED = 1; - const STATUS_CREDITED = 2; + const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type + const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type /** @@ -2343,17 +2344,22 @@ class BonPrelevement extends CommonObject //$langs->load("mymodule"); $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('StatusWaiting'); $this->labelStatus[self::STATUS_TRANSFERED] = $langs->trans('StatusTrans'); - $this->labelStatus[self::STATUS_CREDITED] = $langs->trans('StatusCredited'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('StatusWaiting'); $this->labelStatusShort[self::STATUS_TRANSFERED] = $langs->trans('StatusTrans'); - $this->labelStatusShort[self::STATUS_CREDITED] = $langs->trans('StatusCredited'); + if ($this->type == 'bank-transfer') { + $this->labelStatus[self::STATUS_DEBITED] = $langs->trans('StatusDebited'); + $this->labelStatusShort[self::STATUS_DEBITED] = $langs->trans('StatusDebited'); + } else { + $this->labelStatus[self::STATUS_CREDITED] = $langs->trans('StatusCredited'); + $this->labelStatusShort[self::STATUS_CREDITED] = $langs->trans('StatusCredited'); + } } $statusType = 'status1'; if ($status == self::STATUS_TRANSFERED) { $statusType = 'status3'; } - if ($status == self::STATUS_CREDITED) { + if ($status == self::STATUS_CREDITED || $status == self::STATUS_DEBITED) { $statusType = 'status6'; } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 2a5e3391eb9..909178d4fb1 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -531,7 +531,7 @@ abstract class CommonDocGenerator $totalUp += $line->subprice * $line->qty; } - // @GS: Calculate total up and total discount percentage + // Calculate total up and total discount percentage // Note that this added fields does not match a field into database in Dolibarr (Dolibarr manage discount on lines not as a global property of object) $resarray['object_total_up'] = $totalUp; $resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 36df3b1a7b9..7f26c83a727 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -123,6 +123,12 @@ abstract class CommonObject */ protected $table_ref_field = ''; + /** + * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user + * @var integer + */ + public $restrictiononfksoc = 0; + // Following vars are used by some objects only. We keep this property here in CommonObject to be able to provide common method using them. @@ -4805,13 +4811,18 @@ abstract class CommonObject if (!empty($this->lines)) { foreach ($this->lines as $line) { - if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) { + $reshook = 0; + //if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) { + if (is_object($hookmanager)) { // Old code is commented on preceding line. if (empty($line->fk_parent_line)) { - $parameters = array('line'=>$line, 'i'=>$i); - $action = ''; - $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines); + $reshook = $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + } else { + $parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines, 'fk_parent_line'=>$line->fk_parent_line); + $reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks } - } else { + } + if (empty($reshook)) { $this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9bcbf08f71a..42ffcbb2f6d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -958,7 +958,7 @@ class Form if ($row['code_iso']) { $labeltoshow .= ' ('.$row['code_iso'].')'; if (empty($hideflags)) { - $tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"'); + $tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1); $labeltoshow = $tmpflag.' '.$labeltoshow; } } @@ -969,7 +969,7 @@ class Form $out .= ''; + $out .= ''."\n"; } } $out .= ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 899b3b0ffda..a9cb45e06fb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3790,7 +3790,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ return $fullpathpicto; } // tag title is used for tooltip on , tag alt can be used with very simple text on image for blind people - return ''.dol_escape_htmltag($alt).''; // Alt is used for accessibility, title for popup + return ''.dol_escape_htmltag($alt).''; // Alt is used for accessibility, title for popup } /** @@ -3850,10 +3850,11 @@ function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $mo * @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory. * @param string $moreatt Add more attribute on img tag * @param int $pictoisfullpath If 1, image path is a full path + * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @return string Return img tag * @see img_object(), img_picto() */ -function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0) +function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $notitle = 0) { global $conf; @@ -3875,7 +3876,7 @@ function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0 } } - return img_picto($titlealt, $path, $moreatt, 1); + return img_picto($titlealt, $path, $moreatt, 1, 0, $notitle); } /** @@ -8126,9 +8127,10 @@ function dol_validElement($element) * * @param string $codelang Language code ('en_IN', 'fr_CA', ...) or ISO Country code on 2 characters in uppercase ('IN', 'FR') * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"' or 'class="saturatemedium"') + * @param int $notitlealt No title alt * @return string HTML img string with flag. */ -function picto_from_langcode($codelang, $moreatt = '') +function picto_from_langcode($codelang, $moreatt = '', $notitlealt = 0) { if (empty($codelang)) { return ''; @@ -8161,7 +8163,7 @@ function picto_from_langcode($codelang, $moreatt = '') $flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1]; } - return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt); + return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt, 0, $notitlealt); } /** diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql index 393875dd40f..4005506e887 100644 --- a/htdocs/install/mysql/data/llx_c_email_templates.sql +++ b/htdocs/install/mysql/data/llx_c_email_templates.sql @@ -21,18 +21,18 @@ -- -- Bank Thirdparty -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines) VALUES (0,'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'$conf->societe->enabled && $conf->banque->enabled && $conf->prelevement->enabled',0,'__(YourSEPAMandate)__','__(Hello)__,

\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__

\n__(Sincerely)__
\n__USER_SIGNATURE__',null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'$conf->societe->enabled && $conf->banque->enabled && $conf->prelevement->enabled',0,'__(YourSEPAMandate)__','__(Hello)__,

\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__

\n__(Sincerely)__
\n__USER_SIGNATURE__',null, 0); -- Members -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnMemberValidation)' ,20,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__(FirstName)__ : __MEMBER_FIRSTNAME__
__(LastName)__ : __MEMBER_LASTNAME__
__(ID)__ : __MEMBER_ID__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnNewSubscription)' ,30,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingReminderForExpiredSubscription)',40,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(YourMembershipWasCanceled)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnMemberValidation)' ,20,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__(FirstName)__ : __MEMBER_FIRSTNAME__
__(LastName)__ : __MEMBER_LASTNAME__
__(ID)__ : __MEMBER_ID__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnNewSubscription)' ,30,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingReminderForExpiredSubscription)',40,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(YourMembershipWasCanceled)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -- Recruiting -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswerMessage)__
__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswerMessage)__
__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -- Event organization INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventConfRequestWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); @@ -41,3 +41,9 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailSubsEvent)', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__

__(Sincerely)__

__MYCOMPANY_NAME__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailAttendees)', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationMassEmailSpeakers)', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); + +-- Partnership +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipWillSoonBeCanceled)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipWillSoonBeCanceledTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipWillSoonBeCanceledContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipCanceled)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipCanceledTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipCanceledContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipRefused)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipRefusedTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipRefusedContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); +INSERT INTO llx_c_email_templates (entity, module, type_template, label, lang, position, topic, joinfiles, content) VALUES (0, 'partnership', 'partnership_send', '(SendingEmailOnPartnershipAccepted)', '', 100, '[__[MAIN_INFO_SOCIETE_NOM]__] - __(YourPartnershipAcceptedTopic)__', 0, '\n

__(Hello)__,

\n__(YourPartnershipAcceptedContent)__

\n
\n\n
\n\n __(Sincerely)__
\n __[MAIN_INFO_SOCIETE_NOM]__
\n \n'); diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 26a1c238c86..032504dfa61 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -596,3 +596,5 @@ create table llx_onlinesignature pathoffile varchar(255) )ENGINE=innodb; +-- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN date_partnership_end date NULL; +-- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN date_partnership_end DROP NOT NULL; diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 89546dd9bb6..274e3b145e0 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -32,6 +32,9 @@ -- Missing in v14 or lower +-- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN date_partnership_end date NULL; +-- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN date_partnership_end DROP NOT NULL; + -- v15 diff --git a/htdocs/install/mysql/tables/llx_partnership.sql b/htdocs/install/mysql/tables/llx_partnership.sql index 99dfe0d6ffe..6ab312f8875 100644 --- a/htdocs/install/mysql/tables/llx_partnership.sql +++ b/htdocs/install/mysql/tables/llx_partnership.sql @@ -23,7 +23,7 @@ CREATE TABLE llx_partnership( fk_soc integer, fk_member integer, date_partnership_start date NOT NULL, - date_partnership_end date NOT NULL, + date_partnership_end date NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id, 0 = all reason_decline_or_cancel text NULL, date_creation datetime NOT NULL, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1aa9a5bf520..773695f4601 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1193,6 +1193,9 @@ SetupDescription2=The following two sections are mandatory (the two first entrie SetupDescription3=
%s -> %s

Basic parameters used to customize the default behavior of your application (e.g for country-related features). SetupDescription4=%s -> %s

This software is a suite of many modules/applications. The modules related to your needs must be enabled and configured. Menu entries will appears with the activation of these modules. SetupDescription5=Other Setup menu entries manage optional parameters. +SetupDescriptionLink=%s - %s +SetupDescription3b=Basic parameters used to customize the default behavior of your application (e.g for country-related features). +SetupDescription4b=This software is a suite of many modules/applications. The modules related to your needs must be enabled and configured. Menu entries will appears with the activation of these modules. AuditedSecurityEvents=Security events that are audited NoSecurityEventsAreAduited=No security events are audited. You can enable them from menu %s Audit=Security events @@ -1994,6 +1997,8 @@ MAIN_DOCUMENTS_LOGO_HEIGHT=Height for logo on PDF MAIN_GENERATE_PROPOSALS_WITH_PICTURE=Add picture on proposal line MAIN_PDF_NO_SENDER_FRAME=Hide sender frame MAIN_PDF_NO_RECIPENT_FRAME=Hide recipent frame +PROPOSAL_PDF_HIDE_PAYMENTTERM=Hide payments conditions +PROPOSAL_PDF_HIDE_PAYMENTMODE=Hide payment mode MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING=Add electronic sign in PDF NothingToSetup=There is no specific setup required for this module. SetToYesIfGroupIsComputationOfOtherGroups=Set this to yes if this group is a computation of other groups @@ -2133,6 +2138,7 @@ AskThisIDToYourBank=Contact your bank to get this ID AdvancedModeOnly=Permision available in Advanced permission mode only ConfFileIsReadableOrWritableByAnyUsers=The conf file is readable or writable by any users. Give permission to web server user and group only. MailToSendEventOrganization=Event Organization +MailToPartnership=Partnership AGENDA_EVENT_DEFAULT_STATUS=Default event status when creating a event from the form YouShouldDisablePHPFunctions=You should disable PHP functions IfCLINotRequiredYouShouldDisablePHPFunctions=Except if you need to run system commands in custom code, you shoud disable PHP functions diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index 3a653e29967..f5b9ebcde24 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -77,6 +77,10 @@ YourPartnershipRefusedContent=We inform you that your partnership request has be YourPartnershipAcceptedContent=We inform you that your partnership request has been accepted. YourPartnershipCanceledContent=We inform you that your partnership has been canceled. +CountLastUrlCheckError=Number of errors for last URL check +LastCheckBacklink=Date of last URL check +ReasonDeclineOrCancel=Reason for declining or canceling + # # Status # diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 97da524db31..feef3c7e81f 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -65,8 +65,9 @@ class Partnership extends CommonObject const STATUS_DRAFT = 0; - const STATUS_ACCEPTED = 1; - const STATUS_REFUSED = 2; + const STATUS_VALIDATED = 1; // Validate (no more draft) + const STATUS_ACCEPTED = 2; // Approved + const STATUS_REFUSED = 3; // Refused const STATUS_CANCELED = 9; @@ -100,7 +101,27 @@ class Partnership extends CommonObject /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ - public $fields=array(); + public $fields=array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), + 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), + //'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnershiptype.class.php', 'label' => 'Type', 'default' => 1, 'enabled' => 1, 'visible' => 1, 'position' => 20), + 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), + 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,), + 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), + 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), + 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), + 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,), + 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), + 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), + 'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,), + 'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,), + 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Canceled'),), + 'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>63, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',), + 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>-2,), + 'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>64, 'notnull'=>0, 'visible'=>-2,), + ); /** * @var int rowid @@ -164,7 +185,6 @@ class Partnership extends CommonObject // public $lines = array(); - /** * Constructor * @@ -176,32 +196,10 @@ class Partnership extends CommonObject $this->db = $db; - $this->fields=array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), - //'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnershiptype.class.php', 'label' => 'Type', 'default' => 1, 'enabled' => 1, 'visible' => 1, 'position' => 20), - 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), - 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), - 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), - 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), - 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,), - 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), - 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), - 'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,), - 'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>1, 'visible'=>1,), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>$langs->trans('Draft'), '1'=>$langs->trans('Accepted'), '2'=>$langs->trans('Refused'), '9'=>$langs->trans('Canceled')),), - 'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>63, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',), - 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>-2,), - 'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>64, 'notnull'=>0, 'visible'=>-2,), - ); - if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { $this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member'); } else { - $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'societe'); + $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company'); } if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { @@ -593,7 +591,7 @@ class Partnership extends CommonObject $error = 0; // Protection - if ($this->status == self::STATUS_ACCEPTED) { + if ($this->status == self::STATUS_VALIDATED) { dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING); return 0; } @@ -622,7 +620,7 @@ class Partnership extends CommonObject // Validate $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; $sql .= " SET ref = '".$this->db->escape($num)."',"; - $sql .= " status = ".self::STATUS_ACCEPTED; + $sql .= " status = ".self::STATUS_VALIDATED; if (!empty($this->fields['date_validation'])) { $sql .= ", date_validation = '".$this->db->idate($now)."'"; } @@ -689,7 +687,7 @@ class Partnership extends CommonObject // Set new ref and current status if (!$error) { $this->ref = $num; - $this->status = self::STATUS_ACCEPTED; + $this->status = self::STATUS_VALIDATED; } if (!$error) { @@ -1067,17 +1065,24 @@ class Partnership extends CommonObject global $langs; //$langs->load("partnership"); $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Validated'); $this->labelStatus[self::STATUS_ACCEPTED] = $langs->trans('Accepted'); $this->labelStatus[self::STATUS_REFUSED] = $langs->trans('Refused'); $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Validated'); $this->labelStatusShort[self::STATUS_ACCEPTED] = $langs->trans('Accepted'); $this->labelStatusShort[self::STATUS_REFUSED] = $langs->trans('Refused'); $this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Canceled'); } $statusType = 'status'.$status; - //if ($status == self::STATUS_ACCEPTED) $statusType = 'status1'; + if ($status == self::STATUS_ACCEPTED) { + $statusType = 'status4'; + } + if ($status == self::STATUS_REFUSED) { + $statusType = 'status9'; + } if ($status == self::STATUS_CANCELED) { $statusType = 'status6'; } diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index e79924caf48..e0fa5b90f4c 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2021 NextGestion +/* Copyright (C) 2017-2021 Laurent Destailleur + * Copyright (C) 2021 NextGestion * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -120,7 +120,39 @@ if (empty($reshook)) { $triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record // Action accept object - if ($action == 'confirm_accept' && $confirm == 'yes' && $permissiontoadd) { + if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) { + $result = $object->validate($user); + if ($result >= 0) { + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (method_exists($object, 'generateDocument')) { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); + } + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { + $newlang = $object->thirdparty->default_lang; + } + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + + $ret = $object->fetch($id); // Reload to get new records + + $model = $object->model_pdf; + + $retgen = $object->generateDocument($model, $outputlangs, 0, 0, 0); + if ($retgen < 0) { + setEventMessages($object->error, $object->errors, 'warnings'); + } + } + } + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } elseif ($action == 'confirm_accept' && $confirm == 'yes' && $permissiontoadd) { $result = $object->accept($user); if ($result >= 0) { // Define output language @@ -143,7 +175,7 @@ if (empty($reshook)) { $model = $object->model_pdf; - $retgen = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + $retgen = $object->generateDocument($model, $outputlangs, 0, 0, 0); if ($retgen < 0) { setEventMessages($object->error, $object->errors, 'warnings'); } @@ -339,7 +371,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToReopon'), $langs->trans('ConfirmReoponAsk', $object->ref), 'confirm_reopen', $formquestion, 'yes', 1); } - // Refuse confirmatio + // Refuse confirmation if ($action == 'refuse') { //Form to close proposal (signed or not) $formquestion = array( @@ -533,23 +565,35 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); } + if ($object->status == $object::STATUS_DRAFT) { + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); + } + // Back to draft if ($object->status != $object::STATUS_DRAFT) { print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); } - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); - - // Accept + // Validate if ($object->status == $object::STATUS_DRAFT) { if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes&token='.newToken(), '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); } else { $langs->load("errors"); print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); } } + // Approve + if ($object->status == $object::STATUS_VALIDATED) { + if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { + print dolGetButtonAction($langs->trans('Approved'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes&token='.newToken(), '', $permissiontoadd); + } else { + $langs->load("errors"); + print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Approved"), 'default', '#', '', 0); + } + } + // Cancel if ($permissiontoadd) { if ($object->status == $object::STATUS_ACCEPTED) { @@ -562,7 +606,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Refuse if ($permissiontoadd) { - if ($object->status != $object::STATUS_ACCEPTED && $object->status != $object::STATUS_CANCELED && $object->status != $object::STATUS_REFUSED) { + if ($object->status != $object::STATUS_DRAFT && $object->status != $object::STATUS_ACCEPTED && $object->status != $object::STATUS_CANCELED && $object->status != $object::STATUS_REFUSED) { print dolGetButtonAction($langs->trans('Refuse'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=refuse&token='.newToken(), '', $permissiontoadd); } } diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 1234deef497..97f29de72f6 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -103,6 +103,9 @@ if ($id > 0 || $ref) { $object->fetch($id, $ref); } +$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->lire)); +$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)); + if ($object->id > 0) { if ($object->type == $object::TYPE_PRODUCT) { restrictedArea($user, 'produit', $object->id, 'product&product', '', ''); @@ -123,9 +126,6 @@ if ($cancel) { $action = ''; } -$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->lire)); -$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)); - $parameters = array('socid'=>$socid, 'id_prod'=>$id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -404,13 +404,23 @@ if ($id > 0 || $ref) { print '
'; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").''; if ($conf->use_javascript_ajax) { diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 4c52182cff7..d24ba63ef55 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -72,10 +72,12 @@ function printDropdownBookmarksList() // Url to go on create new bookmark page $newbtn = ''; if (!empty($user->rights->bookmark->creer)) { - //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url); - $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); - $newbtn .= ''; - $newbtn .= img_picto('', 'add', '', false, 0, 0, '', 'paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).''; + if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) { + //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url); + $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); + $newbtn .= ''; + $newbtn .= img_picto('', 'add', '', false, 0, 0, '', 'paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).''; + } } // Menu with list of bookmarks @@ -105,9 +107,11 @@ function printDropdownBookmarksList() $searchForm .= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...'; // Url to go on create new bookmark page if (!empty($user->rights->bookmark->creer)) { - $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); - $searchForm .= ''; + if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) { + $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); + $searchForm .= ''; + } } $i = 0; while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) { diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index b03ed9d93e0..8a232377ab7 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -200,7 +200,8 @@ if ($id > 0 || $ref) { //print '
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'.$langs->trans("Amount").''.price($object->amount).'
'.$langs->trans("Amount").''.price($object->amount).'
'; + // Type + if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) { + $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); + print ''; + } + // Cost price. Can be used for margin module for option "calculate margin on explicit cost price print ''; @@ -425,7 +435,7 @@ if ($id > 0 || $ref) { // Best buying Price print ''; - print ''; + } + // Selling price - print ''; print ''; + } + // We show only vat for level 1 - print ''; + print ''; print ''; print ''; } else { + // Type + if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) { + $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); + print ''; + } + // TVA - print ''; } @@ -618,7 +637,7 @@ if ($id > 0 || $ref) { $textdesc .= "
".$langs->trans("CostPriceUsage"); $text = $form->textwithpicto($langs->trans("CostPrice"), $textdesc, 1, 'help', ''); print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); - print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index e384007262f..0f4ac71fd54 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -647,6 +647,9 @@ textarea.centpercent { .large { font-size: 125%; } +.double { + font-size: 2em; +} .h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small { font-size: 65%; diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index 4802755608f..34f6db8d044 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -226,9 +226,9 @@ if ($rss) { // Find the subdirectory name as the reference include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname); - $accessallowed = $check_access['accessallowed']; - $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; - $fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name + $accessallowed = empty($check_access['accessallowed']) ? '' : $check_access['accessallowed']; + $sqlprotectagainstexternals = empty($check_access['sqlprotectagainstexternals']) ? '' : $check_access['sqlprotectagainstexternals']; + $fullpath_original_file = empty($check_access['original_file']) ? '' : $check_access['original_file']; // $fullpath_original_file is now a full path name if ($hashp) { $accessallowed = 1; // When using hashp, link is public so we force $accessallowed $sqlprotectagainstexternals = '';
'; + print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type'); + print ''; + print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat); + print '
'; $textdesc = $langs->trans("CostPriceDescription"); $textdesc .= "
".$langs->trans("CostPriceUsage"); $text = $form->textwithpicto($langs->trans("CostPrice"), $textdesc, 1, 'help', ''); print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); - print '
'; + print ''; print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); print '
'.$langs->trans("BuyingPriceMin").''; + print ''; $product_fourn = new ProductFournisseur($db); if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0) { if ($product_fourn->product_fourn_price_id > 0) { diff --git a/htdocs/product/price.php b/htdocs/product/price.php index bb46839e588..03867bb65e9 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -717,8 +717,18 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ $soc->id = $socid; $soc->fetch($socid); + // Type + if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) { + $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); + print '
'; + print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type'); + print ''; + print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat); + print '
'; + print '
'; print $langs->trans("SellingPrice"); print ''; @@ -791,13 +801,33 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ } } else { if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility + // Type + if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) { + $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); + print '
'; + print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type'); + print ''; + print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat); + print '
'.$langs->trans("DefaultTaxRate").'
'.$langs->trans("DefaultTaxRate").''.vatrate($object->multiprices_tva_tx[1], true).'
'; + print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type'); + print ''; + print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat); + print '
'.$langs->trans("DefaultTaxRate").''; + print '
'.$langs->trans("DefaultTaxRate").''; $positiverates = ''; if (price2num($object->tva_tx)) { diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index a00feb194a0..7fcee8f59cd 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -77,6 +77,7 @@ $batchnumber = GETPOST('batch_number', 'san_alpha'); if (!empty($batchnumber)) { $batchnumber = trim($batchnumber); } +$cost_price = GETPOST('cost_price', 'alpha'); // Security check if ($user->socid) { @@ -113,6 +114,9 @@ $hookmanager->initHooks(array('stockproductcard', 'globalcard')); $error = 0; +$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->lire)); +$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)); + if ($object->id > 0) { if ($object->type == $object::TYPE_PRODUCT) { restrictedArea($user, 'produit', $object->id, 'product&product', '', ''); @@ -139,6 +143,21 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } +if ($action == 'setcost_price') { + if ($id) { + $result = $object->fetch($id); + $object->cost_price = price2num($cost_price); + $result = $object->update($object->id, $user); + if ($result > 0) { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + $action = ''; + } else { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } +} + if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer)) { $seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); @@ -600,9 +619,9 @@ if ($id > 0 || $ref) { if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) { $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); print '
'; - print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); + print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type'); print ''; - print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat); + print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat); print '
'; + print ''; print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); print '