if (!defined("_PS_VERSION_")) {
die;
}
use Doctrine\DBAL\Query\QueryBuilder;
use PrestaShop\PrestaShop\Core\Search\Filters\CustomerFilters;
use PrestaShop\PrestaShop\Core\Grid\Column\Type\DataColumn;
use PrestaShop\PrestaShop\Core\Grid\Filter\Filter;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use PrestaShop\PrestaShop\Core\Grid\Definition\GridDefinitionInterface;
use PrestaShop\PrestaShop\Core\Grid\Column\Type\Common\ToggleColumn;
use PrestaShopBundle\Form\Admin\Type\YesAndNoChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use PrestaShopBundle\Form\Admin\Type\SwitchType;
class Ps8modAdminInvoiceMailFormBuilder {
protected $module = false;
protected $name_of_class;
public function __construct(Module $module = null) {
$this->name_of_class = get_class($this);
$this->module = $module;
}
public function l($string, $source = null) {
if (is_object($this->module)) {
if (is_null($source)) {
$source = strtolower($this->name_of_class);
}
return $this->module->l($string, $source);
}
return $string;
}
public function getInvoiceEmail($customerId) {
if ($customerId) {
$getEmails = Db::getInstance()->getValue("SELECT invoice_email FROM " . _DB_PREFIX_ . $this->module->name . " WHERE id_customer = " . $customerId);
return $getEmails;
}
}
public function create($params) {
$formBuilder = $params["form_builder"];
$formBuilder->add("invoice_email", TextType::class, array("label" => $this->l("Invoice email"), "required" => false));
$customerId = $params["id"];
$params["data"]["invoice_email"] = $this->getInvoiceEmail($customerId);
$formBuilder->setData($params["data"]);
}
}
© 2023 Quttera Ltd. All rights reserved.